|
From: | Mark Cave-Ayland |
Subject: | Re: [PATCH 5/7] hw/ide/piix: Use generic ide_init_ioport() |
Date: | Wed, 1 Mar 2023 12:14:36 +0000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 |
On 10/02/2023 16:34, Bernhard Beschow wrote:
Fishing out the ISA bus is still a hack IMO, for two reasons: First, IIUC, QOM'ified devices shall only care about its children while looking up one's parent bus violates this rule. Second, using the global machine pointer to scan for the ISA bus just trades one global for another. That's why I'm only doing this for user-created instances. If we deprecated user-created piix IDE devices we could eventually get rid of this hack.
As far as I can tell the solution to QOMified devices finding their parent bus is easy: turn DeviceState::parent_bus into a QOM link property called "parent-bus" or similar which accepts TYPE_BUS, and then any object of TYPE_DEVICE can locate its parent bus using object_property_get_link() with a standardised property name.
I think it may be impossible to completely remove parent bus references, since buses like PCI currently make use of upwards hierarchy navigation for things like IRQ mapping and PCI-PCI bridge traversal.
ATB, Mark.
[Prev in Thread] | Current Thread | [Next in Thread] |