[PATCH] hw/intc/riscv_aplic: APLICs should add child earlier than realize

yang.zhang posted 1 patch 3 weeks, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240409014445.278-1-gaoshanliukou@163.com
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
hw/intc/riscv_aplic.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] hw/intc/riscv_aplic: APLICs should add child earlier than realize
Posted by yang.zhang 3 weeks, 2 days ago
From: "yang.zhang" <yang.zhang@hexintek.com>

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>
---
 hw/intc/riscv_aplic.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
index fc5df0d598..32edd6d07b 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);
-- 
2.25.1
Re: [PATCH] hw/intc/riscv_aplic: APLICs should add child earlier than realize
Posted by Alistair Francis 1 week, 2 days ago
On Tue, Apr 9, 2024 at 11:46 AM yang.zhang <gaoshanliukou@163.com> wrote:
>
> From: "yang.zhang" <yang.zhang@hexintek.com>
>
> 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>

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>  hw/intc/riscv_aplic.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
> index fc5df0d598..32edd6d07b 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);
> --
> 2.25.1
>
>
Re:Re: [PATCH] hw/intc/riscv_aplic: APLICs should add child earlier than realize
Posted by yang.zhang 1 week ago
At 2024-04-23 14:04:29, "Alistair Francis" <alistair23@gmail.com> wrote:
>On Tue, Apr 9, 2024 at 11:46 AM yang.zhang <gaoshanliukou@163.com> wrote:
>>
>> From: "yang.zhang" <yang.zhang@hexintek.com>
>>
>> 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>
>
>Thanks!
>
>Applied to riscv-to-apply.next
>

>Alistair
Thanks.
>> ---
>>  hw/intc/riscv_aplic.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c
>> index fc5df0d598..32edd6d07b 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);
>> --
>> 2.25.1
>>
>>