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
>
>