Skip to contentSkip to conversation

Add TIFS Stub support in AM62x

PATCH In review Dhruva Gole 4 participants 8 messages Apr 3, 2024 – Apr 12, 2024

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

cover Add TIFS Stub support in AM62x

Add support for signing, detection and loading of TIFSSTUB images for for HSSE, HSFS and GP AM62x devices.

Boot tested and Deepsleep entry exist tested with ti-linux:
https://gist.github.com/DhruvaG2000/036010f6ae75aa6443fc77f61fd74893

Patches are based on top of tag: v2024.04

Cc Tom Rini <[email protected]>
Cc Neha Malcom Francis <[email protected]>
Cc Kamlesh Gurudasani <[email protected]>
Cc Vibhore Vardhan <[email protected]>
Cc Vishal Mahaveer <[email protected]>
Cc Akashdeep Kaur <[email protected]>
Cc Sebin Francis <[email protected]>

Kamlesh Gurudasani (2):
arm: mach-k3: add support for detecting TIFSSTUB images
arm: dts: k3: binman: am625: add support for signing TIFSSTUB Images

 arch/arm/dts/k3-am625-sk-binman.dtsi | 141 ++++++++++++++++++++++++++-
 arch/arm/mach-k3/r5/common.c         |  24 +++++
 2 files changed, 163 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 arm: mach-k3: add support for detecting TIFSSTUB images

From: Kamlesh Gurudasani <[email protected]>

Add support for detecting and processing TIFSSTUB images for HS, HSFS and GP devices.

TIFSSTUB image for related device type will be loaded, rest TIFSSTUB images will be discarded.

Example, for GP device, tifsstub-gp will be loaded, tifsstub-hs and tifsstub-fs will be discarded.

---
 arch/arm/mach-k3/r5/common.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/mach-k3/r5/common.c +24 -0
index c02f8d330998..0f6c294f1eb2 100644
@@ -24,6 +24,9 @@ enum {
 	IMAGE_ID_OPTEE,
 	IMAGE_ID_SPL,
 	IMAGE_ID_DM_FW,
+	IMAGE_ID_TIFSSTUB_HS,
+	IMAGE_ID_TIFSSTUB_FS,
+	IMAGE_ID_T,
 	IMAGE_AMT,
 };
 
@@ -33,6 +36,9 @@ static const char *image_os_match[IMAGE_AMT] = {
 	"tee",
 	"U-Boot",
 	"DM",
+	"tifsstub-hs",
+	"tifsstub-fs",
+	"tifsstub-gp",
 };
 #endif
 
@@ -314,6 +320,24 @@ void board_fit_image_post_process(const void *fit, int node, void **p_image,
 			break;
 		}
 	}
