From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, qemu-s390x@nongnu.org, qemu-ppc@nongnu.org,
qemu-block@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Chris Wulff" <crwulff@gmail.com>, "Marek Vasut" <marex@denx.de>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Cédric Le Goater" <clg@kaod.org>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>
Subject: [PATCH 21/21] hw: Add QOM parentship relation with CPUs
Date: Fri, 16 Feb 2024 12:03:12 +0100 [thread overview]
Message-ID: <20240216110313.17039-22-philmd@linaro.org> (raw)
In-Reply-To: <20240216110313.17039-1-philmd@linaro.org>
QDev objects created with object_new() need to manually add
their parent relationship with object_property_add_child().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/x86.c | 1 +
hw/microblaze/petalogix_ml605_mmu.c | 1 +
hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 +
hw/mips/cps.c | 1 +
hw/nios2/10m50_devboard.c | 1 +
hw/ppc/e500.c | 1 +
hw/ppc/spapr.c | 1 +
7 files changed, 7 insertions(+)
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 684dce90e9..7021419d91 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -102,6 +102,7 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) {
goto out;
}
+ object_property_add_child(OBJECT(x86ms), "cpu[*]", OBJECT(cpu));
qdev_realize(DEVICE(cpu), NULL, errp);
out:
diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
index 0f5fabc32e..dfd881322d 100644
--- a/hw/microblaze/petalogix_ml605_mmu.c
+++ b/hw/microblaze/petalogix_ml605_mmu.c
@@ -83,6 +83,7 @@ petalogix_ml605_init(MachineState *machine)
/* init CPUs */
cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+ object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
object_property_set_str(OBJECT(cpu), "version", "8.10.a", &error_abort);
/* Use FPU but don't use floating point conversion and square
* root instructions
diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
index dad46bd7f9..255d8d4d47 100644
--- a/hw/microblaze/petalogix_s3adsp1800_mmu.c
+++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c
@@ -70,6 +70,7 @@ petalogix_s3adsp1800_init(MachineState *machine)
MemoryRegion *sysmem = get_system_memory();
cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
+ object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
object_property_set_str(OBJECT(cpu), "version", "7.10.d", &error_abort);
qdev_realize(DEVICE(cpu), NULL, &error_abort);
diff --git a/hw/mips/cps.c b/hw/mips/cps.c
index 07b73b0a1f..6b4e918807 100644
--- a/hw/mips/cps.c
+++ b/hw/mips/cps.c
@@ -84,6 +84,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
/* All cores use the same clock tree */
qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock);
+ object_property_add_child(OBJECT(dev), "cpu[*]", OBJECT(cpu));
if (!qdev_realize_and_unref(DEVICE(cpu), NULL, errp)) {
return;
}
diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
index 6cb32f777b..f6a691d340 100644
--- a/hw/nios2/10m50_devboard.c
+++ b/hw/nios2/10m50_devboard.c
@@ -95,6 +95,7 @@ static void nios2_10m50_ghrd_init(MachineState *machine)
cpu->exception_addr = 0xc8000120;
cpu->fast_tlb_miss_addr = 0xc0000100;
+ object_property_add_child(OBJECT(machine), "cpu", OBJECT(cpu));
qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal);
if (nms->vic) {
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 3bd12b54ab..77b7d2858c 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -956,6 +956,7 @@ void ppce500_init(MachineState *machine)
*/
object_property_set_bool(OBJECT(cs), "start-powered-off", i != 0,
&error_abort);
+ object_property_add_child(OBJECT(machine), "cpu[*]", OBJECT(cpu));
qdev_realize_and_unref(DEVICE(cs), NULL, &error_fatal);
if (!firstenv) {
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 0d72d286d8..b6e5caa0d2 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2715,6 +2715,7 @@ static void spapr_init_cpus(SpaprMachineState *spapr)
&error_fatal);
object_property_set_int(core, CPU_CORE_PROP_CORE_ID, core_id,
&error_fatal);
+ object_property_add_child(OBJECT(spapr), "cpu[*]", OBJECT(core));
qdev_realize(DEVICE(core), NULL, &error_fatal);
object_unref(core);
--
2.41.0
next prev parent reply other threads:[~2024-02-16 11:09 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 11:02 [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
2024-02-16 11:02 ` [PATCH 01/21] hw/i386/pc: Do not use C99 mixed-declarations style Philippe Mathieu-Daudé
2024-02-22 9:12 ` Zhao Liu
2024-02-22 10:10 ` Philippe Mathieu-Daudé
2024-02-16 11:02 ` [PATCH 02/21] hw/i386/pc_sysfw: Use qdev_is_realized() instead of QOM API Philippe Mathieu-Daudé
2024-02-22 9:16 ` Zhao Liu
2024-02-16 11:02 ` [PATCH 03/21] hw/ppc/spapr_cpu: " Philippe Mathieu-Daudé
2024-02-22 9:56 ` Zhao Liu
2024-02-16 11:02 ` [PATCH 04/21] hw/tricore/testboard: Use qdev_new() instead of QOM basic API Philippe Mathieu-Daudé
2024-02-19 11:59 ` Bastian Koppelmann
2024-02-16 11:02 ` [PATCH 05/21] hw/ppc/pnv_bmc: Use qdev_new() instead of QOM API Philippe Mathieu-Daudé
2024-02-16 11:08 ` Cédric Le Goater
2024-02-16 11:02 ` [PATCH 06/21] hw: Replace DEVICE(object_new) -> qdev_new() Philippe Mathieu-Daudé
2024-02-22 9:50 ` Zhao Liu
2024-02-16 11:02 ` [PATCH 07/21] target: " Philippe Mathieu-Daudé
2024-02-22 9:54 ` Zhao Liu
2024-02-16 11:02 ` [PATCH 08/21] hw/isa: Inline isa_try_new() Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 09/21] hw/usb: Inline usb_try_new() Philippe Mathieu-Daudé
2024-02-22 9:53 ` Zhao Liu
2024-02-16 11:03 ` [PATCH 10/21] hw/usb: Inline usb_new() Philippe Mathieu-Daudé
2024-02-22 9:55 ` Zhao Liu
2024-02-16 11:03 ` [PATCH 11/21] hw/usb: Add QOM parentship relation with hub devices Philippe Mathieu-Daudé
2024-02-22 9:49 ` Zhao Liu
2024-02-16 11:03 ` [PATCH 12/21] hw/pci-host/q35: Update q35_host_props[] comment Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 13/21] hw/pci-host/raven: Embedded OrIRQ in PRePPCIState Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 14/21] hw/pci-host/raven: Prefer object_initialize_child over object_initialize Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 15/21] hw/core/register: " Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 16/21] hw/net/can/versal: " Philippe Mathieu-Daudé
2024-02-23 11:06 ` Francisco Iglesias
2024-02-23 12:23 ` Pavel Pisa via
2025-08-21 13:33 ` Peter Maydell
2024-02-16 11:03 ` [PATCH 17/21] hw/i386/iommu: " Philippe Mathieu-Daudé
2024-02-22 9:24 ` Zhao Liu
2024-02-16 11:03 ` [PATCH 18/21] hw/pci-host/versatile: Replace object_initialize() -> _child() Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 19/21] hw/s390x/zpci-bus: Add QOM parentship relation with zPCI devices Philippe Mathieu-Daudé
2024-02-19 13:38 ` Thomas Huth
2024-02-19 14:37 ` Philippe Mathieu-Daudé
2024-02-16 11:03 ` [PATCH 20/21] hw/arm/mps2: Add QOM parentship relation with OR IRQ gates Philippe Mathieu-Daudé
2024-02-16 11:03 ` Philippe Mathieu-Daudé [this message]
2024-02-22 9:59 ` [PATCH 21/21] hw: Add QOM parentship relation with CPUs Zhao Liu
2025-01-12 17:23 ` [PATCH 00/21] hw: More QDev cleanups Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240216110313.17039-22-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=clg@kaod.org \
--cc=crwulff@gmail.com \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=harshpb@linux.ibm.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=marex@denx.de \
--cc=mst@redhat.com \
--cc=npiggin@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).