diff options
author | Andre Przywara <andre.przywara@arm.com> | 2020-08-03 12:55:28 +0100 |
---|---|---|
committer | Andre Przywara <andre.przywara@arm.com> | 2020-09-29 13:28:25 +0100 |
commit | 40a0de1972bc9a12470b10bc08b7174e4990b30c (patch) | |
tree | 7f1e0abbc69c5dd0c120d1dd157038e3be811ac0 | |
parent | 283e5595afa28a5930ac5f0dcdf7c18804221070 (diff) | |
download | trusted-firmware-a-40a0de1972bc9a12470b10bc08b7174e4990b30c.tar.gz |
arm_fpga: Remove SPE PMU DT node if SPE is not available
The Statistical Profiling Extension (SPE) is an architectural feature we
can safely detect at runtime. However it still relies on one piece of
platform-specific information: the interrupt line it is connected
to. This requires SPE to be described in a devicetree node.
Since SPE support varies with the CPU cores found on an FPGA image, we
should detect the presence of SPE at runtime, and remove a potentially
existing SPE PMU node from the DT.
This allows to always have the SPE node in a generic devicetree file,
without risking exposing it on a CPU without this feature.
Change-Id: I73d83ea8509b03fe7bba20b9cce8d1335035fa31
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
-rw-r--r-- | plat/arm/board/arm_fpga/fpga_bl31_setup.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plat/arm/board/arm_fpga/fpga_bl31_setup.c b/plat/arm/board/arm_fpga/fpga_bl31_setup.c index d5478d2d63..a5f5ea0f3a 100644 --- a/plat/arm/board/arm_fpga/fpga_bl31_setup.c +++ b/plat/arm/board/arm_fpga/fpga_bl31_setup.c @@ -12,6 +12,7 @@ #include <drivers/arm/gicv3.h> #include <drivers/delay_timer.h> #include <drivers/generic_delay_timer.h> +#include <lib/extensions/spe.h> #include <libfdt.h> #include "fpga_private.h" @@ -224,6 +225,16 @@ static void fpga_prepare_dtb(void) } } + /* Check whether we support the SPE PMU. Remove the DT node if not. */ + if (!spe_supported()) { + int node = fdt_node_offset_by_compatible(fdt, 0, + "arm,statistical-profiling-extension-v1"); + + 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); |