+
+	if (i < IMAGE_AMT && i > IMAGE_ID_DM_FW) {
+		int device_type = get_device_type();
+
+		if ((device_type == K3_DEVICE_TYPE_HS_SE &&
+		     strcmp(os, "tifsstub-hs")) ||
+		   (device_type == K3_DEVICE_TYPE_HS_FS &&
+		     strcmp(os, "tifsstub-fs")) ||
+		   (device_type == K3_DEVICE_TYPE_GP &&
+		     strcmp(os, "tifsstub-gp"))) {
+			*p_size = 0;
+		} else {
+			debug("tifsstub-type: %s\n", os);
+		}
+
+		return;
+	}
+
 	/*
 	 * Only DM and the DTBs are being authenticated here,
 	 * rest will be authenticated when A72 cluster is up
Signature · 1 line
2.34.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] arm: mach-k3: add support for detecting TIFSSTUB images

Hi Dhruva,

Quoted 56 lines · Dhruva Gole

From: Kamlesh Gurudasani <[email protected]>

Add support for detecting and processing TIFSSTUB images for HS, HSFS and GP devices.

TIFSSTUB image for related device type will be loaded, rest TIFSSTUB images will be discarded.

Example, for GP device, tifsstub-gp will be loaded, tifsstub-hs and tifsstub-fs will be discarded.

---
  arch/arm/mach-k3/r5/common.c | 24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)
arch/arm/mach-k3/r5/common.c +17 -0
index c02f8d330998..0f6c294f1eb2 100644
@@ -24,6 +24,9 @@ enum {
  	IMAGE_ID_OPTEE,
  	IMAGE_ID_SPL,
  	IMAGE_ID_DM_FW,
+	IMAGE_ID_TIFSSTUB_HS,
+	IMAGE_ID_TIFSSTUB_FS,
+	IMAGE_ID_T,
  	IMAGE_AMT,
  };
 
@@ -33,6 +36,9 @@ static const char *image_os_match[IMAGE_AMT] = {
  	"tee",
  	"U-Boot",
  	"DM",
+	"tifsstub-hs",
+	"tifsstub-fs",
+	"tifsstub-gp",
  };
  #endif
 
@@ -314,6 +320,24 @@ void board_fit_image_post_process(const void *fit, int node, void **p_image,
  			break;
  		}
  	}
+
+	if (i < IMAGE_AMT && i > IMAGE_ID_DM_FW) {
+		int device_type = get_device_type();
+
+		if ((device_type == K3_DEVICE_TYPE_HS_SE &&
+		     strcmp(os, "tifsstub-hs")) ||
+		   (device_type == K3_DEVICE_TYPE_HS_FS &&
+		     strcmp(os, "tifsstub-fs")) ||
+		   (device_type == K3_DEVICE_TYPE_GP &&
+		     strcmp(os, "tifsstub-gp"))) {
+			*p_size = 0;

arch/arm/mach-k3/r5/common.c void board_fit_image_post_process(const void *fit, int node, void **p_image, · line 343

Quoted 10 lines
arch/arm/mach-k3/r5/common.c +7 -0
+		} else {
+			debug("tifsstub-type: %s\n", os);
+		}
+
+		return;
+	}
+
  	/*
  	 * Only DM and the DTBs are being authenticated here,
  	 * rest will be authenticated when A72 cluster is up
Signature · 2 lines
Thanking You
Neha Malcom Francis
#3 lore raw

PATCH 2/2 arm: dts: k3: binman: am625: add support for signing TIFSSTUB Images

In reply to Dhruva Gole

From: Kamlesh Gurudasani <[email protected]>

Add support for signing of TIFSSTUB images for HSSE, HSFS and GP devices and include them in tispl.bin and tispl.bin_unsigned.

---
 arch/arm/dts/k3-am625-sk-binman.dtsi | 141 ++++++++++++++++++++++++++-
 1 file changed, 139 insertions(+), 2 deletions(-)
arch/arm/dts/k3-am625-sk-binman.dtsi +139 -2
index 5b058bd03a07..dfd38d64f638 100644
@@ -151,11 +151,107 @@
 			filename = "ti-dm/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f";
 		};
 	};
+
+	tifsstub-hs {
+		filename = "tifsstub.bin_hs";
+		ti-secure-rom {
+			content = <&tifsstub_hs_cert>;
+			core = "secure";
+			load = <0x40000>;
+			sw-rev = <CONFIG_K3_X509_SWRV>;
+			keyfile = "custMpk.pem";
+			countersign;
+			tifsstub;
+		};
+		tifsstub_hs_cert: tifsstub-hs-cert.bin {
+			filename = "ti-sysfw/ti-fs-stub-firmware-am62x-hs-cert.bin";
+			type = "blob-ext";
+			optional;
+		};
+		tifsstub_hs_enc: tifsstub-hs-enc.bin {
+			filename = "ti-sysfw/ti-fs-stub-firmware-am62x-hs-enc.bin";
+			type = "blob-ext";
+			optional;
+		};
+	};
+
+	tifsstub-fs {
+		filename = "tifsstub.bin_fs";
+		tifsstub_fs_cert: tifsstub-fs-cert.bin {
+			filename = "ti-sysfw/ti-fs-stub-firmware-am62x-hs-cert.bin";
+			type = "blob-ext";
+			optional;
+		};
+		tifsstub_fs_enc: tifsstub-fs-enc.bin {
+			filename = "ti-sysfw/ti-fs-stub-firmware-am62x-hs-enc.bin";
+			type = "blob-ext";
+			optional;
+		};
+
+	};
+
+	tifsstub-gp {
+		filename = "tifsstub.bin_gp";
+		ti-secure-rom {
+			content = <&tifsstub_gp>;
+			core = "secure";
+			load = <0x60000>;
+			sw-rev = <CONFIG_K3_X509_SWRV>;
+			keyfile = "ti-degenerate-key.pem";
+			tifsstub;
+		};
+		tifsstub_gp: tifsstub-gp.bin {
+			filename = "ti-sysfw/ti-fs-stub-firmware-am62x-gp.bin";
+			type = "blob-ext";
+			optional;
+		};
+	};
+
 	ti-spl {
 		insert-template = <&ti_spl_template>;
 
 		fit {
 			images {
+
+				tifsstub-hs {
+					description = "TIFSSTUB";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-hs";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_hs";
+					};
+				};
+
+				tifsstub-fs {
+					description = "TIFSSTUB";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-fs";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_fs";
+					};
+				};
+
+				tifsstub-gp {
+					description = "TIFSSTUB";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-gp";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_gp";
+					};
+				};
+
 				dm {
 					ti-secure {
 						content = <&dm>;
@@ -189,7 +285,8 @@
 				conf-0 {
 					description = "k3-am625-sk";
 					firmware = "atf";
-					loadables = "tee", "dm", "spl";
+					loadables = "tee", "tifsstub-hs", "tifsstub-fs",
+					"tifsstub-gp", "dm", "spl";
 					fdt = "fdt-0";
 				};
 			};
@@ -247,6 +344,45 @@
 		fit {
 			images {
 
+				tifsstub-hs {
+					description = "tifsstub";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-hs";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_hs";
+					};
+				};
+
+				tifsstub-fs {
+					description = "tifsstub";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-fs";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_fs";
+					};
+				};
+
+				tifsstub-gp {
+					description = "tifsstub";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-gp";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_gp";
+					};
+				};
+
 				dm {
 					ti-dm {
 						filename = "ti-dm.bin";
@@ -270,7 +406,8 @@
 				conf-0 {
 					description = "k3-am625-sk";
 					firmware = "atf";
-					loadables = "tee", "dm", "spl";
+					loadables = "tee", "tifsstub-hs", "tifsstub-fs",
+						  "tifsstub-gp", "dm", "spl";
 					fdt = "fdt-0";
 				};
 			};
Signature · 1 line
2.34.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] arm: dts: k3: binman: am625: add support for signing TIFSSTUB Images

Hi Dhruva

Quoted 180 lines · Dhruva Gole

From: Kamlesh Gurudasani <[email protected]>

Add support for signing of TIFSSTUB images for HSSE, HSFS and GP devices and include them in tispl.bin and tispl.bin_unsigned.

---
  arch/arm/dts/k3-am625-sk-binman.dtsi | 141 ++++++++++++++++++++++++++-
  1 file changed, 139 insertions(+), 2 deletions(-)
arch/arm/dts/k3-am625-sk-binman.dtsi +137 -1
index 5b058bd03a07..dfd38d64f638 100644
@@ -151,11 +151,107 @@
  			filename = "ti-dm/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f";
  		};
  	};
+
+	tifsstub-hs {
+		filename = "tifsstub.bin_hs";
+		ti-secure-rom {
+			content = <&tifsstub_hs_cert>;
+			core = "secure";
+			load = <0x40000>;
+			sw-rev = <CONFIG_K3_X509_SWRV>;
+			keyfile = "custMpk.pem";
+			countersign;
+			tifsstub;
+		};
+		tifsstub_hs_cert: tifsstub-hs-cert.bin {
+			filename = "ti-sysfw/ti-fs-stub-firmware-am62x-hs-cert.bin";
+			type = "blob-ext";
+			optional;
+		};
+		tifsstub_hs_enc: tifsstub-hs-enc.bin {
+			filename = "ti-sysfw/ti-fs-stub-firmware-am62x-hs-enc.bin";
+			type = "blob-ext";
+			optional;
+		};
+	};
+
+	tifsstub-fs {
+		filename = "tifsstub.bin_fs";
+		tifsstub_fs_cert: tifsstub-fs-cert.bin {
+			filename = "ti-sysfw/ti-fs-stub-firmware-am62x-hs-cert.bin";
+			type = "blob-ext";
+			optional;
+		};
+		tifsstub_fs_enc: tifsstub-fs-enc.bin {
+			filename = "ti-sysfw/ti-fs-stub-firmware-am62x-hs-enc.bin";
+			type = "blob-ext";
+			optional;
+		};
+
+	};
+
+	tifsstub-gp {
+		filename = "tifsstub.bin_gp";
+		ti-secure-rom {
+			content = <&tifsstub_gp>;
+			core = "secure";
+			load = <0x60000>;
+			sw-rev = <CONFIG_K3_X509_SWRV>;
+			keyfile = "ti-degenerate-key.pem";
+			tifsstub;
+		};
+		tifsstub_gp: tifsstub-gp.bin {
+			filename = "ti-sysfw/ti-fs-stub-firmware-am62x-gp.bin";
+			type = "blob-ext";
+			optional;
+		};
+	};
+
  	ti-spl {
  		insert-template = <&ti_spl_template>;
 
  		fit {
  			images {
+
+				tifsstub-hs {
+					description = "TIFSSTUB";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-hs";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_hs";
+					};
+				};
+
+				tifsstub-fs {
+					description = "TIFSSTUB";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-fs";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_fs";
+					};
+				};
+
+				tifsstub-gp {
+					description = "TIFSSTUB";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-gp";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_gp";
+					};
+				};
+
  				dm {
  					ti-secure {
  						content = <&dm>;
@@ -189,7 +285,8 @@
  				conf-0 {
  					description = "k3-am625-sk";
  					firmware = "atf";
-					loadables = "tee", "dm", "spl";
+					loadables = "tee", "tifsstub-hs", "tifsstub-fs",
+					"tifsstub-gp", "dm", "spl";
  					fdt = "fdt-0";
  				};
  			};
@@ -247,6 +344,45 @@
  		fit {
  			images {
 
+				tifsstub-hs {
+					description = "tifsstub";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-hs";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_hs";
+					};
+				};
+
+				tifsstub-fs {
+					description = "tifsstub";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-fs";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_fs";
+					};
+				};
+
+				tifsstub-gp {
+					description = "tifsstub";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "tifsstub-gp";
+					load = <0x9dc00000>;
+					entry = <0x9dc00000>;
+					blob-ext {
+						filename = "tifsstub.bin_gp";
+					};
+				};
+
  				dm {
  					ti-dm {
  						filename = "ti-dm.bin";

arch/arm/dts/k3-am625-sk-binman.dtsi line 413

Quoted 9 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +2 -1
@@ -270,7 +406,8 @@
  				conf-0 {
  					description = "k3-am625-sk";
  					firmware = "atf";
-					loadables = "tee", "dm", "spl";
+					loadables = "tee", "tifsstub-hs", "tifsstub-fs",
+						  "tifsstub-gp", "dm", "spl";
  					fdt = "fdt-0";
  				};
  			};

If there are multiple boards that will support TIFSSTUB in future, I would prefer templating these out and putting them in k3-binman.dtsi. However considering there's a lot of movement currently (cleanup and OF_STREAM) in that file, you can maybe take this up when adding support for the next board.

Signature · 2 lines
Thanking You
Neha Malcom Francis
#5 lore raw

Re: [PATCH 2/2] arm: dts: k3: binman: am625: add support for signing TIFSSTUB Images

Quoted 8 lines · Neha Malcom Francis
Quoted 7 lines · Dhruva Gole

From: Kamlesh Gurudasani <[email protected]>

Add support for signing of TIFSSTUB images for HSSE, HSFS and GP devices and include them in tispl.bin and tispl.bin_unsigned.

[...]

Quoted 5 lines
Quoted 5 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +0 -1
@@ -270,7 +406,8 @@
  				conf-0 {
  					description = "k3-am625-sk";
  					firmware = "atf";
-					loadables = "tee", "dm", "spl";
Quoted 8 lines

arch/arm/dts/k3-am625-sk-binman.dtsi line 292

Quoted 5 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +2 -0
+					loadables = "tee", "tifsstub-hs", "tifsstub-fs",
+						  "tifsstub-gp", "dm", "spl";
  					fdt = "fdt-0";
  				};
  			};

If there are multiple boards that will support TIFSSTUB in future, I would

I would assume that this will be the case. Verdin AM62 would need the same, for example.

Francesco

#6 lore raw

Re: [PATCH 2/2] arm: dts: k3: binman: am625: add support for signing TIFSSTUB Images

In reply to Neha Malcom Francis

Hi Neha!

Quoted 14 lines · Neha Malcom Francis

Hi Dhruva

Quoted 11 lines · Dhruva Gole

From: Kamlesh Gurudasani <[email protected]>

Add support for signing of TIFSSTUB images for HSSE, HSFS and GP devices and include them in tispl.bin and tispl.bin_unsigned.

---
  arch/arm/dts/k3-am625-sk-binman.dtsi | 141 ++++++++++++++++++++++++++-
  1 file changed, 139 insertions(+), 2 deletions(-)

[...]

Quoted 9 lines
Quoted 9 lines
  				dm {
  					ti-dm {
  						filename = "ti-dm.bin";
arch/arm/dts/k3-am625-sk-binman.dtsi +1 -1
@@ -270,7 +406,8 @@
  				conf-0 {
  					description = "k3-am625-sk";
  					firmware = "atf";
-					loadables = "tee", "dm", "spl";
+					loadables = "tee", "tifsstub-hs", "tifsstub-fs",
Quoted 8 lines

arch/arm/dts/k3-am625-sk-binman.dtsi line 292

Quoted 4 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +1 -0
+						  "tifsstub-gp", "dm", "spl";
  					fdt = "fdt-0";
  				};
  			};

If there are multiple boards that will support TIFSSTUB in future, I would prefer templating these out and putting them in k3-binman.dtsi. However

That's a great idea. From the next set of boards for which also need binman TIFS Stub support we will keep in mind as you said below. Currently amidst all the movement and cleanup I don't want to push out too many changes at once.

I also have cleanup and OF_UPSTREAM changes for am62x pending which I plan on posting sometime soon..

Quoted 5 lines

considering there's a lot of movement currently (cleanup and OF_STREAM) in that file, you can maybe take this up when adding support for the next board.

Thanks!

Signature · 2 lines
Best regards,
Dhruva Gole <[email protected]>