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.

Reply via email to