Hi,
On 10/03/2026 17:31, Yodel Eldar wrote:
> Use object_resolve_path_component() in clipper_init() to retrieve
> the PCI bus after it is realized in typhoon_init(). Modify
> typhoon_init() such that it returns nothing instead of the PCI bus.
>
> After this commit, we could cleanly split typhoon_init()
> into the typhoon's instance_init and realize hooks.
>
> Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev>
> ---
> hw/alpha/alpha_sys.h | 3 ++-
> hw/alpha/dp264.c | 4 +++-
> hw/alpha/typhoon.c | 6 ++----
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h
> index cf16e235fb..27c3a72b13 100644
> --- a/hw/alpha/alpha_sys.h
> +++ b/hw/alpha/alpha_sys.h
> @@ -20,9 +20,10 @@ typedef struct TyphoonClass {
>
> OBJECT_DECLARE_TYPE(TyphoonState, TyphoonClass, TYPHOON_PCI_HOST_BRIDGE)
>
> -PCIBus *typhoon_init(TyphoonState *);
> +void typhoon_init(TyphoonState *);
>
> #define TYPHOON_PROP_RAM "ram"
> +#define TYPHOON_PCI_BUS_NAME "pci"
>
> #define TYPHOON_GPIO_ISA_IRQ "isa-irq"
> #define TYPHOON_GPIO_RTC_IRQ "rtc-irq"
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index de5829a004..92a15b0239 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -111,7 +111,9 @@ static void clipper_init(MachineState *machine)
> * Init the chipset. Because we're using CLIPPER IRQ mappings,
> * the minimum PCI device IdSel is 1.
> */
> - pci_bus = typhoon_init(typhoon);
> + typhoon_init(typhoon);
> + pci_bus = PCI_BUS(object_resolve_path_component(typhoon_obj,
> + TYPHOON_PCI_BUS_NAME));
Scratch this; for v2:
pci_bus = PCI_HOST_BRIDGE(typhoon_obj)->bus;
>
> /*
> * Init the PCI -> ISA bridge.
> diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
> index ad5010bea8..55f3aae584 100644
> --- a/hw/alpha/typhoon.c
> +++ b/hw/alpha/typhoon.c
> @@ -833,7 +833,7 @@ static void typhoon_alarm_timer(void *opaque)
> cpu_interrupt(CPU(s->cchip.cpu[cpu]), CPU_INTERRUPT_TIMER);
> }
>
> -PCIBus *typhoon_init(TyphoonState *s)
> +void typhoon_init(TyphoonState *s)
> {
> TyphoonClass *tc = TYPHOON_PCI_HOST_BRIDGE_GET_CLASS(s);
> MemoryRegion *addr_space = get_system_memory();
> @@ -900,7 +900,7 @@ PCIBus *typhoon_init(TyphoonState *s)
> memory_region_add_subregion(addr_space, 0x801fc000000ULL,
> &s->pchip.reg_io);
>
> - b = pci_register_root_bus(dev, "pci",
> + b = pci_register_root_bus(dev, TYPHOON_PCI_BUS_NAME,
> typhoon_set_irq, tc->sys_map_irq, s,
> &s->pchip.reg_mem, &s->pchip.reg_io,
> tc->devfn_min, 64, TYPE_PCI_BUS);
> @@ -937,8 +937,6 @@ PCIBus *typhoon_init(TyphoonState *s)
> /* Pchip1 PCI special/interrupt acknowledge, 0x802.F800.0000, 64MB. */
> /* Pchip1 PCI I/O, 0x802.FC00.0000, 32MB. */
> /* Pchip1 PCI configuration, 0x802.FE00.0000, 16MB. */
> -
> - return b;
> }
>
> static void typhoon_pcihost_init(Object *obj)
>