| 422b44fb | 01-Sep-2021 |
Andre Przywara <andre.przywara@arm.com> |
feat(arm_fpga): write UART baud base clock frequency into DTB
Since we now autodetect the actual system frequency, which is also used as the base for the UART baudrate generation, we should update t
feat(arm_fpga): write UART baud base clock frequency into DTB
Since we now autodetect the actual system frequency, which is also used as the base for the UART baudrate generation, we should update the value currently hard-coded in the DT. Otherwise Linux will reprogram the divider using a potentially wrong base rate, which breaks the UART output.
Find the DT node referenced by the UART node as the clock rate, and set the "clock-frequency" property in that node to the detected system frequency. This will let Linux reprogram the divider to the same value, preserving the actual baudrate.
Change-Id: Ib5a936849f2198577b86509f032751d5386ed2f8 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|
| d850169c | 01-Sep-2021 |
Andre Przywara <andre.przywara@arm.com> |
feat(arm_fpga): query PL011 to learn system frequency
The Arm FPGAs run in mostly one clock domain, which is used for the CPU cores, the generic timer, and also the UART baudrate base clock. This si
feat(arm_fpga): query PL011 to learn system frequency
The Arm FPGAs run in mostly one clock domain, which is used for the CPU cores, the generic timer, and also the UART baudrate base clock. This single clock can have different rates, to compensate for different IP complexity. So far most images used 10 MHz, but different rates start to appear.
To avoid patching both the arch timer frequency and UART baud base fixed clock in the DTB manually, we would like to set the clock rate automatically. Fortunately the SCP firmware has the actual clock rate hard coded, and already programs the PL011 UART baud divider register with the correct value to achieve a 38400 bps baudrate.
So read the two PL011 baudrate divider values and re-calculate the original base clock from there, to use as the arch timer frequency. If the arch timer DT node contains a clock-frequency property, we use that instead, to support overriding and disabling this autodetection.
Change-Id: I9857fbb418deb4644aeb2816f1102796f9bfd3bb Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|
| 52b8f446 | 01-Sep-2021 |
Andre Przywara <andre.przywara@arm.com> |
refactor(arm_fpga): move command line code into separate function
The code dealing with finding the command line and inserting that into the DTB is somewhat large, and drowns the other DT handlers i
refactor(arm_fpga): move command line code into separate function
The code dealing with finding the command line and inserting that into the DTB is somewhat large, and drowns the other DT handlers in our fpga_prepare_dtb() function.
Move that code into a separate function, to improve readability.
Change-Id: I828203c4bb248d38a2562fcb6afdefedf3179f8d Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|
| d7e39c43 | 20-Jul-2021 |
Andre Przywara <andre.przywara@arm.com> |
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
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>
show more ...
|
| 93b785f5 | 19-May-2021 |
Andre Przywara <andre.przywara@arm.com> |
feat(arm_fpga): determine GICR base by probing
When an Arm Ltd GIC (Arm GIC-[567]00) is instantiated with one or more ITSes, the ITS MMIO frames appear between the distributor and redistributor addr
feat(arm_fpga): determine GICR base by probing
When an Arm Ltd GIC (Arm GIC-[567]00) is instantiated with one or more ITSes, the ITS MMIO frames appear between the distributor and redistributor addresses. This makes the beginning of the redistributor region dependent on the existence and number of ITSes.
To support various FPGA images, with and without ITSes, probe the addresses in question, to learn whether they accommodate an ITS or a redistributor. This can be safely done by looking at the PIDR[01] registers, which contain an ID code for each region, documented in the Arm GIC TRMs.
We try to find all ITSes instantiated, and skip either two or four 64K frames, depending on GICv4.1 support. At some point we will find the first redistributor; this address we then update in the DTB.
Change-Id: Iefb88c2afa989e044fe0b36b7020b56538c60b07 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|
| 4d585fe5 | 19-May-2021 |
Andre Przywara <andre.przywara@arm.com> |
feat(libfdt): also allow changing base address
For platforms where we don't know the number of cores at compile time, the size of the GIC redistributor frame is then also undetermined, since it depe
feat(libfdt): also allow changing base address
For platforms where we don't know the number of cores at compile time, the size of the GIC redistributor frame is then also undetermined, since it depends on this number of cores. On top of this the GICR base address can also change, when an unknown number of ITS frames (including zero) take up space between the distributor and redistributor.
So while those two adjustments are done for independent reasons, the code for doing so is very similar, so we should utilise the existing fdt_adjust_gic_redist() function.
Add an (optional) gicr_base parameters to the prototype, so callers can choose to also adjust this base address later, if needed.
Change-Id: Id39c0ba83e7401fdff1944e86950bb7121f210e8 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|
| 9177e4fd | 20-Aug-2021 |
Andre Przywara <andre.przywara@arm.com> |
fix(arm_fpga): streamline generated axf file
For convenience we let the build system generate an ELF file (named bl31.axf), containing all the trampolines, BL31 code and the DTB in one file. This ca
fix(arm_fpga): streamline generated axf file
For convenience we let the build system generate an ELF file (named bl31.axf), containing all the trampolines, BL31 code and the DTB in one file. This can be fed directly into the FPGA payload tool, and it will load the bits at the right addresses. Since this ELF file is more used as a "container with load addresses", there is no need for normal ELF features like alignment or a symbol table.
Remove unnecessary sections from that output file, by doing a static "link", dropping the NOBITS stacks section, and by adding "-n" to the linker command line (to avoid page alignment). This trims the generated .axf file, and makes it smaller.
Change-Id: I5768543101d667fb4a3b70e60b08cfe970d2a2b6 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|
| 13e16fee | 02-Sep-2021 |
Andre Przywara <andre.przywara@arm.com> |
fix(arm_fpga): reserve BL31 memory
Embarrassingly we never told the non-secure world that secure firmware lives in the first few hundred KBs of DRAM, so any non-secure payload could happily overwrit
fix(arm_fpga): reserve BL31 memory
Embarrassingly we never told the non-secure world that secure firmware lives in the first few hundred KBs of DRAM, so any non-secure payload could happily overwrite TF-A, and we couldn't even blame it.
Advertise the BL31 region in the reserved-memory DT node, so non-secure world stays out of it.
This fixes Linux booting on FPGAs with less memory than usual.
Change-Id: I7fbe7d42c0b251c0ccc43d7c50ca902013d152ec Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|
| c69f815b | 18-May-2021 |
Andre Przywara <andre.przywara@arm.com> |
feat(arm_fpga): support GICv4 images
Up until now we relied on the GICs used in our FPGA images to be GICv3 compliant, without the "direct virtual injection" feature (aka GICv4) enabled. To support
feat(arm_fpga): support GICv4 images
Up until now we relied on the GICs used in our FPGA images to be GICv3 compliant, without the "direct virtual injection" feature (aka GICv4) enabled. To support newer images which have GICv4 compliant GICs, enable the newly introduced GICv4 detection code, and use that also when we adjust the redistributor region size in the devicetree.
This allows the same BL31 image to be used with GICv3 or GICv4 FPGA images.
Change-Id: I9f6435a6d5150983625efe3650a8b7d1ef11b1d1 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|
| 858f40e3 | 18-May-2021 |
Andre Przywara <andre.przywara@arm.com> |
feat(gicv3): detect GICv4 feature at runtime
At the moment we have a GIC_ENABLE_V4_EXTN build time variable to determine whether the GIC interrupt controller is compliant to version 4.0 of the spec
feat(gicv3): detect GICv4 feature at runtime
At the moment we have a GIC_ENABLE_V4_EXTN build time variable to determine whether the GIC interrupt controller is compliant to version 4.0 of the spec or not. This just changes the number of 64K MMIO pages we expect per redistributor.
To support firmware builds which run on variable systems (emulators, fast model or FPGAs), let's make this decision at runtime. The GIC specification provides several architected flags to learn the size of the MMIO frame per redistributor, we use GICR_TYPER[VLPI] here.
Provide a (static inline) function to return the size of each redistributor. We keep the GIC_ENABLE_V4_EXTN build time variable around, but change its meaning to enable this autodetection code. Systems not defining this rely on a "pure" GICv3 (as before), but platforms setting it to "1" can now deal with both configurations.
Change-Id: I9ede4acf058846157a0a9e2ef6103bf07c7655d9 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|