Now that KVM supports the GICv5 ITS, add in the FDT to describe it to the guest. This ITS node is the MSI controller node used for MSIs, and hence MSIs are now supported. It is marked with PHANDLE_MSI. Signed-off-by: Sascha Bischoff --- arm64/gic.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/arm64/gic.c b/arm64/gic.c index 45dd2dab..b32462a8 100644 --- a/arm64/gic.c +++ b/arm64/gic.c @@ -448,6 +448,7 @@ void gic__generate_fdt_nodes(void *fdt, enum irqchip_type type, bool nested, reg_prop[2] = cpu_to_fdt64(gic_redists_base); reg_prop[3] = cpu_to_fdt64(gic_redists_size); break; + case IRQCHIP_GICV5_ITS: case IRQCHIP_GICV5: return gic__generate_gicv5_fdt_nodes(fdt, type, nested, nr_cpus); default: @@ -495,6 +496,16 @@ static void gic__generate_gicv5_fdt_nodes(void *fdt, enum irqchip_type type, cpu_to_fdt64(ARM_GICV5_IRS_SETLPI_SIZE) }; + u64 its_config_reg_prop[] = { + cpu_to_fdt64(ARM_GICV5_ITS_CONFIG_BASE), + cpu_to_fdt64(ARM_GICV5_ITS_CONFIG_SIZE), + }; + + u64 its_trans_reg_prop[] = { + cpu_to_fdt64(ARM_GICV5_ITS_TRANSL_BASE), + cpu_to_fdt64(ARM_GICV5_ITS_TRANSL_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)); @@ -527,6 +538,33 @@ static void gic__generate_gicv5_fdt_nodes(void *fdt, enum irqchip_type type, _FDT(fdt_property(fdt, "cpus", cpus, sizeof(u32) * nr_cpus)); _FDT(fdt_property(fdt, "arm,iaffids", iaffids, sizeof(u16) * nr_cpus)); + if (type == IRQCHIP_GICV5_ITS) { + /* + * GICv5 ITS node + */ + snprintf(node_at_addr, 64, "gicv5-its@%lx", fdt64_to_cpu(its_config_reg_prop[0])); + _FDT(fdt_begin_node(fdt, node_at_addr)); + _FDT(fdt_property_string(fdt, "compatible", "arm,gic-v5-its")); + _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", its_config_reg_prop, sizeof(its_config_reg_prop))); + _FDT(fdt_property_string(fdt, "reg-names", "ns-config")); + + snprintf(node_at_addr, 64, "msi-controller@%lx", fdt64_to_cpu(its_trans_reg_prop[0])); + _FDT(fdt_begin_node(fdt, node_at_addr)); + _FDT(fdt_property_cell(fdt, "phandle", PHANDLE_MSI)); + _FDT(fdt_property(fdt, "msi-controller", NULL, 0)); + + _FDT(fdt_property(fdt, "reg", its_trans_reg_prop, sizeof(its_trans_reg_prop))); + _FDT(fdt_property_string(fdt, "reg-names", "ns-translate")); + + _FDT(fdt_end_node(fdt)); // End of ITS msi-controller node + + _FDT(fdt_end_node(fdt)); // End of ITS node + } + _FDT(fdt_end_node(fdt)); // End of IRS node _FDT(fdt_end_node(fdt)); // End of GIC node -- 2.34.1