Skip to content

Commit 8d664e5

Browse files
zhangyang-hxdMichael Tokarev
authored andcommitted
hw/intc/riscv_aplic: APLICs should add child earlier than realize
Since only root APLICs can have hw IRQ lines, aplic->parent should be initialized first. Fixes: e8f7934 ("hw/intc: Add RISC-V AIA APLIC device emulation") Reviewed-by: Daniel Henrique Barboza <[email protected]> Signed-off-by: yang.zhang <[email protected]> Cc: qemu-stable <[email protected]> Message-ID: <[email protected]> Signed-off-by: Alistair Francis <[email protected]> (cherry picked from commit c76b121) Signed-off-by: Michael Tokarev <[email protected]>
1 parent f7ddff7 commit 8d664e5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hw/intc/riscv_aplic.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,16 +1000,16 @@ DeviceState *riscv_aplic_create(hwaddr addr, hwaddr size,
10001000
qdev_prop_set_bit(dev, "msimode", msimode);
10011001
qdev_prop_set_bit(dev, "mmode", mmode);
10021002

1003+
if (parent) {
1004+
riscv_aplic_add_child(parent, dev);
1005+
}
1006+
10031007
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
10041008

10051009
if (!is_kvm_aia(msimode)) {
10061010
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr);
10071011
}
10081012

1009-
if (parent) {
1010-
riscv_aplic_add_child(parent, dev);
1011-
}
1012-
10131013
if (!msimode) {
10141014
for (i = 0; i < num_harts; i++) {
10151015
CPUState *cpu = cpu_by_arch_id(hartid_base + i);

0 commit comments

Comments
 (0)