Skip to contentSkip to conversation

imx8m: soc: Disable OP-TEE CAAM job ring in kernel device-tree

PATCH New Primoz Fiser 1 participant 1 message Oct 28

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx8m: soc: Disable OP-TEE CAAM job ring in kernel device-tree

On i.MX8M, OP-TEE reserves CAAM job ring 2 for the secure world (its CAAM driver forces CFG_JR_INDEX=2 for all i.MX8M variants).

As a result, the ring stays enabled in the device-tree handed to Linux. The kernel then tries to reset a ring it has no access to and logs:

caam_jr 30903000.jr: failed to flush job ring 1
caam_jr 30903000.jr: probe with driver caam_jr failed with error -5

Function ft_add_optee_node() already detects a running OP-TEE and adds its node and reserved memory. Disable job ring 2 there as well, so the OS only sees the job rings it can actually use. The node path is the same on NXP i.MX8MQ, i.MX8MM, i.MX8MN and i.MX8MP SoCs.

---
 arch/arm/mach-imx/imx8m/soc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/mach-imx/imx8m/soc.c +9 -1
index 909bd7476db3..29c0216aca2f 100644
@@ -1234,6 +1234,10 @@ static int cleanup_nodes_for_efi(void *blob)
 #define OPTEE_SHM_SIZE 0x00400000
 static int ft_add_optee_node(void *fdt, struct bd_info *bd)
 {
+	/* CAAM job ring reserved by OP-TEE on i.MX8M (CFG_JR_INDEX = 2) */
+	static const char * const optee_jr_path[] = {
+		"/soc@0/bus@30800000/crypto@30900000/jr@3000",
+	};
 	struct fdt_memory carveout;
 	const char *path, *subpath;
 	phys_addr_t optee_start;
@@ -1305,7 +1309,11 @@ static int ft_add_optee_node(void *fdt, struct bd_info *bd)
 		return ret;
 	}
 
-	return 0;
+	/*
+	 * OP-TEE uses this job ring from the secure world. Disable it so
+	 * the OS does not try to probe a ring it cannot access.
+	 */
+	return disable_fdt_nodes(fdt, optee_jr_path, ARRAY_SIZE(optee_jr_path));
 }
 
 int ft_system_setup(void *blob, struct bd_info *bd)
Signature · 1 line
2.34.1