From 9f32a1a2f5c5656d3e552f032bec5146d53b8986 Mon Sep 17 00:00:00 2001 From: Gabor Toth Date: Wed, 19 Jun 2024 09:33:14 +0200 Subject: [PATCH] core: spmc: handle BTI/PAUTH info in SP manifest Provide information to the SP whether BTI and PAUTH are enabled in OP-TEE by updating the relevant DT node in the SP manifest. This way the SP can detect if the required protection is not available. Signed-off-by: Gabor Toth Acked-by: Etienne Carriere --- core/arch/arm/kernel/secure_partition.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/arch/arm/kernel/secure_partition.c b/core/arch/arm/kernel/secure_partition.c index 63ae7d6cbf3..74f5c87e8ed 100644 --- a/core/arch/arm/kernel/secure_partition.c +++ b/core/arch/arm/kernel/secure_partition.c @@ -1411,6 +1411,22 @@ static TEE_Result handle_hw_features(void *fdt) return res; } + /* Modify the property only if it's already present */ + if (!sp_dt_get_u32(fdt, node, "bti", &val)) { + res = fdt_setprop_u32(fdt, node, "bti", + feat_bti_is_implemented()); + if (res) + return res; + } + + /* Modify the property only if it's already present */ + if (!sp_dt_get_u32(fdt, node, "pauth", &val)) { + res = fdt_setprop_u32(fdt, node, "pauth", + feat_pauth_is_implemented()); + if (res) + return res; + } + return TEE_SUCCESS; }