* [PATCH 1/5] hw/arm/fsl-imx8mp: Do not create redundant unimplemented devices
2026-03-08 20:35 [PATCH 0/5] Trivial cleanup Bernhard Beschow
@ 2026-03-08 20:35 ` Bernhard Beschow
2026-04-28 9:46 ` Peter Maydell
2026-03-08 20:35 ` [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region Bernhard Beschow
` (5 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Bernhard Beschow @ 2026-03-08 20:35 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Laurent Vivier, qemu-trivial,
qemu-arm, Michael Tokarev, Daniel P. Berrangé, Peter Maydell,
Bernhard Beschow, Gaurav Sharma
The GPT devices are implemented. No need to create redundant
unimplemented devices.
Fixes: f8b26121762c ("hw/arm/fsl-imx8mp: Implement general purpose
timers")
cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/arm/fsl-imx8mp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/arm/fsl-imx8mp.c b/hw/arm/fsl-imx8mp.c
index 79f9142777..0119a18416 100644
--- a/hw/arm/fsl-imx8mp.c
+++ b/hw/arm/fsl-imx8mp.c
@@ -688,6 +688,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
case FSL_IMX8MP_GIC_DIST:
case FSL_IMX8MP_GIC_REDIST:
case FSL_IMX8MP_GPIO1 ... FSL_IMX8MP_GPIO5:
+ case FSL_IMX8MP_GPT1 ... FSL_IMX8MP_GPT6:
case FSL_IMX8MP_ECSPI1 ... FSL_IMX8MP_ECSPI3:
case FSL_IMX8MP_ENET1:
case FSL_IMX8MP_I2C1 ... FSL_IMX8MP_I2C6:
--
2.53.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 1/5] hw/arm/fsl-imx8mp: Do not create redundant unimplemented devices
2026-03-08 20:35 ` [PATCH 1/5] hw/arm/fsl-imx8mp: Do not create redundant unimplemented devices Bernhard Beschow
@ 2026-04-28 9:46 ` Peter Maydell
0 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2026-04-28 9:46 UTC (permalink / raw)
To: Bernhard Beschow
Cc: qemu-devel, Eduardo Habkost, Paolo Bonzini, Laurent Vivier,
qemu-trivial, qemu-arm, Michael Tokarev, Daniel P. Berrangé,
Gaurav Sharma
On Sun, 8 Mar 2026 at 20:35, Bernhard Beschow <shentey@gmail.com> wrote:
>
> The GPT devices are implemented. No need to create redundant
> unimplemented devices.
>
> Fixes: f8b26121762c ("hw/arm/fsl-imx8mp: Implement general purpose
> timers")
> cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region
2026-03-08 20:35 [PATCH 0/5] Trivial cleanup Bernhard Beschow
2026-03-08 20:35 ` [PATCH 1/5] hw/arm/fsl-imx8mp: Do not create redundant unimplemented devices Bernhard Beschow
@ 2026-03-08 20:35 ` Bernhard Beschow
2026-03-10 9:54 ` Markus Armbruster
2026-03-10 10:00 ` Peter Maydell
2026-03-08 20:35 ` [PATCH 3/5] hw/arm/imx8mp-evk: Fix reference count of SoC object Bernhard Beschow
` (4 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Bernhard Beschow @ 2026-03-08 20:35 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Laurent Vivier, qemu-trivial,
qemu-arm, Michael Tokarev, Daniel P. Berrangé, Peter Maydell,
Bernhard Beschow, Gaurav Sharma
Rather than having a NULL parent, let the containing SoC object be the
parent. This cleans up the QOM composition tree a bit.
Fixes: 1aaf3478684f ("hw/arm/fsl-imx8mp: Add on-chip RAM")
cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/arm/fsl-imx8mp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/arm/fsl-imx8mp.c b/hw/arm/fsl-imx8mp.c
index 0119a18416..839c925e4a 100644
--- a/hw/arm/fsl-imx8mp.c
+++ b/hw/arm/fsl-imx8mp.c
@@ -671,7 +671,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
fsl_imx8mp_memmap[FSL_IMX8MP_PCIE_PHY1].addr);
/* On-Chip RAM */
- if (!memory_region_init_ram(&s->ocram, NULL, "imx8mp.ocram",
+ if (!memory_region_init_ram(&s->ocram, OBJECT(dev), "imx8mp.ocram",
fsl_imx8mp_memmap[FSL_IMX8MP_OCRAM].size,
errp)) {
return;
--
2.53.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region
2026-03-08 20:35 ` [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region Bernhard Beschow
@ 2026-03-10 9:54 ` Markus Armbruster
2026-03-10 10:00 ` Peter Maydell
1 sibling, 0 replies; 20+ messages in thread
From: Markus Armbruster @ 2026-03-10 9:54 UTC (permalink / raw)
To: Bernhard Beschow
Cc: qemu-devel, Eduardo Habkost, Paolo Bonzini, Laurent Vivier,
qemu-trivial, qemu-arm, Michael Tokarev, Daniel P. Berrangé,
Peter Maydell, Gaurav Sharma
Bernhard Beschow <shentey@gmail.com> writes:
> Rather than having a NULL parent, let the containing SoC object be the
> parent. This cleans up the QOM composition tree a bit.
>
> Fixes: 1aaf3478684f ("hw/arm/fsl-imx8mp: Add on-chip RAM")
> cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/arm/fsl-imx8mp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/fsl-imx8mp.c b/hw/arm/fsl-imx8mp.c
> index 0119a18416..839c925e4a 100644
> --- a/hw/arm/fsl-imx8mp.c
> +++ b/hw/arm/fsl-imx8mp.c
> @@ -671,7 +671,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
> fsl_imx8mp_memmap[FSL_IMX8MP_PCIE_PHY1].addr);
>
> /* On-Chip RAM */
> - if (!memory_region_init_ram(&s->ocram, NULL, "imx8mp.ocram",
> + if (!memory_region_init_ram(&s->ocram, OBJECT(dev), "imx8mp.ocram",
> fsl_imx8mp_memmap[FSL_IMX8MP_OCRAM].size,
> errp)) {
> return;
This moves /machine/unattached/imx8mp.ocram[0] to
/machine/soc/imx8mp.ocram[0], as expected.
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Aside: not sure why [0]. Might just be something memory regions do.
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region
2026-03-08 20:35 ` [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region Bernhard Beschow
2026-03-10 9:54 ` Markus Armbruster
@ 2026-03-10 10:00 ` Peter Maydell
2026-04-27 10:29 ` Bernhard Beschow
1 sibling, 1 reply; 20+ messages in thread
From: Peter Maydell @ 2026-03-10 10:00 UTC (permalink / raw)
To: Bernhard Beschow
Cc: qemu-devel, Eduardo Habkost, Paolo Bonzini, Laurent Vivier,
qemu-trivial, qemu-arm, Michael Tokarev, Daniel P. Berrangé,
Gaurav Sharma
On Sun, 8 Mar 2026 at 20:35, Bernhard Beschow <shentey@gmail.com> wrote:
>
> Rather than having a NULL parent, let the containing SoC object be the
> parent. This cleans up the QOM composition tree a bit.
>
> Fixes: ("hw/arm/fsl-imx8mp: Add on-chip RAM")
> cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/arm/fsl-imx8mp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/fsl-imx8mp.c b/hw/arm/fsl-imx8mp.c
> index 0119a18416..839c925e4a 100644
> --- a/hw/arm/fsl-imx8mp.c
> +++ b/hw/arm/fsl-imx8mp.c
> @@ -671,7 +671,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
> fsl_imx8mp_memmap[FSL_IMX8MP_PCIE_PHY1].addr);
>
> /* On-Chip RAM */
> - if (!memory_region_init_ram(&s->ocram, NULL, "imx8mp.ocram",
> + if (!memory_region_init_ram(&s->ocram, OBJECT(dev), "imx8mp.ocram",
> fsl_imx8mp_memmap[FSL_IMX8MP_OCRAM].size,
> errp)) {
> return;
This is a migration break, because qemu_ram_set_idstr()
includes the qdev path of the owning device when it
creates the name of the ramblock for migrating it.
But since we haven't released anything with this change in
it and this board isn't versioned either, that's not a problem.
-- PMM
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region
2026-03-10 10:00 ` Peter Maydell
@ 2026-04-27 10:29 ` Bernhard Beschow
2026-04-27 12:13 ` Peter Maydell
0 siblings, 1 reply; 20+ messages in thread
From: Bernhard Beschow @ 2026-04-27 10:29 UTC (permalink / raw)
To: Peter Maydell
Cc: qemu-devel, Eduardo Habkost, Paolo Bonzini, Laurent Vivier,
qemu-trivial, qemu-arm, Michael Tokarev, Daniel P. Berrangé,
Gaurav Sharma
Am 10. März 2026 10:00:31 UTC schrieb Peter Maydell <peter.maydell@linaro.org>:
>On Sun, 8 Mar 2026 at 20:35, Bernhard Beschow <shentey@gmail.com> wrote:
>>
>> Rather than having a NULL parent, let the containing SoC object be the
>> parent. This cleans up the QOM composition tree a bit.
>>
>> Fixes: ("hw/arm/fsl-imx8mp: Add on-chip RAM")
>> cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>> ---
>> hw/arm/fsl-imx8mp.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/arm/fsl-imx8mp.c b/hw/arm/fsl-imx8mp.c
>> index 0119a18416..839c925e4a 100644
>> --- a/hw/arm/fsl-imx8mp.c
>> +++ b/hw/arm/fsl-imx8mp.c
>> @@ -671,7 +671,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
>> fsl_imx8mp_memmap[FSL_IMX8MP_PCIE_PHY1].addr);
>>
>> /* On-Chip RAM */
>> - if (!memory_region_init_ram(&s->ocram, NULL, "imx8mp.ocram",
>> + if (!memory_region_init_ram(&s->ocram, OBJECT(dev), "imx8mp.ocram",
>> fsl_imx8mp_memmap[FSL_IMX8MP_OCRAM].size,
>> errp)) {
>> return;
>
>
>This is a migration break, because qemu_ram_set_idstr()
>includes the qdev path of the owning device when it
>creates the name of the ramblock for migrating it.
>But since we haven't released anything with this change in
>it and this board isn't versioned either, that's not a problem.
Do we still need to catch that? If so, how?
>
>-- PMM
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region
2026-04-27 10:29 ` Bernhard Beschow
@ 2026-04-27 12:13 ` Peter Maydell
0 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2026-04-27 12:13 UTC (permalink / raw)
To: Bernhard Beschow
Cc: qemu-devel, Eduardo Habkost, Paolo Bonzini, Laurent Vivier,
qemu-trivial, qemu-arm, Michael Tokarev, Daniel P. Berrangé,
Gaurav Sharma
On Mon, 27 Apr 2026 at 13:09, Bernhard Beschow <shentey@gmail.com> wrote:
>
>
>
> Am 10. März 2026 10:00:31 UTC schrieb Peter Maydell <peter.maydell@linaro.org>:
> >On Sun, 8 Mar 2026 at 20:35, Bernhard Beschow <shentey@gmail.com> wrote:
> >>
> >> Rather than having a NULL parent, let the containing SoC object be the
> >> parent. This cleans up the QOM composition tree a bit.
> >>
> >> Fixes: ("hw/arm/fsl-imx8mp: Add on-chip RAM")
> >> cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
> >> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> >> ---
> >> hw/arm/fsl-imx8mp.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/hw/arm/fsl-imx8mp.c b/hw/arm/fsl-imx8mp.c
> >> index 0119a18416..839c925e4a 100644
> >> --- a/hw/arm/fsl-imx8mp.c
> >> +++ b/hw/arm/fsl-imx8mp.c
> >> @@ -671,7 +671,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error **errp)
> >> fsl_imx8mp_memmap[FSL_IMX8MP_PCIE_PHY1].addr);
> >>
> >> /* On-Chip RAM */
> >> - if (!memory_region_init_ram(&s->ocram, NULL, "imx8mp.ocram",
> >> + if (!memory_region_init_ram(&s->ocram, OBJECT(dev), "imx8mp.ocram",
> >> fsl_imx8mp_memmap[FSL_IMX8MP_OCRAM].size,
> >> errp)) {
> >> return;
> >
> >
> >This is a migration break, because qemu_ram_set_idstr()
> >includes the qdev path of the owning device when it
> >creates the name of the ramblock for migrating it.
> >But since we haven't released anything with this change in
> >it and this board isn't versioned either, that's not a problem.
>
> Do we still need to catch that? If so, how?
The code change is fine; we just need to mention in the commit message
that it's a migration compat break but that it's OK to do that for this
board because it isn't versioned.
-- PMM
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 3/5] hw/arm/imx8mp-evk: Fix reference count of SoC object
2026-03-08 20:35 [PATCH 0/5] Trivial cleanup Bernhard Beschow
2026-03-08 20:35 ` [PATCH 1/5] hw/arm/fsl-imx8mp: Do not create redundant unimplemented devices Bernhard Beschow
2026-03-08 20:35 ` [PATCH 2/5] hw/arm/fsl-imx8mp: Fix parent of ocram memory region Bernhard Beschow
@ 2026-03-08 20:35 ` Bernhard Beschow
2026-04-28 9:51 ` Peter Maydell
2026-04-30 15:39 ` Peter Maydell
2026-03-08 20:35 ` [PATCH 4/5] system/vl: Fix reference count of machine object Bernhard Beschow
` (3 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Bernhard Beschow @ 2026-03-08 20:35 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Laurent Vivier, qemu-trivial,
qemu-arm, Michael Tokarev, Daniel P. Berrangé, Peter Maydell,
Bernhard Beschow, Gaurav Sharma
object_new() leaves a reference count of one, and object_property_add_child()
then leaves it at two. This would leak the SoC object if the machine object was
destroyed since the machine is the SoC's sole owner. Fix this by converting to
object_new_with_props() which gets the parenting and reference count right in
one go.
Fixes: a4eefc69b237 ("hw/arm: Add i.MX 8M Plus EVK board")
cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/arm/imx8mp-evk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/arm/imx8mp-evk.c b/hw/arm/imx8mp-evk.c
index b84ac91a17..cfc3038c36 100644
--- a/hw/arm/imx8mp-evk.c
+++ b/hw/arm/imx8mp-evk.c
@@ -74,8 +74,8 @@ static void imx8mp_evk_init(MachineState *machine)
.modify_dtb = imx8mp_evk_modify_dtb,
};
- s = FSL_IMX8MP(object_new(TYPE_FSL_IMX8MP));
- object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
+ s = FSL_IMX8MP(object_new_with_props(TYPE_FSL_IMX8MP, OBJECT(machine),
+ "soc", &error_fatal, NULL));
object_property_set_uint(OBJECT(s), "fec1-phy-num", 1, &error_fatal);
sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal);
--
2.53.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 3/5] hw/arm/imx8mp-evk: Fix reference count of SoC object
2026-03-08 20:35 ` [PATCH 3/5] hw/arm/imx8mp-evk: Fix reference count of SoC object Bernhard Beschow
@ 2026-04-28 9:51 ` Peter Maydell
2026-04-30 15:39 ` Peter Maydell
1 sibling, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2026-04-28 9:51 UTC (permalink / raw)
To: Bernhard Beschow
Cc: qemu-devel, Eduardo Habkost, Paolo Bonzini, Laurent Vivier,
qemu-trivial, qemu-arm, Michael Tokarev, Daniel P. Berrangé,
Gaurav Sharma
On Sun, 8 Mar 2026 at 20:35, Bernhard Beschow <shentey@gmail.com> wrote:
>
> object_new() leaves a reference count of one, and object_property_add_child()
> then leaves it at two. This would leak the SoC object if the machine object was
> destroyed since the machine is the SoC's sole owner. Fix this by converting to
> object_new_with_props() which gets the parenting and reference count right in
> one go.
>
> Fixes: a4eefc69b237 ("hw/arm: Add i.MX 8M Plus EVK board")
> cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/arm/imx8mp-evk.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/imx8mp-evk.c b/hw/arm/imx8mp-evk.c
> index b84ac91a17..cfc3038c36 100644
> --- a/hw/arm/imx8mp-evk.c
> +++ b/hw/arm/imx8mp-evk.c
> @@ -74,8 +74,8 @@ static void imx8mp_evk_init(MachineState *machine)
> .modify_dtb = imx8mp_evk_modify_dtb,
> };
>
> - s = FSL_IMX8MP(object_new(TYPE_FSL_IMX8MP));
> - object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
> + s = FSL_IMX8MP(object_new_with_props(TYPE_FSL_IMX8MP, OBJECT(machine),
> + "soc", &error_fatal, NULL));
> object_property_set_uint(OBJECT(s), "fec1-phy-num", 1, &error_fatal);
> sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal);
There are more boards doing this as object_new / add_child / unref
than with object_new_with_props(), but doing it in one call seems
better than three.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 3/5] hw/arm/imx8mp-evk: Fix reference count of SoC object
2026-03-08 20:35 ` [PATCH 3/5] hw/arm/imx8mp-evk: Fix reference count of SoC object Bernhard Beschow
2026-04-28 9:51 ` Peter Maydell
@ 2026-04-30 15:39 ` Peter Maydell
2026-05-05 20:53 ` Bernhard Beschow
1 sibling, 1 reply; 20+ messages in thread
From: Peter Maydell @ 2026-04-30 15:39 UTC (permalink / raw)
To: Bernhard Beschow
Cc: qemu-devel, Eduardo Habkost, Paolo Bonzini, Laurent Vivier,
qemu-trivial, qemu-arm, Michael Tokarev, Daniel P. Berrangé,
Gaurav Sharma
On Sun, 8 Mar 2026 at 20:35, Bernhard Beschow <shentey@gmail.com> wrote:
>
> object_new() leaves a reference count of one, and object_property_add_child()
> then leaves it at two. This would leak the SoC object if the machine object was
> destroyed since the machine is the SoC's sole owner. Fix this by converting to
> object_new_with_props() which gets the parenting and reference count right in
> one go.
>
> Fixes: a4eefc69b237 ("hw/arm: Add i.MX 8M Plus EVK board")
> cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> hw/arm/imx8mp-evk.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/imx8mp-evk.c b/hw/arm/imx8mp-evk.c
> index b84ac91a17..cfc3038c36 100644
> --- a/hw/arm/imx8mp-evk.c
> +++ b/hw/arm/imx8mp-evk.c
> @@ -74,8 +74,8 @@ static void imx8mp_evk_init(MachineState *machine)
> .modify_dtb = imx8mp_evk_modify_dtb,
> };
>
> - s = FSL_IMX8MP(object_new(TYPE_FSL_IMX8MP));
> - object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
> + s = FSL_IMX8MP(object_new_with_props(TYPE_FSL_IMX8MP, OBJECT(machine),
> + "soc", &error_fatal, NULL));
> object_property_set_uint(OBJECT(s), "fec1-phy-num", 1, &error_fatal);
> sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal);
Looking again at this, is this really right?
object_property_add_child(...) creates the object (refcount 1),
adds it as a child of the specified parent (refcount 2), then
does object_unref() (refcount 1). Then in this code we call
sysbus_realize_and_unref(), which calls qdev_realize_and_unref().
That function:
* (indirectly) calls bus_add_child(), which takes a reference and
hands it to the link property on the parent (refcount 2)
* calls object_unref(), as its name suggests (refcount 1)
So now we have the object with refcount 1, so it doesn't just
vanish, but on the other hand both the QOM tree parent and the
qbus tree parent think they own a reference to the object,
so our refcount is wrong.
I think the existing code here was correct: we get a reference
because we call object_new(), and then we drop it by calling
the realize_and_unref function.
I'm going to drop this patch from target-arm.next.
-- PMM
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 3/5] hw/arm/imx8mp-evk: Fix reference count of SoC object
2026-04-30 15:39 ` Peter Maydell
@ 2026-05-05 20:53 ` Bernhard Beschow
0 siblings, 0 replies; 20+ messages in thread
From: Bernhard Beschow @ 2026-05-05 20:53 UTC (permalink / raw)
To: Peter Maydell
Cc: qemu-devel, Eduardo Habkost, Paolo Bonzini, Laurent Vivier,
qemu-trivial, qemu-arm, Michael Tokarev, Daniel P. Berrangé,
Gaurav Sharma
Am 30. April 2026 15:39:48 UTC schrieb Peter Maydell <peter.maydell@linaro.org>:
>On Sun, 8 Mar 2026 at 20:35, Bernhard Beschow <shentey@gmail.com> wrote:
>>
>> object_new() leaves a reference count of one, and object_property_add_child()
>> then leaves it at two. This would leak the SoC object if the machine object was
>> destroyed since the machine is the SoC's sole owner. Fix this by converting to
>> object_new_with_props() which gets the parenting and reference count right in
>> one go.
>>
>> Fixes: a4eefc69b237 ("hw/arm: Add i.MX 8M Plus EVK board")
>> cc: Gaurav Sharma <gaurav.sharma_7@nxp.com>
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>> ---
>> hw/arm/imx8mp-evk.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/arm/imx8mp-evk.c b/hw/arm/imx8mp-evk.c
>> index b84ac91a17..cfc3038c36 100644
>> --- a/hw/arm/imx8mp-evk.c
>> +++ b/hw/arm/imx8mp-evk.c
>> @@ -74,8 +74,8 @@ static void imx8mp_evk_init(MachineState *machine)
>> .modify_dtb = imx8mp_evk_modify_dtb,
>> };
>>
>> - s = FSL_IMX8MP(object_new(TYPE_FSL_IMX8MP));
>> - object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
>> + s = FSL_IMX8MP(object_new_with_props(TYPE_FSL_IMX8MP, OBJECT(machine),
>> + "soc", &error_fatal, NULL));
>> object_property_set_uint(OBJECT(s), "fec1-phy-num", 1, &error_fatal);
>> sysbus_realize_and_unref(SYS_BUS_DEVICE(s), &error_fatal);
>
>Looking again at this, is this really right?
>object_property_add_child(...) creates the object (refcount 1),
>adds it as a child of the specified parent (refcount 2), then
>does object_unref() (refcount 1). Then in this code we call
>sysbus_realize_and_unref(), which calls qdev_realize_and_unref().
>That function:
> * (indirectly) calls bus_add_child(), which takes a reference and
> hands it to the link property on the parent (refcount 2)
> * calls object_unref(), as its name suggests (refcount 1)
>
>So now we have the object with refcount 1, so it doesn't just
>vanish, but on the other hand both the QOM tree parent and the
>qbus tree parent think they own a reference to the object,
>so our refcount is wrong.
>
>I think the existing code here was correct: we get a reference
>because we call object_new(), and then we drop it by calling
>the realize_and_unref function.
>
>I'm going to drop this patch from target-arm.next.
Yeah, makes sense. Thanks foe the clarification.
We'll need to fix imx8mm-evk now since it uses the same broken pattern (I cc'd Gurav who incorporated this patch into his series). I'll send a fix.
Best regards,
Bernhard
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 4/5] system/vl: Fix reference count of machine object
2026-03-08 20:35 [PATCH 0/5] Trivial cleanup Bernhard Beschow
` (2 preceding siblings ...)
2026-03-08 20:35 ` [PATCH 3/5] hw/arm/imx8mp-evk: Fix reference count of SoC object Bernhard Beschow
@ 2026-03-08 20:35 ` Bernhard Beschow
2026-03-08 20:35 ` [PATCH 5/5] Revert "sysbus: add irq_routing_notifier" Bernhard Beschow
` (2 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: Bernhard Beschow @ 2026-03-08 20:35 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Laurent Vivier, qemu-trivial,
qemu-arm, Michael Tokarev, Daniel P. Berrangé, Peter Maydell,
Bernhard Beschow
object_new_with_class() and object_property_add_child() leave a reference count
of two while the QOM root is the sole owner. Fix the reference count to be one
by calling object_unref() once.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
system/vl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/system/vl.c b/system/vl.c
index 38d7b849e0..91b390dafd 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -2197,6 +2197,7 @@ static void qemu_create_machine(QDict *qdict)
current_machine = MACHINE(object_new_with_class(OBJECT_CLASS(machine_class)));
object_property_add_child(object_get_root(), "machine",
OBJECT(current_machine));
+ object_unref(current_machine);
qemu_create_machine_containers(OBJECT(current_machine));
object_property_add_child(machine_get_container("unattached"),
"sysbus", OBJECT(sysbus_get_default()));
--
2.53.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 5/5] Revert "sysbus: add irq_routing_notifier"
2026-03-08 20:35 [PATCH 0/5] Trivial cleanup Bernhard Beschow
` (3 preceding siblings ...)
2026-03-08 20:35 ` [PATCH 4/5] system/vl: Fix reference count of machine object Bernhard Beschow
@ 2026-03-08 20:35 ` Bernhard Beschow
2026-03-09 9:19 ` Cédric Le Goater
2026-03-08 21:27 ` [PATCH 0/5] Trivial cleanup Bernhard Beschow
2026-04-30 10:42 ` Peter Maydell
6 siblings, 1 reply; 20+ messages in thread
From: Bernhard Beschow @ 2026-03-08 20:35 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Laurent Vivier, qemu-trivial,
qemu-arm, Michael Tokarev, Daniel P. Berrangé, Peter Maydell,
Bernhard Beschow, Cédric Le Goater
The callback has been introduced in commit 715ca691daca ("sysbus: add
irq_routing_notifier") for use in VFIO platform. Meanwhile, VFIO
platform has been removed via commit 762c85543948 ("vfio: Remove 'vfio-
platform'") which was its only user. Remove this unused code.
This reverts commit 715ca691daca081108b33306faa6fa102f0df8d8.
cc: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
include/hw/core/sysbus.h | 1 -
hw/core/sysbus.c | 6 ------
2 files changed, 7 deletions(-)
diff --git a/include/hw/core/sysbus.h b/include/hw/core/sysbus.h
index c0d18d9e00..f3c4259d29 100644
--- a/include/hw/core/sysbus.h
+++ b/include/hw/core/sysbus.h
@@ -50,7 +50,6 @@ struct SysBusDeviceClass {
* omitted then. (This is not considered a fatal error.)
*/
char *(*explicit_ofw_unit_address)(const SysBusDevice *dev);
- void (*connect_irq_notifier)(SysBusDevice *dev, qemu_irq irq);
};
struct SysBusDevice {
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 3adf2f2faf..3e1160ee92 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -104,13 +104,7 @@ qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n)
void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
{
- SysBusDeviceClass *sbd = SYS_BUS_DEVICE_GET_CLASS(dev);
-
qdev_connect_gpio_out_named(DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ, n, irq);
-
- if (sbd->connect_irq_notifier) {
- sbd->connect_irq_notifier(dev, irq);
- }
}
/* Check whether an MMIO region exists */
--
2.53.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 5/5] Revert "sysbus: add irq_routing_notifier"
2026-03-08 20:35 ` [PATCH 5/5] Revert "sysbus: add irq_routing_notifier" Bernhard Beschow
@ 2026-03-09 9:19 ` Cédric Le Goater
2026-04-27 10:30 ` Bernhard Beschow
0 siblings, 1 reply; 20+ messages in thread
From: Cédric Le Goater @ 2026-03-09 9:19 UTC (permalink / raw)
To: Bernhard Beschow, qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Laurent Vivier, qemu-trivial,
qemu-arm, Michael Tokarev, Daniel P. Berrangé, Peter Maydell
On 3/8/26 21:35, Bernhard Beschow wrote:
> The callback has been introduced in commit 715ca691daca ("sysbus: add
> irq_routing_notifier") for use in VFIO platform. Meanwhile, VFIO
> platform has been removed via commit 762c85543948 ("vfio: Remove 'vfio-
> platform'") which was its only user. Remove this unused code.
>
> This reverts commit 715ca691daca081108b33306faa6fa102f0df8d8.
>
> cc: Cédric Le Goater <clg@redhat.com>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> include/hw/core/sysbus.h | 1 -
> hw/core/sysbus.c | 6 ------
> 2 files changed, 7 deletions(-)
>
> diff --git a/include/hw/core/sysbus.h b/include/hw/core/sysbus.h
> index c0d18d9e00..f3c4259d29 100644
> --- a/include/hw/core/sysbus.h
> +++ b/include/hw/core/sysbus.h
> @@ -50,7 +50,6 @@ struct SysBusDeviceClass {
> * omitted then. (This is not considered a fatal error.)
> */
> char *(*explicit_ofw_unit_address)(const SysBusDevice *dev);
> - void (*connect_irq_notifier)(SysBusDevice *dev, qemu_irq irq);
> };
>
> struct SysBusDevice {
> diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
> index 3adf2f2faf..3e1160ee92 100644
> --- a/hw/core/sysbus.c
> +++ b/hw/core/sysbus.c
> @@ -104,13 +104,7 @@ qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n)
>
> void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
> {
> - SysBusDeviceClass *sbd = SYS_BUS_DEVICE_GET_CLASS(dev);
> -
> qdev_connect_gpio_out_named(DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ, n, irq);
> -
> - if (sbd->connect_irq_notifier) {
> - sbd->connect_irq_notifier(dev, irq);
> - }
> }
>
> /* Check whether an MMIO region exists */
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 5/5] Revert "sysbus: add irq_routing_notifier"
2026-03-09 9:19 ` Cédric Le Goater
@ 2026-04-27 10:30 ` Bernhard Beschow
2026-05-04 9:51 ` Cédric Le Goater
0 siblings, 1 reply; 20+ messages in thread
From: Bernhard Beschow @ 2026-04-27 10:30 UTC (permalink / raw)
To: Cédric Le Goater, qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Laurent Vivier, qemu-trivial,
qemu-arm, Michael Tokarev, Daniel P. Berrangé, Peter Maydell
Am 9. März 2026 09:19:10 UTC schrieb "Cédric Le Goater" <clg@redhat.com>:
>On 3/8/26 21:35, Bernhard Beschow wrote:
>> The callback has been introduced in commit 715ca691daca ("sysbus: add
>> irq_routing_notifier") for use in VFIO platform. Meanwhile, VFIO
>> platform has been removed via commit 762c85543948 ("vfio: Remove 'vfio-
>> platform'") which was its only user. Remove this unused code.
>>
>> This reverts commit 715ca691daca081108b33306faa6fa102f0df8d8.
>>
>> cc: Cédric Le Goater <clg@redhat.com>
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>> ---
>> include/hw/core/sysbus.h | 1 -
>> hw/core/sysbus.c | 6 ------
>> 2 files changed, 7 deletions(-)
>>
>> diff --git a/include/hw/core/sysbus.h b/include/hw/core/sysbus.h
>> index c0d18d9e00..f3c4259d29 100644
>> --- a/include/hw/core/sysbus.h
>> +++ b/include/hw/core/sysbus.h
>> @@ -50,7 +50,6 @@ struct SysBusDeviceClass {
>> * omitted then. (This is not considered a fatal error.)
>> */
>> char *(*explicit_ofw_unit_address)(const SysBusDevice *dev);
>> - void (*connect_irq_notifier)(SysBusDevice *dev, qemu_irq irq);
>> };
>> struct SysBusDevice {
>> diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
>> index 3adf2f2faf..3e1160ee92 100644
>> --- a/hw/core/sysbus.c
>> +++ b/hw/core/sysbus.c
>> @@ -104,13 +104,7 @@ qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n)
>> void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
>> {
>> - SysBusDeviceClass *sbd = SYS_BUS_DEVICE_GET_CLASS(dev);
>> -
>> qdev_connect_gpio_out_named(DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ, n, irq);
>> -
>> - if (sbd->connect_irq_notifier) {
>> - sbd->connect_irq_notifier(dev, irq);
>> - }
>> }
>> /* Check whether an MMIO region exists */
>
>Reviewed-by: Cédric Le Goater <clg@redhat.com>
>
>Thanks,
>
>C.
Who will pick up this patch?
Best regards,
Bernhard
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 5/5] Revert "sysbus: add irq_routing_notifier"
2026-04-27 10:30 ` Bernhard Beschow
@ 2026-05-04 9:51 ` Cédric Le Goater
2026-05-05 18:17 ` Bernhard Beschow
0 siblings, 1 reply; 20+ messages in thread
From: Cédric Le Goater @ 2026-05-04 9:51 UTC (permalink / raw)
To: Bernhard Beschow, qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Laurent Vivier, qemu-trivial,
qemu-arm, Michael Tokarev, Daniel P. Berrangé, Peter Maydell
On 4/27/26 12:30, Bernhard Beschow wrote:
>
>
> Am 9. März 2026 09:19:10 UTC schrieb "Cédric Le Goater" <clg@redhat.com>:
>> On 3/8/26 21:35, Bernhard Beschow wrote:
>>> The callback has been introduced in commit 715ca691daca ("sysbus: add
>>> irq_routing_notifier") for use in VFIO platform. Meanwhile, VFIO
>>> platform has been removed via commit 762c85543948 ("vfio: Remove 'vfio-
>>> platform'") which was its only user. Remove this unused code.
>>>
>>> This reverts commit 715ca691daca081108b33306faa6fa102f0df8d8.
>>>
>>> cc: Cédric Le Goater <clg@redhat.com>
>>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>>> ---
>>> include/hw/core/sysbus.h | 1 -
>>> hw/core/sysbus.c | 6 ------
>>> 2 files changed, 7 deletions(-)
>>>
>>> diff --git a/include/hw/core/sysbus.h b/include/hw/core/sysbus.h
>>> index c0d18d9e00..f3c4259d29 100644
>>> --- a/include/hw/core/sysbus.h
>>> +++ b/include/hw/core/sysbus.h
>>> @@ -50,7 +50,6 @@ struct SysBusDeviceClass {
>>> * omitted then. (This is not considered a fatal error.)
>>> */
>>> char *(*explicit_ofw_unit_address)(const SysBusDevice *dev);
>>> - void (*connect_irq_notifier)(SysBusDevice *dev, qemu_irq irq);
>>> };
>>> struct SysBusDevice {
>>> diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
>>> index 3adf2f2faf..3e1160ee92 100644
>>> --- a/hw/core/sysbus.c
>>> +++ b/hw/core/sysbus.c
>>> @@ -104,13 +104,7 @@ qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n)
>>> void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
>>> {
>>> - SysBusDeviceClass *sbd = SYS_BUS_DEVICE_GET_CLASS(dev);
>>> -
>>> qdev_connect_gpio_out_named(DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ, n, irq);
>>> -
>>> - if (sbd->connect_irq_notifier) {
>>> - sbd->connect_irq_notifier(dev, irq);
>>> - }
>>> }
>>> /* Check whether an MMIO region exists */
>>
>> Reviewed-by: Cédric Le Goater <clg@redhat.com>
>>
>> Thanks,
>>
>> C.
>
> Who will pick up this patch?
I would say this is a qdev related matter, so Paolo ?
Thanks,
C.
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 5/5] Revert "sysbus: add irq_routing_notifier"
2026-05-04 9:51 ` Cédric Le Goater
@ 2026-05-05 18:17 ` Bernhard Beschow
0 siblings, 0 replies; 20+ messages in thread
From: Bernhard Beschow @ 2026-05-05 18:17 UTC (permalink / raw)
To: Cédric Le Goater, qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Laurent Vivier, qemu-trivial,
qemu-arm, Michael Tokarev, Daniel P. Berrangé, Peter Maydell
Am 4. Mai 2026 09:51:05 UTC schrieb "Cédric Le Goater" <clg@redhat.com>:
>On 4/27/26 12:30, Bernhard Beschow wrote:
>>
>>
>> Am 9. März 2026 09:19:10 UTC schrieb "Cédric Le Goater" <clg@redhat.com>:
>>> On 3/8/26 21:35, Bernhard Beschow wrote:
>>>> The callback has been introduced in commit 715ca691daca ("sysbus: add
>>>> irq_routing_notifier") for use in VFIO platform. Meanwhile, VFIO
>>>> platform has been removed via commit 762c85543948 ("vfio: Remove 'vfio-
>>>> platform'") which was its only user. Remove this unused code.
>>>>
>>>> This reverts commit 715ca691daca081108b33306faa6fa102f0df8d8.
>>>>
>>>> cc: Cédric Le Goater <clg@redhat.com>
>>>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>>>> ---
>>>> include/hw/core/sysbus.h | 1 -
>>>> hw/core/sysbus.c | 6 ------
>>>> 2 files changed, 7 deletions(-)
>>>>
>>>> diff --git a/include/hw/core/sysbus.h b/include/hw/core/sysbus.h
>>>> index c0d18d9e00..f3c4259d29 100644
>>>> --- a/include/hw/core/sysbus.h
>>>> +++ b/include/hw/core/sysbus.h
>>>> @@ -50,7 +50,6 @@ struct SysBusDeviceClass {
>>>> * omitted then. (This is not considered a fatal error.)
>>>> */
>>>> char *(*explicit_ofw_unit_address)(const SysBusDevice *dev);
>>>> - void (*connect_irq_notifier)(SysBusDevice *dev, qemu_irq irq);
>>>> };
>>>> struct SysBusDevice {
>>>> diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
>>>> index 3adf2f2faf..3e1160ee92 100644
>>>> --- a/hw/core/sysbus.c
>>>> +++ b/hw/core/sysbus.c
>>>> @@ -104,13 +104,7 @@ qemu_irq sysbus_get_connected_irq(const SysBusDevice *dev, int n)
>>>> void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq)
>>>> {
>>>> - SysBusDeviceClass *sbd = SYS_BUS_DEVICE_GET_CLASS(dev);
>>>> -
>>>> qdev_connect_gpio_out_named(DEVICE(dev), SYSBUS_DEVICE_GPIO_IRQ, n, irq);
>>>> -
>>>> - if (sbd->connect_irq_notifier) {
>>>> - sbd->connect_irq_notifier(dev, irq);
>>>> - }
>>>> }
>>>> /* Check whether an MMIO region exists */
>>>
>>> Reviewed-by: Cédric Le Goater <clg@redhat.com>
>>>
>>> Thanks,
>>>
>>> C.
>>
>> Who will pick up this patch?
>I would say this is a qdev related matter, so Paolo ?
Meanwhile, Peter took already care of it by applying the patch to target-arm.next and issuing a pull request -- thanks, Peter!
Best regards,
Bernhard
>
>Thanks,
>
>C.
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 0/5] Trivial cleanup
2026-03-08 20:35 [PATCH 0/5] Trivial cleanup Bernhard Beschow
` (4 preceding siblings ...)
2026-03-08 20:35 ` [PATCH 5/5] Revert "sysbus: add irq_routing_notifier" Bernhard Beschow
@ 2026-03-08 21:27 ` Bernhard Beschow
2026-04-30 10:42 ` Peter Maydell
6 siblings, 0 replies; 20+ messages in thread
From: Bernhard Beschow @ 2026-03-08 21:27 UTC (permalink / raw)
To: qemu-devel
Cc: Eduardo Habkost, Paolo Bonzini, Laurent Vivier, qemu-trivial,
qemu-arm, Michael Tokarev, Daniel P. Berrangé, Peter Maydell,
Markus Armbruster
Am 8. März 2026 20:35:11 UTC schrieb Bernhard Beschow <shentey@gmail.com>:
+Markus
>This series contains some low-hanging fruit fixes I came up with when
>investigating Rust for QEMU, especially QOM object lifecycle vs. the Drop trait.
>
>I noticed that no finalize methods were called in Rust sysbus devices when QEMU
>quits, and neither are its C variants. What is probably missing in the first
>place is a
>
> object_unref(object_get_root());
>
>at the end of qemu_cleanup() in runstate.c (see TODO there). Adding it before
>this series won't clean up machines since their refcount won't reach zero. With
>this series applied this additional line will cause various issues when quitting
>QEMU, allowing the problem to be investigated. Fixing it is beyond the scope of
>this series (and my time budget).
>
>Testing done:
>* `make check`
>* Run imx8mp-evk with a Buildroot image
>
>Bernhard Beschow (5):
> hw/arm/fsl-imx8mp: Do not create redundant unimplemented devices
> hw/arm/fsl-imx8mp: Fix parent of ocram memory region
> hw/arm/imx8mp-evk: Fix reference count of SoC object
> system/vl: Fix reference count of machine object
> Revert "sysbus: add irq_routing_notifier"
>
> include/hw/core/sysbus.h | 1 -
> hw/arm/fsl-imx8mp.c | 3 ++-
> hw/arm/imx8mp-evk.c | 4 ++--
> hw/core/sysbus.c | 6 ------
> system/vl.c | 1 +
> 5 files changed, 5 insertions(+), 10 deletions(-)
>
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 0/5] Trivial cleanup
2026-03-08 20:35 [PATCH 0/5] Trivial cleanup Bernhard Beschow
` (5 preceding siblings ...)
2026-03-08 21:27 ` [PATCH 0/5] Trivial cleanup Bernhard Beschow
@ 2026-04-30 10:42 ` Peter Maydell
6 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2026-04-30 10:42 UTC (permalink / raw)
To: Bernhard Beschow
Cc: qemu-devel, Eduardo Habkost, Paolo Bonzini, Laurent Vivier,
qemu-trivial, qemu-arm, Michael Tokarev, Daniel P. Berrangé
On Sun, 8 Mar 2026 at 20:35, Bernhard Beschow <shentey@gmail.com> wrote:
>
> This series contains some low-hanging fruit fixes I came up with when
> investigating Rust for QEMU, especially QOM object lifecycle vs. the Drop trait.
>
> I noticed that no finalize methods were called in Rust sysbus devices when QEMU
> quits, and neither are its C variants. What is probably missing in the first
> place is a
>
> object_unref(object_get_root());
>
> at the end of qemu_cleanup() in runstate.c (see TODO there). Adding it before
> this series won't clean up machines since their refcount won't reach zero. With
> this series applied this additional line will cause various issues when quitting
> QEMU, allowing the problem to be investigated. Fixing it is beyond the scope of
> this series (and my time budget).
>
> Testing done:
> * `make check`
> * Run imx8mp-evk with a Buildroot image
>
> Bernhard Beschow (5):
> hw/arm/fsl-imx8mp: Do not create redundant unimplemented devices
> hw/arm/fsl-imx8mp: Fix parent of ocram memory region
> hw/arm/imx8mp-evk: Fix reference count of SoC object
> system/vl: Fix reference count of machine object
> Revert "sysbus: add irq_routing_notifier"
Hi; I've applied patches 1, 2, 3 and 5 to target-arm.next, since
they're all either arm-specific or the obviously-OK patch that
deletes the unused connect_irq_notifier method.
Patch 4 (the system/vl one) I am not applying, because it hasn't been
reviewed and I don't know enough to know if it's correct or not.
(My guess is that it is correct.) You might want to repost
it as a standalone patch to try to get it a bit more attention.
thanks
-- PMM
^ permalink raw reply [flat|nested] 20+ messages in thread