Skip to contentSkip to conversation

imx: container: Eliminate IMX_PQC_SUPPORT

PATCH In review Marek Vasut 2 participants 8 messages Nov 27, 2025 – Dec 2, 2025

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

PATCH 1/2 imx: container: Eliminate IMX_PQC_SUPPORT

The PQC support is available on i.MX94 and i.MX95 B0 and newer. This can be detected at runtime using is_imx94()/is_imx95() and soc_rev() macros.

Eliminate IMX_PQC_SUPPORT and CONTAINER_HDR_ALIGNMENT and make U-Boot generic on i.MX95 A0, A1, B0 and newer once more.

---
Cc: "João Paulo Gonçalves" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Alice Guo <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Jacky Bai <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Ye Li <[email protected]>
Cc: [email protected]
---
NOTE: Compile-tested only

---
 arch/arm/mach-imx/image-container.c | 20 +++++++++++---------
 arch/arm/mach-imx/imx9/Kconfig      |  2 --
 common/spl/Kconfig                  |  7 -------
 common/spl/spl_imx_container.c      |  7 ++++---
 include/imx_container.h             | 23 +++++++++++++----------
 5 files changed, 28 insertions(+), 31 deletions(-)
arch/arm/mach-imx/image-container.c +11 -9
index 78f2488cf6d..59169db2fa0 100644
@@ -131,7 +131,8 @@ int get_container_size(ulong addr, u16 *header_length)
 
 static int get_dev_container_size(void *dev, int dev_type, unsigned long offset, u16 *header_length, bool *v2x_cntr)
 {
-	u8 *buf = malloc(CONTAINER_HDR_ALIGNMENT);
+	const int hdr_alignment = container_hdr_alignment();
+	u8 *buf = malloc(hdr_alignment);
 	int ret = 0;
 
 	if (!buf) {
@@ -146,7 +147,7 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset,
 
 		count = blk_dread(mmc_get_blk_desc(mmc),
 				  offset / mmc->read_bl_len,
-				  CONTAINER_HDR_ALIGNMENT / mmc->read_bl_len,
+				  hdr_alignment / mmc->read_bl_len,
 				  buf);
 		if (count == 0) {
 			printf("Read container image from MMC/SD failed\n");
@@ -160,7 +161,7 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset,
 		struct spi_flash *flash = (struct spi_flash *)dev;
 
 		ret = spi_flash_read(flash, offset,
-				     CONTAINER_HDR_ALIGNMENT, buf);
+				     hdr_alignment, buf);
 		if (ret != 0) {
 			printf("Read container image from QSPI failed\n");
 			return -EIO;
@@ -170,7 +171,7 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset,
 
 #ifdef CONFIG_SPL_NAND_SUPPORT
 	if (dev_type == NAND_DEV) {
-		ret = nand_spl_load_image(offset, CONTAINER_HDR_ALIGNMENT,
+		ret = nand_spl_load_image(offset, hdr_alignment,
 					  buf);
 		if (ret != 0) {
 			printf("Read container image from NAND failed\n");
@@ -181,12 +182,12 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset,
 
 #ifdef CONFIG_SPL_NOR_SUPPORT
 	if (dev_type == QSPI_NOR_DEV)
-		memcpy(buf, (const void *)offset, CONTAINER_HDR_ALIGNMENT);
+		memcpy(buf, (const void *)offset, hdr_alignment);
 #endif
 
 #ifdef CONFIG_SPL_BOOTROM_SUPPORT
 	if (dev_type == ROM_API_DEV) {
-		ret = spl_romapi_raw_seekable_read(offset, CONTAINER_HDR_ALIGNMENT, buf);
+		ret = spl_romapi_raw_seekable_read(offset, hdr_alignment, buf);
 		if (!ret) {
 			printf("Read container image from ROM API failed\n");
 			return -EIO;
@@ -282,6 +283,7 @@ static unsigned long get_boot_device_offset(void *dev, int dev_type)
 
 static ulong get_imageset_end(void *dev, int dev_type)
 {
+	const int hdr_alignment = container_hdr_alignment();
 	unsigned long offset[3] = {};
 	int value_container[3] = {};
 	u16 hdr_length;
@@ -298,7 +300,7 @@ static ulong get_imageset_end(void *dev, int dev_type)
 	debug("seco container size 0x%x\n", value_container[0]);
 
 	if (is_imx95() || is_imx94()) {
-		offset[1] = ALIGN(hdr_length, CONTAINER_HDR_ALIGNMENT) + offset[0];
+		offset[1] = ALIGN(hdr_length, hdr_alignment) + offset[0];
 
 		value_container[1] = get_dev_container_size(dev, dev_type, offset[1], &hdr_length, &v2x_fw);
 		if (value_container[1] < 0) {
@@ -308,14 +310,14 @@ static ulong get_imageset_end(void *dev, int dev_type)
 
 		if (v2x_fw) {
 			debug("v2x container size 0x%x\n", value_container[1]);
-			offset[2] = ALIGN(hdr_length, CONTAINER_HDR_ALIGNMENT) + offset[1];
+			offset[2] = ALIGN(hdr_length, hdr_alignment) + offset[1];
 		} else {
 			printf("no v2x container included\n");
 			offset[2] = offset[1];
 		}
 	} else {
 		/* Skip offset[1] */
-		offset[2] = ALIGN(hdr_length, CONTAINER_HDR_ALIGNMENT) + offset[0];
+		offset[2] = ALIGN(hdr_length, hdr_alignment) + offset[0];
 	}
 
 	value_container[2] = get_dev_container_size(dev, dev_type, offset[2], &hdr_length, NULL);
arch/arm/mach-imx/imx9/Kconfig +0 -2
index d9725a96043..8a01b9045dd 100644
@@ -36,14 +36,12 @@ config IMX95
 	select DM_MAILBOX
 	select SCMI_FIRMWARE
 	select SPL_IMX_CONTAINER_USE_TRAMPOLINE
-	select IMX_PQC_SUPPORT if !IMX95_A0
 
 config IMX94
 	bool
 	select ARMV8_SPL_EXCEPTION_VECTORS
 	select DM_MAILBOX
 	select IMX9
-	select IMX_PQC_SUPPORT
 	select SCMI_FIRMWARE
 	select SPL_IMX_CONTAINER_USE_TRAMPOLINE
 
common/spl/Kconfig +0 -7
index 8dade2b501e..f8fd502f5a5 100644
@@ -372,13 +372,6 @@ config SPL_IMX_CONTAINER_USE_TRAMPOLINE
 	help
 	  Enable SPL load reader to load data to a trampoline buffer.
 
-config IMX_PQC_SUPPORT
-	bool "Enable to support i.MX ROM PQC Container"
-	depends on SPL && SPL_LOAD_IMX_CONTAINER
-	help
-	  Support i.MX ROM new PQC container format. If your chip does not use
-	  PQC container, say 'n'.
-
 config IMX_CONTAINER_CFG
 	string "i.MX8 Container config file"
 	depends on SPL && SPL_LOAD_IMX_CONTAINER
common/spl/spl_imx_container.c +4 -3
index 79d021f81dc..e0e8ee0a5e6 100644
@@ -87,11 +87,12 @@ static struct boot_img_t *read_auth_image(struct spl_image_info *spl_image,
 static int read_auth_container(struct spl_image_info *spl_image,
 			       struct spl_load_info *info, ulong offset)
 {
+	const int hdr_alignment = container_hdr_alignment();
 	struct container_hdr *container = NULL;
 	u16 length;
 	int i, size, ret = 0;
 
-	size = ALIGN(CONTAINER_HDR_ALIGNMENT, spl_get_bl_len(info));
+	size = ALIGN(hdr_alignment, spl_get_bl_len(info));
 
 	/*
 	 * It will not override the ATF code, so safe to use it here,
@@ -104,7 +105,7 @@ static int read_auth_container(struct spl_image_info *spl_image,
 	debug("%s: container: %p offset: %lu size: %u\n", __func__,
 	      container, offset, size);
 	if (info->read(info, offset, size, container) <
-	    CONTAINER_HDR_ALIGNMENT) {
+	    hdr_alignment) {
 		ret = -EIO;
 		goto end;
 	}
@@ -124,7 +125,7 @@ static int read_auth_container(struct spl_image_info *spl_image,
 	length = container->length_lsb + (container->length_msb << 8);
 	debug("Container length %u\n", length);
 
-	if (length > CONTAINER_HDR_ALIGNMENT) {
+	if (length > hdr_alignment) {
 		size = ALIGN(length, spl_get_bl_len(info));
 
 		free(container);
include/imx_container.h +13 -10
index 684fc3bc988..1a19d2503e7 100644
@@ -6,17 +6,14 @@
 #ifndef __CONTAINER_HEADER_H_
 #define __CONTAINER_HEADER_H_
 
+#include <asm/arch/sys_proto.h>
+
 #include <linux/sizes.h>
 #include <linux/types.h>
 
 #define IV_MAX_LEN			32
 #define HASH_MAX_LEN			64
 
-#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT)
-#define CONTAINER_HDR_ALIGNMENT 0x4000
-#else
-#define CONTAINER_HDR_ALIGNMENT 0x400
-#endif
 #define CONTAINER_HDR_EMMC_OFFSET 0
 #define CONTAINER_HDR_MMCSD_OFFSET SZ_32K
 #define CONTAINER_HDR_QSPI_OFFSET SZ_4K
@@ -76,14 +73,20 @@ int get_container_size(ulong addr, u16 *header_length);
 
 static inline bool valid_container_hdr(struct container_hdr *container)
 {
-#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT)
 	return (container->tag == CONTAINER_HDR_TAG ||
 		container->tag == 0x82) &&
 		(container->version == CONTAINER_HDR_VERSION ||
 		 container->version == 0x2);
-#else
-	return container->tag == CONTAINER_HDR_TAG &&
-	       container->version == CONTAINER_HDR_VERSION;
-#endif
+}
+
+static inline int container_hdr_alignment(void)
+{
+	if (is_imx94())
+		return 0x4000;	/* PQC */
+
+	if (is_imx95() && (soc_rev() >= CHIP_REV_2_0))
+		return 0x4000;	/* PQC on i.MX95 B0 and newer */
+
+	return 0x400;	/* Non-PQC on i.MX95 A1 and older */
 }
 #endif
Signature · 1 line
2.51.0
#1 lore raw

PATCH 2/2 imx: Eliminate IMX95_A0

Instead of ifdeffery in DTs, simply generate flash-a0.bin for i.MX95 A0/A1 and flash.bin for i.MX95 B0 and newer. This way, both SoC revisions can be supported and binman will fill in missing blobs into flash*bin if they are not accessible. This makes U-Boot generic on i.MX95 A0, A1, B0 and newer once more.

---
Cc: "João Paulo Gonçalves" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Alice Guo <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Jacky Bai <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Ye Li <[email protected]>
Cc: [email protected]
---
NOTE: Compile-tested only

---
 arch/arm/dts/imx95-u-boot.dtsi       | 49 ++++++++++++++++++++--------
 arch/arm/mach-imx/imx9/Kconfig       |  3 --
 configs/imx95_a0_19x19_evk_defconfig |  2 --
 3 files changed, 35 insertions(+), 19 deletions(-)
 delete mode 100644 configs/imx95_a0_19x19_evk_defconfig
arch/arm/dts/imx95-u-boot.dtsi +35 -14
index 591cb317508..01f3bf9b172 100644
@@ -47,7 +47,41 @@
 			};
 		};
 
-		imx-boot {
+		imx-boot-a0 {
+			filename = "flash-a0.bin";
+			pad-byte = <0x00>;
+
+			spl {
+				type = "nxp-imx9image";
+				cfg-path = "spl/u-boot-spl.cfgout";
+				args;
+
+				boot-from = "sd";
+				soc-type = "IMX9";
+				append = "mx95a0-ahab-container.img";
+				container;
+				image0 = "oei", "m33-oei-ddrfw.bin", "0x1ffc0000";
+				hold = <0x10000>;
+				image1 = "oei", "oei-m33-tcm.bin", "0x1ffc0000";
+				image2 = "m33", "m33_image.bin", "0x1ffc0000";
+				image3 = "a55", "spl/u-boot-spl.bin", "0x20480000";
+				dummy-v2x = <0x8b000000>;
+			};
+
+			u-boot {
+				type = "nxp-imx9image";
+				cfg-path = "u-boot-container.cfgout";
+				args;
+
+				boot-from = "sd";
+				soc-type = "IMX9";
+				container;
+				image0 = "a55", "bl31.bin", "0x8a200000";
+				image1 = "a55", "u-boot.bin", "0x90200000";
+			};
+		};
+
+		imx-boot-b0 {
 			filename = "flash.bin";
 			pad-byte = <0x00>;
 
@@ -56,25 +90,14 @@
 				cfg-path = "spl/u-boot-spl.cfgout";
 				args;
 
-#ifndef CONFIG_IMX95_A0
 				cntr-version = <2>;
-#endif
 				boot-from = "sd";
 				soc-type = "IMX9";
-#ifdef CONFIG_IMX95_A0
-				append = "mx95a0-ahab-container.img";
-#else
 				append = "mx95b0-ahab-container.img";
-#endif
 				container;
-#ifndef CONFIG_IMX95_A0
 				dummy-ddr;
-#endif
 				image0 = "oei", "m33-oei-ddrfw.bin", "0x1ffc0000";
 				hold = <0x10000>;
-#ifdef CONFIG_IMX95_A0
-				image1 = "oei", "oei-m33-tcm.bin", "0x1ffc0000";
-#endif
 				image2 = "m33", "m33_image.bin", "0x1ffc0000";
 				image3 = "a55", "spl/u-boot-spl.bin", "0x20480000";
 				dummy-v2x = <0x8b000000>;
@@ -85,9 +108,7 @@
 				cfg-path = "u-boot-container.cfgout";
 				args;
 
-#ifndef CONFIG_IMX95_A0
 				cntr-version = <2>;
-#endif
 				boot-from = "sd";
 				soc-type = "IMX9";
 				container;
arch/arm/mach-imx/imx9/Kconfig +0 -3
index 8a01b9045dd..f5e4c364087 100644
@@ -25,9 +25,6 @@ config IMX91
 	select ARCH_MISC_INIT
 	select ARMV8_SPL_EXCEPTION_VECTORS
 
-config IMX95_A0
-	bool "Support for i.MX95 A0 silicon version"
-
 config IMX95
 	bool
 	select ARCH_MISC_INIT
configs/imx95_a0_19x19_evk_defconfig deleted +0 -2
deleted file mode 100644
index 9376f11b151..00000000000
@@ -1,2 +0,0 @@
-#include <configs/imx95_evk.config>
-CONFIG_IMX95_A0=y
Signature · 1 line
2.51.0
#2 lore raw
In reply to Marek Vasut

Hi Marek,

Quoted 229 lines · Marek Vasut

The PQC support is available on i.MX94 and i.MX95 B0 and newer. This can be detected at runtime using is_imx94()/is_imx95() and soc_rev() macros.

Eliminate IMX_PQC_SUPPORT and CONTAINER_HDR_ALIGNMENT and make U-Boot generic on i.MX95 A0, A1, B0 and newer once more.

---
Cc: "João Paulo Gonçalves" <[email protected]>
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Alice Guo <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Jacky Bai <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Ye Li <[email protected]>
Cc: [email protected]
---
NOTE: Compile-tested only

---
  arch/arm/mach-imx/image-container.c | 20 +++++++++++---------
  arch/arm/mach-imx/imx9/Kconfig      |  2 --
  common/spl/Kconfig                  |  7 -------
  common/spl/spl_imx_container.c      |  7 ++++---
  include/imx_container.h             | 23 +++++++++++++----------
  5 files changed, 28 insertions(+), 31 deletions(-)
arch/arm/mach-imx/image-container.c +11 -9
index 78f2488cf6d..59169db2fa0 100644
@@ -131,7 +131,8 @@ int get_container_size(ulong addr, u16 *header_length)
 
  static int get_dev_container_size(void *dev, int dev_type, unsigned long offset, u16 *header_length, bool *v2x_cntr)
  {
-	u8 *buf = malloc(CONTAINER_HDR_ALIGNMENT);
+	const int hdr_alignment = container_hdr_alignment();
+	u8 *buf = malloc(hdr_alignment);
  	int ret = 0;
 
  	if (!buf) {
@@ -146,7 +147,7 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset,
 
  		count = blk_dread(mmc_get_blk_desc(mmc),
  				  offset / mmc->read_bl_len,
-				  CONTAINER_HDR_ALIGNMENT / mmc->read_bl_len,
+				  hdr_alignment / mmc->read_bl_len,
  				  buf);
  		if (count == 0) {
  			printf("Read container image from MMC/SD failed\n");
@@ -160,7 +161,7 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset,
  		struct spi_flash *flash = (struct spi_flash *)dev;
 
  		ret = spi_flash_read(flash, offset,
-				     CONTAINER_HDR_ALIGNMENT, buf);
+				     hdr_alignment, buf);
  		if (ret != 0) {
  			printf("Read container image from QSPI failed\n");
  			return -EIO;
@@ -170,7 +171,7 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset,
 
  #ifdef CONFIG_SPL_NAND_SUPPORT
  	if (dev_type == NAND_DEV) {
-		ret = nand_spl_load_image(offset, CONTAINER_HDR_ALIGNMENT,
+		ret = nand_spl_load_image(offset, hdr_alignment,
  					  buf);
  		if (ret != 0) {
  			printf("Read container image from NAND failed\n");
@@ -181,12 +182,12 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset,
 
  #ifdef CONFIG_SPL_NOR_SUPPORT
  	if (dev_type == QSPI_NOR_DEV)
-		memcpy(buf, (const void *)offset, CONTAINER_HDR_ALIGNMENT);
+		memcpy(buf, (const void *)offset, hdr_alignment);
  #endif
 
  #ifdef CONFIG_SPL_BOOTROM_SUPPORT
  	if (dev_type == ROM_API_DEV) {
-		ret = spl_romapi_raw_seekable_read(offset, CONTAINER_HDR_ALIGNMENT, buf);
+		ret = spl_romapi_raw_seekable_read(offset, hdr_alignment, buf);
  		if (!ret) {
  			printf("Read container image from ROM API failed\n");
  			return -EIO;
@@ -282,6 +283,7 @@ static unsigned long get_boot_device_offset(void *dev, int dev_type)
 
  static ulong get_imageset_end(void *dev, int dev_type)
  {
+	const int hdr_alignment = container_hdr_alignment();
  	unsigned long offset[3] = {};
  	int value_container[3] = {};
  	u16 hdr_length;
@@ -298,7 +300,7 @@ static ulong get_imageset_end(void *dev, int dev_type)
  	debug("seco container size 0x%x\n", value_container[0]);
 
  	if (is_imx95() || is_imx94()) {
-		offset[1] = ALIGN(hdr_length, CONTAINER_HDR_ALIGNMENT) + offset[0];
+		offset[1] = ALIGN(hdr_length, hdr_alignment) + offset[0];
 
  		value_container[1] = get_dev_container_size(dev, dev_type, offset[1], &hdr_length, &v2x_fw);
  		if (value_container[1] < 0) {
@@ -308,14 +310,14 @@ static ulong get_imageset_end(void *dev, int dev_type)
 
  		if (v2x_fw) {
  			debug("v2x container size 0x%x\n", value_container[1]);
-			offset[2] = ALIGN(hdr_length, CONTAINER_HDR_ALIGNMENT) + offset[1];
+			offset[2] = ALIGN(hdr_length, hdr_alignment) + offset[1];
  		} else {
  			printf("no v2x container included\n");
  			offset[2] = offset[1];
  		}
  	} else {
  		/* Skip offset[1] */
-		offset[2] = ALIGN(hdr_length, CONTAINER_HDR_ALIGNMENT) + offset[0];
+		offset[2] = ALIGN(hdr_length, hdr_alignment) + offset[0];
  	}
 
  	value_container[2] = get_dev_container_size(dev, dev_type, offset[2], &hdr_length, NULL);
arch/arm/mach-imx/imx9/Kconfig +0 -2
index d9725a96043..8a01b9045dd 100644
@@ -36,14 +36,12 @@ config IMX95
  	select DM_MAILBOX
  	select SCMI_FIRMWARE
  	select SPL_IMX_CONTAINER_USE_TRAMPOLINE
-	select IMX_PQC_SUPPORT if !IMX95_A0
 
  config IMX94
  	bool
  	select ARMV8_SPL_EXCEPTION_VECTORS
  	select DM_MAILBOX
  	select IMX9
-	select IMX_PQC_SUPPORT
  	select SCMI_FIRMWARE
  	select SPL_IMX_CONTAINER_USE_TRAMPOLINE
 
common/spl/Kconfig +0 -7
index 8dade2b501e..f8fd502f5a5 100644
@@ -372,13 +372,6 @@ config SPL_IMX_CONTAINER_USE_TRAMPOLINE
  	help
  	  Enable SPL load reader to load data to a trampoline buffer.
 
-config IMX_PQC_SUPPORT
-	bool "Enable to support i.MX ROM PQC Container"
-	depends on SPL && SPL_LOAD_IMX_CONTAINER
-	help
-	  Support i.MX ROM new PQC container format. If your chip does not use
-	  PQC container, say 'n'.
-
  config IMX_CONTAINER_CFG
  	string "i.MX8 Container config file"
  	depends on SPL && SPL_LOAD_IMX_CONTAINER
common/spl/spl_imx_container.c +4 -3
index 79d021f81dc..e0e8ee0a5e6 100644
@@ -87,11 +87,12 @@ static struct boot_img_t *read_auth_image(struct spl_image_info *spl_image,
  static int read_auth_container(struct spl_image_info *spl_image,
  			       struct spl_load_info *info, ulong offset)
  {
+	const int hdr_alignment = container_hdr_alignment();
  	struct container_hdr *container = NULL;
  	u16 length;
  	int i, size, ret = 0;
 
-	size = ALIGN(CONTAINER_HDR_ALIGNMENT, spl_get_bl_len(info));
+	size = ALIGN(hdr_alignment, spl_get_bl_len(info));
 
  	/*
  	 * It will not override the ATF code, so safe to use it here,
@@ -104,7 +105,7 @@ static int read_auth_container(struct spl_image_info *spl_image,
  	debug("%s: container: %p offset: %lu size: %u\n", __func__,
  	      container, offset, size);
  	if (info->read(info, offset, size, container) <
-	    CONTAINER_HDR_ALIGNMENT) {
+	    hdr_alignment) {
  		ret = -EIO;
  		goto end;
  	}
@@ -124,7 +125,7 @@ static int read_auth_container(struct spl_image_info *spl_image,
  	length = container->length_lsb + (container->length_msb << 8);
  	debug("Container length %u\n", length);
 
-	if (length > CONTAINER_HDR_ALIGNMENT) {
+	if (length > hdr_alignment) {
  		size = ALIGN(length, spl_get_bl_len(info));
 
  		free(container);
include/imx_container.h +3 -10
index 684fc3bc988..1a19d2503e7 100644
@@ -6,17 +6,14 @@
  #ifndef __CONTAINER_HEADER_H_
  #define __CONTAINER_HEADER_H_
 
+#include <asm/arch/sys_proto.h>
+
  #include <linux/sizes.h>
  #include <linux/types.h>
 
  #define IV_MAX_LEN			32
  #define HASH_MAX_LEN			64
 
-#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT)
-#define CONTAINER_HDR_ALIGNMENT 0x4000
-#else
-#define CONTAINER_HDR_ALIGNMENT 0x400
-#endif
  #define CONTAINER_HDR_EMMC_OFFSET 0
  #define CONTAINER_HDR_MMCSD_OFFSET SZ_32K
  #define CONTAINER_HDR_QSPI_OFFSET SZ_4K
@@ -76,14 +73,20 @@ int get_container_size(ulong addr, u16 *header_length);
 
  static inline bool valid_container_hdr(struct container_hdr *container)
  {
-#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT)
  	return (container->tag == CONTAINER_HDR_TAG ||
  		container->tag == 0x82) &&
  		(container->version == CONTAINER_HDR_VERSION ||
  		 container->version == 0x2);
-#else
-	return container->tag == CONTAINER_HDR_TAG &&
-	       container->version == CONTAINER_HDR_VERSION;
-#endif
+}

include/imx_container.h int get_container_size(ulong addr, u16 *header_length); · line 90

Quoted 10 lines
include/imx_container.h +10 -0
+
+static inline int container_hdr_alignment(void)
+{
+	if (is_imx94())
+		return 0x4000;	/* PQC */
+
+	if (is_imx95() && (soc_rev() >= CHIP_REV_2_0))
+		return 0x4000;	/* PQC on i.MX95 B0 and newer */
+
+	return 0x400;	/* Non-PQC on i.MX95 A1 and older */

I understand you want to use single uboot and spl image for A0 and B0. But A0 is not production. Only early customers get few A0 samples. NXP marketing has notified these customers to replace A0 to B0. Are you still using A0 board? Is it necessary to do such change as we want to remove A0 to simplify the codes?

Eliminate IMX_PQC_SUPPORT config is not a good way. When adding new SOC, developer has to update the container_hdr_alignment, then it will be a long list in this function. Actually only iMX95 is the exception. If you insist keeping A0, I prefer change like below and retain IMX_PQC_SUPPORT.

#if IS_ENABLED(CONFIG_IMX95)
static inline u32 container_hdr_alignment(void)

{
	if (is_imx95() && (soc_rev() >= CHIP_REV_2_0))
		return 0x4000;
	else
		return 0x400;
}
#else
static inline u32 container_hdr_alignment(void)
{
#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT)
	return 0x4000;
#else
	return 0x400;

#endif
}
#endif

Best regards,
Ye Li

Quoted 2 lines
include/imx_container.h +0 -0
  }
  #endif
#3 lore raw

On 11/28/25 4:26 AM, Ye Li wrote:

Hello everyone,

Quoted 4 lines
Quoted 4 lines
include/imx_container.h +4 -0
+static inline int container_hdr_alignment(void)
+{
+    if (is_imx94())
+        return 0x4000;    /* PQC */
Quoted 8 lines

include/imx_container.h int get_container_size(ulong addr, u16 *header_length); · line 90

Quoted 5 lines
include/imx_container.h +5 -0
+
+    if (is_imx95() && (soc_rev() >= CHIP_REV_2_0))
+        return 0x4000;    /* PQC on i.MX95 B0 and newer */
+
+    return 0x400;    /* Non-PQC on i.MX95 A1 and older */

I understand you want to use single uboot and spl image for A0 and B0. But A0 is not production. Only early customers get few A0 samples. NXP marketing has notified these customers to replace A0 to B0. Are you still using A0 board? Is it necessary to do such change as we want to remove A0 to simplify the codes?

I have both A0 and B0 device.

I do not see why we need to have a Kconfig option for something we can trivially auto-detect, hence this patch.

Quoted 12 lines

Eliminate IMX_PQC_SUPPORT config is not a good way. When adding new SOC, developer has to update the container_hdr_alignment, then it will be a long list in this function. Actually only iMX95 is the exception. If you insist keeping A0, I prefer change like below and retain IMX_PQC_SUPPORT.

#if IS_ENABLED(CONFIG_IMX95)
static inline u32 container_hdr_alignment(void) {
    if (is_imx95() && (soc_rev() >= CHIP_REV_2_0)) return 0x4000;
    else
        return 0x400;
}
#else
static inline u32 container_hdr_alignment(void)

Quoted 8 lines

{
#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT)
    return 0x4000;
#else
    return 0x400;
#endif
}
#endif

This adds even more ifdeffery and makes the code even worse, so no.

But if you are sure that every new SoC will have the PQC alignment, then the condition in this patch can be inverted this way:

static inline int container_hdr_alignment(void)

{
	if (is_imx95() && (soc_rev() < CHIP_REV_2_0))
		return 0x400;	/* PQC on i.MX95 A1 and older */

	return 0x4000;	/* PQC is the default */
}

Are you sure every new SoC (at least in the foreseeable future) will be like that ?

#4 lore raw
Quoted 17 lines · Marek Vasut

On 11/28/25 4:26 AM, Ye Li wrote:

Hello everyone,

Quoted 4 lines
Quoted 4 lines
include/imx_container.h +4 -0
+static inline int container_hdr_alignment(void)
+{
+    if (is_imx94())
+        return 0x4000;    /* PQC */
Quoted 8 lines

include/imx_container.h int get_container_size(ulong addr, u16 *header_length); · line 90

Quoted 5 lines
include/imx_container.h +5 -0
+
+    if (is_imx95() && (soc_rev() >= CHIP_REV_2_0))
+        return 0x4000;    /* PQC on i.MX95 B0 and newer */
+
+    return 0x400;    /* Non-PQC on i.MX95 A1 and older */

I understand you want to use single uboot and spl image for A0 and B0. But A0 is not production. Only early customers get few A0 samples. NXP marketing has notified these customers to replace A0 to B0. Are you still using A0 board? Is it necessary to do such change as we want to remove A0 to simplify the codes?

Quoted 3 lines

I have both A0 and B0 device.

I do not see why we need to have a Kconfig option for something we can trivially auto-detect, hence this patch.

Yes, it can auto-detect. The history is we dropped A0 when upstreaming B0 support. But someone from community complained A0 broken and requested to add back A0. Using static Kconfig is easy for removing A0 in future.

Quoted 30 lines
Quoted 13 lines

Eliminate IMX_PQC_SUPPORT config is not a good way. When adding new SOC, developer has to update the container_hdr_alignment, then it will be a long list in this function. Actually only iMX95 is the exception. If you insist keeping A0, I prefer change like below and retain IMX_PQC_SUPPORT.

#if IS_ENABLED(CONFIG_IMX95)
static inline u32 container_hdr_alignment(void) {
     if (is_imx95() && (soc_rev() >= CHIP_REV_2_0)) return 0x4000;
     else
         return 0x400;
}
#else
static inline u32 container_hdr_alignment(void)

Quoted 8 lines

{
#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT)
     return 0x4000;
#else
     return 0x400;
#endif
}
#endif

This adds even more ifdeffery and makes the code even worse, so no.

But if you are sure that every new SoC will have the PQC alignment, then the condition in this patch can be inverted this way:

static inline int container_hdr_alignment(void)
{
    if (is_imx95() && (soc_rev() < CHIP_REV_2_0)) return 0x400;    /* PQC on i.MX95 A1 and older */

Quoted 4 lines

    return 0x4000;    /* PQC is the default */
}

Are you sure every new SoC (at least in the foreseeable future) will be like that ?

No, it can't be guaranteed. And we have legacy SOC like 8QM/8QXP/8ULP/93/91 using this container without PQC support, above new change will break them. Please consider keeping the IMX_PQC_SUPPORT, so every soc can select it to work.

Best regards,
Ye Li

#5 lore raw
Quoted 20 lines · Ye Li
Quoted 17 lines · Marek Vasut

On 11/28/25 4:26 AM, Ye Li wrote:

Hello everyone,

Quoted 12 lines

include/imx_container.h int get_container_size(ulong addr, u16 *header_length); · line 90

Quoted 9 lines
include/imx_container.h +9 -0
+static inline int container_hdr_alignment(void)
+{
+    if (is_imx94())
+        return 0x4000;    /* PQC */
+
+    if (is_imx95() && (soc_rev() >= CHIP_REV_2_0))
+        return 0x4000;    /* PQC on i.MX95 B0 and newer */
+
+    return 0x400;    /* Non-PQC on i.MX95 A1 and older */

I understand you want to use single uboot and spl image for A0 and B0. But A0 is not production. Only early customers get few A0 samples. NXP marketing has notified these customers to replace A0 to B0. Are you still using A0 board? Is it necessary to do such change as we want to remove A0 to simplify the codes?

Quoted 5 lines
Quoted 3 lines

I have both A0 and B0 device.

I do not see why we need to have a Kconfig option for something we can trivially auto-detect, hence this patch.

Yes, it can auto-detect. The history is we dropped A0 when upstreaming B0 support. But someone from community complained A0 broken and requested to add back A0. Using static Kconfig is easy for removing A0 in future.

Adding another Kconfig symbol and ifdeffery seems easy, but it also had additional implications -- more code paths because of the ifdeffery, more Kconfig symbols which the user has to understand, and another machine config has to be built in the CI to cover this configuration.

The auto-detection avoids all these problems.

Quoted 29 lines
Quoted 29 lines
Quoted 12 lines

Eliminate IMX_PQC_SUPPORT config is not a good way. When adding new SOC, developer has to update the container_hdr_alignment, then it will be a long list in this function. Actually only iMX95 is the exception. If you insist keeping A0, I prefer change like below and retain IMX_PQC_SUPPORT.

#if IS_ENABLED(CONFIG_IMX95)
static inline u32 container_hdr_alignment(void) {
     if (is_imx95() && (soc_rev() >= CHIP_REV_2_0)) return 0x4000;
     else
         return 0x400;
}
#else
static inline u32 container_hdr_alignment(void)

Quoted 8 lines

{
#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT)
     return 0x4000;
#else
     return 0x400;
#endif
}
#endif

This adds even more ifdeffery and makes the code even worse, so no.

But if you are sure that every new SoC will have the PQC alignment, then the condition in this patch can be inverted this way:

static inline int container_hdr_alignment(void)
{
     if (is_imx95() && (soc_rev() < CHIP_REV_2_0)) return 0x400;    /* PQC on i.MX95 A1 and older */

Quoted 5 lines
Quoted 4 lines

     return 0x4000;    /* PQC is the default */
}

Are you sure every new SoC (at least in the foreseeable future) will be like that ?

No, it can't be guaranteed. And we have legacy SOC like 8QM/8QXP/8ULP/93/91 using this container without PQC support, above new change will break them. Please consider keeping the IMX_PQC_SUPPORT, so every soc can select it to work.

See above why adding more and more Kconfig options is not a good solution.

I believe the original implementation in this patch does not break the legacy SoCs ?

If you are concerned about growing list of SoCs in this function, then this function can list the five legacy SoCs + imx95a0 SoC with non-PQC alignment and by default return PQC alignment ?

#6 lore raw
Quoted 23 lines · Marek Vasut
Quoted 22 lines · Ye Li
Quoted 19 lines · Marek Vasut

On 11/28/25 4:26 AM, Ye Li wrote:

Hello everyone,

Quoted 4 lines
Quoted 4 lines
include/imx_container.h +4 -0
+static inline int container_hdr_alignment(void)
+{
+    if (is_imx94())
+        return 0x4000;    /* PQC */
Quoted 8 lines

include/imx_container.h int get_container_size(ulong addr, u16 *header_length); · line 90

Quoted 5 lines
include/imx_container.h +5 -0
+
+    if (is_imx95() && (soc_rev() >= CHIP_REV_2_0))
+        return 0x4000;    /* PQC on i.MX95 B0 and newer */
+
+    return 0x400;    /* Non-PQC on i.MX95 A1 and older */

I understand you want to use single uboot and spl image for A0 and B0. But A0 is not production. Only early customers get few A0 samples. NXP marketing has notified these customers to replace A0 to B0. Are you still using A0 board? Is it necessary to do such change as we want to remove A0 to simplify the codes?

I have both A0 and B0 device.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

I do not see why we need to have a Kconfig option for something we can trivially auto-detect, hence this patch.

Yes, it can auto-detect. The history is we dropped A0 when upstreaming B0 support. But someone from community complained A0 broken and requested to add back A0. Using static Kconfig is easy for removing A0 in future.

Adding another Kconfig symbol and ifdeffery seems easy, but it also had additional implications -- more code paths because of the ifdeffery, more Kconfig symbols which the user has to understand, and another machine config has to be built in the CI to cover this configuration.

The auto-detection avoids all these problems.

I agree to remove IMX95_A0, but I don't suggest removing IMX_PQC_SUPPORT. For each SOC, supporting PQC container or not is definite. Adding runtime detect is just for iMX95. But iMX95 A1 is EOL, everyone must use B0. And A1 codes should be removed. You said you have A1 board, could you share the board name?

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 12 lines

Eliminate IMX_PQC_SUPPORT config is not a good way. When adding new SOC, developer has to update the container_hdr_alignment, then it will be a long list in this function. Actually only iMX95 is the exception. If you insist keeping A0, I prefer change like below and retain IMX_PQC_SUPPORT.

#if IS_ENABLED(CONFIG_IMX95)
static inline u32 container_hdr_alignment(void) {
     if (is_imx95() && (soc_rev() >= CHIP_REV_2_0)) return 0x4000;
     else
         return 0x400;
}
#else
static inline u32 container_hdr_alignment(void)

Quoted 8 lines

{
#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT)
     return 0x4000;
#else
     return 0x400;
#endif
}
#endif

This adds even more ifdeffery and makes the code even worse, so no.

But if you are sure that every new SoC will have the PQC alignment, then the condition in this patch can be inverted this way:

static inline int container_hdr_alignment(void)
{
     if (is_imx95() && (soc_rev() < CHIP_REV_2_0)) return 0x400;    /* PQC on i.MX95 A1 and older */

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

     return 0x4000;    /* PQC is the default */
}

Are you sure every new SoC (at least in the foreseeable future) will be like that ?

No, it can't be guaranteed. And we have legacy SOC like 8QM/8QXP/8ULP/93/91 using this container without PQC support, above new change will break them. Please consider keeping the IMX_PQC_SUPPORT, so every soc can select it to work.

See above why adding more and more Kconfig options is not a good solution.

I believe the original implementation in this patch does not break the legacy SoCs ?

Your original implementation does not break legacy SoCs. I mean the new change break them.

Quoted 2 lines

If you are concerned about growing list of SoCs in this function, then this function can list the five legacy SoCs + imx95a0 SoC with non-PQC alignment and by default return PQC alignment ?

I can't ensure no new SoC with legacy container. From roadmap, there is still some iMX93 derivations planned. This way is just better than original implementation in this patch.

Best regards,
Ye Li

#7 lore raw
Quoted 5 lines · Ye Li
Quoted 4 lines

Adding another Kconfig symbol and ifdeffery seems easy, but it also had additional implications -- more code paths because of the ifdeffery, more Kconfig symbols which the user has to understand, and another machine config has to be built in the CI to cover this configuration.

The auto-detection avoids all these problems.

I agree to remove IMX95_A0, but I don't suggest removing IMX_PQC_SUPPORT. For each SOC, supporting PQC container or not is definite. Adding runtime detect is just for iMX95. But iMX95 A1 is EOL, everyone must use B0. And A1 codes should be removed.

I don't really see why the MX95 A0/A1 should be removed, it doesn't seem to take any maintenance effort or extra overhead. Maybe lets revisit that A0/A1 removal part at some later date.

Quoted 1 line

You said you have A1 board, could you share the board name?

The one I can share is the Toradex Verdin MX95 (the old one, I had it for a while).

Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 12 lines

Eliminate IMX_PQC_SUPPORT config is not a good way. When adding new SOC, developer has to update the container_hdr_alignment, then it will be a long list in this function. Actually only iMX95 is the exception. If you insist keeping A0, I prefer change like below and retain IMX_PQC_SUPPORT.

#if IS_ENABLED(CONFIG_IMX95)
static inline u32 container_hdr_alignment(void) {
     if (is_imx95() && (soc_rev() >= CHIP_REV_2_0)) return 0x4000;
     else
         return 0x400;
}
#else
static inline u32 container_hdr_alignment(void)

Quoted 8 lines

{
#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT)
     return 0x4000;
#else
     return 0x400;
#endif
}
#endif

This adds even more ifdeffery and makes the code even worse, so no.

But if you are sure that every new SoC will have the PQC alignment, then the condition in this patch can be inverted this way:

static inline int container_hdr_alignment(void)
{
     if (is_imx95() && (soc_rev() < CHIP_REV_2_0)) return 0x400;    /* PQC on i.MX95 A1 and older */

     return 0x4000;    /* PQC is the default */
}

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

Are you sure every new SoC (at least in the foreseeable future) will be like that ?

No, it can't be guaranteed. And we have legacy SOC like 8QM/8QXP/8ULP/93/91 using this container without PQC support, above new change will break them. Please consider keeping the IMX_PQC_SUPPORT, so every soc can select it to work.

See above why adding more and more Kconfig options is not a good solution.

I believe the original implementation in this patch does not break the legacy SoCs ?

Your original implementation does not break legacy SoCs. I mean the new change break them.

OK

Quoted 3 lines
Quoted 1 line

If you are concerned about growing list of SoCs in this function, then this function can list the five legacy SoCs + imx95a0 SoC with non-PQC alignment and by default return PQC alignment ?

I can't ensure no new SoC with legacy container. From roadmap, there is still some iMX93 derivations planned. This way is just better than original implementation in this patch.

Good, let's keep the original change.