diff mbox series

[4/4] hw/riscv: virt: Use AIA INTC compatible string when available

Message ID 20210514143242.377645-5-anup.patel@wdc.com
State New
Headers show
Series AIA local interrupt CSR support | expand

Commit Message

Anup Patel May 14, 2021, 2:32 p.m. UTC
We should use the AIA INTC compatible string in the CPU INTC
DT nodes when the CPUs support AIA feature. This will allow
Linux INTC driver to use AIA local interrupt CSRs.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
---
 hw/riscv/virt.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Alistair Francis June 10, 2021, 11:20 p.m. UTC | #1
On Sat, May 15, 2021 at 12:36 AM Anup Patel <anup.patel@wdc.com> wrote:
>
> We should use the AIA INTC compatible string in the CPU INTC
> DT nodes when the CPUs support AIA feature. This will allow
> Linux INTC driver to use AIA local interrupt CSRs.
>
> Signed-off-by: Anup Patel <anup.patel@wdc.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/riscv/virt.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index c0dc69ff33..981a3a06d5 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -262,8 +262,15 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap,
>              qemu_fdt_add_subnode(fdt, intc_name);
>              intc_phandle = phandle++;
>              qemu_fdt_setprop_cell(fdt, intc_name, "phandle", intc_phandle);
> -            qemu_fdt_setprop_string(fdt, intc_name, "compatible",
> -                "riscv,cpu-intc");
> +            if (riscv_feature(&s->soc[socket].harts[cpu].env,
> +                              RISCV_FEATURE_AIA)) {
> +                const char intcomp[] = "riscv,cpu-intc-aia\0riscv,cpu-intc";
> +                qemu_fdt_setprop(fdt, name, "compatible",
> +                    intcomp, sizeof(intcomp));
> +            } else {
> +                qemu_fdt_setprop_string(fdt, intc_name, "compatible",
> +                    "riscv,cpu-intc");
> +            }
>              qemu_fdt_setprop(fdt, intc_name, "interrupt-controller", NULL, 0);
>              qemu_fdt_setprop_cell(fdt, intc_name, "#interrupt-cells", 1);
>
> --
> 2.25.1
>
>
diff mbox series

Patch

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index c0dc69ff33..981a3a06d5 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -262,8 +262,15 @@  static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap,
             qemu_fdt_add_subnode(fdt, intc_name);
             intc_phandle = phandle++;
             qemu_fdt_setprop_cell(fdt, intc_name, "phandle", intc_phandle);
-            qemu_fdt_setprop_string(fdt, intc_name, "compatible",
-                "riscv,cpu-intc");
+            if (riscv_feature(&s->soc[socket].harts[cpu].env,
+                              RISCV_FEATURE_AIA)) {
+                const char intcomp[] = "riscv,cpu-intc-aia\0riscv,cpu-intc";
+                qemu_fdt_setprop(fdt, name, "compatible",
+                    intcomp, sizeof(intcomp));
+            } else {
+                qemu_fdt_setprop_string(fdt, intc_name, "compatible",
+                    "riscv,cpu-intc");
+            }
             qemu_fdt_setprop(fdt, intc_name, "interrupt-controller", NULL, 0);
             qemu_fdt_setprop_cell(fdt, intc_name, "#interrupt-cells", 1);