From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Bernhard Beschow" <shentey@gmail.com>,
qemu-devel@nongnu.org, "Helge Deller" <deller@gmx.de>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Cédric Le Goater" <clg@kaod.org>, "Troy Lee" <leetroy@gmail.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Mark Cave-Ayland" <mark.caveayland@nutanix.com>,
qemu-arm@nongnu.org, "Jamin Lin" <jamin_lin@aspeedtech.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>
Subject: Re: QOM parent type "sys-bus-device" vs. "device"
Date: Thu, 05 Mar 2026 12:00:40 +0100 [thread overview]
Message-ID: <874imuo813.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFEAcA8CTLsKxJ8iza9T3bSafdgaM0dag2=KXqWLdMiXAHiGGQ@mail.gmail.com> (Peter Maydell's message of "Thu, 5 Mar 2026 09:30:49 +0000")
Peter Maydell <peter.maydell@linaro.org> writes:
> On Thu, 5 Mar 2026 at 09:25, Markus Armbruster <armbru@redhat.com> wrote:
>> > Disentangling reset is extremely painful -- I don't even know
>> > what it ought to be doing. Maybe propagating along the QOM tree?
>>
>> I think this would make more sense. Unlike the qtree, the QOM
>> composition tree contains all devices, and reflects the actual
>> composition. It's certainly closer to the real reset tree than the
>> qtree is. Is it close enough? I don't know. If yes, there's our reset
>> tree. If no, I guess we could still use it as a base, with manually
>> corrected reset lines where the QOM composition tree is off.
A walk to the farmers market jogged my memory: the QOM composition tree
is in fact off for user-created devices. These go into
/machine/peripheral and /machine/peripheral-anon.
Most of them plug into a bus, and reset should flow through that bus,
not through their peripheral container.
A few don't, and I can't say how reset is supposed to work then.
Onboard device can also be connected via some bus. For instance,
machine "pc" contains sysbus device "i440FX-pcihost", which provides a
PCI bus. It also contains PCI device "PIIX3" (the south bridge)
connected via that PCI bus.
The QOM composition tree has "i440FX-pcihost" and its PCI bus in the
right place, and "PIIX3" in the orphanage:
/machine (pc-i440fx-11.0-machine)
/i440fx (i440FX-pcihost)
/pci.0 (PCI)
/unattached (container)
/device[3] (PIIX3)
/sysbus (System)
Say we fixed that like so
/machine (pc-i440fx-11.0-machine)
/i440fx (i440FX-pcihost)
/pci.0 (PCI)
/piix3 (PIIX3)
then reset flowing along the composition tree is still problematic: we
probably want to reset the PCI bus before the devices plugged into it.
So maybe reset should flow along the composition tree to buses, from bus
to devices plugged into it, from such a device again along the
composition tree, and so forth.
> Yes. We really don't want to add more boilerplate requirements
> to how you write "container" type devices like SoC objects.
> It's already bad enough that you have to have an instance_init
> that manually calls instance_init on all your subcomponents,
> and a realize that calls realize on all of them. If we add
> a requirement that you need to have reset methods for 3 phases
> that call reset on all your subcomponents, people are going to
> forget. We need the default to be "do the thing that's right
> almost every time", not "do the thing that's wrong".
Good interfaces make doing the right thing easier than doing the wrong
thing. We clearly failed there.
> (And then of course there is the "how do we get there from
> here?" question :-))
Good question. Next question? SCNR!
I'm afraid I don't understand how reset works *now* well enough to come
up with a workable plan.
In other words, I don't have a clear idea of "here", and I fear we
together don't have a sufficiently clear idea of "there".
What can we do to improve on both?
next prev parent reply other threads:[~2026-03-05 11:01 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 22:21 [PATCH v2 00/13] TYPE_SERIAL cleanup Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 01/13] hw/arm/Kconfig: Fix serial selection for NPCM8XX Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 02/13] hw/arm/aspeed_ast27x0-{ssp, tsp}: Do not access SerialMM internals directly Bernhard Beschow
2026-03-04 15:19 ` Philippe Mathieu-Daudé
2026-03-03 22:21 ` [PATCH v2 03/13] util/fifo8: Make all read-only methods const-correct Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 04/13] hw/char/serial: Remove explicit cast from void pointer Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 05/13] hw/char/serial: Prefer fifo8 methods over open-coding Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 06/13] hw/char/serial: Reuse fifo8_num_used() Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 07/13] hw/char/serial: Remove stale comment Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 08/13] hw/char/serial: Add constants for Line Control Register Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 09/13] hw/char/serial: Remove redundant reset Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 10/13] hw/char/serial: Avoid implicit conversion when tracing Bernhard Beschow
2026-03-04 15:21 ` Philippe Mathieu-Daudé
2026-03-03 22:21 ` [PATCH v2 11/13] hw/char/serial: Keep MemoryRegionOps private Bernhard Beschow
2026-03-03 22:56 ` BALATON Zoltan
2026-03-04 1:33 ` BALATON Zoltan
2026-03-04 8:45 ` Bernhard Beschow
2026-03-04 8:38 ` Bernhard Beschow
2026-03-05 10:03 ` Peter Maydell
2026-03-05 22:48 ` Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 12/13] hw/char/serial: Inherit from SysBusDevice Bernhard Beschow
2026-03-04 12:25 ` QOM parent type "sys-bus-device" vs. "device" (was: [PATCH v2 12/13] hw/char/serial: Inherit from SysBusDevice) Markus Armbruster
2026-03-04 13:54 ` Peter Maydell
2026-03-04 14:37 ` BALATON Zoltan
2026-03-05 9:25 ` QOM parent type "sys-bus-device" vs. "device" Markus Armbruster via qemu development
2026-03-05 9:30 ` Peter Maydell
2026-03-05 11:00 ` Markus Armbruster [this message]
2026-03-05 10:07 ` [PATCH v2 12/13] hw/char/serial: Inherit from SysBusDevice Peter Maydell
2026-03-05 17:53 ` Bernhard Beschow
2026-03-03 22:21 ` [PATCH v2 13/13] hw/char/serial: Plug into reset framework Bernhard Beschow
2026-03-05 10:07 ` Peter Maydell
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=874imuo813.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=andrew@codeconstruct.com.au \
--cc=clg@kaod.org \
--cc=deller@gmx.de \
--cc=jamin_lin@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=leetroy@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=mark.caveayland@nutanix.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
--cc=steven_lee@aspeedtech.com \
/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