aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryang.zhang <yang.zhang@hexintek.com>2024-04-09 09:44:45 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2024-06-05 13:00:13 +0300
commit8d664e5bc24d1ec382a73679762a082bf313e12f (patch)
tree5b25e7a7584c90996f34a713792f1f0c55d84b7f
parentf7ddff7d5bd825903c9262f0bd28a69fd5e1ea6d (diff)
downloadqemu-8d664e5bc24d1ec382a73679762a082bf313e12f.zip
qemu-8d664e5bc24d1ec382a73679762a082bf313e12f.tar.gz
qemu-8d664e5bc24d1ec382a73679762a082bf313e12f.tar.bz2
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: e8f79343cf ("hw/intc: Add RISC-V AIA APLIC device emulation") Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Signed-off-by: yang.zhang <yang.zhang@hexintek.com> Cc: qemu-stable <qemu-stable@nongnu.org> Message-ID: <20240409014445.278-1-gaoshanliukou@163.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com> (cherry picked from commit c76b121840c6ca79dc6305a5f4bcf17c72217d9c) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--hw/intc/riscv_aplic.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
index fc5df0d..32edd6d 100644
--- a/hw/intc/riscv_aplic.c
+++ b/hw/intc/riscv_aplic.c
@@ -1000,16 +1000,16 @@ DeviceState *riscv_aplic_create(hwaddr addr, hwaddr size,
qdev_prop_set_bit(dev, "msimode", msimode);
qdev_prop_set_bit(dev, "mmode", mmode);
+ if (parent) {
+ riscv_aplic_add_child(parent, dev);
+ }
+
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
if (!is_kvm_aia(msimode)) {
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr);
}
- if (parent) {
- riscv_aplic_add_child(parent, dev);
- }
-
if (!msimode) {
for (i = 0; i < num_harts; i++) {
CPUState *cpu = cpu_by_arch_id(hartid_base + i);