Set the "cpu[*]" links upon instantiation. Eliminate the cpus
array parameter of typhoon_init(), as it is no longer needed.
Note: This commit helps with the eventual splitting of
typhoon_init() into instance_init and realize hooks, by
eliminating one of its parameters.
Signed-off-by: Yodel Eldar <yodel.eldar@yodel.dev>
---
hw/alpha/alpha_sys.h | 2 +-
hw/alpha/dp264.c | 3 ++-
hw/alpha/typhoon.c | 5 ++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h
index 247a52b776..f6779520d9 100644
--- a/hw/alpha/alpha_sys.h
+++ b/hw/alpha/alpha_sys.h
@@ -11,7 +11,7 @@
#define TYPE_TYPHOON_PCI_HOST_BRIDGE "typhoon-pcihost"
OBJECT_DECLARE_SIMPLE_TYPE(TyphoonState, TYPHOON_PCI_HOST_BRIDGE)
-PCIBus *typhoon_init(MemoryRegion *, qemu_irq *, qemu_irq *, AlphaCPU *[4],
+PCIBus *typhoon_init(MemoryRegion *, qemu_irq *, qemu_irq *,
pci_map_irq_fn, uint8_t devfn_min, TyphoonState *);
/* alpha_pci.c. */
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index c9d639eb7b..c0996efffe 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -85,6 +85,7 @@ static void clipper_init(MachineState *machine)
g_autofree char *name = g_strdup_printf("cpu[%ld]", i);
Object *cpu = object_new(machine->cpu_type);
object_property_add_child(OBJECT(machine), name, cpu);
+ object_property_set_link(typhoon_obj, name, cpu, &error_fatal);
qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal);
cpus[i] = ALPHA_CPU(cpu);
}
@@ -107,7 +108,7 @@ 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(machine->ram, &isa_irq, &rtc_irq, cpus,
+ pci_bus = typhoon_init(machine->ram, &isa_irq, &rtc_irq,
clipper_pci_map_irq, PCI_DEVFN(1, 0), typhoon);
/*
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index b0eb4e415c..5fac5eba1c 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -832,7 +832,7 @@ static void typhoon_alarm_timer(void *opaque)
}
PCIBus *typhoon_init(MemoryRegion *ram, qemu_irq *p_isa_irq,
- qemu_irq *p_rtc_irq, AlphaCPU *cpus[4],
+ qemu_irq *p_rtc_irq,
pci_map_irq_fn sys_map_irq, uint8_t devfn_min,
TyphoonState *s)
{
@@ -849,8 +849,7 @@ PCIBus *typhoon_init(MemoryRegion *ram, qemu_irq *p_isa_irq,
/* Remember the CPUs so that we can deliver interrupts to them. */
for (i = 0; i < 4; i++) {
- AlphaCPU *cpu = cpus[i];
- s->cchip.cpu[i] = cpu;
+ AlphaCPU *cpu = s->cchip.cpu[i];
if (cpu != NULL) {
cpu->alarm_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
typhoon_alarm_timer,
--
2.53.0