feat(arm_fpga): add ITS autodetection

Some FPGAs come with a GIC that has an ITS block configured. Since the
ITS sits between the distributor and redistributors, we can autodetect
that, and already adjust the GICR base address.

To also make this ITS usable, add an ITS node to our base DTB, and
remove that should we not find an ITS during the scan for the
redistributor. This allows to use the same TF-A binary for FPGA images
with or without an ITS.

Change-Id: I4c0417dec7bccdbad8cbca26fa2634950fc50a66
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
This commit is contained in:
Andre Przywara 2021-07-20 20:05:38 +01:00
parent 93b785f5ae
commit d7e39c43f2
4 changed files with 23 additions and 0 deletions

View File

@ -98,5 +98,12 @@
/* The GICR size will be adjusted at runtime to match the cores. */
<0x0 0x30040000 0x0 0x00020000>; /* GICR for one core */
interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
its: msi-controller@30040000 {
compatible = "arm,gic-v3-its";
reg = <0x0 0x30040000 0x0 0x40000>;
#msi-cells = <1>;
msi-controller;
};
};
};

View File

@ -242,6 +242,16 @@ static void fpga_prepare_dtb(void)
}
}
/* Check whether we have an ITS. Remove the DT node if not. */
if (!fpga_has_its()) {
int node = fdt_node_offset_by_compatible(fdt, 0,
"arm,gic-v3-its");
if (node >= 0) {
fdt_del_node(fdt, node);
}
}
err = fdt_pack(fdt);
if (err < 0) {
ERROR("Failed to pack Device Tree at %p: error %d\n", fdt, err);

View File

@ -155,3 +155,8 @@ uintptr_t fpga_get_redist_base(void)
{
return fpga_gicv3_driver_data.gicr_base;
}
bool fpga_has_its(void)
{
return nr_itses > 0;
}

View File

@ -27,6 +27,7 @@ unsigned int plat_fpga_calc_core_pos(uint32_t mpid);
unsigned int fpga_get_nr_gic_cores(void);
uintptr_t fpga_get_redist_size(void);
uintptr_t fpga_get_redist_base(void);
bool fpga_has_its(void);
#endif /* __ASSEMBLER__ */