From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311010613530.892380118248; Tue, 27 Nov 2018 01:30:10 -0800 (PST) Received: from localhost ([::1]:40847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZh3-0003Lg-IT for importer@patchew.org; Tue, 27 Nov 2018 04:30:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZfH-0002Fn-3T for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZfG-0003yu-AY for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56600) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZfG-0003ye-5c for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:18 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7AA33307CDC6; Tue, 27 Nov 2018 09:28:17 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 821815C3FA; Tue, 27 Nov 2018 09:28:16 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:34 +0400 Message-Id: <20181127092801.21777-2-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 27 Nov 2018 09:28:17 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 01/28] target/xtensa: gdbstub fix register counting 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: imammedo@redhat.com, Max Filippov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Max Filippov In order to communicate correctly with gdb xtensa gdbstub must provide expected number of registers in 'g' packet response. xtensa-elf-gdb expects both nonprivileged and privileged registers. xtensa-linux-gdb only expects nonprivileged registers. gdb only counts one contiguous stretch of registers, do the same for the core registers in the xtensa_count_regs. With this change qemu-system-xtensa is able to communicate with all xtensa-elf-gdb versions (versions prior to 8.2 require overlay fixup), and qemu-xtensa is able to communicate with all xtensa-linux-gdb versions, except 8.2. Signed-off-by: Max Filippov --- target/xtensa/gdbstub.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/target/xtensa/gdbstub.c b/target/xtensa/gdbstub.c index c9450914c7..d43bb190c6 100644 --- a/target/xtensa/gdbstub.c +++ b/target/xtensa/gdbstub.c @@ -45,15 +45,20 @@ void xtensa_count_regs(const XtensaConfig *config, unsigned *n_regs, unsigned *n_core_regs) { unsigned i; + bool count_core_regs =3D true; =20 for (i =3D 0; config->gdb_regmap.reg[i].targno >=3D 0; ++i) { if (config->gdb_regmap.reg[i].type !=3D xtRegisterTypeTieState && config->gdb_regmap.reg[i].type !=3D xtRegisterTypeMapped && config->gdb_regmap.reg[i].type !=3D xtRegisterTypeUnmapped) { ++*n_regs; - if ((config->gdb_regmap.reg[i].flags & - XTENSA_REGISTER_FLAGS_PRIVILEGED) =3D=3D 0) { - ++*n_core_regs; + if (count_core_regs) { + if ((config->gdb_regmap.reg[i].flags & + XTENSA_REGISTER_FLAGS_PRIVILEGED) =3D=3D 0) { + ++*n_core_regs; + } else { + count_core_regs =3D false; + } } } } --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311200622195.79083115576896; Tue, 27 Nov 2018 01:33:20 -0800 (PST) Received: from localhost ([::1]:40864 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZk5-0005nV-0Q for importer@patchew.org; Tue, 27 Nov 2018 04:33:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZfO-0002Lk-A9 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZfL-00041L-6L for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39941) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZfL-000417-1H for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:23 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6797488318; Tue, 27 Nov 2018 09:28:22 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E9875C6A6; Tue, 27 Nov 2018 09:28:21 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:35 +0400 Message-Id: <20181127092801.21777-3-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 27 Nov 2018 09:28:22 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 02/28] target/xtensa: drop num_[core_]regs from dc232b/dc233c configs 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: imammedo@redhat.com, Max Filippov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Max Filippov Now that xtensa_count_regs does the right thing, remove manual initialization of these fields from the affected configurations and let xtensa_finalize_config initialize them. Add XTREG_END to terminate register lists. Signed-off-by: Max Filippov --- target/xtensa/core-dc232b.c | 2 -- target/xtensa/core-dc232b/gdb-config.inc.c | 1 + target/xtensa/core-dc233c.c | 2 -- target/xtensa/core-dc233c/gdb-config.inc.c | 1 + 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/target/xtensa/core-dc232b.c b/target/xtensa/core-dc232b.c index 7131337840..7851bcb636 100644 --- a/target/xtensa/core-dc232b.c +++ b/target/xtensa/core-dc232b.c @@ -40,8 +40,6 @@ static XtensaConfig dc232b __attribute__((unused)) =3D { .name =3D "dc232b", .gdb_regmap =3D { - .num_regs =3D 120, - .num_core_regs =3D 52, .reg =3D { #include "core-dc232b/gdb-config.inc.c" } diff --git a/target/xtensa/core-dc232b/gdb-config.inc.c b/target/xtensa/cor= e-dc232b/gdb-config.inc.c index 13aba5edec..d87168628b 100644 --- a/target/xtensa/core-dc232b/gdb-config.inc.c +++ b/target/xtensa/core-dc232b/gdb-config.inc.c @@ -259,3 +259,4 @@ 0, 0, 0, 0, 0, 0) XTREG(119, 476, 32, 4, 4, 0x000f, 0x0006, -2, 8, 0x0100, a15, 0, 0, 0, 0, 0, 0) + XTREG_END diff --git a/target/xtensa/core-dc233c.c b/target/xtensa/core-dc233c.c index d701e3f5de..8853bfd4d0 100644 --- a/target/xtensa/core-dc233c.c +++ b/target/xtensa/core-dc233c.c @@ -40,8 +40,6 @@ static XtensaConfig dc233c __attribute__((unused)) =3D { .name =3D "dc233c", .gdb_regmap =3D { - .num_regs =3D 121, - .num_core_regs =3D 52, .reg =3D { #include "core-dc233c/gdb-config.inc.c" } diff --git a/target/xtensa/core-dc233c/gdb-config.inc.c b/target/xtensa/cor= e-dc233c/gdb-config.inc.c index b632341b28..7e8963227f 100644 --- a/target/xtensa/core-dc233c/gdb-config.inc.c +++ b/target/xtensa/core-dc233c/gdb-config.inc.c @@ -143,3 +143,4 @@ XTREG(117, 468, 32, 4, 4, 0x000c, 0x0006, -2, 8, 0x0100= , a12, 0, 0, 0, 0 XTREG(118, 472, 32, 4, 4, 0x000d, 0x0006, -2, 8, 0x0100, a13, 0, 0= , 0, 0, 0, 0) XTREG(119, 476, 32, 4, 4, 0x000e, 0x0006, -2, 8, 0x0100, a14, 0, 0= , 0, 0, 0, 0) XTREG(120, 480, 32, 4, 4, 0x000f, 0x0006, -2, 8, 0x0100, a15, 0, 0= , 0, 0, 0, 0) +XTREG_END --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311026118471.91669538385224; Tue, 27 Nov 2018 01:30:26 -0800 (PST) Received: from localhost ([::1]:40848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZhI-0003YG-U0 for importer@patchew.org; Tue, 27 Nov 2018 04:30:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZfT-0002SP-DJ for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZfS-00044W-HB for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52692) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZfS-000449-AN for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:30 -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 A54D5307D867; Tue, 27 Nov 2018 09:28:29 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 820C760BE8; Tue, 27 Nov 2018 09:28:26 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:36 +0400 Message-Id: <20181127092801.21777-4-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@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.48]); Tue, 27 Nov 2018 09:28:29 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 03/28] target/xtensa: xtfpga: provide default memory sizes 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: imammedo@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Max Filippov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Max Filippov Provide default RAM sizes for all XTFPGA boards, so that when started without -m option they do the right thing. Signed-off-by: Max Filippov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/xtensa/xtfpga.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index b3161de320..21094319a6 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -446,6 +446,8 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, M= achineState *machine) } } =20 +#define XTFPGA_MMU_RESERVED_MEMORY_SIZE (128 * MiB) + static const hwaddr xtfpga_mmu_io[2] =3D { 0xf0000000, }; @@ -568,6 +570,7 @@ static void xtfpga_lx60_class_init(ObjectClass *oc, voi= d *data) mc->init =3D xtfpga_lx60_init; mc->max_cpus =3D 4; mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_TYPE; + mc->default_ram_size =3D 64 * MiB; } =20 static const TypeInfo xtfpga_lx60_type =3D { @@ -584,6 +587,7 @@ static void xtfpga_lx60_nommu_class_init(ObjectClass *o= c, void *data) mc->init =3D xtfpga_lx60_nommu_init; mc->max_cpus =3D 4; mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_NOMMU_TYPE; + mc->default_ram_size =3D 64 * MiB; } =20 static const TypeInfo xtfpga_lx60_nommu_type =3D { @@ -600,6 +604,7 @@ static void xtfpga_lx200_class_init(ObjectClass *oc, vo= id *data) mc->init =3D xtfpga_lx200_init; mc->max_cpus =3D 4; mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_TYPE; + mc->default_ram_size =3D 96 * MiB; } =20 static const TypeInfo xtfpga_lx200_type =3D { @@ -616,6 +621,7 @@ static void xtfpga_lx200_nommu_class_init(ObjectClass *= oc, void *data) mc->init =3D xtfpga_lx200_nommu_init; mc->max_cpus =3D 4; mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_NOMMU_TYPE; + mc->default_ram_size =3D 96 * MiB; } =20 static const TypeInfo xtfpga_lx200_nommu_type =3D { @@ -632,6 +638,7 @@ static void xtfpga_ml605_class_init(ObjectClass *oc, vo= id *data) mc->init =3D xtfpga_ml605_init; mc->max_cpus =3D 4; mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_TYPE; + mc->default_ram_size =3D 512 * MiB - XTFPGA_MMU_RESERVED_MEMORY_SIZE; } =20 static const TypeInfo xtfpga_ml605_type =3D { @@ -648,6 +655,7 @@ static void xtfpga_ml605_nommu_class_init(ObjectClass *= oc, void *data) mc->init =3D xtfpga_ml605_nommu_init; mc->max_cpus =3D 4; mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_NOMMU_TYPE; + mc->default_ram_size =3D 256 * MiB; } =20 static const TypeInfo xtfpga_ml605_nommu_type =3D { @@ -664,6 +672,7 @@ static void xtfpga_kc705_class_init(ObjectClass *oc, vo= id *data) mc->init =3D xtfpga_kc705_init; mc->max_cpus =3D 4; mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_TYPE; + mc->default_ram_size =3D 1 * GiB - XTFPGA_MMU_RESERVED_MEMORY_SIZE; } =20 static const TypeInfo xtfpga_kc705_type =3D { @@ -680,6 +689,7 @@ static void xtfpga_kc705_nommu_class_init(ObjectClass *= oc, void *data) mc->init =3D xtfpga_kc705_nommu_init; mc->max_cpus =3D 4; mc->default_cpu_type =3D XTENSA_DEFAULT_CPU_NOMMU_TYPE; + mc->default_ram_size =3D 256 * MiB; } =20 static const TypeInfo xtfpga_kc705_nommu_type =3D { --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311201495339.86086256026556; Tue, 27 Nov 2018 01:33:21 -0800 (PST) Received: from localhost ([::1]:40865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZk8-0005pb-5d for importer@patchew.org; Tue, 27 Nov 2018 04:33:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZfd-0002ZR-M3 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZfa-0004Ge-IB for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53550) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZfa-0004EX-DD for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:38 -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 BB99231500B8; Tue, 27 Nov 2018 09:28:37 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7297F608E0; Tue, 27 Nov 2018 09:28:33 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:37 +0400 Message-Id: <20181127092801.21777-5-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 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.41]); Tue, 27 Nov 2018 09:28:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 04/28] MAINTAINERS: add missing xtensa patterns 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: imammedo@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Max Filippov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Max Filippov Signed-off-by: Max Filippov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1032406c56..f4a7e453c0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -311,6 +311,8 @@ F: target/xtensa/ F: hw/xtensa/ F: tests/tcg/xtensa/ F: disas/xtensa.c +F: include/hw/xtensa/xtensa-isa.h +F: default-configs/xtensa*.mak =20 TriCore M: Bastian Koppelmann --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311228615929.8769581417431; Tue, 27 Nov 2018 01:33:48 -0800 (PST) Received: from localhost ([::1]:40866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZkO-0006fO-LN for importer@patchew.org; Tue, 27 Nov 2018 04:33:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZfg-0002bY-Hf for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZff-0004S1-OW for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41980) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZff-0004Rm-Hf for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:43 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF1F77F40E; Tue, 27 Nov 2018 09:28:42 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2F505C6A6; Tue, 27 Nov 2018 09:28:41 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:38 +0400 Message-Id: <20181127092801.21777-6-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 27 Nov 2018 09:28:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 05/28] 9p: fix QEMU crash when renaming files 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: imammedo@redhat.com, Prasad J Pandit , zhibin hu , Greg Kurz , P J P Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Greg Kurz When using the 9P2000.u version of the protocol, the following shell command line in the guest can cause QEMU to crash: while true; do rm -rf aa; mkdir -p a/b & touch a/b/c & mv a aa; done With 9P2000.u, file renaming is handled by the WSTAT command. The v9fs_wstat() function calls v9fs_complete_rename(), which calls v9fs_fix_path() for every fid whose path is affected by the change. The involved calls to v9fs_path_copy() may race with any other access to the fid path performed by some worker thread, causing a crash like shown below: Thread 12 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. 0x0000555555a25da2 in local_open_nofollow (fs_ctx=3D0x555557d958b8, path=3D= 0x0, flags=3D65536, mode=3D0) at hw/9pfs/9p-local.c:59 59 while (*path && fd !=3D -1) { (gdb) bt #0 0x0000555555a25da2 in local_open_nofollow (fs_ctx=3D0x555557d958b8, path=3D0x0, flags=3D65536, mode=3D0) at hw/9pfs/9p-local.c:59 #1 0x0000555555a25e0c in local_opendir_nofollow (fs_ctx=3D0x555557d958b8, path=3D0x0) at hw/9pfs/9p-local.c:92 #2 0x0000555555a261b8 in local_lstat (fs_ctx=3D0x555557d958b8, fs_path=3D0x555556b56858, stbuf=3D0x7fff84830ef0) at hw/9pfs/9p-local.c:185 #3 0x0000555555a2b367 in v9fs_co_lstat (pdu=3D0x555557d97498, path=3D0x555556b56858, stbuf=3D0x7fff84830ef0) at hw/9pfs/cofile.c:53 #4 0x0000555555a1e9e2 in v9fs_stat (opaque=3D0x555557d97498) at hw/9pfs/9p.c:1083 #5 0x0000555555e060a2 in coroutine_trampoline (i0=3D-669165424, i1=3D32767) at util/coroutine-ucontext.c:116 #6 0x00007fffef4f5600 in __start_context () at /lib64/libc.so.6 #7 0x0000000000000000 in () (gdb) The fix is to take the path write lock when calling v9fs_complete_rename(), like in v9fs_rename(). Impact: DoS triggered by unprivileged guest users. Fixes: CVE-2018-19489 Cc: P J P Reported-by: zhibin hu Reviewed-by: Prasad J Pandit Signed-off-by: Greg Kurz --- hw/9pfs/9p.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 267a25533b..bdf7919abf 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2855,6 +2855,7 @@ static void coroutine_fn v9fs_wstat(void *opaque) struct stat stbuf; V9fsFidState *fidp; V9fsPDU *pdu =3D opaque; + V9fsState *s =3D pdu->s; =20 v9fs_stat_init(&v9stat); err =3D pdu_unmarshal(pdu, offset, "dwS", &fid, &unused, &v9stat); @@ -2920,7 +2921,9 @@ static void coroutine_fn v9fs_wstat(void *opaque) } } if (v9stat.name.size !=3D 0) { + v9fs_path_write_lock(s); err =3D v9fs_complete_rename(pdu, fidp, -1, &v9stat.name); + v9fs_path_unlock(s); if (err < 0) { goto out; } --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311061192509.14397403665316; Tue, 27 Nov 2018 01:31:01 -0800 (PST) Received: from localhost ([::1]:40851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZhr-0003vy-W2 for importer@patchew.org; Tue, 27 Nov 2018 04:31:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZfq-0002jm-Qi for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZfn-0004VB-Ma for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35830) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZfn-0004Un-HZ for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:51 -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 E5E777F7B5; Tue, 27 Nov 2018 09:28:50 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCEC79881; Tue, 27 Nov 2018 09:28:46 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:39 +0400 Message-Id: <20181127092801.21777-7-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@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]); Tue, 27 Nov 2018 09:28:50 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 06/28] MAINTAINERS: Assign some more files in the hw/arm/ directory 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: imammedo@redhat.com, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Thomas Huth I apparently missed some more files and even a complete machine (the "imx25-pdk") in my previous patch... but now we should hopefully have a completely coverage for all available ARM boards. Fixes: 95a5db3ae5698b49c63144610ad02913e780c828 Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 1542782568-20059-1-git-send-email-thuth@redhat.com Signed-off-by: Peter Maydell --- MAINTAINERS | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f4a7e453c0..43d0d9d578 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -535,6 +535,17 @@ L: qemu-arm@nongnu.org S: Odd Fixes F: hw/arm/gumstix.c =20 +i.MX25 PDK +M: Peter Maydell +R: Jean-Christophe Dubois +L: qemu-arm@nongnu.org +S: Odd Fixes +F: hw/arm/fsl-imx25.c +F: hw/arm/imx25_pdk.c +F: hw/misc/imx25_ccm.c +F: include/hw/arm/fsl-imx25.h +F: include/hw/misc/imx25_ccm.h + i.MX31 (kzm) M: Peter Chubb M: Peter Maydell @@ -617,6 +628,7 @@ R: Andrew Baumann R: Philippe Mathieu-Daud=C3=A9 L: qemu-arm@nongnu.org S: Odd Fixes +F: hw/arm/raspi.c F: hw/arm/raspi_platform.h F: hw/*/bcm283* F: include/hw/arm/raspi* @@ -641,8 +653,12 @@ F: hw/arm/spitz.c F: hw/arm/tosa.c F: hw/arm/z2.c F: hw/*/pxa2xx* +F: hw/display/tc6393xb.c +F: hw/gpio/max7310.c +F: hw/gpio/zaurus.c F: hw/misc/mst_fpga.c F: include/hw/arm/pxa.h +F: include/hw/arm/sharpsl.h =20 SABRELITE / i.MX6 M: Peter Maydell --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311252323804.6039322605336; Tue, 27 Nov 2018 01:34:12 -0800 (PST) Received: from localhost ([::1]:40867 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZkw-0007Qz-Hc for importer@patchew.org; Tue, 27 Nov 2018 04:34:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZfv-0002oE-OU for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZfv-0004Ya-3F for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44484) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZfu-0004Y8-Tj for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:28:59 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 45ED089AD7; Tue, 27 Nov 2018 09:28:58 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89BCC5D9CA; Tue, 27 Nov 2018 09:28:54 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:40 +0400 Message-Id: <20181127092801.21777-8-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 27 Nov 2018 09:28:58 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 07/28] MAINTAINERS: Add an ARM SMMU 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: Peter Maydell , imammedo@redhat.com, Eric Auger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Eric Auger Add a new ARM SMMU section and set Eric Auger as the maintainer for ARM SMMU emulation sources. Signed-off-by: Eric Auger Message-id: 20181122180143.14237-1-eric.auger@redhat.com Suggested-by: Peter Maydell Signed-off-by: Peter Maydell --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 43d0d9d578..9410bbb7cf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -151,6 +151,13 @@ F: disas/arm.c F: disas/arm-a64.cc F: disas/libvixl/ =20 +ARM SMMU +M: Eric Auger +L: qemu-arm@nongnu.org +S: Maintained +F: hw/arm/smmu* +F: include/hw/arm/smmu* + CRIS M: Edgar E. Iglesias S: Maintained --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311445140557.8724226007257; Tue, 27 Nov 2018 01:37:25 -0800 (PST) Received: from localhost ([::1]:40892 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZo3-0001MY-AC for importer@patchew.org; Tue, 27 Nov 2018 04:37:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZgL-00038n-5q for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZgF-0004gR-F1 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52668) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZg4-0004c4-El; Tue, 27 Nov 2018 04:29:10 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B316580F83; Tue, 27 Nov 2018 09:29:05 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55D1419C65; Tue, 27 Nov 2018 09:29:01 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:41 +0400 Message-Id: <20181127092801.21777-9-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 27 Nov 2018 09:29:05 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 08/28] net: cadence_gem: Remove incorrect assert() 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: "Edgar E. Iglesias" , Peter Maydell , Jason Wang , Alistair Francis , "open list:Xilinx Zynq" , "Edgar E. Iglesias" , mbilal , imammedo@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Don't assert on RX descriptor settings when the receiver is disabled. This fixes an issue with incoming packets on an unused GEM. Reported-by: mbilal Signed-off-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20181123135450.24829-2-edgar.iglesias@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/net/cadence_gem.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index d95cc27f58..7f63411430 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -979,7 +979,6 @@ static ssize_t gem_receive(NetClientState *nc, const ui= nt8_t *buf, size_t size) =20 /* Do nothing if receive is not enabled. */ if (!gem_can_receive(nc)) { - assert(!first_desc); return -1; } =20 --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311415032623.7215174769807; Tue, 27 Nov 2018 01:36:55 -0800 (PST) Received: from localhost ([::1]:40890 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZna-0000zp-0x for importer@patchew.org; Tue, 27 Nov 2018 04:36:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZgL-00038q-6r for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZgF-0004gM-Ey for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8409) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZgD-0004eX-IC for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:17 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E6DB42D80D for ; Tue, 27 Nov 2018 09:29:13 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6FC85DAA0; Tue, 27 Nov 2018 09:29:09 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:42 +0400 Message-Id: <20181127092801.21777-10-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 27 Nov 2018 09:29:13 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 09/28] tests: qdev_prop_check_globals() doesn't return "all_used" 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: imammedo@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Instead, it returns 1 if an error was detected, which is the case for: /qdev/properties/dynamic/global/subprocess: warning: global dynamic-prop-type-bad.prop3 has invalid class name warning: global nohotplug-type.prop5=3D105 not used warning: global nondevice-type.prop6 has invalid class name Clarify the function return value. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- tests/test-qdev-global-props.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index d81b0862d5..ccdf6c57c1 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -214,7 +214,7 @@ static void test_dynamic_globalprop_subprocess(void) { TYPE_NONDEVICE, "prop6", "106", true }, {} }; - int all_used; + int global_error; =20 qdev_prop_register_global_list(props); =20 @@ -223,8 +223,8 @@ static void test_dynamic_globalprop_subprocess(void) =20 g_assert_cmpuint(mt->prop1, =3D=3D, 101); g_assert_cmpuint(mt->prop2, =3D=3D, 102); - all_used =3D qdev_prop_check_globals(); - g_assert_cmpuint(all_used, =3D=3D, 1); + global_error =3D qdev_prop_check_globals(); + g_assert_cmpuint(global_error, =3D=3D, 1); g_assert(props[0].used); g_assert(props[1].used); g_assert(!props[2].used); @@ -259,7 +259,7 @@ static void test_dynamic_globalprop_nouser_subprocess(v= oid) { TYPE_NONDEVICE, "prop6", "106" }, {} }; - int all_used; + int global_error; =20 qdev_prop_register_global_list(props); =20 @@ -268,8 +268,8 @@ static void test_dynamic_globalprop_nouser_subprocess(v= oid) =20 g_assert_cmpuint(mt->prop1, =3D=3D, 101); g_assert_cmpuint(mt->prop2, =3D=3D, 102); - all_used =3D qdev_prop_check_globals(); - g_assert_cmpuint(all_used, =3D=3D, 0); + global_error =3D qdev_prop_check_globals(); + g_assert_cmpuint(global_error, =3D=3D, 0); g_assert(props[0].used); g_assert(props[1].used); g_assert(!props[2].used); --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311419069203.01436110773; Tue, 27 Nov 2018 01:36:59 -0800 (PST) Received: from localhost ([::1]:40891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZnd-00012W-SS for importer@patchew.org; Tue, 27 Nov 2018 04:36:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZgR-0003H8-J3 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZgQ-0004lv-8b for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59146) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZgN-0004j2-8t; Tue, 27 Nov 2018 04:29:27 -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 67069394D52; Tue, 27 Nov 2018 09:29:25 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB8BB1019632; Tue, 27 Nov 2018 09:29:17 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:43 +0400 Message-Id: <20181127092801.21777-11-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@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.38]); Tue, 27 Nov 2018 09:29:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 10/28] qom: make interface types abstract 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: Peter Maydell , Corey Minyard , "Michael S. Tsirkin" , "open list:PReP" , "open list:ARM" , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , imammedo@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Interfaces don't have instance, let's make the interface type really abstract to avoid confusion. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- include/hw/acpi/acpi_dev_interface.h | 6 +----- include/hw/arm/linux-boot-if.h | 5 +---- include/hw/fw-path-provider.h | 4 +--- include/hw/hotplug.h | 6 +----- include/hw/intc/intc.h | 4 +--- include/hw/ipmi/ipmi.h | 4 +--- include/hw/isa/isa.h | 4 ---- include/hw/mem/memory-device.h | 4 +--- include/hw/nmi.h | 4 +--- include/hw/stream.h | 4 +--- include/hw/timer/m48t59.h | 4 +--- include/qom/object_interfaces.h | 6 +----- include/sysemu/tpm.h | 4 +--- target/arm/idau.h | 4 +--- tests/check-qom-interface.c | 4 +--- 15 files changed, 14 insertions(+), 53 deletions(-) diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_de= v_interface.h index dabf4c4fc9..43ff119179 100644 --- a/include/hw/acpi/acpi_dev_interface.h +++ b/include/hw/acpi/acpi_dev_interface.h @@ -25,11 +25,7 @@ typedef enum { INTERFACE_CHECK(AcpiDeviceIf, (obj), \ TYPE_ACPI_DEVICE_IF) =20 - -typedef struct AcpiDeviceIf { - /* */ - Object Parent; -} AcpiDeviceIf; +typedef struct AcpiDeviceIf AcpiDeviceIf; =20 void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event); =20 diff --git a/include/hw/arm/linux-boot-if.h b/include/hw/arm/linux-boot-if.h index aba4479a14..7bbdfd1cc6 100644 --- a/include/hw/arm/linux-boot-if.h +++ b/include/hw/arm/linux-boot-if.h @@ -16,10 +16,7 @@ #define ARM_LINUX_BOOT_IF(obj) \ INTERFACE_CHECK(ARMLinuxBootIf, (obj), TYPE_ARM_LINUX_BOOT_IF) =20 -typedef struct ARMLinuxBootIf { - /*< private >*/ - Object parent_obj; -} ARMLinuxBootIf; +typedef struct ARMLinuxBootIf ARMLinuxBootIf; =20 typedef struct ARMLinuxBootIfClass { /*< private >*/ diff --git a/include/hw/fw-path-provider.h b/include/hw/fw-path-provider.h index 050cb05d92..5df893a3d8 100644 --- a/include/hw/fw-path-provider.h +++ b/include/hw/fw-path-provider.h @@ -30,9 +30,7 @@ #define FW_PATH_PROVIDER(obj) \ INTERFACE_CHECK(FWPathProvider, (obj), TYPE_FW_PATH_PROVIDER) =20 -typedef struct FWPathProvider { - Object parent_obj; -} FWPathProvider; +typedef struct FWPathProvider FWPathProvider; =20 typedef struct FWPathProviderClass { InterfaceClass parent_class; diff --git a/include/hw/hotplug.h b/include/hw/hotplug.h index 1a0516a479..6321e292fd 100644 --- a/include/hw/hotplug.h +++ b/include/hw/hotplug.h @@ -23,11 +23,7 @@ #define HOTPLUG_HANDLER(obj) \ INTERFACE_CHECK(HotplugHandler, (obj), TYPE_HOTPLUG_HANDLER) =20 - -typedef struct HotplugHandler { - /* */ - Object Parent; -} HotplugHandler; +typedef struct HotplugHandler HotplugHandler; =20 /** * hotplug_fn: diff --git a/include/hw/intc/intc.h b/include/hw/intc/intc.h index 27d9828943..fb3e8e621f 100644 --- a/include/hw/intc/intc.h +++ b/include/hw/intc/intc.h @@ -15,9 +15,7 @@ INTERFACE_CHECK(InterruptStatsProvider, (obj), \ TYPE_INTERRUPT_STATS_PROVIDER) =20 -typedef struct InterruptStatsProvider { - Object parent; -} InterruptStatsProvider; +typedef struct InterruptStatsProvider InterruptStatsProvider; =20 typedef struct InterruptStatsProviderClass { InterfaceClass parent; diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h index 0affe5a4d8..99661d2bf0 100644 --- a/include/hw/ipmi/ipmi.h +++ b/include/hw/ipmi/ipmi.h @@ -114,9 +114,7 @@ uint32_t ipmi_next_uuid(void); #define IPMI_INTERFACE_GET_CLASS(class) \ OBJECT_GET_CLASS(IPMIInterfaceClass, (class), TYPE_IPMI_INTERFACE) =20 -typedef struct IPMIInterface { - Object parent; -} IPMIInterface; +typedef struct IPMIInterface IPMIInterface; =20 typedef struct IPMIInterfaceClass { InterfaceClass parent; diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index b9dbab24b4..e62ac91c19 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -43,10 +43,6 @@ static inline uint16_t applesmc_port(void) #define ISADMA(obj) \ INTERFACE_CHECK(IsaDma, (obj), TYPE_ISADMA) =20 -struct IsaDma { - Object parent; -}; - typedef enum { ISADMA_TRANSFER_VERIFY, ISADMA_TRANSFER_READ, diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h index e904e194d5..0293a96abb 100644 --- a/include/hw/mem/memory-device.h +++ b/include/hw/mem/memory-device.h @@ -25,9 +25,7 @@ #define MEMORY_DEVICE(obj) \ INTERFACE_CHECK(MemoryDeviceState, (obj), TYPE_MEMORY_DEVICE) =20 -typedef struct MemoryDeviceState { - Object parent_obj; -} MemoryDeviceState; +typedef struct MemoryDeviceState MemoryDeviceState; =20 /** * MemoryDeviceClass: diff --git a/include/hw/nmi.h b/include/hw/nmi.h index d092c684a1..ad857f3832 100644 --- a/include/hw/nmi.h +++ b/include/hw/nmi.h @@ -34,9 +34,7 @@ #define NMI(obj) \ INTERFACE_CHECK(NMI, (obj), TYPE_NMI) =20 -typedef struct NMIState { - Object parent_obj; -} NMIState; +typedef struct NMIState NMIState; =20 typedef struct NMIClass { InterfaceClass parent_class; diff --git a/include/hw/stream.h b/include/hw/stream.h index c370ba0c66..15774f07ab 100644 --- a/include/hw/stream.h +++ b/include/hw/stream.h @@ -14,9 +14,7 @@ #define STREAM_SLAVE(obj) \ INTERFACE_CHECK(StreamSlave, (obj), TYPE_STREAM_SLAVE) =20 -typedef struct StreamSlave { - Object Parent; -} StreamSlave; +typedef struct StreamSlave StreamSlave; =20 typedef void (*StreamCanPushNotifyFn)(void *opaque); =20 diff --git a/include/hw/timer/m48t59.h b/include/hw/timer/m48t59.h index db5e43a8da..6f8db04fce 100644 --- a/include/hw/timer/m48t59.h +++ b/include/hw/timer/m48t59.h @@ -13,9 +13,7 @@ #define NVRAM(obj) \ INTERFACE_CHECK(Nvram, (obj), TYPE_NVRAM) =20 -typedef struct Nvram { - Object parent; -} Nvram; +typedef struct Nvram Nvram; =20 typedef struct NvramClass { InterfaceClass parent; diff --git a/include/qom/object_interfaces.h b/include/qom/object_interface= s.h index 4d513fb329..652a16d2ba 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -16,11 +16,7 @@ INTERFACE_CHECK(UserCreatable, (obj), \ TYPE_USER_CREATABLE) =20 - -typedef struct UserCreatable { - /* */ - Object Parent; -} UserCreatable; +typedef struct UserCreatable UserCreatable; =20 /** * UserCreatableClass: diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h index 17a97ed77a..5b541a71c8 100644 --- a/include/sysemu/tpm.h +++ b/include/sysemu/tpm.h @@ -33,9 +33,7 @@ typedef enum TPMVersion { #define TPM_IF(obj) \ INTERFACE_CHECK(TPMIf, (obj), TYPE_TPM_IF) =20 -typedef struct TPMIf { - Object parent_obj; -} TPMIf; +typedef struct TPMIf TPMIf; =20 typedef struct TPMIfClass { InterfaceClass parent_class; diff --git a/target/arm/idau.h b/target/arm/idau.h index cac27b95fa..7c0e4e3776 100644 --- a/target/arm/idau.h +++ b/target/arm/idau.h @@ -38,9 +38,7 @@ #define IDAU_INTERFACE_GET_CLASS(obj) \ OBJECT_GET_CLASS(IDAUInterfaceClass, (obj), TYPE_IDAU_INTERFACE) =20 -typedef struct IDAUInterface { - Object parent; -} IDAUInterface; +typedef struct IDAUInterface IDAUInterface; =20 #define IREGION_NOTVALID -1 =20 diff --git a/tests/check-qom-interface.c b/tests/check-qom-interface.c index f87c9aaa8a..2177f0dce5 100644 --- a/tests/check-qom-interface.c +++ b/tests/check-qom-interface.c @@ -23,9 +23,7 @@ #define TEST_IF(obj) \ INTERFACE_CHECK(TestIf, (obj), TYPE_TEST_IF) =20 -typedef struct TestIf { - Object parent_obj; -} TestIf; +typedef struct TestIf TestIf; =20 typedef struct TestIfClass { InterfaceClass parent_class; --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311612496814.2383237945652; Tue, 27 Nov 2018 01:40:12 -0800 (PST) Received: from localhost ([::1]:40906 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZqb-0003L2-OD for importer@patchew.org; Tue, 27 Nov 2018 04:40:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZgU-0003KA-IO for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZgT-0004p8-9I for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37412) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZgT-0004oB-0M for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:33 -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 54155A990; Tue, 27 Nov 2018 09:29:32 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE64360BE8; Tue, 27 Nov 2018 09:29:28 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:44 +0400 Message-Id: <20181127092801.21777-12-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@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.28]); Tue, 27 Nov 2018 09:29:32 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 11/28] qom: make user_creatable_complete() specific to UserCreatable 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: imammedo@redhat.com, "Michael S. Tsirkin" , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Amit Shah , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Instead of accepting any Object*, change user_creatable_complete() to require a UserCreatable*. Modify the callers to pass the appropriate argument, removing redundant dynamic cast checks in object creation. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- include/qom/object_interfaces.h | 4 ++-- hw/misc/ivshmem.c | 2 +- hw/virtio/virtio-rng.c | 2 +- qom/object.c | 12 ++++++++---- qom/object_interfaces.c | 14 +++----------- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/include/qom/object_interfaces.h b/include/qom/object_interface= s.h index 652a16d2ba..682ba1d9b0 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -51,14 +51,14 @@ typedef struct UserCreatableClass { =20 /** * user_creatable_complete: - * @obj: the object whose complete() method is called if defined + * @uc: the user-creatable object whose complete() method is called if def= ined * @errp: if an error occurs, a pointer to an area to store the error * * Wrapper to call complete() method if one of types it's inherited * from implements USER_CREATABLE interface, otherwise the call does * nothing. */ -void user_creatable_complete(Object *obj, Error **errp); +void user_creatable_complete(UserCreatable *uc, Error **errp); =20 /** * user_creatable_can_be_deleted: diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index ecfd10a29a..8213659602 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -1280,7 +1280,7 @@ static void desugar_shm(IVShmemState *s) object_property_add_child(OBJECT(s), "internal-shm-backend", obj, &error_abort); object_unref(obj); - user_creatable_complete(obj, &error_abort); + user_creatable_complete(USER_CREATABLE(obj), &error_abort); s->hostmem =3D MEMORY_BACKEND(obj); } =20 diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 855f1b41d1..30493a2586 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -191,7 +191,7 @@ static void virtio_rng_device_realize(DeviceState *dev,= Error **errp) if (vrng->conf.rng =3D=3D NULL) { vrng->conf.default_backend =3D RNG_RANDOM(object_new(TYPE_RNG_RAND= OM)); =20 - user_creatable_complete(OBJECT(vrng->conf.default_backend), + user_creatable_complete(USER_CREATABLE(vrng->conf.default_backend), &local_err); if (local_err) { error_propagate(errp, local_err); diff --git a/qom/object.c b/qom/object.c index 547dcf97c3..eb770dbf7f 100644 --- a/qom/object.c +++ b/qom/object.c @@ -417,6 +417,7 @@ void object_initialize_childv(Object *parentobj, const = char *propname, { Error *local_err =3D NULL; Object *obj; + UserCreatable *uc; =20 object_initialize(childobj, size, type); obj =3D OBJECT(childobj); @@ -431,8 +432,9 @@ void object_initialize_childv(Object *parentobj, const = char *propname, goto out; } =20 - if (object_dynamic_cast(obj, TYPE_USER_CREATABLE)) { - user_creatable_complete(obj, &local_err); + uc =3D (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE); + if (uc) { + user_creatable_complete(uc, &local_err); if (local_err) { object_unparent(obj); goto out; @@ -590,6 +592,7 @@ Object *object_new_with_propv(const char *typename, Object *obj; ObjectClass *klass; Error *local_err =3D NULL; + UserCreatable *uc; =20 klass =3D object_class_by_name(typename); if (!klass) { @@ -612,8 +615,9 @@ Object *object_new_with_propv(const char *typename, goto error; } =20 - if (object_dynamic_cast(obj, TYPE_USER_CREATABLE)) { - user_creatable_complete(obj, &local_err); + uc =3D (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE); + if (uc) { + user_creatable_complete(uc, &local_err); if (local_err) { object_unparent(obj); goto error; diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 97b79b48bb..db85d1eb75 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -8,18 +8,10 @@ #include "qapi/opts-visitor.h" #include "qemu/config-file.h" =20 -void user_creatable_complete(Object *obj, Error **errp) +void user_creatable_complete(UserCreatable *uc, Error **errp) { + UserCreatableClass *ucc =3D USER_CREATABLE_GET_CLASS(uc); =20 - UserCreatableClass *ucc; - UserCreatable *uc =3D - (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE); - - if (!uc) { - return; - } - - ucc =3D USER_CREATABLE_GET_CLASS(uc); if (ucc->complete) { ucc->complete(uc, errp); } @@ -89,7 +81,7 @@ Object *user_creatable_add_type(const char *type, const c= har *id, goto out; } =20 - user_creatable_complete(obj, &local_err); + user_creatable_complete(USER_CREATABLE(obj), &local_err); if (local_err) { object_property_del(object_get_objects_root(), id, &error_abort); --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311659021195.30022766215814; Tue, 27 Nov 2018 01:40:59 -0800 (PST) Received: from localhost ([::1]:40913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZrV-00042X-Pz for importer@patchew.org; Tue, 27 Nov 2018 04:40:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZgc-0003RB-3I for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZgb-0004vS-7t for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39798) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZgb-0004ut-0n for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:41 -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 6548137E87 for ; Tue, 27 Nov 2018 09:29:40 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30060608C1; Tue, 27 Nov 2018 09:29:35 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:45 +0400 Message-Id: <20181127092801.21777-13-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 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.29]); Tue, 27 Nov 2018 09:29:40 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 12/28] accel: register global_props like machine globals 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: imammedo@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" global_props is only used for Xen xen_compat_props. It's a static array of GlobalProperty, like machine globals in SET_MACHINE_COMPAT(). Let's register the globals the same way, without extra copy allocation. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Igor Mammedov --- include/hw/qdev-properties.h | 29 ----------------------------- accel/accel.c | 9 ++++++++- hw/core/qdev-properties.c | 21 --------------------- 3 files changed, 8 insertions(+), 51 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 4f60cc88f3..a95f4a73eb 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -255,35 +255,6 @@ void qdev_prop_set_globals(DeviceState *dev); void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *de= v, Property *prop, const char *value); =20 -/** - * register_compat_prop: - * - * Register internal (not user-provided) global property, changing the - * default value of a given property in a device type. This can be used - * for enabling machine-type compatibility or for enabling - * accelerator-specific defaults in devices. - * - * The property values set using this function must be always valid and - * never report setter errors, as the property will have - * GlobalProperty::errp set to &error_abort. - * - * User-provided global properties should override internal global - * properties, so callers of this function should ensure that it is - * called before user-provided global properties are registered. - * - * @driver: Device type to be affected - * @property: Property whose default value is going to be changed - * @value: New default value for the property - */ -void register_compat_prop(const char *driver, const char *property, - const char *value); -/* - * register_compat_props_array(): using register_compat_prop(), which - * only registers internal global properties (which has lower priority - * than user-provided global properties) - */ -void register_compat_props_array(GlobalProperty *prop); - /** * qdev_property_add_static: * @dev: Device to add the property to. diff --git a/accel/accel.c b/accel/accel.c index 966b2d8f53..3da26eb90f 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -34,6 +34,7 @@ #include "qom/object.h" #include "qemu/error-report.h" #include "qemu/option.h" +#include "qapi/error.h" =20 static const TypeInfo accel_type =3D { .name =3D TYPE_ACCEL, @@ -121,7 +122,13 @@ void configure_accelerator(MachineState *ms) void accel_register_compat_props(AccelState *accel) { AccelClass *class =3D ACCEL_GET_CLASS(accel); - register_compat_props_array(class->global_props); + GlobalProperty *prop =3D class->global_props; + + for (; prop && prop->driver; prop++) { + /* Any compat_props must never cause error */ + prop->errp =3D &error_abort; + qdev_prop_register_global(prop); + } } =20 void accel_setup_post(MachineState *ms) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 35072dec1e..ab61d502fd 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1180,27 +1180,6 @@ void qdev_prop_register_global(GlobalProperty *prop) global_props =3D g_list_append(global_props, prop); } =20 -void register_compat_prop(const char *driver, - const char *property, - const char *value) -{ - GlobalProperty *p =3D g_new0(GlobalProperty, 1); - - /* Any compat_props must never cause error */ - p->errp =3D &error_abort; - p->driver =3D driver; - p->property =3D property; - p->value =3D value; - qdev_prop_register_global(p); -} - -void register_compat_props_array(GlobalProperty *prop) -{ - for (; prop && prop->driver; prop++) { - register_compat_prop(prop->driver, prop->property, prop->value); - } -} - void qdev_prop_register_global_list(GlobalProperty *props) { int i; --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311781961625.1841108726134; Tue, 27 Nov 2018 01:43:01 -0800 (PST) Received: from localhost ([::1]:40925 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZtU-0006dB-Ue for importer@patchew.org; Tue, 27 Nov 2018 04:43:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZgk-0003Xs-UP for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZgj-0004zv-AU for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36146) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZgj-0004zP-0s for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:49 -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 2767A88313; Tue, 27 Nov 2018 09:29:48 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56AA96266E; Tue, 27 Nov 2018 09:29:43 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:46 +0400 Message-Id: <20181127092801.21777-14-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@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]); Tue, 27 Nov 2018 09:29:48 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 13/28] qdev: move qdev_prop_register_global_list() to tests 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: imammedo@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The function is only used by a test, move it there. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Eduardo Habkost Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/qdev-properties.h | 1 - hw/core/qdev-properties.c | 9 --------- tests/test-qdev-global-props.c | 18 ++++++++++++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index a95f4a73eb..3ab9cd2eb6 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -249,7 +249,6 @@ void qdev_prop_set_enum(DeviceState *dev, const char *n= ame, int value); void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value); =20 void qdev_prop_register_global(GlobalProperty *prop); -void qdev_prop_register_global_list(GlobalProperty *props); int qdev_prop_check_globals(void); void qdev_prop_set_globals(DeviceState *dev); void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *de= v, diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index ab61d502fd..bd84c4ea4c 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1180,15 +1180,6 @@ void qdev_prop_register_global(GlobalProperty *prop) global_props =3D g_list_append(global_props, prop); } =20 -void qdev_prop_register_global_list(GlobalProperty *props) -{ - int i; - - for (i =3D 0; props[i].driver !=3D NULL; i++) { - qdev_prop_register_global(props+i); - } -} - int qdev_prop_check_globals(void) { GList *l; diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index ccdf6c57c1..b1eb505442 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -89,6 +89,16 @@ static void test_static_prop(void) g_test_trap_assert_stdout(""); } =20 +static void register_global_properties(GlobalProperty *props) +{ + int i; + + for (i =3D 0; props[i].driver !=3D NULL; i++) { + qdev_prop_register_global(props + i); + } +} + + /* Test setting of static property using global properties */ static void test_static_globalprop_subprocess(void) { @@ -98,7 +108,7 @@ static void test_static_globalprop_subprocess(void) {} }; =20 - qdev_prop_register_global_list(props); + register_global_properties(props); =20 mt =3D STATIC_TYPE(object_new(TYPE_STATIC_PROPS)); qdev_init_nofail(DEVICE(mt)); @@ -216,7 +226,7 @@ static void test_dynamic_globalprop_subprocess(void) }; int global_error; =20 - qdev_prop_register_global_list(props); + register_global_properties(props); =20 mt =3D DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS)); qdev_init_nofail(DEVICE(mt)); @@ -261,7 +271,7 @@ static void test_dynamic_globalprop_nouser_subprocess(v= oid) }; int global_error; =20 - qdev_prop_register_global_list(props); + register_global_properties(props); =20 mt =3D DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS)); qdev_init_nofail(DEVICE(mt)); @@ -299,7 +309,7 @@ static void test_subclass_global_props(void) {} }; =20 - qdev_prop_register_global_list(props); + register_global_properties(props); =20 mt =3D STATIC_TYPE(object_new(TYPE_SUBCLASS)); qdev_init_nofail(DEVICE(mt)); --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311835702319.6146739356527; Tue, 27 Nov 2018 01:43:55 -0800 (PST) Received: from localhost ([::1]:40927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZuM-0008NC-M6 for importer@patchew.org; Tue, 27 Nov 2018 04:43:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZgx-0003iI-49 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:30:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZgt-000551-IJ for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:30:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42348) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZgt-00052s-7b for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:29:59 -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 51F7481DEB; Tue, 27 Nov 2018 09:29:56 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1199918AD4; Tue, 27 Nov 2018 09:29:51 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:47 +0400 Message-Id: <20181127092801.21777-15-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 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.25]); Tue, 27 Nov 2018 09:29:56 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 14/28] qom: remove unimplemented class_finalize 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: imammedo@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Instead of trying to implement something that isn't well specified, remove it. (it would be tricky to implement, since a class struct is memcpy on children types...) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- include/qom/object.h | 7 ++----- hw/core/machine.c | 11 ----------- qom/object.c | 2 -- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index f0b0bf39cc..0139838b69 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -455,10 +455,8 @@ struct Object * parent class initialization has occurred, but before the class itself * is initialized. This is the function to use to undo the effects of * memcpy from the parent class to the descendants. - * @class_finalize: This function is called during class destruction and is - * meant to release and dynamic parameters allocated by @class_init. - * @class_data: Data to pass to the @class_init, @class_base_init and - * @class_finalize functions. This can be useful when building dynamic + * @class_data: Data to pass to the @class_init, + * @class_base_init. This can be useful when building dynamic * classes. * @interfaces: The list of interfaces associated with this type. This * should point to a static array that's terminated with a zero filled @@ -479,7 +477,6 @@ struct TypeInfo =20 void (*class_init)(ObjectClass *klass, void *data); void (*class_base_init)(ObjectClass *klass, void *data); - void (*class_finalize)(ObjectClass *klass, void *data); void *class_data; =20 InterfaceInfo *interfaces; diff --git a/hw/core/machine.c b/hw/core/machine.c index da50ad6de7..c51423b647 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -834,16 +834,6 @@ void machine_run_board_init(MachineState *machine) machine_class->init(machine); } =20 -static void machine_class_finalize(ObjectClass *klass, void *data) -{ - MachineClass *mc =3D MACHINE_CLASS(klass); - - if (mc->compat_props) { - g_array_free(mc->compat_props, true); - } - g_free(mc->name); -} - void machine_register_compat_props(MachineState *machine) { MachineClass *mc =3D MACHINE_GET_CLASS(machine); @@ -869,7 +859,6 @@ static const TypeInfo machine_info =3D { .class_size =3D sizeof(MachineClass), .class_init =3D machine_class_init, .class_base_init =3D machine_class_base_init, - .class_finalize =3D machine_class_finalize, .instance_size =3D sizeof(MachineState), .instance_init =3D machine_initfn, .instance_finalize =3D machine_finalize, diff --git a/qom/object.c b/qom/object.c index eb770dbf7f..17921c0a71 100644 --- a/qom/object.c +++ b/qom/object.c @@ -49,7 +49,6 @@ struct TypeImpl =20 void (*class_init)(ObjectClass *klass, void *data); void (*class_base_init)(ObjectClass *klass, void *data); - void (*class_finalize)(ObjectClass *klass, void *data); =20 void *class_data; =20 @@ -114,7 +113,6 @@ static TypeImpl *type_new(const TypeInfo *info) =20 ti->class_init =3D info->class_init; ti->class_base_init =3D info->class_base_init; - ti->class_finalize =3D info->class_finalize; ti->class_data =3D info->class_data; =20 ti->instance_init =3D info->instance_init; --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311634989336.4525097715947; Tue, 27 Nov 2018 01:40:34 -0800 (PST) Received: from localhost ([::1]:40907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZr7-0003hN-Nf for importer@patchew.org; Tue, 27 Nov 2018 04:40:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZh8-0003tb-WC for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:30:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZh3-0005Bm-1k for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:30:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55968) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZh2-0005AS-OQ for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:30:08 -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 A36643001932; Tue, 27 Nov 2018 09:30:06 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27145608C2; Tue, 27 Nov 2018 09:29:59 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:48 +0400 Message-Id: <20181127092801.21777-16-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 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.47]); Tue, 27 Nov 2018 09:30:06 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 15/28] hw: apply accel compat properties without touching globals 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: Stefano Stabellini , "open list:X86" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Anthony Perard , imammedo@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Introduce object_apply_global_props() function, to apply compatibility properties from a GPtrArray. For accel compatibility properties, apply them during device_post_init(), after accel_register_compat_props() has set them. To populate the compatibility properties, introduce SET_COMPAT(), a more generic version of SET_MACHINE_COMPAT() that can set compat properties on other objects than Machine, and using GPtrArray. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/qdev-core.h | 13 +++++++++++++ include/qom/object.h | 3 +++ include/sysemu/accel.h | 4 +--- accel/accel.c | 12 ------------ hw/core/qdev.c | 11 +++++++++++ hw/xen/xen-common.c | 38 +++++++++++++++++++------------------- qom/object.c | 25 +++++++++++++++++++++++++ vl.c | 2 +- 8 files changed, 73 insertions(+), 35 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index a24d0dd566..82afd3c50d 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -267,6 +267,19 @@ typedef struct GlobalProperty { Error **errp; } GlobalProperty; =20 +#define SET_COMPAT(S, COMPAT) \ + do { \ + int i; \ + static GlobalProperty props[] =3D { \ + COMPAT \ + }; \ + for (i =3D 0; i < G_N_ELEMENTS(props); i++) { \ + g_ptr_array_add((S)->compat_props, (void *)&props[i]); \ + } \ + } while (0) + +void accel_register_compat_props(const GPtrArray *props); + /*** Board API. This should go away once we have a machine config file. = ***/ =20 DeviceState *qdev_create(BusState *bus, const char *name); diff --git a/include/qom/object.h b/include/qom/object.h index 0139838b69..5183c587f3 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -676,6 +676,9 @@ Object *object_new_with_propv(const char *typename, Error **errp, va_list vargs); =20 +void object_apply_global_props(Object *obj, const GPtrArray *props, + Error **errp); + /** * object_set_props: * @obj: the object instance to set properties on diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 637358f430..f331d128e9 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -49,7 +49,7 @@ typedef struct AccelClass { * global properties may be overridden by machine-type * compat_props or user-provided global properties. */ - GlobalProperty *global_props; + GPtrArray *compat_props; } AccelClass; =20 #define TYPE_ACCEL "accel" @@ -67,8 +67,6 @@ typedef struct AccelClass { extern unsigned long tcg_tb_size; =20 void configure_accelerator(MachineState *ms); -/* Register accelerator specific global properties */ -void accel_register_compat_props(AccelState *accel); /* Called just before os_setup_post (ie just before drop OS privs) */ void accel_setup_post(MachineState *ms); =20 diff --git a/accel/accel.c b/accel/accel.c index 3da26eb90f..6db5d8f4df 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -119,18 +119,6 @@ void configure_accelerator(MachineState *ms) } } =20 -void accel_register_compat_props(AccelState *accel) -{ - AccelClass *class =3D ACCEL_GET_CLASS(accel); - GlobalProperty *prop =3D class->global_props; - - for (; prop && prop->driver; prop++) { - /* Any compat_props must never cause error */ - prop->errp =3D &error_abort; - qdev_prop_register_global(prop); - } -} - void accel_setup_post(MachineState *ms) { AccelState *accel =3D ms->accelerator; diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6b3cc55b27..7066d28271 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -970,8 +970,19 @@ static void device_initfn(Object *obj) QLIST_INIT(&dev->gpios); } =20 +static const GPtrArray *ac_compat_props; + +void accel_register_compat_props(const GPtrArray *props) +{ + ac_compat_props =3D props; +} + static void device_post_init(Object *obj) { + if (ac_compat_props) { + object_apply_global_props(obj, ac_compat_props, &error_abort); + } + qdev_prop_set_globals(DEVICE(obj)); } =20 diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c index 6ec14c73ca..4da0292b61 100644 --- a/hw/xen/xen-common.c +++ b/hw/xen/xen-common.c @@ -159,24 +159,22 @@ static int xen_init(MachineState *ms) return 0; } =20 -static GlobalProperty xen_compat_props[] =3D { - { - .driver =3D "migration", - .property =3D "store-global-state", - .value =3D "off", - }, - { - .driver =3D "migration", - .property =3D "send-configuration", - .value =3D "off", - }, - { - .driver =3D "migration", - .property =3D "send-section-footer", - .value =3D "off", - }, - { /* end of list */ }, -}; +#define XEN_COMPAT \ + { \ + .driver =3D "migration", \ + .property =3D "store-global-state", \ + .value =3D "off", \ + }, \ + { \ + .driver =3D "migration", \ + .property =3D "send-configuration", \ + .value =3D "off", \ + }, \ + { \ + .driver =3D "migration", \ + .property =3D "send-section-footer", \ + .value =3D "off", \ + } =20 static void xen_accel_class_init(ObjectClass *oc, void *data) { @@ -185,7 +183,9 @@ static void xen_accel_class_init(ObjectClass *oc, void = *data) ac->init_machine =3D xen_init; ac->setup_post =3D xen_setup_post; ac->allowed =3D &xen_allowed; - ac->global_props =3D xen_compat_props; + ac->compat_props =3D g_ptr_array_new(); + + SET_COMPAT(ac, XEN_COMPAT); } =20 #define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen") diff --git a/qom/object.c b/qom/object.c index 17921c0a71..dbdab0aead 100644 --- a/qom/object.c +++ b/qom/object.c @@ -370,6 +370,31 @@ static void object_post_init_with_type(Object *obj, Ty= peImpl *ti) } } =20 +void object_apply_global_props(Object *obj, const GPtrArray *props, Error = **errp) +{ + Error *err =3D NULL; + int i; + + if (!props) { + return; + } + + for (i =3D 0; i < props->len; i++) { + GlobalProperty *p =3D g_ptr_array_index(props, i); + + if (object_dynamic_cast(obj, p->driver) =3D=3D NULL) { + continue; + } + p->used =3D true; + object_property_parse(obj, p->value, p->property, &err); + if (err !=3D NULL) { + error_prepend(&err, "can't apply global %s.%s=3D%s: ", + p->driver, p->property, p->value); + error_propagate(errp, err); + } + } +} + static void object_initialize_with_type(void *data, size_t size, TypeImpl = *type) { Object *obj =3D data; diff --git a/vl.c b/vl.c index fa25d1ae2d..c06e94271c 100644 --- a/vl.c +++ b/vl.c @@ -2963,7 +2963,7 @@ static void user_register_global_props(void) */ static void register_global_properties(MachineState *ms) { - accel_register_compat_props(ms->accelerator); + accel_register_compat_props(ACCEL_GET_CLASS(ms->accelerator)->compat_p= rops); machine_register_compat_props(ms); user_register_global_props(); } --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543312002519788.4036861424324; Tue, 27 Nov 2018 01:46:42 -0800 (PST) Received: from localhost ([::1]:40950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZwx-0001yj-9z for importer@patchew.org; Tue, 27 Nov 2018 04:46:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZhn-0004QI-AF for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:30:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZhj-0006BR-KI for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:30:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35316) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZhb-0005zK-UO; Tue, 27 Nov 2018 04:30:44 -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 078083082A46; Tue, 27 Nov 2018 09:30:43 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F1C0101E597; Tue, 27 Nov 2018 09:30:10 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:49 +0400 Message-Id: <20181127092801.21777-17-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@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.45]); Tue, 27 Nov 2018 09:30:43 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 16/28] hw: apply machine compat properties without touching globals 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: Peter Maydell , Eduardo Habkost , "Michael S. Tsirkin" , Cornelia Huck , David Hildenbrand , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "open list:S390" , "open list:Virt" , "open list:sPAPR" , Paolo Bonzini , imammedo@redhat.com, David Gibson , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Similarly to accel properties, move compat properties out of globals registration, and apply the machine compat properties during device_post_init(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/boards.h | 3 +- include/hw/qdev-core.h | 1 + hw/arm/virt.c | 16 +++++------ hw/core/machine.c | 19 +------------ hw/core/qdev.c | 9 ++++++ hw/i386/pc_piix.c | 56 +++++++++++++++++++------------------- hw/i386/pc_q35.c | 20 +++++++------- hw/ppc/spapr.c | 26 +++++++++--------- hw/s390x/s390-virtio-ccw.c | 20 +++++++------- vl.c | 2 +- 10 files changed, 82 insertions(+), 90 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index f82f28468b..28c2b0af41 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -69,7 +69,6 @@ int machine_kvm_shadow_mem(MachineState *machine); int machine_phandle_start(MachineState *machine); bool machine_dump_guest_core(MachineState *machine); bool machine_mem_merge(MachineState *machine); -void machine_register_compat_props(MachineState *machine); HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine= ); void machine_set_cpu_numa_node(MachineState *machine, const CpuInstanceProperties *props, @@ -191,7 +190,7 @@ struct MachineClass { const char *default_machine_opts; const char *default_boot_order; const char *default_display; - GArray *compat_props; + GPtrArray *compat_props; const char *hw_version; ram_addr_t default_ram_size; const char *default_cpu_type; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 82afd3c50d..f6a9503e23 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -279,6 +279,7 @@ typedef struct GlobalProperty { } while (0) =20 void accel_register_compat_props(const GPtrArray *props); +void machine_register_compat_props(const GPtrArray *props); =20 /*** Board API. This should go away once we have a machine config file. = ***/ =20 diff --git a/hw/arm/virt.c b/hw/arm/virt.c index a2b8d8f7c2..d106a8a8c7 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1882,7 +1882,7 @@ static void virt_3_0_instance_init(Object *obj) static void virt_machine_3_0_options(MachineClass *mc) { virt_machine_3_1_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_3_0); + SET_COMPAT(mc, VIRT_COMPAT_3_0); } DEFINE_VIRT_MACHINE(3, 0) =20 @@ -1899,7 +1899,7 @@ static void virt_machine_2_12_options(MachineClass *m= c) VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); =20 virt_machine_3_0_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_12); + SET_COMPAT(mc, VIRT_COMPAT_2_12); vmc->no_highmem_ecam =3D true; mc->max_cpus =3D 255; } @@ -1918,7 +1918,7 @@ static void virt_machine_2_11_options(MachineClass *m= c) VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); =20 virt_machine_2_12_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_11); + SET_COMPAT(mc, VIRT_COMPAT_2_11); vmc->smbios_old_sys_ver =3D true; } DEFINE_VIRT_MACHINE(2, 11) @@ -1934,7 +1934,7 @@ static void virt_2_10_instance_init(Object *obj) static void virt_machine_2_10_options(MachineClass *mc) { virt_machine_2_11_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_10); + SET_COMPAT(mc, VIRT_COMPAT_2_10); /* before 2.11 we never faulted accesses to bad addresses */ mc->ignore_memory_transaction_failures =3D true; } @@ -1951,7 +1951,7 @@ static void virt_2_9_instance_init(Object *obj) static void virt_machine_2_9_options(MachineClass *mc) { virt_machine_2_10_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_9); + SET_COMPAT(mc, VIRT_COMPAT_2_9); } DEFINE_VIRT_MACHINE(2, 9) =20 @@ -1968,7 +1968,7 @@ static void virt_machine_2_8_options(MachineClass *mc) VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); =20 virt_machine_2_9_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_8); + SET_COMPAT(mc, VIRT_COMPAT_2_8); /* For 2.8 and earlier we falsely claimed in the DT that * our timers were edge-triggered, not level-triggered. */ @@ -1989,7 +1989,7 @@ static void virt_machine_2_7_options(MachineClass *mc) VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); =20 virt_machine_2_8_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_7); + SET_COMPAT(mc, VIRT_COMPAT_2_7); /* ITS was introduced with 2.8 */ vmc->no_its =3D true; /* Stick with 1K pages for migration compatibility */ @@ -2010,7 +2010,7 @@ static void virt_machine_2_6_options(MachineClass *mc) VirtMachineClass *vmc =3D VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); =20 virt_machine_2_7_options(mc); - SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_6); + SET_COMPAT(mc, VIRT_COMPAT_2_6); vmc->disallow_affinity_adjustment =3D true; /* Disable PMU for 2.6 as PMU support was first introduced in 2.7 */ vmc->no_pmu =3D true; diff --git a/hw/core/machine.c b/hw/core/machine.c index c51423b647..6e24924aba 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -647,6 +647,7 @@ static void machine_class_base_init(ObjectClass *oc, vo= id *data) assert(g_str_has_suffix(cname, TYPE_MACHINE_SUFFIX)); mc->name =3D g_strndup(cname, strlen(cname) - strlen(TYPE_MACHINE_SUFFIX)); + mc->compat_props =3D g_ptr_array_new(); } } =20 @@ -834,24 +835,6 @@ void machine_run_board_init(MachineState *machine) machine_class->init(machine); } =20 -void machine_register_compat_props(MachineState *machine) -{ - MachineClass *mc =3D MACHINE_GET_CLASS(machine); - int i; - GlobalProperty *p; - - if (!mc->compat_props) { - return; - } - - for (i =3D 0; i < mc->compat_props->len; i++) { - p =3D g_array_index(mc->compat_props, GlobalProperty *, i); - /* Machine compat_props must never cause errors: */ - p->errp =3D &error_abort; - qdev_prop_register_global(p); - } -} - static const TypeInfo machine_info =3D { .name =3D TYPE_MACHINE, .parent =3D TYPE_OBJECT, diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 7066d28271..3b31b2c025 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -971,17 +971,26 @@ static void device_initfn(Object *obj) } =20 static const GPtrArray *ac_compat_props; +static const GPtrArray *mc_compat_props; =20 void accel_register_compat_props(const GPtrArray *props) { ac_compat_props =3D props; } =20 +void machine_register_compat_props(const GPtrArray *props) +{ + mc_compat_props =3D props; +} + static void device_post_init(Object *obj) { if (ac_compat_props) { object_apply_global_props(obj, ac_compat_props, &error_abort); } + if (mc_compat_props) { + object_apply_global_props(obj, mc_compat_props, &error_abort); + } =20 qdev_prop_set_globals(DEVICE(obj)); } diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7092d6d13f..3cc92b8eec 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -443,7 +443,7 @@ static void pc_i440fx_3_0_machine_options(MachineClass = *m) pc_i440fx_3_1_machine_options(m); m->is_default =3D 0; m->alias =3D NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_3_0); + SET_COMPAT(m, PC_COMPAT_3_0); } =20 DEFINE_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL, @@ -452,7 +452,7 @@ DEFINE_I440FX_MACHINE(v3_0, "pc-i440fx-3.0", NULL, static void pc_i440fx_2_12_machine_options(MachineClass *m) { pc_i440fx_3_0_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_12); + SET_COMPAT(m, PC_COMPAT_2_12); } =20 DEFINE_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL, @@ -461,7 +461,7 @@ DEFINE_I440FX_MACHINE(v2_12, "pc-i440fx-2.12", NULL, static void pc_i440fx_2_11_machine_options(MachineClass *m) { pc_i440fx_2_12_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_11); + SET_COMPAT(m, PC_COMPAT_2_11); } =20 DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL, @@ -470,7 +470,7 @@ DEFINE_I440FX_MACHINE(v2_11, "pc-i440fx-2.11", NULL, static void pc_i440fx_2_10_machine_options(MachineClass *m) { pc_i440fx_2_11_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_10); + SET_COMPAT(m, PC_COMPAT_2_10); m->auto_enable_numa_with_memhp =3D false; } =20 @@ -480,7 +480,7 @@ DEFINE_I440FX_MACHINE(v2_10, "pc-i440fx-2.10", NULL, static void pc_i440fx_2_9_machine_options(MachineClass *m) { pc_i440fx_2_10_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_9); + SET_COMPAT(m, PC_COMPAT_2_9); m->numa_auto_assign_ram =3D numa_legacy_auto_assign_ram; } =20 @@ -490,7 +490,7 @@ DEFINE_I440FX_MACHINE(v2_9, "pc-i440fx-2.9", NULL, static void pc_i440fx_2_8_machine_options(MachineClass *m) { pc_i440fx_2_9_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_8); + SET_COMPAT(m, PC_COMPAT_2_8); } =20 DEFINE_I440FX_MACHINE(v2_8, "pc-i440fx-2.8", NULL, @@ -500,7 +500,7 @@ DEFINE_I440FX_MACHINE(v2_8, "pc-i440fx-2.8", NULL, static void pc_i440fx_2_7_machine_options(MachineClass *m) { pc_i440fx_2_8_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_7); + SET_COMPAT(m, PC_COMPAT_2_7); } =20 DEFINE_I440FX_MACHINE(v2_7, "pc-i440fx-2.7", NULL, @@ -513,7 +513,7 @@ static void pc_i440fx_2_6_machine_options(MachineClass = *m) pc_i440fx_2_7_machine_options(m); pcmc->legacy_cpu_hotplug =3D true; pcmc->linuxboot_dma_enabled =3D false; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); + SET_COMPAT(m, PC_COMPAT_2_6); } =20 DEFINE_I440FX_MACHINE(v2_6, "pc-i440fx-2.6", NULL, @@ -526,7 +526,7 @@ static void pc_i440fx_2_5_machine_options(MachineClass = *m) pc_i440fx_2_6_machine_options(m); pcmc->save_tsc_khz =3D false; m->legacy_fw_cfg_order =3D 1; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_5); + SET_COMPAT(m, PC_COMPAT_2_5); } =20 DEFINE_I440FX_MACHINE(v2_5, "pc-i440fx-2.5", NULL, @@ -539,7 +539,7 @@ static void pc_i440fx_2_4_machine_options(MachineClass = *m) pc_i440fx_2_5_machine_options(m); m->hw_version =3D "2.4.0"; pcmc->broken_reserved_end =3D true; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_4); + SET_COMPAT(m, PC_COMPAT_2_4); } =20 DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL, @@ -550,7 +550,7 @@ static void pc_i440fx_2_3_machine_options(MachineClass = *m) { pc_i440fx_2_4_machine_options(m); m->hw_version =3D "2.3.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_3); + SET_COMPAT(m, PC_COMPAT_2_3); } =20 DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3, @@ -562,7 +562,7 @@ static void pc_i440fx_2_2_machine_options(MachineClass = *m) PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_2_3_machine_options(m); m->hw_version =3D "2.2.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_2); + SET_COMPAT(m, PC_COMPAT_2_2); pcmc->rsdp_in_ram =3D false; } =20 @@ -576,7 +576,7 @@ static void pc_i440fx_2_1_machine_options(MachineClass = *m) pc_i440fx_2_2_machine_options(m); m->hw_version =3D "2.1.0"; m->default_display =3D NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_1); + SET_COMPAT(m, PC_COMPAT_2_1); pcmc->smbios_uuid_encoded =3D false; pcmc->enforce_aligned_dimm =3D false; } @@ -591,7 +591,7 @@ static void pc_i440fx_2_0_machine_options(MachineClass = *m) PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_2_1_machine_options(m); m->hw_version =3D "2.0.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_0); + SET_COMPAT(m, PC_COMPAT_2_0); pcmc->smbios_legacy_mode =3D true; pcmc->has_reserved_memory =3D false; /* This value depends on the actual DSDT and SSDT compiled into @@ -625,7 +625,7 @@ static void pc_i440fx_1_7_machine_options(MachineClass = *m) m->hw_version =3D "1.7.0"; m->default_machine_opts =3D NULL; m->option_rom_has_mr =3D true; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_7); + SET_COMPAT(m, PC_COMPAT_1_7); pcmc->smbios_defaults =3D false; pcmc->gigabyte_align =3D false; pcmc->legacy_acpi_table_size =3D 6414; @@ -641,7 +641,7 @@ static void pc_i440fx_1_6_machine_options(MachineClass = *m) pc_i440fx_1_7_machine_options(m); m->hw_version =3D "1.6.0"; m->rom_file_has_mr =3D false; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_6); + SET_COMPAT(m, PC_COMPAT_1_6); pcmc->has_acpi_build =3D false; } =20 @@ -653,7 +653,7 @@ static void pc_i440fx_1_5_machine_options(MachineClass = *m) { pc_i440fx_1_6_machine_options(m); m->hw_version =3D "1.5.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_5); + SET_COMPAT(m, PC_COMPAT_1_5); } =20 DEFINE_I440FX_MACHINE(v1_5, "pc-i440fx-1.5", pc_compat_1_5, @@ -665,7 +665,7 @@ static void pc_i440fx_1_4_machine_options(MachineClass = *m) pc_i440fx_1_5_machine_options(m); m->hw_version =3D "1.4.0"; m->hot_add_cpu =3D NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_4); + SET_COMPAT(m, PC_COMPAT_1_4); } =20 DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4, @@ -697,7 +697,7 @@ static void pc_i440fx_1_3_machine_options(MachineClass = *m) { pc_i440fx_1_4_machine_options(m); m->hw_version =3D "1.3.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_3); + SET_COMPAT(m, PC_COMPAT_1_3); } =20 DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3, @@ -736,7 +736,7 @@ static void pc_i440fx_1_2_machine_options(MachineClass = *m) { pc_i440fx_1_3_machine_options(m); m->hw_version =3D "1.2.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_2); + SET_COMPAT(m, PC_COMPAT_1_2); } =20 DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2, @@ -779,7 +779,7 @@ static void pc_i440fx_1_1_machine_options(MachineClass = *m) { pc_i440fx_1_2_machine_options(m); m->hw_version =3D "1.1.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_1); + SET_COMPAT(m, PC_COMPAT_1_1); } =20 DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2, @@ -810,7 +810,7 @@ static void pc_i440fx_1_0_machine_options(MachineClass = *m) { pc_i440fx_1_1_machine_options(m); m->hw_version =3D "1.0"; - SET_MACHINE_COMPAT(m, PC_COMPAT_1_0); + SET_COMPAT(m, PC_COMPAT_1_0); } =20 DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2, @@ -824,7 +824,7 @@ static void pc_i440fx_0_15_machine_options(MachineClass= *m) { pc_i440fx_1_0_machine_options(m); m->hw_version =3D "0.15"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_15); + SET_COMPAT(m, PC_COMPAT_0_15); } =20 DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2, @@ -863,7 +863,7 @@ static void pc_i440fx_0_14_machine_options(MachineClass= *m) { pc_i440fx_0_15_machine_options(m); m->hw_version =3D "0.14"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_14); + SET_COMPAT(m, PC_COMPAT_0_14); } =20 DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2, @@ -899,7 +899,7 @@ static void pc_i440fx_0_13_machine_options(MachineClass= *m) PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_0_14_machine_options(m); m->hw_version =3D "0.13"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_13); + SET_COMPAT(m, PC_COMPAT_0_13); pcmc->kvmclock_enabled =3D false; } =20 @@ -935,7 +935,7 @@ static void pc_i440fx_0_12_machine_options(MachineClass= *m) { pc_i440fx_0_13_machine_options(m); m->hw_version =3D "0.12"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_12); + SET_COMPAT(m, PC_COMPAT_0_12); } =20 DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13, @@ -967,7 +967,7 @@ static void pc_i440fx_0_11_machine_options(MachineClass= *m) pc_i440fx_0_12_machine_options(m); m->hw_version =3D "0.11"; m->deprecation_reason =3D "use a newer machine type instead"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_11); + SET_COMPAT(m, PC_COMPAT_0_11); } =20 DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13, @@ -1002,7 +1002,7 @@ static void pc_i440fx_0_10_machine_options(MachineCla= ss *m) { pc_i440fx_0_11_machine_options(m); m->hw_version =3D "0.10"; - SET_MACHINE_COMPAT(m, PC_COMPAT_0_10); + SET_COMPAT(m, PC_COMPAT_0_10); } =20 DEFINE_I440FX_MACHINE(v0_10, "pc-0.10", pc_compat_0_13, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 4702bb13c4..19e6ec6675 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -324,7 +324,7 @@ static void pc_q35_3_0_machine_options(MachineClass *m) { pc_q35_3_1_machine_options(m); m->alias =3D NULL; - SET_MACHINE_COMPAT(m, PC_COMPAT_3_0); + SET_COMPAT(m, PC_COMPAT_3_0); } =20 DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL, @@ -333,7 +333,7 @@ DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL, static void pc_q35_2_12_machine_options(MachineClass *m) { pc_q35_3_0_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_12); + SET_COMPAT(m, PC_COMPAT_2_12); } =20 DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL, @@ -345,7 +345,7 @@ static void pc_q35_2_11_machine_options(MachineClass *m) =20 pc_q35_2_12_machine_options(m); pcmc->default_nic_model =3D "e1000"; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_11); + SET_COMPAT(m, PC_COMPAT_2_11); } =20 DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL, @@ -354,7 +354,7 @@ DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL, static void pc_q35_2_10_machine_options(MachineClass *m) { pc_q35_2_11_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_10); + SET_COMPAT(m, PC_COMPAT_2_10); m->numa_auto_assign_ram =3D numa_legacy_auto_assign_ram; m->auto_enable_numa_with_memhp =3D false; } @@ -365,7 +365,7 @@ DEFINE_Q35_MACHINE(v2_10, "pc-q35-2.10", NULL, static void pc_q35_2_9_machine_options(MachineClass *m) { pc_q35_2_10_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_9); + SET_COMPAT(m, PC_COMPAT_2_9); } =20 DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL, @@ -374,7 +374,7 @@ DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL, static void pc_q35_2_8_machine_options(MachineClass *m) { pc_q35_2_9_machine_options(m); - SET_MACHINE_COMPAT(m, PC_COMPAT_2_8); + SET_COMPAT(m, PC_COMPAT_2_8); } =20 DEFINE_Q35_MACHINE(v2_8, "pc-q35-2.8", NULL, @@ -384,7 +384,7 @@ static void pc_q35_2_7_machine_options(MachineClass *m) { pc_q35_2_8_machine_options(m); m->max_cpus =3D 255; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_7); + SET_COMPAT(m, PC_COMPAT_2_7); } =20 DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL, @@ -396,7 +396,7 @@ static void pc_q35_2_6_machine_options(MachineClass *m) pc_q35_2_7_machine_options(m); pcmc->legacy_cpu_hotplug =3D true; pcmc->linuxboot_dma_enabled =3D false; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); + SET_COMPAT(m, PC_COMPAT_2_6); } =20 DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL, @@ -408,7 +408,7 @@ static void pc_q35_2_5_machine_options(MachineClass *m) pc_q35_2_6_machine_options(m); pcmc->save_tsc_khz =3D false; m->legacy_fw_cfg_order =3D 1; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_5); + SET_COMPAT(m, PC_COMPAT_2_5); } =20 DEFINE_Q35_MACHINE(v2_5, "pc-q35-2.5", NULL, @@ -420,7 +420,7 @@ static void pc_q35_2_4_machine_options(MachineClass *m) pc_q35_2_5_machine_options(m); m->hw_version =3D "2.4.0"; pcmc->broken_reserved_end =3D true; - SET_MACHINE_COMPAT(m, PC_COMPAT_2_4); + SET_COMPAT(m, PC_COMPAT_2_4); } =20 DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 7afd1a175b..f36554687f 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3986,7 +3986,7 @@ static void spapr_machine_3_0_class_options(MachineCl= ass *mc) sPAPRMachineClass *smc =3D SPAPR_MACHINE_CLASS(mc); =20 spapr_machine_3_1_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_3_0); + SET_COMPAT(mc, SPAPR_COMPAT_3_0); =20 smc->legacy_irq_allocation =3D true; smc->irq =3D &spapr_irq_xics_legacy; @@ -4020,7 +4020,7 @@ static void spapr_machine_2_12_class_options(MachineC= lass *mc) sPAPRMachineClass *smc =3D SPAPR_MACHINE_CLASS(mc); =20 spapr_machine_3_0_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_12); + SET_COMPAT(mc, SPAPR_COMPAT_2_12); =20 /* We depend on kvm_enabled() to choose a default value for the * hpt-max-page-size capability. Of course we can't do it here @@ -4066,7 +4066,7 @@ static void spapr_machine_2_11_class_options(MachineC= lass *mc) =20 spapr_machine_2_12_class_options(mc); smc->default_caps.caps[SPAPR_CAP_HTM] =3D SPAPR_CAP_ON; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_11); + SET_COMPAT(mc, SPAPR_COMPAT_2_11); } =20 DEFINE_SPAPR_MACHINE(2_11, "2.11", false); @@ -4085,7 +4085,7 @@ static void spapr_machine_2_10_instance_options(Machi= neState *machine) static void spapr_machine_2_10_class_options(MachineClass *mc) { spapr_machine_2_11_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_10); + SET_COMPAT(mc, SPAPR_COMPAT_2_10); } =20 DEFINE_SPAPR_MACHINE(2_10, "2.10", false); @@ -4111,7 +4111,7 @@ static void spapr_machine_2_9_class_options(MachineCl= ass *mc) sPAPRMachineClass *smc =3D SPAPR_MACHINE_CLASS(mc); =20 spapr_machine_2_10_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_9); + SET_COMPAT(mc, SPAPR_COMPAT_2_9); mc->numa_auto_assign_ram =3D numa_legacy_auto_assign_ram; smc->pre_2_10_has_unused_icps =3D true; smc->resize_hpt_default =3D SPAPR_RESIZE_HPT_DISABLED; @@ -4138,7 +4138,7 @@ static void spapr_machine_2_8_instance_options(Machin= eState *machine) static void spapr_machine_2_8_class_options(MachineClass *mc) { spapr_machine_2_9_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_8); + SET_COMPAT(mc, SPAPR_COMPAT_2_8); mc->numa_mem_align_shift =3D 23; } =20 @@ -4233,7 +4233,7 @@ static void spapr_machine_2_7_class_options(MachineCl= ass *mc) =20 spapr_machine_2_8_class_options(mc); mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("power7_v2.3"); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_7); + SET_COMPAT(mc, SPAPR_COMPAT_2_7); smc->phb_placement =3D phb_placement_2_7; } =20 @@ -4259,7 +4259,7 @@ static void spapr_machine_2_6_class_options(MachineCl= ass *mc) { spapr_machine_2_7_class_options(mc); mc->has_hotpluggable_cpus =3D false; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_6); + SET_COMPAT(mc, SPAPR_COMPAT_2_6); } =20 DEFINE_SPAPR_MACHINE(2_6, "2.6", false); @@ -4286,7 +4286,7 @@ static void spapr_machine_2_5_class_options(MachineCl= ass *mc) =20 spapr_machine_2_6_class_options(mc); smc->use_ohci_by_default =3D true; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_5); + SET_COMPAT(mc, SPAPR_COMPAT_2_5); } =20 DEFINE_SPAPR_MACHINE(2_5, "2.5", false); @@ -4308,7 +4308,7 @@ static void spapr_machine_2_4_class_options(MachineCl= ass *mc) =20 spapr_machine_2_5_class_options(mc); smc->dr_lmb_enabled =3D false; - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_4); + SET_COMPAT(mc, SPAPR_COMPAT_2_4); } =20 DEFINE_SPAPR_MACHINE(2_4, "2.4", false); @@ -4332,7 +4332,7 @@ static void spapr_machine_2_3_instance_options(Machin= eState *machine) static void spapr_machine_2_3_class_options(MachineClass *mc) { spapr_machine_2_4_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_3); + SET_COMPAT(mc, SPAPR_COMPAT_2_3); } DEFINE_SPAPR_MACHINE(2_3, "2.3", false); =20 @@ -4357,7 +4357,7 @@ static void spapr_machine_2_2_instance_options(Machin= eState *machine) static void spapr_machine_2_2_class_options(MachineClass *mc) { spapr_machine_2_3_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_2); + SET_COMPAT(mc, SPAPR_COMPAT_2_2); } DEFINE_SPAPR_MACHINE(2_2, "2.2", false); =20 @@ -4375,7 +4375,7 @@ static void spapr_machine_2_1_instance_options(Machin= eState *machine) static void spapr_machine_2_1_class_options(MachineClass *mc) { spapr_machine_2_2_class_options(mc); - SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_1); + SET_COMPAT(mc, SPAPR_COMPAT_2_1); } DEFINE_SPAPR_MACHINE(2_1, "2.1", false); =20 diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index a0615a8b35..41b72356e9 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -762,7 +762,7 @@ static void ccw_machine_3_0_class_options(MachineClass = *mc) =20 s390mc->hpage_1m_allowed =3D false; ccw_machine_3_1_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_3_0); + SET_COMPAT(mc, CCW_COMPAT_3_0); } DEFINE_CCW_MACHINE(3_0, "3.0", false); =20 @@ -776,7 +776,7 @@ static void ccw_machine_2_12_instance_options(MachineSt= ate *machine) static void ccw_machine_2_12_class_options(MachineClass *mc) { ccw_machine_3_0_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_12); + SET_COMPAT(mc, CCW_COMPAT_2_12); } DEFINE_CCW_MACHINE(2_12, "2.12", false); =20 @@ -792,7 +792,7 @@ static void ccw_machine_2_11_instance_options(MachineSt= ate *machine) static void ccw_machine_2_11_class_options(MachineClass *mc) { ccw_machine_2_12_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_11); + SET_COMPAT(mc, CCW_COMPAT_2_11); } DEFINE_CCW_MACHINE(2_11, "2.11", false); =20 @@ -804,7 +804,7 @@ static void ccw_machine_2_10_instance_options(MachineSt= ate *machine) static void ccw_machine_2_10_class_options(MachineClass *mc) { ccw_machine_2_11_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_10); + SET_COMPAT(mc, CCW_COMPAT_2_10); } DEFINE_CCW_MACHINE(2_10, "2.10", false); =20 @@ -823,7 +823,7 @@ static void ccw_machine_2_9_class_options(MachineClass = *mc) S390CcwMachineClass *s390mc =3D S390_MACHINE_CLASS(mc); =20 ccw_machine_2_10_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_9); + SET_COMPAT(mc, CCW_COMPAT_2_9); s390mc->css_migration_enabled =3D false; } DEFINE_CCW_MACHINE(2_9, "2.9", false); @@ -836,7 +836,7 @@ static void ccw_machine_2_8_instance_options(MachineSta= te *machine) static void ccw_machine_2_8_class_options(MachineClass *mc) { ccw_machine_2_9_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_8); + SET_COMPAT(mc, CCW_COMPAT_2_8); } DEFINE_CCW_MACHINE(2_8, "2.8", false); =20 @@ -851,7 +851,7 @@ static void ccw_machine_2_7_class_options(MachineClass = *mc) =20 s390mc->cpu_model_allowed =3D false; ccw_machine_2_8_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_7); + SET_COMPAT(mc, CCW_COMPAT_2_7); } DEFINE_CCW_MACHINE(2_7, "2.7", false); =20 @@ -866,7 +866,7 @@ static void ccw_machine_2_6_class_options(MachineClass = *mc) =20 s390mc->ri_allowed =3D false; ccw_machine_2_7_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_6); + SET_COMPAT(mc, CCW_COMPAT_2_6); } DEFINE_CCW_MACHINE(2_6, "2.6", false); =20 @@ -878,7 +878,7 @@ static void ccw_machine_2_5_instance_options(MachineSta= te *machine) static void ccw_machine_2_5_class_options(MachineClass *mc) { ccw_machine_2_6_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_5); + SET_COMPAT(mc, CCW_COMPAT_2_5); } DEFINE_CCW_MACHINE(2_5, "2.5", false); =20 @@ -890,7 +890,7 @@ static void ccw_machine_2_4_instance_options(MachineSta= te *machine) static void ccw_machine_2_4_class_options(MachineClass *mc) { ccw_machine_2_5_class_options(mc); - SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_4); + SET_COMPAT(mc, CCW_COMPAT_2_4); } DEFINE_CCW_MACHINE(2_4, "2.4", false); =20 diff --git a/vl.c b/vl.c index c06e94271c..943e9b6a69 100644 --- a/vl.c +++ b/vl.c @@ -2964,7 +2964,7 @@ static void user_register_global_props(void) static void register_global_properties(MachineState *ms) { accel_register_compat_props(ACCEL_GET_CLASS(ms->accelerator)->compat_p= rops); - machine_register_compat_props(ms); + machine_register_compat_props(MACHINE_GET_CLASS(ms)->compat_props); user_register_global_props(); } =20 --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311820936674.4785794323543; Tue, 27 Nov 2018 01:43:40 -0800 (PST) Received: from localhost ([::1]:40926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZu7-0008AZ-JU for importer@patchew.org; Tue, 27 Nov 2018 04:43:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZho-0004RT-MT for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:30:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZhn-0006DS-TR for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:30:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45414) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZhn-0006D6-OO for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:30:55 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F8783081D91; Tue, 27 Nov 2018 09:30:55 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E1EC5C26E; Tue, 27 Nov 2018 09:30:46 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:50 +0400 Message-Id: <20181127092801.21777-18-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 27 Nov 2018 09:30:55 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 17/28] hw: remove SET_MACHINE_COMPAT 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: imammedo@redhat.com, Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Now replaced with more generic SET_COMPAT(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/boards.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 28c2b0af41..f743d9d4a4 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -287,20 +287,4 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) =20 -#define SET_MACHINE_COMPAT(m, COMPAT) \ - do { \ - int i; \ - static GlobalProperty props[] =3D { \ - COMPAT \ - { /* end of list */ } \ - }; \ - if (!m->compat_props) { \ - m->compat_props =3D g_array_new(false, false, sizeof(void *));= \ - } \ - for (i =3D 0; props[i].driver !=3D NULL; i++) { \ - GlobalProperty *prop =3D &props[i]; \ - g_array_append_val(m->compat_props, prop); \ - } \ - } while (0) - #endif --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543312057473133.7600466690095; Tue, 27 Nov 2018 01:47:37 -0800 (PST) Received: from localhost ([::1]:40952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZxw-0002cR-7u for importer@patchew.org; Tue, 27 Nov 2018 04:47:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZhw-0004YV-E3 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZht-0006G9-Ek for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45652) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZht-0006FY-73 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:01 -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 82BB53078A50 for ; Tue, 27 Nov 2018 09:31:00 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBD4C5D6A9; Tue, 27 Nov 2018 09:30:58 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:51 +0400 Message-Id: <20181127092801.21777-19-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@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.43]); Tue, 27 Nov 2018 09:31:00 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 18/28] qdev: all globals are now user-provided 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: imammedo@redhat.com, Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" All globals are now either provided via -global or through -cpu features (CPU features are implemented by registering globals). If the global isn't being used, it should warn in either case. We can thus consider that all global_props are "user-provided" globals. No need to track this per-globals anymore. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/qdev-core.h | 3 -- hw/core/qdev-properties.c | 4 --- tests/test-qdev-global-props.c | 57 ++++------------------------------ vl.c | 1 - 4 files changed, 6 insertions(+), 59 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index f6a9503e23..7a53213297 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -249,8 +249,6 @@ struct PropertyInfo { =20 /** * GlobalProperty: - * @user_provided: Set to true if property comes from user-provided config - * (command-line or config file). * @used: Set to true if property was used when initializing a device. * @errp: Error destination, used like first argument of error_setg() * in case property setting fails later. If @errp is NULL, we @@ -262,7 +260,6 @@ typedef struct GlobalProperty { const char *driver; const char *property; const char *value; - bool user_provided; bool used; Error **errp; } GlobalProperty; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index bd84c4ea4c..43c30a57f4 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1192,9 +1192,6 @@ int qdev_prop_check_globals(void) if (prop->used) { continue; } - if (!prop->user_provided) { - continue; - } oc =3D object_class_by_name(prop->driver); oc =3D object_class_dynamic_cast(oc, TYPE_DEVICE); if (!oc) { @@ -1233,7 +1230,6 @@ void qdev_prop_set_globals(DeviceState *dev) if (!dev->hotplugged && prop->errp) { error_propagate(prop->errp, err); } else { - assert(prop->user_provided); warn_report_err(err); } } diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index b1eb505442..60231b1372 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -216,12 +216,12 @@ static void test_dynamic_globalprop_subprocess(void) { MyType *mt; static GlobalProperty props[] =3D { - { TYPE_DYNAMIC_PROPS, "prop1", "101", true }, - { TYPE_DYNAMIC_PROPS, "prop2", "102", true }, - { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", true }, - { TYPE_UNUSED_HOTPLUG, "prop4", "104", true }, - { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", true }, - { TYPE_NONDEVICE, "prop6", "106", true }, + { TYPE_DYNAMIC_PROPS, "prop1", "101", }, + { TYPE_DYNAMIC_PROPS, "prop2", "102", }, + { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", }, + { TYPE_UNUSED_HOTPLUG, "prop4", "104", }, + { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", }, + { TYPE_NONDEVICE, "prop6", "106", }, {} }; int global_error; @@ -256,46 +256,6 @@ static void test_dynamic_globalprop(void) g_test_trap_assert_stdout(""); } =20 -/* Test setting of dynamic properties using user_provided=3Dfalse properti= es */ -static void test_dynamic_globalprop_nouser_subprocess(void) -{ - MyType *mt; - static GlobalProperty props[] =3D { - { TYPE_DYNAMIC_PROPS, "prop1", "101" }, - { TYPE_DYNAMIC_PROPS, "prop2", "102" }, - { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103" }, - { TYPE_UNUSED_HOTPLUG, "prop4", "104" }, - { TYPE_UNUSED_NOHOTPLUG, "prop5", "105" }, - { TYPE_NONDEVICE, "prop6", "106" }, - {} - }; - int global_error; - - register_global_properties(props); - - mt =3D DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS)); - qdev_init_nofail(DEVICE(mt)); - - g_assert_cmpuint(mt->prop1, =3D=3D, 101); - g_assert_cmpuint(mt->prop2, =3D=3D, 102); - global_error =3D qdev_prop_check_globals(); - g_assert_cmpuint(global_error, =3D=3D, 0); - g_assert(props[0].used); - g_assert(props[1].used); - g_assert(!props[2].used); - g_assert(!props[3].used); - g_assert(!props[4].used); - g_assert(!props[5].used); -} - -static void test_dynamic_globalprop_nouser(void) -{ - g_test_trap_subprocess("/qdev/properties/dynamic/global/nouser/subproc= ess", 0, 0); - g_test_trap_assert_passed(); - g_test_trap_assert_stderr(""); - g_test_trap_assert_stdout(""); -} - /* Test if global props affecting subclasses are applied in the right orde= r */ static void test_subclass_global_props(void) { @@ -345,11 +305,6 @@ int main(int argc, char **argv) g_test_add_func("/qdev/properties/dynamic/global", test_dynamic_globalprop); =20 - g_test_add_func("/qdev/properties/dynamic/global/nouser/subprocess", - test_dynamic_globalprop_nouser_subprocess); - g_test_add_func("/qdev/properties/dynamic/global/nouser", - test_dynamic_globalprop_nouser); - g_test_add_func("/qdev/properties/global/subclass", test_subclass_global_props); =20 diff --git a/vl.c b/vl.c index 943e9b6a69..6414259b48 100644 --- a/vl.c +++ b/vl.c @@ -2931,7 +2931,6 @@ static int global_init_func(void *opaque, QemuOpts *o= pts, Error **errp) g->driver =3D qemu_opt_get(opts, "driver"); g->property =3D qemu_opt_get(opts, "property"); g->value =3D qemu_opt_get(opts, "value"); - g->user_provided =3D true; g->errp =3D &error_fatal; qdev_prop_register_global(g); return 0; --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311475026540.4752633057725; Tue, 27 Nov 2018 01:37:55 -0800 (PST) Received: from localhost ([::1]:40893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZoX-0001jE-Kd for importer@patchew.org; Tue, 27 Nov 2018 04:37:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZi2-0004d6-Jb for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZhy-0006Ic-QJ for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58084) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZhy-0006IA-LI for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:06 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04763313D878 for ; Tue, 27 Nov 2018 09:31:06 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61BE3617B6; Tue, 27 Nov 2018 09:31:04 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:52 +0400 Message-Id: <20181127092801.21777-20-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 27 Nov 2018 09:31:06 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 19/28] qdev-props: convert global_props to GPtrArray 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: imammedo@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" A step towards being able to call object_apply_global_props(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/qdev-properties.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 43c30a57f4..3467e0485c 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1173,22 +1173,32 @@ void qdev_prop_set_ptr(DeviceState *dev, const char= *name, void *value) *ptr =3D value; } =20 -static GList *global_props; +static GPtrArray *global_props(void) +{ + static GPtrArray *gp; + + if (!gp) { + gp =3D g_ptr_array_new(); + } + + return gp; +} =20 void qdev_prop_register_global(GlobalProperty *prop) { - global_props =3D g_list_append(global_props, prop); + g_ptr_array_add(global_props(), prop); } =20 int qdev_prop_check_globals(void) { - GList *l; - int ret =3D 0; + int i, ret =3D 0; =20 - for (l =3D global_props; l; l =3D l->next) { - GlobalProperty *prop =3D l->data; + for (i =3D 0; i < global_props()->len; i++) { + GlobalProperty *prop; ObjectClass *oc; DeviceClass *dc; + + prop =3D g_ptr_array_index(global_props(), i); if (prop->used) { continue; } @@ -1213,12 +1223,13 @@ int qdev_prop_check_globals(void) =20 void qdev_prop_set_globals(DeviceState *dev) { - GList *l; + int i; =20 - for (l =3D global_props; l; l =3D l->next) { - GlobalProperty *prop =3D l->data; + for (i =3D 0; i < global_props()->len; i++) { + GlobalProperty *prop; Error *err =3D NULL; =20 + prop =3D g_ptr_array_index(global_props(), i); if (object_dynamic_cast(OBJECT(dev), prop->driver) =3D=3D NULL) { continue; } --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543312249204903.0759144409117; Tue, 27 Nov 2018 01:50:49 -0800 (PST) Received: from localhost ([::1]:40968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRa12-00066r-3u for importer@patchew.org; Tue, 27 Nov 2018 04:50:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZiA-0004i3-7L for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZi9-0006MF-9b for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43576) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZi9-0006Ly-2a for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:17 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 68DAD53FC; Tue, 27 Nov 2018 09:31:16 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E9BC1C92F; Tue, 27 Nov 2018 09:31:09 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:53 +0400 Message-Id: <20181127092801.21777-21-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 27 Nov 2018 09:31:16 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 20/28] qdev-props: remove errp from GlobalProperty 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: Eduardo Habkost , Mark Cave-Ayland , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , imammedo@redhat.com, Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" All qdev_prop_register_global() set &error_fatal for errp, except '-rtc driftfix=3Dslew', which arguably should also use &error_fatal, as otherwise failing to apply the property would only report a warning. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/qdev-core.h | 6 ------ hw/core/qdev-properties.c | 4 ++-- qom/cpu.c | 1 - target/i386/cpu.c | 1 - target/sparc/cpu.c | 1 - vl.c | 1 - 6 files changed, 2 insertions(+), 12 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 7a53213297..eaaf20fc40 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -250,18 +250,12 @@ struct PropertyInfo { /** * GlobalProperty: * @used: Set to true if property was used when initializing a device. - * @errp: Error destination, used like first argument of error_setg() - * in case property setting fails later. If @errp is NULL, we - * print warnings instead of ignoring errors silently. For - * hotplugged devices, errp is always ignored and warnings are - * printed instead. */ typedef struct GlobalProperty { const char *driver; const char *property; const char *value; bool used; - Error **errp; } GlobalProperty; =20 #define SET_COMPAT(S, COMPAT) \ diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 3467e0485c..a2d25d3d37 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1238,8 +1238,8 @@ void qdev_prop_set_globals(DeviceState *dev) if (err !=3D NULL) { error_prepend(&err, "can't apply global %s.%s=3D%s: ", prop->driver, prop->property, prop->value); - if (!dev->hotplugged && prop->errp) { - error_propagate(prop->errp, err); + if (!dev->hotplugged) { + error_propagate(&error_fatal, err); } else { warn_report_err(err); } diff --git a/qom/cpu.c b/qom/cpu.c index 9ad1372d57..5442a7323b 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -312,7 +312,6 @@ static void cpu_common_parse_features(const char *typen= ame, char *features, prop->driver =3D typename; prop->property =3D g_strdup(featurestr); prop->value =3D g_strdup(val); - prop->errp =3D &error_fatal; qdev_prop_register_global(prop); } else { error_setg(errp, "Expected key=3Dvalue format, found %s.", diff --git a/target/i386/cpu.c b/target/i386/cpu.c index f81d35e1f9..c687a9b694 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3568,7 +3568,6 @@ static void x86_cpu_parse_featurestr(const char *type= name, char *features, prop->driver =3D typename; prop->property =3D g_strdup(name); prop->value =3D g_strdup(val); - prop->errp =3D &error_fatal; qdev_prop_register_global(prop); } =20 diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 0f090ece54..4a4445bdf5 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -111,7 +111,6 @@ cpu_add_feat_as_prop(const char *typename, const char *= name, const char *val) prop->driver =3D typename; prop->property =3D g_strdup(name); prop->value =3D g_strdup(val); - prop->errp =3D &error_fatal; qdev_prop_register_global(prop); } =20 diff --git a/vl.c b/vl.c index 6414259b48..fad335106c 100644 --- a/vl.c +++ b/vl.c @@ -2931,7 +2931,6 @@ static int global_init_func(void *opaque, QemuOpts *o= pts, Error **errp) g->driver =3D qemu_opt_get(opts, "driver"); g->property =3D qemu_opt_get(opts, "property"); g->value =3D qemu_opt_get(opts, "value"); - g->errp =3D &error_fatal; qdev_prop_register_global(g); return 0; } --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311664137718.7063880457242; Tue, 27 Nov 2018 01:41:04 -0800 (PST) Received: from localhost ([::1]:40914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZra-00047b-Uw for importer@patchew.org; Tue, 27 Nov 2018 04:41:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZiO-0004sn-CA for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZiK-0006PR-Cr for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:29578) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZiK-0006PG-76 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:28 -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 931F83084298; Tue, 27 Nov 2018 09:31:27 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 372545FCAE; Tue, 27 Nov 2018 09:31:19 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:54 +0400 Message-Id: <20181127092801.21777-22-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@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.40]); Tue, 27 Nov 2018 09:31:27 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 21/28] qdev-props: call object_apply_global_props() 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: imammedo@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" It's now possible to use the common function. Teach object_apply_global_props() to warn if Error argument is NULL. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/core/qdev-properties.c | 24 ++---------------------- qom/object.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index a2d25d3d37..6061090dc2 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1223,28 +1223,8 @@ int qdev_prop_check_globals(void) =20 void qdev_prop_set_globals(DeviceState *dev) { - int i; - - for (i =3D 0; i < global_props()->len; i++) { - GlobalProperty *prop; - Error *err =3D NULL; - - prop =3D g_ptr_array_index(global_props(), i); - if (object_dynamic_cast(OBJECT(dev), prop->driver) =3D=3D NULL) { - continue; - } - prop->used =3D true; - object_property_parse(OBJECT(dev), prop->value, prop->property, &e= rr); - if (err !=3D NULL) { - error_prepend(&err, "can't apply global %s.%s=3D%s: ", - prop->driver, prop->property, prop->value); - if (!dev->hotplugged) { - error_propagate(&error_fatal, err); - } else { - warn_report_err(err); - } - } - } + object_apply_global_props(OBJECT(dev), global_props(), + dev->hotplugged ? NULL : &error_fatal); } =20 /* --- 64bit unsigned int 'size' type --- */ diff --git a/qom/object.c b/qom/object.c index dbdab0aead..aa6f3a2a71 100644 --- a/qom/object.c +++ b/qom/object.c @@ -390,7 +390,17 @@ void object_apply_global_props(Object *obj, const GPtr= Array *props, Error **errp if (err !=3D NULL) { error_prepend(&err, "can't apply global %s.%s=3D%s: ", p->driver, p->property, p->value); - error_propagate(errp, err); + /* + * If errp !=3D NULL, propagate error and return. + * If errp =3D=3D NULL, report a warning, but keep going + * with the remaining globals. + */ + if (errp) { + error_propagate(errp, err); + return; + } else { + warn_report_err(err); + } } } } --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543312007782642.48352158061; Tue, 27 Nov 2018 01:46:47 -0800 (PST) Received: from localhost ([::1]:40951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZx6-00028i-4U for importer@patchew.org; Tue, 27 Nov 2018 04:46:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZiQ-0004tt-6W for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZiP-0006Rv-Cy for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41732) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZiP-0006Qg-5M for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:33 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E4B1307DAC1; Tue, 27 Nov 2018 09:31:32 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A17B5DD63; Tue, 27 Nov 2018 09:31:31 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:55 +0400 Message-Id: <20181127092801.21777-23-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 27 Nov 2018 09:31:32 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 22/28] qom: teach interfaces to implement post-init 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: imammedo@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The following patches are going to implement post_init callbacks for settings properties. The interface post_init are called before the instance post_init, so the default interface behaviour can be overriden if necessary. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qom/object.c | 8 +++++++- tests/check-qom-interface.c | 23 +++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/qom/object.c b/qom/object.c index aa6f3a2a71..8fa59026c5 100644 --- a/qom/object.c +++ b/qom/object.c @@ -288,7 +288,6 @@ static void type_initialize(TypeImpl *ti) assert(ti->instance_size =3D=3D 0); assert(ti->abstract); assert(!ti->instance_init); - assert(!ti->instance_post_init); assert(!ti->instance_finalize); assert(!ti->num_interfaces); } @@ -361,6 +360,13 @@ static void object_init_with_type(Object *obj, TypeImp= l *ti) =20 static void object_post_init_with_type(Object *obj, TypeImpl *ti) { + GSList *e; + + for (e =3D ti->class->interfaces; e; e =3D e->next) { + TypeImpl *itype =3D OBJECT_CLASS(e->data)->type; + object_post_init_with_type(obj, itype); + } + if (ti->instance_post_init) { ti->instance_post_init(obj); } diff --git a/tests/check-qom-interface.c b/tests/check-qom-interface.c index 2177f0dce5..cd2dd6dcee 100644 --- a/tests/check-qom-interface.c +++ b/tests/check-qom-interface.c @@ -31,9 +31,27 @@ typedef struct TestIfClass { uint32_t test; } TestIfClass; =20 +typedef struct DirectImpl { + Object parent_obj; + + bool if_post_init; +} DirectImpl; + +#define TYPE_DIRECT_IMPL "direct-impl" +#define DIRECT_IMPL(obj) \ + OBJECT_CHECK(DirectImpl, (obj), TYPE_DIRECT_IMPL) + +static void test_if_post_init(Object *obj) +{ + DirectImpl *d =3D DIRECT_IMPL(obj); + + d->if_post_init =3D true; +} + static const TypeInfo test_if_info =3D { .name =3D TYPE_TEST_IF, .parent =3D TYPE_INTERFACE, + .instance_post_init =3D test_if_post_init, .class_size =3D sizeof(TestIfClass), }; =20 @@ -47,11 +65,10 @@ static void test_class_init(ObjectClass *oc, void *data) tc->test =3D PATTERN; } =20 -#define TYPE_DIRECT_IMPL "direct-impl" - static const TypeInfo direct_impl_info =3D { .name =3D TYPE_DIRECT_IMPL, .parent =3D TYPE_OBJECT, + .instance_size =3D sizeof(DirectImpl), .class_init =3D test_class_init, .interfaces =3D (InterfaceInfo[]) { { TYPE_TEST_IF }, @@ -70,10 +87,12 @@ static void test_interface_impl(const char *type) { Object *obj =3D object_new(type); TestIf *iobj =3D TEST_IF(obj); + DirectImpl *d =3D DIRECT_IMPL(obj); TestIfClass *ioc =3D TEST_IF_GET_CLASS(iobj); =20 g_assert(iobj); g_assert(ioc->test =3D=3D PATTERN); + g_assert(d->if_post_init =3D=3D true); object_unref(obj); } =20 --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543312206554976.5968450552052; Tue, 27 Nov 2018 01:50:06 -0800 (PST) Received: from localhost ([::1]:40964 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRa0E-0005Vx-Ur for importer@patchew.org; Tue, 27 Nov 2018 04:49:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZie-00055a-Cb for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZid-0006Vq-OB for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56158) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZic-0006Uf-0U for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:46 -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 5BDA53154847; Tue, 27 Nov 2018 09:31:42 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AA2A59D0C; Tue, 27 Nov 2018 09:31:35 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:56 +0400 Message-Id: <20181127092801.21777-24-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 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.41]); Tue, 27 Nov 2018 09:31:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 23/28] qom: add object_class_get_class_data() 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: imammedo@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add a simple function to retrieve the associated class data. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qom/object.h | 9 +++++++++ qom/object.c | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 5183c587f3..d5266405da 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -916,6 +916,15 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *kl= ass, */ ObjectClass *object_class_get_parent(ObjectClass *klass); =20 + +/** + * object_class_get_class_data: + * @klass: The class to obtain associated data. + * + * Returns: the class_data given when registering the type. + */ +void *object_class_get_class_data(ObjectClass *klass); + /** * object_class_get_name: * @klass: The class to obtain the QOM typename for. diff --git a/qom/object.c b/qom/object.c index 8fa59026c5..036ff6da00 100644 --- a/qom/object.c +++ b/qom/object.c @@ -873,6 +873,11 @@ const char *object_class_get_name(ObjectClass *klass) return klass->type->name; } =20 +void *object_class_get_class_data(ObjectClass *klass) +{ + return klass->type->class_data; +} + ObjectClass *object_class_by_name(const char *typename) { TypeImpl *type =3D type_get_by_name(typename); --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543312216792867.4350468952375; Tue, 27 Nov 2018 01:50:16 -0800 (PST) Received: from localhost ([::1]:40965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRa0O-0005e3-4Q for importer@patchew.org; Tue, 27 Nov 2018 04:50:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZik-0005Ab-T7 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZih-0006X2-Ng for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33164) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZif-0006Vy-Km; Tue, 27 Nov 2018 04:31:49 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0AB2A4021; Tue, 27 Nov 2018 09:31:47 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53DBD5C3FA; Tue, 27 Nov 2018 09:31:45 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:57 +0400 Message-Id: <20181127092801.21777-25-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 27 Nov 2018 09:31:47 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 24/28] arm: replace instance_post_init() 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: Peter Maydell , imammedo@redhat.com, "open list:ARM" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Replace arm_cpu_post_init() instance callback by calling it from leaf classes, to avoid potential the ordering issue with interfaces post-init. Signed-off-by: Marc-Andr=C3=A9 Lureau Suggested-by: Igor Mammedov --- target/arm/cpu.h | 2 ++ target/arm/cpu.c | 15 ++++++++++++--- target/arm/cpu64.c | 11 ++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 2a73fed9a0..84fba2b24b 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -884,6 +884,8 @@ static inline ARMCPU *arm_env_get_cpu(CPUARMState *env) return container_of(env, ARMCPU, env); } =20 +void arm_cpu_post_init(Object *obj); + uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz); =20 #define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e)) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 60411f6bfe..8a4aae7438 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -734,7 +734,7 @@ static Property arm_cpu_pmsav7_dregion_property =3D static Property arm_cpu_initsvtor_property =3D DEFINE_PROP_UINT32("init-svtor", ARMCPU, init_svtor, 0); =20 -static void arm_cpu_post_init(Object *obj) +void arm_cpu_post_init(Object *obj) { ARMCPU *cpu =3D ARM_CPU(obj); =20 @@ -2094,6 +2094,7 @@ static void arm_host_initfn(Object *obj) ARMCPU *cpu =3D ARM_CPU(obj); =20 kvm_arm_set_cpu_features_from_host(cpu); + arm_cpu_post_init(ARM_CPU(obj)); } =20 static const TypeInfo host_arm_cpu_type_info =3D { @@ -2108,14 +2109,23 @@ static const TypeInfo host_arm_cpu_type_info =3D { =20 #endif =20 +static void arm_cpu_instance_init(Object *obj) +{ + const ARMCPUInfo *info =3D object_class_get_class_data(object_get_clas= s(obj)); + + info->initfn(obj); + arm_cpu_post_init(obj); +} + static void cpu_register(const ARMCPUInfo *info) { TypeInfo type_info =3D { .parent =3D TYPE_ARM_CPU, .instance_size =3D sizeof(ARMCPU), - .instance_init =3D info->initfn, + .instance_init =3D arm_cpu_instance_init, .class_size =3D sizeof(ARMCPUClass), .class_init =3D info->class_init, + .class_data =3D (void *)info, }; =20 type_info.name =3D g_strdup_printf("%s-" TYPE_ARM_CPU, info->name); @@ -2128,7 +2138,6 @@ static const TypeInfo arm_cpu_type_info =3D { .parent =3D TYPE_CPU, .instance_size =3D sizeof(ARMCPU), .instance_init =3D arm_cpu_initfn, - .instance_post_init =3D arm_cpu_post_init, .instance_finalize =3D arm_cpu_finalizefn, .abstract =3D true, .class_size =3D sizeof(ARMCPUClass), diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 873f059bf2..dbfc3ee490 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -447,14 +447,23 @@ static void aarch64_cpu_class_init(ObjectClass *oc, v= oid *data) cc->gdb_arch_name =3D aarch64_gdb_arch_name; } =20 +static void aarch64_cpu_instance_init(Object *obj) +{ + const ARMCPUInfo *info =3D object_class_get_class_data(object_get_clas= s(obj)); + + info->initfn(obj); + arm_cpu_post_init(obj); +} + static void aarch64_cpu_register(const ARMCPUInfo *info) { TypeInfo type_info =3D { .parent =3D TYPE_AARCH64_CPU, .instance_size =3D sizeof(ARMCPU), - .instance_init =3D info->initfn, + .instance_init =3D aarch64_cpu_instance_init, .class_size =3D sizeof(ARMCPUClass), .class_init =3D info->class_init, + .class_data =3D (void *)info, }; =20 type_info.name =3D g_strdup_printf("%s-" TYPE_ARM_CPU, info->name); --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543311841279673.0968523788647; Tue, 27 Nov 2018 01:44:01 -0800 (PST) Received: from localhost ([::1]:40928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZuR-0008Sf-T6 for importer@patchew.org; Tue, 27 Nov 2018 04:43:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZik-0005Ac-T9 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZij-0006Xp-Qi for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35008) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZij-0006XJ-HU for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:53 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9099C0C8B9C; Tue, 27 Nov 2018 09:31:52 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A0AB5C3FA; Tue, 27 Nov 2018 09:31:50 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:58 +0400 Message-Id: <20181127092801.21777-26-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 27 Nov 2018 09:31:52 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 25/28] machine: add compat-props interface 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: imammedo@redhat.com, Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Let's make compatiblity properties an interface, so that objects other than QDev can benefit from having machine compatiblity properties. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/boards.h | 2 ++ hw/core/compat-props.c | 55 ++++++++++++++++++++++++++++++++++++++++++ hw/core/qdev.c | 24 +++--------------- MAINTAINERS | 1 + hw/core/Makefile.objs | 1 + tests/Makefile.include | 1 + 6 files changed, 64 insertions(+), 20 deletions(-) create mode 100644 hw/core/compat-props.c diff --git a/include/hw/boards.h b/include/hw/boards.h index f743d9d4a4..77d1fc1bef 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -9,6 +9,8 @@ #include "qom/object.h" #include "qom/cpu.h" =20 +#define TYPE_COMPAT_PROPS "compat-props" + /** * memory_region_allocate_system_memory - Allocate a board's main memory * @mr: the #MemoryRegion to be initialized diff --git a/hw/core/compat-props.c b/hw/core/compat-props.c new file mode 100644 index 0000000000..538378e71f --- /dev/null +++ b/hw/core/compat-props.c @@ -0,0 +1,55 @@ +/* + * QEMU Machine compat properties + * + * Copyright (C) 2018 Red Hat Inc + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/boards.h" +#include "qapi/error.h" + +typedef struct CompatProps CompatProps; + +typedef struct CompatPropsClass { + InterfaceClass parent_class; +} CompatPropsClass; + +static const GPtrArray *ac_compat_props; +static const GPtrArray *mc_compat_props; + +void accel_register_compat_props(const GPtrArray *props) +{ + ac_compat_props =3D props; +} + +void machine_register_compat_props(const GPtrArray *props) +{ + mc_compat_props =3D props; +} + +static void compat_props_post_init(Object *obj) +{ + if (ac_compat_props) { + object_apply_global_props(obj, ac_compat_props, &error_abort); + } + if (mc_compat_props) { + object_apply_global_props(obj, mc_compat_props, &error_abort); + } +} + +static void compat_props_register_types(void) +{ + static const TypeInfo cp_interface_info =3D { + .name =3D TYPE_COMPAT_PROPS, + .parent =3D TYPE_INTERFACE, + .class_size =3D sizeof(CompatPropsClass), + .instance_post_init =3D compat_props_post_init, + }; + + type_register_static(&cp_interface_info); +} + +type_init(compat_props_register_types) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 3b31b2c025..b0ee05f837 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -970,28 +970,8 @@ static void device_initfn(Object *obj) QLIST_INIT(&dev->gpios); } =20 -static const GPtrArray *ac_compat_props; -static const GPtrArray *mc_compat_props; - -void accel_register_compat_props(const GPtrArray *props) -{ - ac_compat_props =3D props; -} - -void machine_register_compat_props(const GPtrArray *props) -{ - mc_compat_props =3D props; -} - static void device_post_init(Object *obj) { - if (ac_compat_props) { - object_apply_global_props(obj, ac_compat_props, &error_abort); - } - if (mc_compat_props) { - object_apply_global_props(obj, mc_compat_props, &error_abort); - } - qdev_prop_set_globals(DEVICE(obj)); } =20 @@ -1124,6 +1104,10 @@ static const TypeInfo device_type_info =3D { .class_init =3D device_class_init, .abstract =3D true, .class_size =3D sizeof(DeviceClass), + .interfaces =3D (InterfaceInfo[]) { + { TYPE_COMPAT_PROPS }, + { } + } }; =20 static void qdev_register_types(void) diff --git a/MAINTAINERS b/MAINTAINERS index 9410bbb7cf..adff09627f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1145,6 +1145,7 @@ Machine core M: Eduardo Habkost M: Marcel Apfelbaum S: Supported +F: hw/core/compat-props.c F: hw/core/machine.c F: hw/core/null-machine.c F: include/hw/boards.h diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs index a799c83815..f15b3c970a 100644 --- a/hw/core/Makefile.objs +++ b/hw/core/Makefile.objs @@ -1,5 +1,6 @@ # core qdev-related obj files, also used by *-user: common-obj-y +=3D qdev.o qdev-properties.o +common-obj-y +=3D compat-props.o common-obj-y +=3D bus.o reset.o common-obj-$(CONFIG_SOFTMMU) +=3D qdev-fw.o common-obj-$(CONFIG_SOFTMMU) +=3D fw-path-provider.o diff --git a/tests/Makefile.include b/tests/Makefile.include index fb0b449c02..fc74358c0a 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -567,6 +567,7 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-= global-props.o \ hw/core/irq.o \ hw/core/fw-path-provider.o \ hw/core/reset.o \ + hw/core/compat-props.o \ $(test-qapi-obj-y) tests/test-vmstate$(EXESUF): tests/test-vmstate.o \ migration/vmstate.o migration/vmstate-types.o migration/qemu-file.o \ --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543312405848325.2540861242603; Tue, 27 Nov 2018 01:53:25 -0800 (PST) Received: from localhost ([::1]:40985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRa3Q-00081s-TA for importer@patchew.org; Tue, 27 Nov 2018 04:53:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZip-0005En-J1 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:32:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZio-0006ZT-NB for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:13729) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZio-0006ZJ-G4 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:31:58 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D21EAA7E1; Tue, 27 Nov 2018 09:31:57 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9AFDC5C26E; Tue, 27 Nov 2018 09:31:56 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:27:59 +0400 Message-Id: <20181127092801.21777-27-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 27 Nov 2018 09:31:57 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 26/28] hw/i386: add pc-i440fx-3.2 & pc-q35-3.2 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: Eduardo Habkost , "Michael S. Tsirkin" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , imammedo@redhat.com, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The following patch is going to add compatiblity parameters for qemu <=3D 3.1. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/compat.h | 3 +++ include/hw/i386/pc.h | 3 +++ hw/i386/pc_piix.c | 15 ++++++++++++--- hw/i386/pc_q35.c | 13 +++++++++++-- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/include/hw/compat.h b/include/hw/compat.h index 6f4d5fc647..70958328fe 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -1,6 +1,9 @@ #ifndef HW_COMPAT_H #define HW_COMPAT_H =20 +#define HW_COMPAT_3_1 \ + /* empty */ + #define HW_COMPAT_3_0 \ /* empty */ =20 diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 136fe497b6..c37d4333a0 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -294,6 +294,9 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t); int e820_get_num_entries(void); bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); =20 +#define PC_COMPAT_3_1 \ + HW_COMPAT_3_1 + #define PC_COMPAT_3_0 \ HW_COMPAT_3_0 \ {\ diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 3cc92b8eec..a4dcadac37 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -428,21 +428,30 @@ static void pc_i440fx_machine_options(MachineClass *m) machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE); } =20 -static void pc_i440fx_3_1_machine_options(MachineClass *m) +static void pc_i440fx_3_2_machine_options(MachineClass *m) { pc_i440fx_machine_options(m); m->alias =3D "pc"; m->is_default =3D 1; } =20 +DEFINE_I440FX_MACHINE(v3_2, "pc-i440fx-3.2", NULL, + pc_i440fx_3_2_machine_options); + +static void pc_i440fx_3_1_machine_options(MachineClass *m) +{ + pc_i440fx_3_2_machine_options(m); + m->is_default =3D 0; + m->alias =3D NULL; + SET_COMPAT(m, PC_COMPAT_3_1); +} + DEFINE_I440FX_MACHINE(v3_1, "pc-i440fx-3.1", NULL, pc_i440fx_3_1_machine_options); =20 static void pc_i440fx_3_0_machine_options(MachineClass *m) { pc_i440fx_3_1_machine_options(m); - m->is_default =3D 0; - m->alias =3D NULL; SET_COMPAT(m, PC_COMPAT_3_0); } =20 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 19e6ec6675..a990a22f87 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -311,19 +311,28 @@ static void pc_q35_machine_options(MachineClass *m) m->max_cpus =3D 288; } =20 -static void pc_q35_3_1_machine_options(MachineClass *m) +static void pc_q35_3_2_machine_options(MachineClass *m) { pc_q35_machine_options(m); m->alias =3D "q35"; } =20 +DEFINE_Q35_MACHINE(v3_2, "pc-q35-3.2", NULL, + pc_q35_3_2_machine_options); + +static void pc_q35_3_1_machine_options(MachineClass *m) +{ + pc_q35_3_2_machine_options(m); + m->alias =3D NULL; + SET_COMPAT(m, PC_COMPAT_3_1); +} + DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL, pc_q35_3_1_machine_options); =20 static void pc_q35_3_0_machine_options(MachineClass *m) { pc_q35_3_1_machine_options(m); - m->alias =3D NULL; SET_COMPAT(m, PC_COMPAT_3_0); } =20 --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543312057857735.1514393939577; Tue, 27 Nov 2018 01:47:37 -0800 (PST) Received: from localhost ([::1]:40953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZxw-0002dJ-KP for importer@patchew.org; Tue, 27 Nov 2018 04:47:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZj6-0005Sq-U7 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:32:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZj2-0006cu-0B for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:32:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50336) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZit-0006bC-55; Tue, 27 Nov 2018 04:32:03 -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 7791B3138B83; Tue, 27 Nov 2018 09:32:02 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B9385D6A9; Tue, 27 Nov 2018 09:32:01 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:28:00 +0400 Message-Id: <20181127092801.21777-28-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@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.42]); Tue, 27 Nov 2018 09:32:02 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 27/28] hw/arm/virt: add virt-3.2 machine type 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: Peter Maydell , imammedo@redhat.com, "open list:Virt" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/arm/virt.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index d106a8a8c7..22343db485 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1796,7 +1796,7 @@ static void machvirt_machine_init(void) } type_init(machvirt_machine_init); =20 -static void virt_3_1_instance_init(Object *obj) +static void virt_3_2_instance_init(Object *obj) { VirtMachineState *vms =3D VIRT_MACHINE(obj); VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); @@ -1866,10 +1866,26 @@ static void virt_3_1_instance_init(Object *obj) vms->irqmap =3D a15irqmap; } =20 +static void virt_machine_3_2_options(MachineClass *mc) +{ +} +DEFINE_VIRT_MACHINE_AS_LATEST(3, 2) + +#define VIRT_COMPAT_3_1 \ + HW_COMPAT_3_1 + +static void virt_3_1_instance_init(Object *obj) +{ + virt_3_2_instance_init(obj); +} + static void virt_machine_3_1_options(MachineClass *mc) { + virt_machine_3_2_options(mc); + SET_COMPAT(mc, VIRT_COMPAT_3_1); } -DEFINE_VIRT_MACHINE_AS_LATEST(3, 1) + +DEFINE_VIRT_MACHINE(3, 1) =20 #define VIRT_COMPAT_3_0 \ HW_COMPAT_3_0 --=20 2.20.0.rc1 From nobody Sun May 5 23:52:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154331245936093.64016054648607; Tue, 27 Nov 2018 01:54:19 -0800 (PST) Received: from localhost ([::1]:40992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRa4Q-0000S0-5Z for importer@patchew.org; Tue, 27 Nov 2018 04:54:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRZj6-0005Sz-U9 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:32:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRZj4-0006dD-7w for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:32:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33512) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRZj3-0006d5-W6 for qemu-devel@nongnu.org; Tue, 27 Nov 2018 04:32:14 -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 389FBCAA80 for ; Tue, 27 Nov 2018 09:32:13 +0000 (UTC) Received: from localhost (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 982FD51C7A; Tue, 27 Nov 2018 09:32:06 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 27 Nov 2018 13:28:01 +0400 Message-Id: <20181127092801.21777-29-marcandre.lureau@redhat.com> In-Reply-To: <20181127092801.21777-1-marcandre.lureau@redhat.com> References: <20181127092801.21777-1-marcandre.lureau@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.38]); Tue, 27 Nov 2018 09:32:13 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.2 v4 28/28] hostmem: use object id for memory region name with >= 3.1 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: imammedo@redhat.com, Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" hostmem-file and hostmem-memfd use the whole object path for the memory region name, and hostname-ram uses only the path component (the object id, or canonical path basename): qemu -m 1024 -object memory-backend-file,id=3Dmem,size=3D1G,mem-path=3D/tmp= /foo -numa node,memdev=3Dmem -monitor stdio (qemu) info ramblock Block Name PSize Offset Used = Total /objects/mem 4 KiB 0x0000000000000000 0x0000000040000000 0x= 0000000040000000 qemu -m 1024 -object memory-backend-memfd,id=3Dmem,size=3D1G -numa node,mem= dev=3Dmem -monitor stdio (qemu) info ramblock Block Name PSize Offset Used = Total /objects/mem 4 KiB 0x0000000000000000 0x0000000040000000 0x= 0000000040000000 qemu -m 1024 -object memory-backend-ram,id=3Dmem,size=3D1G -numa node,memde= v=3Dmem -monitor stdio (qemu) info ramblock Block Name PSize Offset Used = Total mem 4 KiB 0x0000000000000000 0x0000000040000000 0x= 0000000040000000 Use the object id for -file and -memfd with >=3D 3.1 for consistency. Having a consistent naming allow to migrate to different hostmem backends. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/compat.h | 10 +++++++++- include/sysemu/hostmem.h | 3 ++- backends/hostmem-file.c | 8 ++++---- backends/hostmem-memfd.c | 2 +- backends/hostmem-ram.c | 9 ++++----- backends/hostmem.c | 31 +++++++++++++++++++++++++++++++ 6 files changed, 51 insertions(+), 12 deletions(-) diff --git a/include/hw/compat.h b/include/hw/compat.h index 70958328fe..99cf6b1e03 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -2,7 +2,15 @@ #define HW_COMPAT_H =20 #define HW_COMPAT_3_1 \ - /* empty */ + {\ + .driver =3D "memory-backend-file",\ + .property =3D "x-use-canonical-path-for-ramblock-id",\ + .value =3D "true",\ + },{\ + .driver =3D "memory-backend-memfd",\ + .property =3D "x-use-canonical-path-for-ramblock-id",\ + .value =3D "true",\ + }, =20 #define HW_COMPAT_3_0 \ /* empty */ diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index 6e6bd2c1cb..a023b372a4 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -53,7 +53,7 @@ struct HostMemoryBackend { =20 /* protected */ uint64_t size; - bool merge, dump; + bool merge, dump, use_canonical_path; bool prealloc, force_prealloc, is_mapped, share; DECLARE_BITMAP(host_nodes, MAX_NODES + 1); HostMemPolicy policy; @@ -67,5 +67,6 @@ MemoryRegion *host_memory_backend_get_memory(HostMemoryBa= ckend *backend); void host_memory_backend_set_mapped(HostMemoryBackend *backend, bool mappe= d); bool host_memory_backend_is_mapped(HostMemoryBackend *backend); size_t host_memory_backend_pagesize(HostMemoryBackend *memdev); +char *host_memory_backend_get_name(HostMemoryBackend *backend); =20 #endif diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 639c8d4307..c01a7cdf8d 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -55,16 +55,16 @@ file_backend_memory_alloc(HostMemoryBackend *backend, E= rror **errp) error_setg(errp, "-mem-path not supported on this host"); #else if (!host_memory_backend_mr_inited(backend)) { - gchar *path; + gchar *name; backend->force_prealloc =3D mem_prealloc; - path =3D object_get_canonical_path(OBJECT(backend)); + name =3D host_memory_backend_get_name(backend); memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), - path, + name, backend->size, fb->align, (backend->share ? RAM_SHARED : 0) | (fb->is_pmem ? RAM_PMEM : 0), fb->mem_path, errp); - g_free(path); + g_free(name); } #endif } diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index b6836b28e5..c5a4a9b530 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -57,7 +57,7 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Er= ror **errp) return; } =20 - name =3D object_get_canonical_path(OBJECT(backend)); + name =3D host_memory_backend_get_name(backend); memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name, backend->size, true, fd, errp); g_free(name); diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c index 7ddd08d370..24b65d9ae3 100644 --- a/backends/hostmem-ram.c +++ b/backends/hostmem-ram.c @@ -16,21 +16,20 @@ =20 #define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram" =20 - static void ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { - char *path; + char *name; =20 if (!backend->size) { error_setg(errp, "can't create backend with size 0"); return; } =20 - path =3D object_get_canonical_path_component(OBJECT(backend)); - memory_region_init_ram_shared_nomigrate(&backend->mr, OBJECT(backend),= path, + name =3D host_memory_backend_get_name(backend); + memory_region_init_ram_shared_nomigrate(&backend->mr, OBJECT(backend),= name, backend->size, backend->share, errp); - g_free(path); + g_free(name); } =20 static void diff --git a/backends/hostmem.c b/backends/hostmem.c index 1a89342039..35c665fca2 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -28,6 +28,16 @@ QEMU_BUILD_BUG_ON(HOST_MEM_POLICY_BIND !=3D MPOL_BIND); QEMU_BUILD_BUG_ON(HOST_MEM_POLICY_INTERLEAVE !=3D MPOL_INTERLEAVE); #endif =20 +char * +host_memory_backend_get_name(HostMemoryBackend *self) +{ + if (!self->use_canonical_path) { + return object_get_canonical_path_component(OBJECT(self)); + } + + return object_get_canonical_path(OBJECT(self)); +} + static void host_memory_backend_get_size(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -386,6 +396,23 @@ static void host_memory_backend_set_share(Object *o, b= ool value, Error **errp) backend->share =3D value; } =20 +static bool +host_memory_backend_get_use_canonical_path(Object *obj, Error **errp) +{ + HostMemoryBackend *self =3D MEMORY_BACKEND(obj); + + return self->use_canonical_path; +} + +static void +host_memory_backend_set_use_canonical_path(Object *obj, bool value, + Error **errp) +{ + HostMemoryBackend *self =3D MEMORY_BACKEND(obj); + + self->use_canonical_path =3D value; +} + static void host_memory_backend_class_init(ObjectClass *oc, void *data) { @@ -432,6 +459,9 @@ host_memory_backend_class_init(ObjectClass *oc, void *d= ata) &error_abort); object_class_property_set_description(oc, "share", "Mark the memory as private to QEMU or shared", &error_abort); + object_class_property_add_bool(oc, "x-use-canonical-path-for-ramblock-= id", + host_memory_backend_get_use_canonical_path, + host_memory_backend_set_use_canonical_path, &error_abort); } =20 static const TypeInfo host_memory_backend_info =3D { @@ -444,6 +474,7 @@ static const TypeInfo host_memory_backend_info =3D { .instance_init =3D host_memory_backend_init, .interfaces =3D (InterfaceInfo[]) { { TYPE_USER_CREATABLE }, + { TYPE_COMPAT_PROPS }, { } } }; --=20 2.20.0.rc1