mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-19 11:04:20 +00:00
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>
This commit is contained in:
parent
283e5595af
commit
40a0de1972
1 changed files with 11 additions and 0 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue