From patchwork Thu Jan 10 14:29:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1022973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43b82M2K9gz9sCs for ; Fri, 11 Jan 2019 01:46:19 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbb7-00082k-8H for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2019 09:46:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbLN-0003m0-F7 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbLM-0005iF-Ha for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53554) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghbLM-0005ho-6t for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:00 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 797C312F900; Thu, 10 Jan 2019 14:29:59 +0000 (UTC) Received: from localhost (ovpn-116-5.gru2.redhat.com [10.97.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF47A600C8; Thu, 10 Jan 2019 14:29:58 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 12:29:46 -0200 Message-Id: <20190110142955.23254-2-ehabkost@redhat.com> In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com> References: <20190110142955.23254-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 10 Jan 2019 14:29:59 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/10] qemu-deprecated.texi: Rename the HMP section X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kashyap Chamarthy Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Kashyap Chamarthy So that it is consistent with the naming of QMP's Signed-off-by: Kashyap Chamarthy Message-Id: <20181213124224.31585-2-kchamart@redhat.com> Reviewed-by: Thomas Huth Signed-off-by: Eduardo Habkost --- qemu-deprecated.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index c3735b698e..3f30f05a61 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -106,7 +106,7 @@ The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command. The ``arch'' output member of the ``query-cpus-fast'' command is replaced by the ``target'' output member. -@section System emulator human monitor commands +@section Human Monitor Protocol (HMP) commands @subsection The hub_id parameter of 'hostfwd_add' / 'hostfwd_remove' (since 3.1) From patchwork Thu Jan 10 14:29:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1022975 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43b83H6psbz9sCs for ; Fri, 11 Jan 2019 01:47:07 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbbq-0008VT-RP for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2019 09:47:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbLP-0003np-89 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbLO-0005kc-EQ for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36656) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghbLO-0005j0-7c for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:02 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FD557F086; Thu, 10 Jan 2019 14:30:01 +0000 (UTC) Received: from localhost (ovpn-116-5.gru2.redhat.com [10.97.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA67D7E497; Thu, 10 Jan 2019 14:30:00 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 12:29:47 -0200 Message-Id: <20190110142955.23254-3-ehabkost@redhat.com> In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com> References: <20190110142955.23254-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 10 Jan 2019 14:30:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 02/10] Update that HMP 'cpu-add' is deprecated in 4.0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kashyap Chamarthy Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Kashyap Chamarthy Signed-off-by: Kashyap Chamarthy Message-Id: <20181213124224.31585-3-kchamart@redhat.com> Reviewed-by: Igor Mammedov [ehabkost: revert back to 'cpu-add' spelling] Signed-off-by: Eduardo Habkost --- qemu-deprecated.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 3f30f05a61..f4a5cea62b 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -113,7 +113,7 @@ replaced by the ``target'' output member. The @option{[hub_id name]} parameter tuple of the 'hostfwd_add' and 'hostfwd_remove' HMP commands has been replaced by @option{netdev_id}. -@subsection cpu-add (since 3.1) +@subsection cpu-add (since 4.0) Use ``device_add'' for hotplugging vCPUs instead of ``cpu-add''. See documentation of ``query-hotpluggable-cpus'' for additional details. From patchwork Thu Jan 10 14:29:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1022964 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43b7nv1GHxz9sCs for ; Fri, 11 Jan 2019 01:35:31 +1100 (AEDT) Received: from localhost ([127.0.0.1]:36673 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbQf-0007YT-2p for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2019 09:35:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbLe-0003yf-8a for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbLT-0005m9-B4 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghbLT-0005lp-5w for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:07 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3225CA7FED; Thu, 10 Jan 2019 14:30:06 +0000 (UTC) Received: from localhost (ovpn-116-5.gru2.redhat.com [10.97.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE19C601A7; Thu, 10 Jan 2019 14:30:02 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 12:29:48 -0200 Message-Id: <20190110142955.23254-4-ehabkost@redhat.com> In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com> References: <20190110142955.23254-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 10 Jan 2019 14:30:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/10] Mention that QMP 'cpu-add' will be deprecated X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kashyap Chamarthy Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Kashyap Chamarthy Signed-off-by: Kashyap Chamarthy Message-Id: <20181213124224.31585-4-kchamart@redhat.com> Reviewed-by: Igor Mammedov Reviewed-by: Thomas Huth Signed-off-by: Eduardo Habkost --- qemu-deprecated.texi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index f4a5cea62b..81de5fc019 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -106,6 +106,12 @@ The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command. The ``arch'' output member of the ``query-cpus-fast'' command is replaced by the ``target'' output member. +@subsection cpu-add (since 4.0) + +Use ``device_add'' for hotplugging vCPUs instead of ``cpu-add''. See +documentation of ``query-hotpluggable-cpus'' for additional +details. + @section Human Monitor Protocol (HMP) commands @subsection The hub_id parameter of 'hostfwd_add' / 'hostfwd_remove' (since 3.1) From patchwork Thu Jan 10 14:29:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1022977 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43b8606tWCz9sLt for ; Fri, 11 Jan 2019 01:49:28 +1100 (AEDT) Received: from localhost ([127.0.0.1]:40161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbeA-0001Wk-S1 for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2019 09:49:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbLv-0004Ge-Rk for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbLu-00061D-Nx for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41130) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghbLu-0005zi-ET for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:34 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB964420A5; Thu, 10 Jan 2019 14:30:32 +0000 (UTC) Received: from localhost (ovpn-116-5.gru2.redhat.com [10.97.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58E115D75C; Thu, 10 Jan 2019 14:30:07 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 12:29:49 -0200 Message-Id: <20190110142955.23254-5-ehabkost@redhat.com> In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com> References: <20190110142955.23254-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 10 Jan 2019 14:30:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/10] range: add some more functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand Add some more functions that will be used in memory-device context. range_init(): Init using lower bound and size, check for validity range_init_nofail(): Init using lower bound and size, validity asserted range_size(): Extract the size of a range range_overlaps_range(): Check for overlaps of two ranges range_contains_range(): Check if one range is contained in the other Reviewed-by: Igor Mammedov Signed-off-by: David Hildenbrand Message-Id: <20181214131043.25071-2-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Eduardo Habkost --- include/qemu/range.h | 62 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/include/qemu/range.h b/include/qemu/range.h index 7e75f4e655..ba606c6bc0 100644 --- a/include/qemu/range.h +++ b/include/qemu/range.h @@ -112,6 +112,68 @@ static inline uint64_t range_upb(Range *range) return range->upb; } +/* + * Initialize @range to span the interval [@lob,@lob + @size - 1]. + * @size may be 0. If the range would overflow, returns -ERANGE, otherwise + * 0. + */ +static inline int QEMU_WARN_UNUSED_RESULT range_init(Range *range, uint64_t lob, + uint64_t size) +{ + if (lob + size < lob) { + return -ERANGE; + } + range->lob = lob; + range->upb = lob + size - 1; + range_invariant(range); + return 0; +} + +/* + * Initialize @range to span the interval [@lob,@lob + @size - 1]. + * @size may be 0. Range must not overflow. + */ +static inline void range_init_nofail(Range *range, uint64_t lob, uint64_t size) +{ + range->lob = lob; + range->upb = lob + size - 1; + range_invariant(range); +} + +/* + * Get the size of @range. + */ +static inline uint64_t range_size(const Range *range) +{ + return range->upb - range->lob + 1; +} + +/* + * Check if @range1 overlaps with @range2. If one of the ranges is empty, + * the result is always "false". + */ +static inline bool range_overlaps_range(const Range *range1, + const Range *range2) +{ + if (range_is_empty(range1) || range_is_empty(range2)) { + return false; + } + return !(range2->upb < range1->lob || range1->upb < range2->lob); +} + +/* + * Check if @range1 contains @range2. If one of the ranges is empty, + * the result is always "false". + */ +static inline bool range_contains_range(const Range *range1, + const Range *range2) +{ + if (range_is_empty(range1) || range_is_empty(range2)) { + return false; + } + return range1->lob <= range2->lob && range1->upb >= range2->upb; +} + /* * Extend @range to the smallest interval that includes @extend_by, too. */ From patchwork Thu Jan 10 14:29:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1022965 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43b7pc3r8Cz9sCs for ; Fri, 11 Jan 2019 01:36:08 +1100 (AEDT) Received: from localhost ([127.0.0.1]:36843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbRG-0008OH-4t for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2019 09:36:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbLx-0004Hh-4n for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbLw-00062N-2G for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56068) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghbLv-00061i-Pp for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:35 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 057727FD4D; Thu, 10 Jan 2019 14:30:35 +0000 (UTC) Received: from localhost (ovpn-116-5.gru2.redhat.com [10.97.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A5825D75C; Thu, 10 Jan 2019 14:30:34 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 12:29:50 -0200 Message-Id: <20190110142955.23254-6-ehabkost@redhat.com> In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com> References: <20190110142955.23254-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 10 Jan 2019 14:30:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/10] memory-device: rewrite address assignment using ranges X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand Let's rewrite it properly using ranges. This fixes certain overflows that are right now possible. E.g. qemu-system-x86_64 -m 4G,slots=20,maxmem=40G -M pc \ -object memory-backend-file,id=mem1,share,mem-path=/dev/zero,size=2G -device pc-dimm,memdev=mem1,id=dimm1,addr=-0x40000000 Now properly errors out instead of succeeding. (Note that qapi parsing of huge uint64_t values is broken and fixes are on the way) "can't add memory device [0xffffffffa0000000:0x80000000], usable range for memory devices [0x140000000:0xe00000000]" Signed-off-by: David Hildenbrand Message-Id: <20181214131043.25071-3-david@redhat.com> Reviewed-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Eduardo Habkost --- hw/mem/memory-device.c | 51 +++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c index 8be63c8032..5f2c408036 100644 --- a/hw/mem/memory-device.c +++ b/hw/mem/memory-device.c @@ -100,9 +100,8 @@ static uint64_t memory_device_get_free_addr(MachineState *ms, uint64_t align, uint64_t size, Error **errp) { - uint64_t address_space_start, address_space_end; GSList *list = NULL, *item; - uint64_t new_addr = 0; + Range as, new = range_empty; if (!ms->device_memory) { error_setg(errp, "memory devices (e.g. for memory hotplug) are not " @@ -115,13 +114,11 @@ static uint64_t memory_device_get_free_addr(MachineState *ms, "enabled, please specify the maxmem option"); return 0; } - address_space_start = ms->device_memory->base; - address_space_end = address_space_start + - memory_region_size(&ms->device_memory->mr); - g_assert(address_space_end >= address_space_start); + range_init_nofail(&as, ms->device_memory->base, + memory_region_size(&ms->device_memory->mr)); - /* address_space_start indicates the maximum alignment we expect */ - if (!QEMU_IS_ALIGNED(address_space_start, align)) { + /* start of address space indicates the maximum alignment we expect */ + if (!QEMU_IS_ALIGNED(range_lob(&as), align)) { error_setg(errp, "the alignment (0x%" PRIx64 ") is not supported", align); return 0; @@ -145,20 +142,18 @@ static uint64_t memory_device_get_free_addr(MachineState *ms, } if (hint) { - new_addr = *hint; - if (new_addr < address_space_start) { + if (range_init(&new, *hint, size) || !range_contains_range(&as, &new)) { error_setg(errp, "can't add memory device [0x%" PRIx64 ":0x%" PRIx64 - "] before 0x%" PRIx64, new_addr, size, - address_space_start); - return 0; - } else if ((new_addr + size) > address_space_end) { - error_setg(errp, "can't add memory device [0x%" PRIx64 ":0x%" PRIx64 - "] beyond 0x%" PRIx64, new_addr, size, - address_space_end); + "], usable range for memory devices [0x%" PRIx64 ":0x%" + PRIx64 "]", *hint, size, range_lob(&as), + range_size(&as)); return 0; } } else { - new_addr = address_space_start; + if (range_init(&new, range_lob(&as), size)) { + error_setg(errp, "can't add memory device, device too big"); + return 0; + } } /* find address range that will fit new memory device */ @@ -166,30 +161,36 @@ static uint64_t memory_device_get_free_addr(MachineState *ms, for (item = list; item; item = g_slist_next(item)) { const MemoryDeviceState *md = item->data; const MemoryDeviceClass *mdc = MEMORY_DEVICE_GET_CLASS(OBJECT(md)); - uint64_t md_size, md_addr; + uint64_t next_addr; + Range tmp; - md_addr = mdc->get_addr(md); - md_size = memory_device_get_region_size(md, &error_abort); + range_init_nofail(&tmp, mdc->get_addr(md), + memory_device_get_region_size(md, &error_abort)); - if (ranges_overlap(md_addr, md_size, new_addr, size)) { + if (range_overlaps_range(&tmp, &new)) { if (hint) { const DeviceState *d = DEVICE(md); error_setg(errp, "address range conflicts with memory device" " id='%s'", d->id ? d->id : "(unnamed)"); goto out; } - new_addr = QEMU_ALIGN_UP(md_addr + md_size, align); + + next_addr = QEMU_ALIGN_UP(range_upb(&tmp) + 1, align); + if (!next_addr || range_init(&new, next_addr, range_size(&new))) { + range_make_empty(&new); + break; + } } } - if (new_addr + size > address_space_end) { + if (!range_contains_range(&as, &new)) { error_setg(errp, "could not find position in guest address space for " "memory device - memory fragmented due to alignments"); goto out; } out: g_slist_free(list); - return new_addr; + return range_lob(&new); } MemoryDeviceInfoList *qmp_memory_device_list(void) From patchwork Thu Jan 10 14:29:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1022967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43b7sT4wRJz9sCs for ; Fri, 11 Jan 2019 01:38:37 +1100 (AEDT) Received: from localhost ([127.0.0.1]:37468 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbTf-0001wP-66 for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2019 09:38:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbLy-0004JG-Vc for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbLx-00063P-Sz for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55318) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghbLx-00062t-Mz for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:37 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DDCC74025D; Thu, 10 Jan 2019 14:30:36 +0000 (UTC) Received: from localhost (ovpn-116-5.gru2.redhat.com [10.97.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 630FE5D757; Thu, 10 Jan 2019 14:30:36 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 12:29:51 -0200 Message-Id: <20190110142955.23254-7-ehabkost@redhat.com> In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com> References: <20190110142955.23254-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 10 Jan 2019 14:30:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/10] spapr: Eliminate SPAPR_PCI_2_7_MMIO_WIN_SIZE macro X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The macro is only used in one place, where the purpose of the value is obvious. Eliminate the macro so we don't need to rely on stringify(). Signed-off-by: Eduardo Habkost Message-Id: <20190107193020.21744-2-ehabkost@redhat.com> Reviewed-by: Marc-André Lureau Acked-by: David Gibson Reviewed-by: Cornelia Huck Signed-off-by: Eduardo Habkost --- include/hw/pci-host/spapr.h | 1 - hw/ppc/spapr.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index 4eb3a2ce3e..a5a7bf4837 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -101,7 +101,6 @@ struct sPAPRPHBState { #define SPAPR_MAX_PHBS ((SPAPR_PCI_LIMIT - SPAPR_PCI_BASE) / \ SPAPR_PCI_MEM64_WIN_SIZE - 1) -#define SPAPR_PCI_2_7_MMIO_WIN_SIZE 0xf80000000 #define SPAPR_PCI_IO_WIN_SIZE 0x10000 #define SPAPR_PCI_MSI_WINDOW 0x40000000000ULL diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 83081defde..54a19d2db8 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4285,7 +4285,7 @@ static void spapr_machine_2_7_class_options(MachineClass *mc) { .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, .property = "mem_win_size", - .value = stringify(SPAPR_PCI_2_7_MMIO_WIN_SIZE), + .value = "0xf80000000", }, { .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, From patchwork Thu Jan 10 14:29:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1022979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43b89Q68f7z9s7h for ; Fri, 11 Jan 2019 01:52:26 +1100 (AEDT) Received: from localhost ([127.0.0.1]:40962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbh2-0003tK-PI for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2019 09:52:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbM9-0004RL-I7 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbM0-00065Z-A6 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41386) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghbLz-00064w-W9 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:40 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 39CE2A7FE1; Thu, 10 Jan 2019 14:30:39 +0000 (UTC) Received: from localhost (ovpn-116-5.gru2.redhat.com [10.97.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 769FD5D76C; Thu, 10 Jan 2019 14:30:38 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 12:29:52 -0200 Message-Id: <20190110142955.23254-8-ehabkost@redhat.com> In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com> References: <20190110142955.23254-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 10 Jan 2019 14:30:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/10] machine: Eliminate unnecessary stringify() usage X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" stringify() is useful when we need to use macros in compat_props (like when we set virtio-baloon-pci.class=PCI_CLASS_MEMORY_RAM at pc_i440fx_1_0_machine_options()), but it is pointless when we are already providing a number literal. Replace stringify() with string literals when appropriate. Signed-off-by: Eduardo Habkost Message-Id: <20190107193020.21744-3-ehabkost@redhat.com> Reviewed-by: Marc-André Lureau Reviewed-by: David Gibson Reviewed-by: Cornelia Huck Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Eduardo Habkost --- hw/core/machine.c | 8 ++-- hw/i386/pc.c | 94 +++++++++++++++++++++++------------------------ hw/i386/pc_piix.c | 30 +++++++-------- hw/ppc/spapr.c | 2 +- 4 files changed, 67 insertions(+), 67 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index f8563efb86..4b4d6c23de 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -135,11 +135,11 @@ GlobalProperty hw_compat_2_8[] = { { .driver = "fw_cfg_mem", .property = "x-file-slots", - .value = stringify(0x10), + .value = "0x10", },{ .driver = "fw_cfg_io", .property = "x-file-slots", - .value = stringify(0x10), + .value = "0x10", },{ .driver = "pflash_cfi01", .property = "old-multiple-chip-handling", @@ -337,11 +337,11 @@ GlobalProperty hw_compat_2_1[] = { },{ .driver = "usb-mouse", .property = "usb_version", - .value = stringify(1), + .value = "1", },{ .driver = "usb-kbd", .property = "usb_version", - .value = stringify(1), + .value = "1", },{ .driver = "virtio-pci", .property = "virtio-pci-bus-master-bug-migration", diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 4952feb476..ff14b6d4df 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -148,11 +148,11 @@ GlobalProperty pc_compat_2_12[] = { },{ .driver = "EPYC-" TYPE_X86_CPU, .property = "xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "EPYC-IBPB-" TYPE_X86_CPU, .property = "xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", }, }; const size_t pc_compat_2_12_len = G_N_ELEMENTS(pc_compat_2_12); @@ -191,7 +191,7 @@ GlobalProperty pc_compat_2_9[] = { { .driver = "mch", .property = "extended-tseg-mbytes", - .value = stringify(0), + .value = "0", }, }; const size_t pc_compat_2_9_len = G_N_ELEMENTS(pc_compat_2_9); @@ -365,75 +365,75 @@ GlobalProperty pc_compat_2_3[] = { },{ .driver = "qemu64" "-" TYPE_X86_CPU, .property = "min-level", - .value = stringify(4), + .value = "4", },{ .driver = "kvm64" "-" TYPE_X86_CPU, .property = "min-level", - .value = stringify(5), + .value = "5", },{ .driver = "pentium3" "-" TYPE_X86_CPU, .property = "min-level", - .value = stringify(2), + .value = "2", },{ .driver = "n270" "-" TYPE_X86_CPU, .property = "min-level", - .value = stringify(5), + .value = "5", },{ .driver = "Conroe" "-" TYPE_X86_CPU, .property = "min-level", - .value = stringify(4), + .value = "4", },{ .driver = "Penryn" "-" TYPE_X86_CPU, .property = "min-level", - .value = stringify(4), + .value = "4", },{ .driver = "Nehalem" "-" TYPE_X86_CPU, .property = "min-level", - .value = stringify(4), + .value = "4", },{ .driver = "n270" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "Penryn" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "Conroe" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "Nehalem" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "Westmere" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "SandyBridge" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "IvyBridge" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "Haswell" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "Haswell-noTSX" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "Broadwell" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU, .property = "min-xlevel", - .value = stringify(0x8000000a), + .value = "0x8000000a", },{ .driver = TYPE_X86_CPU, .property = "kvm-no-smi-migration", @@ -566,7 +566,7 @@ GlobalProperty pc_compat_2_0[] = { { .driver = "apic", .property = "version", - .value = stringify(0x11), + .value = "0x11", }, { .driver = "nec-usb-xhci", @@ -581,17 +581,17 @@ GlobalProperty pc_compat_2_0[] = { { .driver = "pci-serial", .property = "prog_if", - .value = stringify(0), + .value = "0", }, { .driver = "pci-serial-2x", .property = "prog_if", - .value = stringify(0), + .value = "0", }, { .driver = "pci-serial-4x", .property = "prog_if", - .value = stringify(0), + .value = "0", }, { .driver = "virtio-net-pci", @@ -629,7 +629,7 @@ GlobalProperty pc_compat_1_7[] = { { .driver = "hpet", .property = HPET_INTCAP, - .value = stringify(4), + .value = "4", }, }; const size_t pc_compat_1_7_len = G_N_ELEMENTS(pc_compat_1_7); @@ -643,19 +643,19 @@ GlobalProperty pc_compat_1_6[] = { },{ .driver = "qemu64-" TYPE_X86_CPU, .property = "model", - .value = stringify(2), + .value = "2", },{ .driver = "qemu32-" TYPE_X86_CPU, .property = "model", - .value = stringify(3), + .value = "3", },{ .driver = "i440FX-pcihost", .property = "short_root_bus", - .value = stringify(1), + .value = "1", },{ .driver = "q35-pcihost", .property = "short_root_bus", - .value = stringify(1), + .value = "1", }, }; const size_t pc_compat_1_6_len = G_N_ELEMENTS(pc_compat_1_6); @@ -665,27 +665,27 @@ GlobalProperty pc_compat_1_5[] = { { .driver = "Conroe-" TYPE_X86_CPU, .property = "model", - .value = stringify(2), + .value = "2", },{ .driver = "Conroe-" TYPE_X86_CPU, .property = "min-level", - .value = stringify(2), + .value = "2", },{ .driver = "Penryn-" TYPE_X86_CPU, .property = "model", - .value = stringify(2), + .value = "2", },{ .driver = "Penryn-" TYPE_X86_CPU, .property = "min-level", - .value = stringify(2), + .value = "2", },{ .driver = "Nehalem-" TYPE_X86_CPU, .property = "model", - .value = stringify(2), + .value = "2", },{ .driver = "Nehalem-" TYPE_X86_CPU, .property = "min-level", - .value = stringify(2), + .value = "2", },{ .driver = "virtio-net-pci", .property = "any_layout", @@ -697,11 +697,11 @@ GlobalProperty pc_compat_1_5[] = { },{ .driver = "i440FX-pcihost", .property = "short_root_bus", - .value = stringify(0), + .value = "0", },{ .driver = "q35-pcihost", .property = "short_root_bus", - .value = stringify(0), + .value = "0", }, }; const size_t pc_compat_1_5_len = G_N_ELEMENTS(pc_compat_1_5); @@ -711,36 +711,36 @@ GlobalProperty pc_compat_1_4[] = { { .driver = "scsi-hd", .property = "discard_granularity", - .value = stringify(0), + .value = "0", },{ .driver = "scsi-cd", .property = "discard_granularity", - .value = stringify(0), + .value = "0", },{ .driver = "scsi-disk", .property = "discard_granularity", - .value = stringify(0), + .value = "0", },{ .driver = "ide-hd", .property = "discard_granularity", - .value = stringify(0), + .value = "0", },{ .driver = "ide-cd", .property = "discard_granularity", - .value = stringify(0), + .value = "0", },{ .driver = "ide-drive", .property = "discard_granularity", - .value = stringify(0), + .value = "0", },{ .driver = "virtio-blk-pci", .property = "discard_granularity", - .value = stringify(0), + .value = "0", },{ .driver = "virtio-serial-pci", .property = "vectors", /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */ - .value = stringify(0xFFFFFFFF), + .value = "0xFFFFFFFF", },{ .driver = "virtio-net-pci", .property = "ctrl_guest_offloads", @@ -768,7 +768,7 @@ GlobalProperty pc_compat_1_4[] = { },{ .driver = "486-" TYPE_X86_CPU, .property = "model", - .value = stringify(0), + .value = "0", }, { .driver = "n270" "-" TYPE_X86_CPU, diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index ed6984638e..fd20227af3 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -697,7 +697,7 @@ static void pc_i440fx_1_3_machine_options(MachineClass *m) { .driver = "usb-tablet", .property = "usb_version", - .value = stringify(1), + .value = "1", },{ .driver = "virtio-net-pci", .property = "ctrl_mac_addr", @@ -741,11 +741,11 @@ static void pc_i440fx_1_2_machine_options(MachineClass *m) },{ .driver = "qxl", .property = "revision", - .value = stringify(3), + .value = "3", },{ .driver = "qxl-vga", .property = "revision", - .value = stringify(3), + .value = "3", },{ .driver = "VGA", .property = "mmio", @@ -777,19 +777,19 @@ static void pc_i440fx_1_1_machine_options(MachineClass *m) },{ .driver = "VGA", .property = "vgamem_mb", - .value = stringify(8), + .value = "8", },{ .driver = "vmware-svga", .property = "vgamem_mb", - .value = stringify(8), + .value = "8", },{ .driver = "qxl-vga", .property = "vgamem_mb", - .value = stringify(8), + .value = "8", },{ .driver = "qxl", .property = "vgamem_mb", - .value = stringify(8), + .value = "8", },{ .driver = "virtio-blk-pci", .property = "config-wce", @@ -876,11 +876,11 @@ static void pc_i440fx_0_14_machine_options(MachineClass *m) },{ .driver = "qxl", .property = "revision", - .value = stringify(2), + .value = "2", },{ .driver = "qxl-vga", .property = "revision", - .value = stringify(2), + .value = "2", }, }; @@ -904,19 +904,19 @@ static void pc_i440fx_0_13_machine_options(MachineClass *m) },{ .driver = "AC97", .property = "use_broken_id", - .value = stringify(1), + .value = "1", },{ .driver = "virtio-9p-pci", .property = "vectors", - .value = stringify(0), + .value = "0", },{ .driver = "VGA", .property = "rombar", - .value = stringify(0), + .value = "0", },{ .driver = "vmware-svga", .property = "rombar", - .value = stringify(0), + .value = "0", }, }; @@ -936,11 +936,11 @@ static void pc_i440fx_0_12_machine_options(MachineClass *m) { .driver = "virtio-serial-pci", .property = "max_ports", - .value = stringify(1), + .value = "1", },{ .driver = "virtio-serial-pci", .property = "vectors", - .value = stringify(0), + .value = "0", },{ .driver = "usb-mouse", .property = "serial", diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 54a19d2db8..b6e42c7775 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4324,7 +4324,7 @@ static void spapr_machine_2_6_class_options(MachineClass *mc) { .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, .property = "ddw", - .value = stringify(off), + .value = "off", }, }; From patchwork Thu Jan 10 14:29:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1022970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43b7xy6sR4z9sDL for ; Fri, 11 Jan 2019 01:42:30 +1100 (AEDT) Received: from localhost ([127.0.0.1]:38438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbXQ-00059E-Hk for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2019 09:42:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbMF-0004UN-Hm for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:31:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbM8-00069x-04 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41472) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghbM4-00066q-6X for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:45 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BEC87A429D; Thu, 10 Jan 2019 14:30:41 +0000 (UTC) Received: from localhost (ovpn-116-5.gru2.redhat.com [10.97.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 998241001F5E; Thu, 10 Jan 2019 14:30:40 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 12:29:53 -0200 Message-Id: <20190110142955.23254-9-ehabkost@redhat.com> In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com> References: <20190110142955.23254-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 10 Jan 2019 14:30:41 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 08/10] machine: Use shorter format for GlobalProperty arrays X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Instead of verbose arrays with 4 lines for each entry, make each entry take only one line. This makes long arrays that couldn't fit in the screen become short and readable. Signed-off-by: Eduardo Habkost Message-Id: <20190107193020.21744-4-ehabkost@redhat.com> Reviewed-by: Marc-André Lureau Reviewed-by: Cornelia Huck Signed-off-by: Eduardo Habkost --- include/hw/i386/pc.h | 18 +- hw/core/machine.c | 338 ++++------------- hw/i386/pc.c | 720 +++++++------------------------------ hw/i386/pc_piix.c | 192 ++-------- hw/ppc/spapr.c | 72 +--- hw/s390x/s390-virtio-ccw.c | 75 +--- hw/xen/xen-common.c | 18 +- 7 files changed, 265 insertions(+), 1168 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 84720bede9..0abbe45637 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -354,21 +354,9 @@ extern const size_t pc_compat_1_4_len; * depending on QEMU versions up to QEMU 2.4. */ #define PC_CPU_MODEL_IDS(v) \ - {\ - .driver = "qemu32-" TYPE_X86_CPU,\ - .property = "model-id",\ - .value = "QEMU Virtual CPU version " v,\ - },\ - {\ - .driver = "qemu64-" TYPE_X86_CPU,\ - .property = "model-id",\ - .value = "QEMU Virtual CPU version " v,\ - },\ - {\ - .driver = "athlon-" TYPE_X86_CPU,\ - .property = "model-id",\ - .value = "QEMU Virtual CPU version " v,\ - }, + { "qemu32-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\ + { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\ + { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, }, #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \ static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \ diff --git a/hw/core/machine.c b/hw/core/machine.c index 4b4d6c23de..5530b71981 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -24,23 +24,10 @@ #include "hw/pci/pci.h" GlobalProperty hw_compat_3_1[] = { - { - .driver = "pcie-root-port", - .property = "x-speed", - .value = "2_5", - },{ - .driver = "pcie-root-port", - .property = "x-width", - .value = "1", - },{ - .driver = "memory-backend-file", - .property = "x-use-canonical-path-for-ramblock-id", - .value = "true", - },{ - .driver = "memory-backend-memfd", - .property = "x-use-canonical-path-for-ramblock-id", - .value = "true", - }, + { "pcie-root-port", "x-speed", "2_5" }, + { "pcie-root-port", "x-width", "1" }, + { "memory-backend-file", "x-use-canonical-path-for-ramblock-id", "true" }, + { "memory-backend-memfd", "x-use-canonical-path-for-ramblock-id", "true" }, }; const size_t hw_compat_3_1_len = G_N_ELEMENTS(hw_compat_3_1); @@ -48,269 +35,96 @@ GlobalProperty hw_compat_3_0[] = {}; const size_t hw_compat_3_0_len = G_N_ELEMENTS(hw_compat_3_0); GlobalProperty hw_compat_2_12[] = { - { - .driver = "migration", - .property = "decompress-error-check", - .value = "off", - },{ - .driver = "hda-audio", - .property = "use-timer", - .value = "false", - },{ - .driver = "cirrus-vga", - .property = "global-vmstate", - .value = "true", - },{ - .driver = "VGA", - .property = "global-vmstate", - .value = "true", - },{ - .driver = "vmware-svga", - .property = "global-vmstate", - .value = "true", - },{ - .driver = "qxl-vga", - .property = "global-vmstate", - .value = "true", - }, + { "migration", "decompress-error-check", "off" }, + { "hda-audio", "use-timer", "false" }, + { "cirrus-vga", "global-vmstate", "true" }, + { "VGA", "global-vmstate", "true" }, + { "vmware-svga", "global-vmstate", "true" }, + { "qxl-vga", "global-vmstate", "true" }, }; const size_t hw_compat_2_12_len = G_N_ELEMENTS(hw_compat_2_12); GlobalProperty hw_compat_2_11[] = { - { - .driver = "hpet", - .property = "hpet-offset-saved", - .value = "false", - },{ - .driver = "virtio-blk-pci", - .property = "vectors", - .value = "2", - },{ - .driver = "vhost-user-blk-pci", - .property = "vectors", - .value = "2", - },{ - .driver = "e1000", - .property = "migrate_tso_props", - .value = "off", - }, + { "hpet", "hpet-offset-saved", "false" }, + { "virtio-blk-pci", "vectors", "2" }, + { "vhost-user-blk-pci", "vectors", "2" }, + { "e1000", "migrate_tso_props", "off" }, }; const size_t hw_compat_2_11_len = G_N_ELEMENTS(hw_compat_2_11); GlobalProperty hw_compat_2_10[] = { - { - .driver = "virtio-mouse-device", - .property = "wheel-axis", - .value = "false", - },{ - .driver = "virtio-tablet-device", - .property = "wheel-axis", - .value = "false", - }, + { "virtio-mouse-device", "wheel-axis", "false" }, + { "virtio-tablet-device", "wheel-axis", "false" }, }; const size_t hw_compat_2_10_len = G_N_ELEMENTS(hw_compat_2_10); GlobalProperty hw_compat_2_9[] = { - { - .driver = "pci-bridge", - .property = "shpc", - .value = "off", - },{ - .driver = "intel-iommu", - .property = "pt", - .value = "off", - },{ - .driver = "virtio-net-device", - .property = "x-mtu-bypass-backend", - .value = "off", - },{ - .driver = "pcie-root-port", - .property = "x-migrate-msix", - .value = "false", - }, + { "pci-bridge", "shpc", "off" }, + { "intel-iommu", "pt", "off" }, + { "virtio-net-device", "x-mtu-bypass-backend", "off" }, + { "pcie-root-port", "x-migrate-msix", "false" }, }; const size_t hw_compat_2_9_len = G_N_ELEMENTS(hw_compat_2_9); GlobalProperty hw_compat_2_8[] = { - { - .driver = "fw_cfg_mem", - .property = "x-file-slots", - .value = "0x10", - },{ - .driver = "fw_cfg_io", - .property = "x-file-slots", - .value = "0x10", - },{ - .driver = "pflash_cfi01", - .property = "old-multiple-chip-handling", - .value = "on", - },{ - .driver = "pci-bridge", - .property = "shpc", - .value = "on", - },{ - .driver = TYPE_PCI_DEVICE, - .property = "x-pcie-extcap-init", - .value = "off", - },{ - .driver = "virtio-pci", - .property = "x-pcie-deverr-init", - .value = "off", - },{ - .driver = "virtio-pci", - .property = "x-pcie-lnkctl-init", - .value = "off", - },{ - .driver = "virtio-pci", - .property = "x-pcie-pm-init", - .value = "off", - },{ - .driver = "cirrus-vga", - .property = "vgamem_mb", - .value = "8", - },{ - .driver = "isa-cirrus-vga", - .property = "vgamem_mb", - .value = "8", - }, + { "fw_cfg_mem", "x-file-slots", "0x10" }, + { "fw_cfg_io", "x-file-slots", "0x10" }, + { "pflash_cfi01", "old-multiple-chip-handling", "on" }, + { "pci-bridge", "shpc", "on" }, + { TYPE_PCI_DEVICE, "x-pcie-extcap-init", "off" }, + { "virtio-pci", "x-pcie-deverr-init", "off" }, + { "virtio-pci", "x-pcie-lnkctl-init", "off" }, + { "virtio-pci", "x-pcie-pm-init", "off" }, + { "cirrus-vga", "vgamem_mb", "8" }, + { "isa-cirrus-vga", "vgamem_mb", "8" }, }; const size_t hw_compat_2_8_len = G_N_ELEMENTS(hw_compat_2_8); GlobalProperty hw_compat_2_7[] = { - { - .driver = "virtio-pci", - .property = "page-per-vq", - .value = "on", - },{ - .driver = "virtio-serial-device", - .property = "emergency-write", - .value = "off", - },{ - .driver = "ioapic", - .property = "version", - .value = "0x11", - },{ - .driver = "intel-iommu", - .property = "x-buggy-eim", - .value = "true", - },{ - .driver = "virtio-pci", - .property = "x-ignore-backend-features", - .value = "on", - }, + { "virtio-pci", "page-per-vq", "on" }, + { "virtio-serial-device", "emergency-write", "off" }, + { "ioapic", "version", "0x11" }, + { "intel-iommu", "x-buggy-eim", "true" }, + { "virtio-pci", "x-ignore-backend-features", "on" }, }; const size_t hw_compat_2_7_len = G_N_ELEMENTS(hw_compat_2_7); GlobalProperty hw_compat_2_6[] = { - { - .driver = "virtio-mmio", - .property = "format_transport_address", - .value = "off", - },{ - .driver = "virtio-pci", - .property = "disable-modern", - .value = "on", - },{ - .driver = "virtio-pci", - .property = "disable-legacy", - .value = "off", - }, + { "virtio-mmio", "format_transport_address", "off" }, + { "virtio-pci", "disable-modern", "on" }, + { "virtio-pci", "disable-legacy", "off" }, }; const size_t hw_compat_2_6_len = G_N_ELEMENTS(hw_compat_2_6); GlobalProperty hw_compat_2_5[] = { - { - .driver = "isa-fdc", - .property = "fallback", - .value = "144", - },{ - .driver = "pvscsi", - .property = "x-old-pci-configuration", - .value = "on", - },{ - .driver = "pvscsi", - .property = "x-disable-pcie", - .value = "on", - }, - { - .driver = "vmxnet3", - .property = "x-old-msi-offsets", - .value = "on", - },{ - .driver = "vmxnet3", - .property = "x-disable-pcie", - .value = "on", - }, + { "isa-fdc", "fallback", "144" }, + { "pvscsi", "x-old-pci-configuration", "on" }, + { "pvscsi", "x-disable-pcie", "on" }, + { "vmxnet3", "x-old-msi-offsets", "on" }, + { "vmxnet3", "x-disable-pcie", "on" }, }; const size_t hw_compat_2_5_len = G_N_ELEMENTS(hw_compat_2_5); GlobalProperty hw_compat_2_4[] = { - { - .driver = "virtio-blk-device", - .property = "scsi", - .value = "true", - },{ - .driver = "e1000", - .property = "extra_mac_registers", - .value = "off", - },{ - .driver = "virtio-pci", - .property = "x-disable-pcie", - .value = "on", - },{ - .driver = "virtio-pci", - .property = "migrate-extra", - .value = "off", - },{ - .driver = "fw_cfg_mem", - .property = "dma_enabled", - .value = "off", - },{ - .driver = "fw_cfg_io", - .property = "dma_enabled", - .value = "off", - } + { "virtio-blk-device", "scsi", "true" }, + { "e1000", "extra_mac_registers", "off" }, + { "virtio-pci", "x-disable-pcie", "on" }, + { "virtio-pci", "migrate-extra", "off" }, + { "fw_cfg_mem", "dma_enabled", "off" }, + { "fw_cfg_io", "dma_enabled", "off" } }; const size_t hw_compat_2_4_len = G_N_ELEMENTS(hw_compat_2_4); GlobalProperty hw_compat_2_3[] = { - { - .driver = "virtio-blk-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "virtio-balloon-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "virtio-serial-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "virtio-9p-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "virtio-rng-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = TYPE_PCI_DEVICE, - .property = "x-pcie-lnksta-dllla", - .value = "off", - },{ - .driver = "migration", - .property = "send-configuration", - .value = "off", - },{ - .driver = "migration", - .property = "send-section-footer", - .value = "off", - },{ - .driver = "migration", - .property = "store-global-state", - .value = "off", - }, + { "virtio-blk-pci", "any_layout", "off" }, + { "virtio-balloon-pci", "any_layout", "off" }, + { "virtio-serial-pci", "any_layout", "off" }, + { "virtio-9p-pci", "any_layout", "off" }, + { "virtio-rng-pci", "any_layout", "off" }, + { TYPE_PCI_DEVICE, "x-pcie-lnksta-dllla", "off" }, + { "migration", "send-configuration", "off" }, + { "migration", "send-section-footer", "off" }, + { "migration", "store-global-state", "off" }, }; const size_t hw_compat_2_3_len = G_N_ELEMENTS(hw_compat_2_3); @@ -318,35 +132,13 @@ GlobalProperty hw_compat_2_2[] = {}; const size_t hw_compat_2_2_len = G_N_ELEMENTS(hw_compat_2_2); GlobalProperty hw_compat_2_1[] = { - { - .driver = "intel-hda", - .property = "old_msi_addr", - .value = "on", - },{ - .driver = "VGA", - .property = "qemu-extended-regs", - .value = "off", - },{ - .driver = "secondary-vga", - .property = "qemu-extended-regs", - .value = "off", - },{ - .driver = "virtio-scsi-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "usb-mouse", - .property = "usb_version", - .value = "1", - },{ - .driver = "usb-kbd", - .property = "usb_version", - .value = "1", - },{ - .driver = "virtio-pci", - .property = "virtio-pci-bus-master-bug-migration", - .value = "on", - }, + { "intel-hda", "old_msi_addr", "on" }, + { "VGA", "qemu-extended-regs", "off" }, + { "secondary-vga", "qemu-extended-regs", "off" }, + { "virtio-scsi-pci", "any_layout", "off" }, + { "usb-mouse", "usb_version", "1" }, + { "usb-kbd", "usb_version", "1" }, + { "virtio-pci", "virtio-pci-bus-master-bug-migration", "on" }, }; const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ff14b6d4df..f238424499 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -111,174 +111,67 @@ static unsigned e820_entries; struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX}; GlobalProperty pc_compat_3_1[] = { - { - .driver = "intel-iommu", - .property = "dma-drain", - .value = "off", - }, + { "intel-iommu", "dma-drain", "off" }, }; const size_t pc_compat_3_1_len = G_N_ELEMENTS(pc_compat_3_1); GlobalProperty pc_compat_3_0[] = { - { - .driver = TYPE_X86_CPU, - .property = "x-hv-synic-kvm-only", - .value = "on", - },{ - .driver = "Skylake-Server" "-" TYPE_X86_CPU, - .property = "pku", - .value = "off", - },{ - .driver = "Skylake-Server-IBRS" "-" TYPE_X86_CPU, - .property = "pku", - .value = "off", - }, + { TYPE_X86_CPU, "x-hv-synic-kvm-only", "on" }, + { "Skylake-Server" "-" TYPE_X86_CPU, "pku", "off" }, + { "Skylake-Server-IBRS" "-" TYPE_X86_CPU, "pku", "off" }, }; const size_t pc_compat_3_0_len = G_N_ELEMENTS(pc_compat_3_0); GlobalProperty pc_compat_2_12[] = { - { - .driver = TYPE_X86_CPU, - .property = "legacy-cache", - .value = "on", - },{ - .driver = TYPE_X86_CPU, - .property = "topoext", - .value = "off", - },{ - .driver = "EPYC-" TYPE_X86_CPU, - .property = "xlevel", - .value = "0x8000000a", - },{ - .driver = "EPYC-IBPB-" TYPE_X86_CPU, - .property = "xlevel", - .value = "0x8000000a", - }, + { TYPE_X86_CPU, "legacy-cache", "on" }, + { TYPE_X86_CPU, "topoext", "off" }, + { "EPYC-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, + { "EPYC-IBPB-" TYPE_X86_CPU, "xlevel", "0x8000000a" }, }; const size_t pc_compat_2_12_len = G_N_ELEMENTS(pc_compat_2_12); GlobalProperty pc_compat_2_11[] = { - { - .driver = TYPE_X86_CPU, - .property = "x-migrate-smi-count", - .value = "off", - },{ - .driver = "Skylake-Server" "-" TYPE_X86_CPU, - .property = "clflushopt", - .value = "off", - }, + { TYPE_X86_CPU, "x-migrate-smi-count", "off" }, + { "Skylake-Server" "-" TYPE_X86_CPU, "clflushopt", "off" }, }; const size_t pc_compat_2_11_len = G_N_ELEMENTS(pc_compat_2_11); GlobalProperty pc_compat_2_10[] = { - { - .driver = TYPE_X86_CPU, - .property = "x-hv-max-vps", - .value = "0x40", - },{ - .driver = "i440FX-pcihost", - .property = "x-pci-hole64-fix", - .value = "off", - },{ - .driver = "q35-pcihost", - .property = "x-pci-hole64-fix", - .value = "off", - }, + { TYPE_X86_CPU, "x-hv-max-vps", "0x40" }, + { "i440FX-pcihost", "x-pci-hole64-fix", "off" }, + { "q35-pcihost", "x-pci-hole64-fix", "off" }, }; const size_t pc_compat_2_10_len = G_N_ELEMENTS(pc_compat_2_10); GlobalProperty pc_compat_2_9[] = { - { - .driver = "mch", - .property = "extended-tseg-mbytes", - .value = "0", - }, + { "mch", "extended-tseg-mbytes", "0" }, }; const size_t pc_compat_2_9_len = G_N_ELEMENTS(pc_compat_2_9); GlobalProperty pc_compat_2_8[] = { - { - .driver = TYPE_X86_CPU, - .property = "tcg-cpuid", - .value = "off", - }, - { - .driver = "kvmclock", - .property = "x-mach-use-reliable-get-clock", - .value = "off", - }, - { - .driver = "ICH9-LPC", - .property = "x-smi-broadcast", - .value = "off", - }, - { - .driver = TYPE_X86_CPU, - .property = "vmware-cpuid-freq", - .value = "off", - }, - { - .driver = "Haswell-" TYPE_X86_CPU, - .property = "stepping", - .value = "1", - }, + { TYPE_X86_CPU, "tcg-cpuid", "off" }, + { "kvmclock", "x-mach-use-reliable-get-clock", "off" }, + { "ICH9-LPC", "x-smi-broadcast", "off" }, + { TYPE_X86_CPU, "vmware-cpuid-freq", "off" }, + { "Haswell-" TYPE_X86_CPU, "stepping", "1" }, }; const size_t pc_compat_2_8_len = G_N_ELEMENTS(pc_compat_2_8); GlobalProperty pc_compat_2_7[] = { - { - .driver = TYPE_X86_CPU, - .property = "l3-cache", - .value = "off", - }, - { - .driver = TYPE_X86_CPU, - .property = "full-cpuid-auto-level", - .value = "off", - }, - { - .driver = "Opteron_G3" "-" TYPE_X86_CPU, - .property = "family", - .value = "15", - }, - { - .driver = "Opteron_G3" "-" TYPE_X86_CPU, - .property = "model", - .value = "6", - }, - { - .driver = "Opteron_G3" "-" TYPE_X86_CPU, - .property = "stepping", - .value = "1", - }, - { - .driver = "isa-pcspk", - .property = "migrate", - .value = "off", - }, + { TYPE_X86_CPU, "l3-cache", "off" }, + { TYPE_X86_CPU, "full-cpuid-auto-level", "off" }, + { "Opteron_G3" "-" TYPE_X86_CPU, "family", "15" }, + { "Opteron_G3" "-" TYPE_X86_CPU, "model", "6" }, + { "Opteron_G3" "-" TYPE_X86_CPU, "stepping", "1" }, + { "isa-pcspk", "migrate", "off" }, }; const size_t pc_compat_2_7_len = G_N_ELEMENTS(pc_compat_2_7); GlobalProperty pc_compat_2_6[] = { - { - .driver = TYPE_X86_CPU, - .property = "cpuid-0xb", - .value = "off", - },{ - .driver = "vmxnet3", - .property = "romfile", - .value = "", - }, - { - .driver = TYPE_X86_CPU, - .property = "fill-mtrr-mask", - .value = "off", - }, - { - .driver = "apic-common", - .property = "legacy-instance-id", - .value = "on", - } + { TYPE_X86_CPU, "cpuid-0xb", "off" }, + { "vmxnet3", "romfile", "" }, + { TYPE_X86_CPU, "fill-mtrr-mask", "off" }, + { "apic-common", "legacy-instance-id", "on", } }; const size_t pc_compat_2_6_len = G_N_ELEMENTS(pc_compat_2_6); @@ -287,499 +180,148 @@ const size_t pc_compat_2_5_len = G_N_ELEMENTS(pc_compat_2_5); GlobalProperty pc_compat_2_4[] = { PC_CPU_MODEL_IDS("2.4.0") - { - .driver = "Haswell-" TYPE_X86_CPU, - .property = "abm", - .value = "off", - }, - { - .driver = "Haswell-noTSX-" TYPE_X86_CPU, - .property = "abm", - .value = "off", - }, - { - .driver = "Broadwell-" TYPE_X86_CPU, - .property = "abm", - .value = "off", - }, - { - .driver = "Broadwell-noTSX-" TYPE_X86_CPU, - .property = "abm", - .value = "off", - }, - { - .driver = "host" "-" TYPE_X86_CPU, - .property = "host-cache-info", - .value = "on", - }, - { - .driver = TYPE_X86_CPU, - .property = "check", - .value = "off", - }, - { - .driver = "qemu64" "-" TYPE_X86_CPU, - .property = "sse4a", - .value = "on", - }, - { - .driver = "qemu64" "-" TYPE_X86_CPU, - .property = "abm", - .value = "on", - }, - { - .driver = "qemu64" "-" TYPE_X86_CPU, - .property = "popcnt", - .value = "on", - }, - { - .driver = "qemu32" "-" TYPE_X86_CPU, - .property = "popcnt", - .value = "on", - },{ - .driver = "Opteron_G2" "-" TYPE_X86_CPU, - .property = "rdtscp", - .value = "on", - },{ - .driver = "Opteron_G3" "-" TYPE_X86_CPU, - .property = "rdtscp", - .value = "on", - },{ - .driver = "Opteron_G4" "-" TYPE_X86_CPU, - .property = "rdtscp", - .value = "on", - },{ - .driver = "Opteron_G5" "-" TYPE_X86_CPU, - .property = "rdtscp", - .value = "on", - } + { "Haswell-" TYPE_X86_CPU, "abm", "off" }, + { "Haswell-noTSX-" TYPE_X86_CPU, "abm", "off" }, + { "Broadwell-" TYPE_X86_CPU, "abm", "off" }, + { "Broadwell-noTSX-" TYPE_X86_CPU, "abm", "off" }, + { "host" "-" TYPE_X86_CPU, "host-cache-info", "on" }, + { TYPE_X86_CPU, "check", "off" }, + { "qemu64" "-" TYPE_X86_CPU, "sse4a", "on" }, + { "qemu64" "-" TYPE_X86_CPU, "abm", "on" }, + { "qemu64" "-" TYPE_X86_CPU, "popcnt", "on" }, + { "qemu32" "-" TYPE_X86_CPU, "popcnt", "on" }, + { "Opteron_G2" "-" TYPE_X86_CPU, "rdtscp", "on" }, + { "Opteron_G3" "-" TYPE_X86_CPU, "rdtscp", "on" }, + { "Opteron_G4" "-" TYPE_X86_CPU, "rdtscp", "on" }, + { "Opteron_G5" "-" TYPE_X86_CPU, "rdtscp", "on", } }; const size_t pc_compat_2_4_len = G_N_ELEMENTS(pc_compat_2_4); GlobalProperty pc_compat_2_3[] = { PC_CPU_MODEL_IDS("2.3.0") - { - .driver = TYPE_X86_CPU, - .property = "arat", - .value = "off", - },{ - .driver = "qemu64" "-" TYPE_X86_CPU, - .property = "min-level", - .value = "4", - },{ - .driver = "kvm64" "-" TYPE_X86_CPU, - .property = "min-level", - .value = "5", - },{ - .driver = "pentium3" "-" TYPE_X86_CPU, - .property = "min-level", - .value = "2", - },{ - .driver = "n270" "-" TYPE_X86_CPU, - .property = "min-level", - .value = "5", - },{ - .driver = "Conroe" "-" TYPE_X86_CPU, - .property = "min-level", - .value = "4", - },{ - .driver = "Penryn" "-" TYPE_X86_CPU, - .property = "min-level", - .value = "4", - },{ - .driver = "Nehalem" "-" TYPE_X86_CPU, - .property = "min-level", - .value = "4", - },{ - .driver = "n270" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = "Penryn" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = "Conroe" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = "Nehalem" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = "Westmere" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = "SandyBridge" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = "IvyBridge" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = "Haswell" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = "Haswell-noTSX" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = "Broadwell" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU, - .property = "min-xlevel", - .value = "0x8000000a", - },{ - .driver = TYPE_X86_CPU, - .property = "kvm-no-smi-migration", - .value = "on", - }, + { TYPE_X86_CPU, "arat", "off" }, + { "qemu64" "-" TYPE_X86_CPU, "min-level", "4" }, + { "kvm64" "-" TYPE_X86_CPU, "min-level", "5" }, + { "pentium3" "-" TYPE_X86_CPU, "min-level", "2" }, + { "n270" "-" TYPE_X86_CPU, "min-level", "5" }, + { "Conroe" "-" TYPE_X86_CPU, "min-level", "4" }, + { "Penryn" "-" TYPE_X86_CPU, "min-level", "4" }, + { "Nehalem" "-" TYPE_X86_CPU, "min-level", "4" }, + { "n270" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Penryn" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Conroe" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Nehalem" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Westmere" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "SandyBridge" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "IvyBridge" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Haswell" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Haswell-noTSX" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Broadwell" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { "Broadwell-noTSX" "-" TYPE_X86_CPU, "min-xlevel", "0x8000000a" }, + { TYPE_X86_CPU, "kvm-no-smi-migration", "on" }, }; const size_t pc_compat_2_3_len = G_N_ELEMENTS(pc_compat_2_3); GlobalProperty pc_compat_2_2[] = { PC_CPU_MODEL_IDS("2.2.0") - { - .driver = "kvm64" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "kvm32" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Conroe" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Penryn" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Nehalem" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Westmere" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "SandyBridge" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Haswell" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Broadwell" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Opteron_G1" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Opteron_G2" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Opteron_G3" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Opteron_G4" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Opteron_G5" "-" TYPE_X86_CPU, - .property = "vme", - .value = "off", - }, - { - .driver = "Haswell" "-" TYPE_X86_CPU, - .property = "f16c", - .value = "off", - }, - { - .driver = "Haswell" "-" TYPE_X86_CPU, - .property = "rdrand", - .value = "off", - }, - { - .driver = "Broadwell" "-" TYPE_X86_CPU, - .property = "f16c", - .value = "off", - }, - { - .driver = "Broadwell" "-" TYPE_X86_CPU, - .property = "rdrand", - .value = "off", - }, + { "kvm64" "-" TYPE_X86_CPU, "vme", "off" }, + { "kvm32" "-" TYPE_X86_CPU, "vme", "off" }, + { "Conroe" "-" TYPE_X86_CPU, "vme", "off" }, + { "Penryn" "-" TYPE_X86_CPU, "vme", "off" }, + { "Nehalem" "-" TYPE_X86_CPU, "vme", "off" }, + { "Westmere" "-" TYPE_X86_CPU, "vme", "off" }, + { "SandyBridge" "-" TYPE_X86_CPU, "vme", "off" }, + { "Haswell" "-" TYPE_X86_CPU, "vme", "off" }, + { "Broadwell" "-" TYPE_X86_CPU, "vme", "off" }, + { "Opteron_G1" "-" TYPE_X86_CPU, "vme", "off" }, + { "Opteron_G2" "-" TYPE_X86_CPU, "vme", "off" }, + { "Opteron_G3" "-" TYPE_X86_CPU, "vme", "off" }, + { "Opteron_G4" "-" TYPE_X86_CPU, "vme", "off" }, + { "Opteron_G5" "-" TYPE_X86_CPU, "vme", "off" }, + { "Haswell" "-" TYPE_X86_CPU, "f16c", "off" }, + { "Haswell" "-" TYPE_X86_CPU, "rdrand", "off" }, + { "Broadwell" "-" TYPE_X86_CPU, "f16c", "off" }, + { "Broadwell" "-" TYPE_X86_CPU, "rdrand", "off" }, }; const size_t pc_compat_2_2_len = G_N_ELEMENTS(pc_compat_2_2); GlobalProperty pc_compat_2_1[] = { PC_CPU_MODEL_IDS("2.1.0") - { - .driver = "coreduo" "-" TYPE_X86_CPU, - .property = "vmx", - .value = "on", - }, - { - .driver = "core2duo" "-" TYPE_X86_CPU, - .property = "vmx", - .value = "on", - }, + { "coreduo" "-" TYPE_X86_CPU, "vmx", "on" }, + { "core2duo" "-" TYPE_X86_CPU, "vmx", "on" }, }; const size_t pc_compat_2_1_len = G_N_ELEMENTS(pc_compat_2_1); GlobalProperty pc_compat_2_0[] = { PC_CPU_MODEL_IDS("2.0.0") - { - .driver = "virtio-scsi-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = "PIIX4_PM", - .property = "memory-hotplug-support", - .value = "off", - }, - { - .driver = "apic", - .property = "version", - .value = "0x11", - }, - { - .driver = "nec-usb-xhci", - .property = "superspeed-ports-first", - .value = "off", - }, - { - .driver = "nec-usb-xhci", - .property = "force-pcie-endcap", - .value = "on", - }, - { - .driver = "pci-serial", - .property = "prog_if", - .value = "0", - }, - { - .driver = "pci-serial-2x", - .property = "prog_if", - .value = "0", - }, - { - .driver = "pci-serial-4x", - .property = "prog_if", - .value = "0", - }, - { - .driver = "virtio-net-pci", - .property = "guest_announce", - .value = "off", - }, - { - .driver = "ICH9-LPC", - .property = "memory-hotplug-support", - .value = "off", - },{ - .driver = "xio3130-downstream", - .property = COMPAT_PROP_PCP, - .value = "off", - },{ - .driver = "ioh3420", - .property = COMPAT_PROP_PCP, - .value = "off", - }, + { "virtio-scsi-pci", "any_layout", "off" }, + { "PIIX4_PM", "memory-hotplug-support", "off" }, + { "apic", "version", "0x11" }, + { "nec-usb-xhci", "superspeed-ports-first", "off" }, + { "nec-usb-xhci", "force-pcie-endcap", "on" }, + { "pci-serial", "prog_if", "0" }, + { "pci-serial-2x", "prog_if", "0" }, + { "pci-serial-4x", "prog_if", "0" }, + { "virtio-net-pci", "guest_announce", "off" }, + { "ICH9-LPC", "memory-hotplug-support", "off" }, + { "xio3130-downstream", COMPAT_PROP_PCP, "off" }, + { "ioh3420", COMPAT_PROP_PCP, "off" }, }; const size_t pc_compat_2_0_len = G_N_ELEMENTS(pc_compat_2_0); GlobalProperty pc_compat_1_7[] = { PC_CPU_MODEL_IDS("1.7.0") - { - .driver = TYPE_USB_DEVICE, - .property = "msos-desc", - .value = "no", - }, - { - .driver = "PIIX4_PM", - .property = "acpi-pci-hotplug-with-bridge-support", - .value = "off", - }, - { - .driver = "hpet", - .property = HPET_INTCAP, - .value = "4", - }, + { TYPE_USB_DEVICE, "msos-desc", "no" }, + { "PIIX4_PM", "acpi-pci-hotplug-with-bridge-support", "off" }, + { "hpet", HPET_INTCAP, "4" }, }; const size_t pc_compat_1_7_len = G_N_ELEMENTS(pc_compat_1_7); GlobalProperty pc_compat_1_6[] = { PC_CPU_MODEL_IDS("1.6.0") - { - .driver = "e1000", - .property = "mitigation", - .value = "off", - },{ - .driver = "qemu64-" TYPE_X86_CPU, - .property = "model", - .value = "2", - },{ - .driver = "qemu32-" TYPE_X86_CPU, - .property = "model", - .value = "3", - },{ - .driver = "i440FX-pcihost", - .property = "short_root_bus", - .value = "1", - },{ - .driver = "q35-pcihost", - .property = "short_root_bus", - .value = "1", - }, + { "e1000", "mitigation", "off" }, + { "qemu64-" TYPE_X86_CPU, "model", "2" }, + { "qemu32-" TYPE_X86_CPU, "model", "3" }, + { "i440FX-pcihost", "short_root_bus", "1" }, + { "q35-pcihost", "short_root_bus", "1" }, }; const size_t pc_compat_1_6_len = G_N_ELEMENTS(pc_compat_1_6); GlobalProperty pc_compat_1_5[] = { PC_CPU_MODEL_IDS("1.5.0") - { - .driver = "Conroe-" TYPE_X86_CPU, - .property = "model", - .value = "2", - },{ - .driver = "Conroe-" TYPE_X86_CPU, - .property = "min-level", - .value = "2", - },{ - .driver = "Penryn-" TYPE_X86_CPU, - .property = "model", - .value = "2", - },{ - .driver = "Penryn-" TYPE_X86_CPU, - .property = "min-level", - .value = "2", - },{ - .driver = "Nehalem-" TYPE_X86_CPU, - .property = "model", - .value = "2", - },{ - .driver = "Nehalem-" TYPE_X86_CPU, - .property = "min-level", - .value = "2", - },{ - .driver = "virtio-net-pci", - .property = "any_layout", - .value = "off", - },{ - .driver = TYPE_X86_CPU, - .property = "pmu", - .value = "on", - },{ - .driver = "i440FX-pcihost", - .property = "short_root_bus", - .value = "0", - },{ - .driver = "q35-pcihost", - .property = "short_root_bus", - .value = "0", - }, + { "Conroe-" TYPE_X86_CPU, "model", "2" }, + { "Conroe-" TYPE_X86_CPU, "min-level", "2" }, + { "Penryn-" TYPE_X86_CPU, "model", "2" }, + { "Penryn-" TYPE_X86_CPU, "min-level", "2" }, + { "Nehalem-" TYPE_X86_CPU, "model", "2" }, + { "Nehalem-" TYPE_X86_CPU, "min-level", "2" }, + { "virtio-net-pci", "any_layout", "off" }, + { TYPE_X86_CPU, "pmu", "on" }, + { "i440FX-pcihost", "short_root_bus", "0" }, + { "q35-pcihost", "short_root_bus", "0" }, }; const size_t pc_compat_1_5_len = G_N_ELEMENTS(pc_compat_1_5); GlobalProperty pc_compat_1_4[] = { PC_CPU_MODEL_IDS("1.4.0") - { - .driver = "scsi-hd", - .property = "discard_granularity", - .value = "0", - },{ - .driver = "scsi-cd", - .property = "discard_granularity", - .value = "0", - },{ - .driver = "scsi-disk", - .property = "discard_granularity", - .value = "0", - },{ - .driver = "ide-hd", - .property = "discard_granularity", - .value = "0", - },{ - .driver = "ide-cd", - .property = "discard_granularity", - .value = "0", - },{ - .driver = "ide-drive", - .property = "discard_granularity", - .value = "0", - },{ - .driver = "virtio-blk-pci", - .property = "discard_granularity", - .value = "0", - },{ - .driver = "virtio-serial-pci", - .property = "vectors", - /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */ - .value = "0xFFFFFFFF", - },{ - .driver = "virtio-net-pci", - .property = "ctrl_guest_offloads", - .value = "off", - },{ - .driver = "e1000", - .property = "romfile", - .value = "pxe-e1000.rom", - },{ - .driver = "ne2k_pci", - .property = "romfile", - .value = "pxe-ne2k_pci.rom", - },{ - .driver = "pcnet", - .property = "romfile", - .value = "pxe-pcnet.rom", - },{ - .driver = "rtl8139", - .property = "romfile", - .value = "pxe-rtl8139.rom", - },{ - .driver = "virtio-net-pci", - .property = "romfile", - .value = "pxe-virtio.rom", - },{ - .driver = "486-" TYPE_X86_CPU, - .property = "model", - .value = "0", - }, - { - .driver = "n270" "-" TYPE_X86_CPU, - .property = "movbe", - .value = "off", - }, - { - .driver = "Westmere" "-" TYPE_X86_CPU, - .property = "pclmulqdq", - .value = "off", - }, + { "scsi-hd", "discard_granularity", "0" }, + { "scsi-cd", "discard_granularity", "0" }, + { "scsi-disk", "discard_granularity", "0" }, + { "ide-hd", "discard_granularity", "0" }, + { "ide-cd", "discard_granularity", "0" }, + { "ide-drive", "discard_granularity", "0" }, + { "virtio-blk-pci", "discard_granularity", "0" }, + /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string: */ + { "virtio-serial-pci", "vectors", "0xFFFFFFFF" }, + { "virtio-net-pci", "ctrl_guest_offloads", "off" }, + { "e1000", "romfile", "pxe-e1000.rom" }, + { "ne2k_pci", "romfile", "pxe-ne2k_pci.rom" }, + { "pcnet", "romfile", "pxe-pcnet.rom" }, + { "rtl8139", "romfile", "pxe-rtl8139.rom" }, + { "virtio-net-pci", "romfile", "pxe-virtio.rom" }, + { "486-" TYPE_X86_CPU, "model", "0" }, + { "n270" "-" TYPE_X86_CPU, "movbe", "off" }, + { "Westmere" "-" TYPE_X86_CPU, "pclmulqdq", "off" }, }; const size_t pc_compat_1_4_len = G_N_ELEMENTS(pc_compat_1_4); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index fd20227af3..5088e2f492 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -694,23 +694,10 @@ static void pc_i440fx_1_3_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("1.3.0") - { - .driver = "usb-tablet", - .property = "usb_version", - .value = "1", - },{ - .driver = "virtio-net-pci", - .property = "ctrl_mac_addr", - .value = "off", - },{ - .driver = "virtio-net-pci", - .property = "mq", - .value = "off", - }, { - .driver = "e1000", - .property = "autonegotiation", - .value = "off", - }, + { "usb-tablet", "usb_version", "1" }, + { "virtio-net-pci", "ctrl_mac_addr", "off" }, + { "virtio-net-pci", "mq", "off" }, + { "e1000", "autonegotiation", "off" }, }; pc_i440fx_1_4_machine_options(m); @@ -726,31 +713,12 @@ static void pc_i440fx_1_2_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("1.2.0") - { - .driver = "nec-usb-xhci", - .property = "msi", - .value = "off", - },{ - .driver = "nec-usb-xhci", - .property = "msix", - .value = "off", - },{ - .driver = "ivshmem", - .property = "use64", - .value = "0", - },{ - .driver = "qxl", - .property = "revision", - .value = "3", - },{ - .driver = "qxl-vga", - .property = "revision", - .value = "3", - },{ - .driver = "VGA", - .property = "mmio", - .value = "off", - }, + { "nec-usb-xhci", "msi", "off" }, + { "nec-usb-xhci", "msix", "off" }, + { "ivshmem", "use64", "0" }, + { "qxl", "revision", "3" }, + { "qxl-vga", "revision", "3" }, + { "VGA", "mmio", "off" }, }; pc_i440fx_1_3_machine_options(m); @@ -766,35 +734,13 @@ static void pc_i440fx_1_1_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("1.1.0") - { - .driver = "virtio-scsi-pci", - .property = "hotplug", - .value = "off", - },{ - .driver = "virtio-scsi-pci", - .property = "param_change", - .value = "off", - },{ - .driver = "VGA", - .property = "vgamem_mb", - .value = "8", - },{ - .driver = "vmware-svga", - .property = "vgamem_mb", - .value = "8", - },{ - .driver = "qxl-vga", - .property = "vgamem_mb", - .value = "8", - },{ - .driver = "qxl", - .property = "vgamem_mb", - .value = "8", - },{ - .driver = "virtio-blk-pci", - .property = "config-wce", - .value = "off", - }, + { "virtio-scsi-pci", "hotplug", "off" }, + { "virtio-scsi-pci", "param_change", "off" }, + { "VGA", "vgamem_mb", "8" }, + { "vmware-svga", "vgamem_mb", "8" }, + { "qxl-vga", "vgamem_mb", "8" }, + { "qxl", "vgamem_mb", "8" }, + { "virtio-blk-pci", "config-wce", "off" }, }; pc_i440fx_1_2_machine_options(m); @@ -809,23 +755,10 @@ static void pc_i440fx_1_0_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("1.0") - { - .driver = TYPE_ISA_FDC, - .property = "check_media_rate", - .value = "off", - },{ - .driver = "virtio-balloon-pci", - .property = "class", - .value = stringify(PCI_CLASS_MEMORY_RAM), - },{ - .driver = "apic-common", - .property = "vapic", - .value = "off", - },{ - .driver = TYPE_USB_DEVICE, - .property = "full-path", - .value = "no", - }, + { TYPE_ISA_FDC, "check_media_rate", "off" }, + { "virtio-balloon-pci", "class", stringify(PCI_CLASS_MEMORY_RAM) }, + { "apic-common", "vapic", "off" }, + { TYPE_USB_DEVICE, "full-path", "no" }, }; pc_i440fx_1_1_machine_options(m); @@ -857,31 +790,12 @@ static void pc_i440fx_0_14_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("0.14") - { - .driver = "virtio-blk-pci", - .property = "event_idx", - .value = "off", - },{ - .driver = "virtio-serial-pci", - .property = "event_idx", - .value = "off", - },{ - .driver = "virtio-net-pci", - .property = "event_idx", - .value = "off", - },{ - .driver = "virtio-balloon-pci", - .property = "event_idx", - .value = "off", - },{ - .driver = "qxl", - .property = "revision", - .value = "2", - },{ - .driver = "qxl-vga", - .property = "revision", - .value = "2", - }, + { "virtio-blk-pci", "event_idx", "off" }, + { "virtio-serial-pci", "event_idx", "off" }, + { "virtio-net-pci", "event_idx", "off" }, + { "virtio-balloon-pci", "event_idx", "off" }, + { "qxl", "revision", "2" }, + { "qxl-vga", "revision", "2" }, }; pc_i440fx_0_15_machine_options(m); @@ -897,27 +811,11 @@ static void pc_i440fx_0_13_machine_options(MachineClass *m) PCMachineClass *pcmc = PC_MACHINE_CLASS(m); static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("0.13") - { - .driver = TYPE_PCI_DEVICE, - .property = "command_serr_enable", - .value = "off", - },{ - .driver = "AC97", - .property = "use_broken_id", - .value = "1", - },{ - .driver = "virtio-9p-pci", - .property = "vectors", - .value = "0", - },{ - .driver = "VGA", - .property = "rombar", - .value = "0", - },{ - .driver = "vmware-svga", - .property = "rombar", - .value = "0", - }, + { TYPE_PCI_DEVICE, "command_serr_enable", "off" }, + { "AC97", "use_broken_id", "1" }, + { "virtio-9p-pci", "vectors", "0" }, + { "VGA", "rombar", "0" }, + { "vmware-svga", "rombar", "0" }, }; pc_i440fx_0_14_machine_options(m); @@ -933,27 +831,11 @@ static void pc_i440fx_0_12_machine_options(MachineClass *m) { static GlobalProperty compat[] = { PC_CPU_MODEL_IDS("0.12") - { - .driver = "virtio-serial-pci", - .property = "max_ports", - .value = "1", - },{ - .driver = "virtio-serial-pci", - .property = "vectors", - .value = "0", - },{ - .driver = "usb-mouse", - .property = "serial", - .value = "1", - },{ - .driver = "usb-tablet", - .property = "serial", - .value = "1", - },{ - .driver = "usb-kbd", - .property = "serial", - .value = "1", - }, + { "virtio-serial-pci", "max_ports", "1" }, + { "virtio-serial-pci", "vectors", "0" }, + { "usb-mouse", "serial", "1" }, + { "usb-tablet", "serial", "1" }, + { "usb-kbd", "serial", "1" }, }; pc_i440fx_0_13_machine_options(m); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b6e42c7775..0942f35bf8 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4113,16 +4113,8 @@ static void spapr_machine_2_12_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = TYPE_POWERPC_CPU, - .property = "pre-3.0-migration", - .value = "on", - }, - { - .driver = TYPE_SPAPR_CPU_CORE, - .property = "pre-3.0-migration", - .value = "on", - }, + { TYPE_POWERPC_CPU, "pre-3.0-migration", "on" }, + { TYPE_SPAPR_CPU_CORE, "pre-3.0-migration", "on" }, }; spapr_machine_3_0_class_options(mc); @@ -4186,11 +4178,7 @@ static void spapr_machine_2_9_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = TYPE_POWERPC_CPU, - .property = "pre-2.10-migration", - .value = "on", - }, + { TYPE_POWERPC_CPU, "pre-2.10-migration", "on" }, }; spapr_machine_2_10_class_options(mc); @@ -4210,11 +4198,7 @@ DEFINE_SPAPR_MACHINE(2_9, "2.9", false); static void spapr_machine_2_8_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "pcie-extended-configuration-space", - .value = "off", - }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "pcie-extended-configuration-space", "off" }, }; spapr_machine_2_9_class_options(mc); @@ -4282,26 +4266,10 @@ static void spapr_machine_2_7_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "mem_win_size", - .value = "0xf80000000", - }, - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "mem64_win_size", - .value = "0", - }, - { - .driver = TYPE_POWERPC_CPU, - .property = "pre-2.8-migration", - .value = "on", - }, - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "pre-2.8-migration", - .value = "on", - }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "mem_win_size", "0xf80000000", }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "mem64_win_size", "0", }, + { TYPE_POWERPC_CPU, "pre-2.8-migration", "on", }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "pre-2.8-migration", "on", }, }; spapr_machine_2_8_class_options(mc); @@ -4321,11 +4289,7 @@ DEFINE_SPAPR_MACHINE(2_7, "2.7", false); static void spapr_machine_2_6_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "ddw", - .value = "off", - }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "ddw", "off" }, }; spapr_machine_2_7_class_options(mc); @@ -4344,11 +4308,7 @@ static void spapr_machine_2_5_class_options(MachineClass *mc) { sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = "spapr-vlan", - .property = "use-rx-buffer-pools", - .value = "off", - }, + { "spapr-vlan", "use-rx-buffer-pools", "off" }, }; spapr_machine_2_6_class_options(mc); @@ -4381,11 +4341,7 @@ DEFINE_SPAPR_MACHINE(2_4, "2.4", false); static void spapr_machine_2_3_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = "spapr-pci-host-bridge", - .property = "dynamic-reconfiguration", - .value = "off", - }, + { "spapr-pci-host-bridge", "dynamic-reconfiguration", "off" }, }; spapr_machine_2_4_class_options(mc); compat_props_add(mc->compat_props, hw_compat_2_3, hw_compat_2_3_len); @@ -4400,11 +4356,7 @@ DEFINE_SPAPR_MACHINE(2_3, "2.3", false); static void spapr_machine_2_2_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, - .property = "mem_win_size", - .value = "0x20000000", - }, + { TYPE_SPAPR_PCI_HOST_BRIDGE, "mem_win_size", "0x20000000" }, }; spapr_machine_2_3_class_options(mc); diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index c737507053..811fdf913d 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -712,11 +712,7 @@ static void ccw_machine_2_11_instance_options(MachineState *machine) static void ccw_machine_2_11_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_SCLP_EVENT_FACILITY, - .property = "allow_all_mask_sizes", - .value = "off", - }, + { TYPE_SCLP_EVENT_FACILITY, "allow_all_mask_sizes", "off", }, }; ccw_machine_2_12_class_options(mc); @@ -751,11 +747,7 @@ static void ccw_machine_2_9_class_options(MachineClass *mc) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = TYPE_S390_STATTRIB, - .property = "migration-enabled", - .value = "off", - }, + { TYPE_S390_STATTRIB, "migration-enabled", "off", }, }; ccw_machine_2_10_class_options(mc); @@ -773,11 +765,7 @@ static void ccw_machine_2_8_instance_options(MachineState *machine) static void ccw_machine_2_8_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_S390_FLIC_COMMON, - .property = "adapter_routes_max_batch", - .value = "64", - }, + { TYPE_S390_FLIC_COMMON, "adapter_routes_max_batch", "64", }, }; ccw_machine_2_9_class_options(mc); @@ -810,15 +798,8 @@ static void ccw_machine_2_6_class_options(MachineClass *mc) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); static GlobalProperty compat[] = { - { - .driver = TYPE_S390_IPL, - .property = "iplbext_migration", - .value = "off", - }, { - .driver = TYPE_VIRTUAL_CSS_BRIDGE, - .property = "css_dev_path", - .value = "off", - }, + { TYPE_S390_IPL, "iplbext_migration", "off", }, + { TYPE_VIRTUAL_CSS_BRIDGE, "css_dev_path", "off", }, }; s390mc->ri_allowed = false; @@ -848,43 +829,15 @@ static void ccw_machine_2_4_instance_options(MachineState *machine) static void ccw_machine_2_4_class_options(MachineClass *mc) { static GlobalProperty compat[] = { - { - .driver = TYPE_S390_SKEYS, - .property = "migration-enabled", - .value = "off", - },{ - .driver = "virtio-blk-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-balloon-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-serial-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-9p-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-rng-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-net-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "virtio-scsi-ccw", - .property = "max_revision", - .value = "0", - },{ - .driver = "vhost-scsi-ccw", - .property = "max_revision", - .value = "0", - }, + { TYPE_S390_SKEYS, "migration-enabled", "off", }, + { "virtio-blk-ccw", "max_revision", "0", }, + { "virtio-balloon-ccw", "max_revision", "0", }, + { "virtio-serial-ccw", "max_revision", "0", }, + { "virtio-9p-ccw", "max_revision", "0", }, + { "virtio-rng-ccw", "max_revision", "0", }, + { "virtio-net-ccw", "max_revision", "0", }, + { "virtio-scsi-ccw", "max_revision", "0", }, + { "vhost-scsi-ccw", "max_revision", "0", }, }; ccw_machine_2_5_class_options(mc); diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c index d51148b6b3..18a9045556 100644 --- a/hw/xen/xen-common.c +++ b/hw/xen/xen-common.c @@ -163,21 +163,9 @@ static void xen_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac = ACCEL_CLASS(oc); static GlobalProperty compat[] = { - { - .driver = "migration", - .property = "store-global-state", - .value = "off", - }, - { - .driver = "migration", - .property = "send-configuration", - .value = "off", - }, - { - .driver = "migration", - .property = "send-section-footer", - .value = "off", - } + { "migration", "store-global-state", "off" }, + { "migration", "send-configuration", "off" }, + { "migration", "send-section-footer", "off" }, }; ac->name = "Xen"; From patchwork Thu Jan 10 14:29:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1022980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43b8D15VJcz9s7h for ; Fri, 11 Jan 2019 01:54:40 +1100 (AEDT) Received: from localhost ([127.0.0.1]:41575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbj9-0005hR-Ee for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2019 09:54:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbMH-0004Vr-BM for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:31:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbMA-0006Bb-Eo for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57636) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghbM7-00068N-CN for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:48 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A68967AEAC; Thu, 10 Jan 2019 14:30:44 +0000 (UTC) Received: from localhost (ovpn-116-5.gru2.redhat.com [10.97.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F5E560BE7; Thu, 10 Jan 2019 14:30:43 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 12:29:54 -0200 Message-Id: <20190110142955.23254-10-ehabkost@redhat.com> In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com> References: <20190110142955.23254-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 10 Jan 2019 14:30:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/10] qdev: fix -device scsi-hd, help regression X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Since commit ea9ce8934, device_post_init() applies globals directly from machines and accelerator classes. There are cases, such as -device scsi-hd,help, where the machine is setup but there in no accelerator. Let's skip accelerator globals in this case. Fixes SEGV: #0 0x0000555558ea04ff in object_get_class (obj=0x0) at /home/elmarco/src/qemu/build/../qom/object.c:857 #1 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:978 #2 0x000055555854c797 in object_apply_compat_props (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:973 #3 0x000055555854c959 in device_post_init (obj=0x616000078980) at /home/elmarco/src/qemu/build/../hw/core/qdev.c:989 #4 0x0000555558e9e250 in object_post_init_with_type (ti=, obj=0x616000078980) at /home/elmarco/src/qemu/build/../qom/object.c:365 #5 0x0000555558e9e250 in object_initialize_with_type (data=0x616000078980, size=616, type=) at /home/elmarco/src/qemu/build/../qom/object.c:425 #6 0x0000555558e9e571 in object_new_with_type (type=0x613000031900) at /home/elmarco/src/qemu/build/../qom/object.c:588 #7 0x000055555830c048 in qmp_device_list_properties (typename=typename@entry=0x60200000c2d0 "scsi-hd", errp=errp@entry=0x7fffffffc540) at /home/elmarco/src/qemu/qmp.c:519 #8 0x00005555582c4027 in qdev_device_help (opts=) at /home/elmarco/src/qemu/qdev-monitor.c:283 #9 0x0000555559378fa2 in qemu_opts_foreach (list=, func=func@entry=0x5555582cfca0 , opaque=opaque@entry=0x0, errp=errp@entry=0x0) at /home/elmarco/src/qemu/util/qemu-option.c:1171 https://bugzilla.redhat.com/show_bug.cgi?id=1664364 Signed-off-by: Marc-André Lureau Message-Id: <20190109102311.7635-1-marcandre.lureau@redhat.com> Reviewed-by: Cornelia Huck Reviewed-by: Lukáš Doktor Reviewed-by: Igor Mammedov Signed-off-by: Eduardo Habkost --- hw/core/qdev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 3769a2bccb..47bddacb4f 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -975,10 +975,13 @@ void object_apply_compat_props(Object *obj) if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) { MachineState *m = MACHINE(qdev_get_machine()); MachineClass *mc = MACHINE_GET_CLASS(m); - AccelClass *ac = ACCEL_GET_CLASS(m->accelerator); - if (ac->compat_props) { - object_apply_global_props(obj, ac->compat_props, &error_abort); + if (m->accelerator) { + AccelClass *ac = ACCEL_GET_CLASS(m->accelerator); + + if (ac->compat_props) { + object_apply_global_props(obj, ac->compat_props, &error_abort); + } } object_apply_global_props(obj, mc->compat_props, &error_abort); } From patchwork Thu Jan 10 14:29:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 1022978 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43b86s3wPLz9sN4 for ; Fri, 11 Jan 2019 01:50:13 +1100 (AEDT) Received: from localhost ([127.0.0.1]:40353 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbet-000245-F5 for incoming@patchwork.ozlabs.org; Thu, 10 Jan 2019 09:50:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghbMH-0004Vo-9N for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghbMD-0006DE-Hd for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55638) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ghbMA-0006AF-E7 for qemu-devel@nongnu.org; Thu, 10 Jan 2019 09:30:52 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B68EE42BD3; Thu, 10 Jan 2019 14:30:47 +0000 (UTC) Received: from localhost (ovpn-116-5.gru2.redhat.com [10.97.116.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B29B60BE7; Thu, 10 Jan 2019 14:30:46 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 10 Jan 2019 12:29:55 -0200 Message-Id: <20190110142955.23254-11-ehabkost@redhat.com> In-Reply-To: <20190110142955.23254-1-ehabkost@redhat.com> References: <20190110142955.23254-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 10 Jan 2019 14:30:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/10] qom: Don't keep error value between object_property_parse() calls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When handling errp==NULL at object_apply_global_props(), we are leaving the old error value in `err` after printing a warning. This makes QEMU crash if two global properties generate warnings: $ echo device_add rtl8139 | qemu-system-x86_64 -monitor stdio -global rtl8139.xxx=yyy -global rtl8139.xxx=zzz warning: can't apply global rtl8139.xxx=yyy: Property '.xxx' not found qemu-system-x86_64: util/error.c:57: error_setv: Assertion `*errp == NULL' failed. Aborted (core dumped) Fix that by making `err` go out of scope immediately after the warn_report_err() call. Fixes: 50545b2cc029 "qdev-props: call object_apply_global_props()" Signed-off-by: Eduardo Habkost Message-Id: <20190110020259.8492-2-ehabkost@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Marc-André Lureau Reviewed-by: Cornelia Huck Signed-off-by: Eduardo Habkost --- qom/object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qom/object.c b/qom/object.c index aa6f3a2a71..4e5226ca12 100644 --- a/qom/object.c +++ b/qom/object.c @@ -372,7 +372,6 @@ static void object_post_init_with_type(Object *obj, TypeImpl *ti) void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp) { - Error *err = NULL; int i; if (!props) { @@ -381,6 +380,7 @@ void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp for (i = 0; i < props->len; i++) { GlobalProperty *p = g_ptr_array_index(props, i); + Error *err = NULL; if (object_dynamic_cast(obj, p->driver) == NULL) { continue;