[PATCH 0/5] Trivial cleanup

Bernhard Beschow posted 5 patches 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260308203516.160103-1-shentey@gmail.com
Maintainers: Bernhard Beschow <shentey@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eduardo Habkost <eduardo@habkost.net>
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(-)
[PATCH 0/5] Trivial cleanup
Posted by Bernhard Beschow 1 month ago
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(-)

-- 
2.53.0
Re: [PATCH 0/5] Trivial cleanup
Posted by Bernhard Beschow 1 month ago

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(-)
>