Commit 40a0de19 authored by Andre Przywara's avatar Andre Przywara
Browse files

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: default avatarAndre Przywara <andre.przywara@arm.com>
parent 283e5595
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <drivers/arm/gicv3.h> #include <drivers/arm/gicv3.h>
#include <drivers/delay_timer.h> #include <drivers/delay_timer.h>
#include <drivers/generic_delay_timer.h> #include <drivers/generic_delay_timer.h>
#include <lib/extensions/spe.h>
#include <libfdt.h> #include <libfdt.h>
#include "fpga_private.h" #include "fpga_private.h"
...@@ -224,6 +225,16 @@ static void fpga_prepare_dtb(void) ...@@ -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); err = fdt_pack(fdt);
if (err < 0) { if (err < 0) {
ERROR("Failed to pack Device Tree at %p: error %d\n", fdt, err); ERROR("Failed to pack Device Tree at %p: error %d\n", fdt, err);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment