summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-11-18 12:50:38 -0600
committerTom Rini <[email protected]>2025-11-18 12:50:38 -0600
commitabf15eb60c8a87f833f7e75e5e8a51a7eb115e0b (patch)
treedeed0c31b00bc75d4c516c0e250b630ad4e7f19e
parent96edadab5476c37f3c0b0b99877db16e3e58d5e1 (diff)
parent0c192f52cfb8a4b1c29d61750f48e016ba6b978b (diff)
Merge patch series "remoteproc: k3-r5: Build fixes and security improvements"
Philippe Schenker <[email protected]> says: This series fixes compilation errors when building for R5 cores and addresses a security issue where authenticated images were not being used correctly. Patch 1: Cosmetic removal of duplicate code Patches 2-3: Fix build errors caused by type mismatches between function signatures and the types used in R5 builds. Patches 4-5: fix a bug where ti_secure_image_post_process() relocates images during authentication, but callers were still using the original unverified addresses. Patch 6: Implements is_running operation to allow querying R5F core status. Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--arch/arm/dts/k3-am642-evm-u-boot.dtsi4
-rw-r--r--arch/arm/mach-k3/security.c2
-rw-r--r--drivers/remoteproc/ti_k3_r5f_rproc.c26
-rw-r--r--drivers/soc/ti/pruss.c2
4 files changed, 26 insertions, 8 deletions
diff --git a/arch/arm/dts/k3-am642-evm-u-boot.dtsi b/arch/arm/dts/k3-am642-evm-u-boot.dtsi
index 705b3baa81c..6469f43fca8 100644
--- a/arch/arm/dts/k3-am642-evm-u-boot.dtsi
+++ b/arch/arm/dts/k3-am642-evm-u-boot.dtsi
@@ -19,10 +19,6 @@
dr_mode="peripheral";
};
-&main_mmc1_pins_default {
- bootph-all;
-};
-
&sdhci0 {
bootph-all;
};
diff --git a/arch/arm/mach-k3/security.c b/arch/arm/mach-k3/security.c
index 3468a370a45..c7017bba99a 100644
--- a/arch/arm/mach-k3/security.c
+++ b/arch/arm/mach-k3/security.c
@@ -119,6 +119,8 @@ void ti_secure_image_post_process(void **p_image, size_t *p_size)
*/
*p_size = image_size;
+ *p_image = (void *)(uintptr_t)image_addr;
+
/*
* Output notification of successful authentication to re-assure the
* user that the secure code is being processed as expected. However
diff --git a/drivers/remoteproc/ti_k3_r5f_rproc.c b/drivers/remoteproc/ti_k3_r5f_rproc.c
index c738607c109..7326f5a4b30 100644
--- a/drivers/remoteproc/ti_k3_r5f_rproc.c
+++ b/drivers/remoteproc/ti_k3_r5f_rproc.c
@@ -315,6 +315,7 @@ static int k3_r5f_load(struct udevice *dev, ulong addr, ulong size)
bool mem_auto_init;
void *image_addr = (void *)addr;
int ret;
+ size_t size_img;
dev_dbg(dev, "%s addr = 0x%lx, size = 0x%lx\n", __func__, addr, size);
@@ -341,15 +342,17 @@ static int k3_r5f_load(struct udevice *dev, ulong addr, ulong size)
k3_r5f_init_tcm_memories(core, mem_auto_init);
- ti_secure_image_post_process(&image_addr, &size);
+ size_img = size;
+ ti_secure_image_post_process(&image_addr, &size_img);
+ size = size_img;
- ret = rproc_elf_load_image(dev, addr, size);
+ ret = rproc_elf_load_image(dev, (ulong)image_addr, size);
if (ret < 0) {
dev_err(dev, "Loading elf failedi %d\n", ret);
goto proc_release;
}
- boot_vector = rproc_elf_get_boot_addr(dev, addr);
+ boot_vector = rproc_elf_get_boot_addr(dev, (ulong)image_addr);
dev_dbg(dev, "%s: Boot vector = 0x%llx\n", __func__, boot_vector);
@@ -570,6 +573,22 @@ static void *k3_r5f_da_to_va(struct udevice *dev, ulong da, ulong size, bool *is
return map_physmem(da, size, MAP_NOCACHE);
}
+static int k3_r5f_is_running(struct udevice *dev)
+{
+ struct k3_r5f_core *core = dev_get_priv(dev);
+ u32 cfg, ctrl, sts;
+ u64 boot_vec;
+ int ret;
+
+ dev_dbg(dev, "%s\n", __func__);
+
+ ret = ti_sci_proc_get_status(&core->tsp, &boot_vec, &cfg, &ctrl, &sts);
+ if (ret)
+ return -1;
+
+ return !!(ctrl & PROC_BOOT_CTRL_FLAG_R5_CORE_HALT);
+}
+
static int k3_r5f_init(struct udevice *dev)
{
return 0;
@@ -587,6 +606,7 @@ static const struct dm_rproc_ops k3_r5f_rproc_ops = {
.stop = k3_r5f_stop,
.load = k3_r5f_load,
.device_to_virt = k3_r5f_da_to_va,
+ .is_running = k3_r5f_is_running,
};
static int k3_r5f_rproc_configure(struct k3_r5f_core *core)
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index e3bb2ede554..4bc0ff8c2c1 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -163,7 +163,7 @@ static int pruss_probe(struct udevice *dev)
for (i = 0; i < ARRAY_SIZE(mem_names); i++) {
idx = ofnode_stringlist_search(memories, "reg-names", mem_names[i]);
priv->mem_regions[i].pa = ofnode_get_addr_size_index(memories, idx,
- (u64 *)&priv->mem_regions[i].size);
+ (fdt_size_t *)&priv->mem_regions[i].size);
}
sub_node = ofnode_find_subnode(node, "cfg");