Extend the GICv5 FGT generation to include the IRS. For the `gicv5` irqchip config, generate nodes for the GICv5 CPU interface and the IRS. This means that the IAFFIDs are now configured, using the CPU phandles that were previously set up. Signed-off-by: Sascha Bischoff --- arm64/gic.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/arm64/gic.c b/arm64/gic.c index 5cb195ac..2152abf6 100644 --- a/arm64/gic.c +++ b/arm64/gic.c @@ -473,6 +473,16 @@ void gic__generate_fdt_nodes(void *fdt, enum irqchip_type type, bool nested, static void gic__generate_gicv5_fdt_nodes(void *fdt, enum irqchip_type type, bool nested, int nr_cpus) { + char node_at_addr[64]; + int cpus[nr_cpus]; + u16 iaffids[nr_cpus]; + u64 irs_reg_prop[] = { + cpu_to_fdt64(ARM_GICV5_IRS_CONFIG_BASE), + cpu_to_fdt64(ARM_GICV5_IRS_CONFIG_SIZE), + cpu_to_fdt64(ARM_GICV5_IRS_SETLPI_BASE), + cpu_to_fdt64(ARM_GICV5_IRS_SETLPI_SIZE) + }; + _FDT(fdt_begin_node(fdt, "gicv5-cpuif")); _FDT(fdt_property_string(fdt, "compatible", "arm,gic-v5")); _FDT(fdt_property_cell(fdt, "#interrupt-cells", GIC_FDT_IRQ_NUM_CELLS)); @@ -484,6 +494,29 @@ static void gic__generate_gicv5_fdt_nodes(void *fdt, enum irqchip_type type, /* Use a hard-coded phandle for the GIC to help wire things up */ _FDT(fdt_property_cell(fdt, "phandle", PHANDLE_GIC)); + /* + * GICv5 IRS node + */ + snprintf(node_at_addr, 64, "gicv5-irs@%lx", fdt64_to_cpu(irs_reg_prop[0])); + _FDT(fdt_begin_node(fdt, node_at_addr)); + _FDT(fdt_property_string(fdt, "compatible", "arm,gic-v5-irs")); + _FDT(fdt_property_cell(fdt, "#address-cells", 2)); + _FDT(fdt_property_cell(fdt, "#size-cells", 2)); + _FDT(fdt_property(fdt, "ranges", NULL, 0)); + + _FDT(fdt_property(fdt, "reg", irs_reg_prop, sizeof(irs_reg_prop))); + _FDT(fdt_property_string(fdt, "reg-names", "ns-config")); + + for (int cpu = 0; cpu < nr_cpus; ++cpu) { + cpus[cpu] = cpu_to_fdt32(PHANDLE_CPU_BASE + cpu); + iaffids[cpu] = cpu_to_fdt16(cpu); + } + + _FDT(fdt_property(fdt, "cpus", cpus, sizeof(u32) * nr_cpus)); + _FDT(fdt_property(fdt, "arm,iaffids", iaffids, sizeof(u16) * nr_cpus)); + + _FDT(fdt_end_node(fdt)); // End of IRS node + _FDT(fdt_end_node(fdt)); // End of GIC node } -- 2.34.1