U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add ahab_commit command for imx8
@ 2025-07-14 22:07 John Ripple
  2025-07-15  3:47 ` Peng Fan
  0 siblings, 1 reply; 11+ messages in thread
From: John Ripple @ 2025-07-14 22:07 UTC (permalink / raw)
  To: u-boot@lists.denx.de
  Cc: alexander.sverdlin@siemens.com, andrej.valek@siemens.com,
	festevam@gmail.com, hs@denx.de, uboot-imx@nxp.com,
	peng.fan@nxp.com, sr@denx.de, sbabic@nabladev.com,
	trini@konsulko.com

The ahab_commit command allows the user to commit into the SECO fuses
that control the SRK key revocation information. This is used to Revoke
compromised SRK keys.

To use ahab_commit, the boot container must be built with an SRK
revocation bit mask that is not 0x0. For the SPSDK provided by NXP, this
means setting the 'srk_revoke_mask' option in the config file used to
sign the boot container. The 'ahab_commit 0x10' can then be used to commit
the SRK revocation information into the SECO fuses.

Signed-off-by: John Ripple <john.ripple@keysight.com>
---

 arch/arm/mach-imx/imx8/ahab.c  | 27 +++++++++++++++++++++++++++
 drivers/misc/imx8/scu_api.c    | 29 +++++++++++++++++++++++++++++
 include/firmware/imx/sci/sci.h |  6 ++++++
 3 files changed, 62 insertions(+)

diff --git a/arch/arm/mach-imx/imx8/ahab.c b/arch/arm/mach-imx/imx8/ahab.c
index 324e010bb2c..f9a425c899c 100644
--- a/arch/arm/mach-imx/imx8/ahab.c
+++ b/arch/arm/mach-imx/imx8/ahab.c
@@ -401,6 +401,27 @@ static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,
 	return 0;
 }
 
+static int do_ahab_commit(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
+{
+	u32 info;
+
+	if (argc < 2)
+		return CMD_RET_USAGE;
+
+	info = simple_strtoul(argv[1], NULL, 16);
+	printf("Commit index is 0x%x\n", info);
+
+	if (sc_seco_commit(-1, &info)) {
+		printf("Error in AHAB commit\n");
+		return -EIO;
+	}
+
+	printf("AHAB commit succeeded.\n");
+
+	return CMD_RET_SUCCESS;
+}
+
 U_BOOT_CMD(auth_cntr, CONFIG_SYS_MAXARGS, 1, do_authenticate,
 	   "autenticate OS container via AHAB",
 	   "addr\n"
@@ -416,3 +437,9 @@ U_BOOT_CMD(ahab_close, CONFIG_SYS_MAXARGS, 1, do_ahab_close,
 	   "Change AHAB lifecycle to OEM closed",
 	   ""
 );
+
+U_BOOT_CMD(ahab_commit, CONFIG_SYS_MAXARGS, 1, do_ahab_commit,
+	   "commit into the fuses any new SRK revocation information that have been found\n"
+	   "into the NXP (SECO FW) and OEM containers. For SRK revocation use 0x10 for the value.",
+	   ""
+);
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
index a40c8badf9a..ba93ff9bd74 100644
--- a/drivers/misc/imx8/scu_api.c
+++ b/drivers/misc/imx8/scu_api.c
@@ -1287,3 +1287,32 @@ int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data)
 
 	return ret;
 }
+
+int sc_seco_commit(sc_ipc_t ipc, u32 *info)
+{
+	struct udevice *dev = gd->arch.scu_dev;
+	struct sc_rpc_msg_s msg;
+	int size = sizeof(struct sc_rpc_msg_s);
+	int ret;
+
+	/* Fill in header */
+	RPC_VER(&msg) = SC_RPC_VERSION;
+	RPC_SIZE(&msg) = 2U;
+	RPC_SVC(&msg) = (u8)SC_RPC_SVC_SECO;
+	RPC_FUNC(&msg) = (u8)SECO_FUNC_COMMIT;
+
+	/* Fill in send message */
+	RPC_U32(&msg, 0U) = info;
+
+	/* Call RPC */
+	ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+
+	/* Copy out result */
+	ret = (int)RPC_R8(&msg);
+
+	/* Copy out receive message */
+	*info = RPC_U32(&msg, 0U);
+
+	/* Return result */
+	return ret;
+}
diff --git a/include/firmware/imx/sci/sci.h b/include/firmware/imx/sci/sci.h
index 588f3671103..876d52cac35 100644
--- a/include/firmware/imx/sci/sci.h
+++ b/include/firmware/imx/sci/sci.h
@@ -144,6 +144,7 @@ int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data);
 int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access,
 			  u32 *data0, u32 *data1, u32 *data2, u32 *data3,
 			  u32 *data4, u8 size);
+int sc_seco_commit(sc_ipc_t ipc, u32 *info);
 #else
 /* PM API*/
 static inline int sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
@@ -383,6 +384,11 @@ static inline int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access, u32 *dat
 	return -EOPNOTSUPP;
 }
 
+static inline int sc_seco_commit(sc_ipc_t ipc, u32 *info)
+{
+	return -EOPNOTSUPP;
+}
+
 static inline void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type)
 {
 }
base-commit: 235e14b0f1ad7cfd46e18635f22a3cba7209c766
branch: master

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] Add ahab_commit command for imx8
  2025-07-14 22:07 [PATCH] Add ahab_commit command for imx8 John Ripple
@ 2025-07-15  3:47 ` Peng Fan
  2025-08-15 16:49   ` [PATCH v2] imx8: " John Ripple
  0 siblings, 1 reply; 11+ messages in thread
From: Peng Fan @ 2025-07-15  3:47 UTC (permalink / raw)
  To: John Ripple
  Cc: u-boot@lists.denx.de, alexander.sverdlin@siemens.com,
	andrej.valek@siemens.com, festevam@gmail.com, hs@denx.de,
	uboot-imx@nxp.com, peng.fan@nxp.com, sr@denx.de,
	sbabic@nabladev.com, trini@konsulko.com

Nit: subject: imx8: Add ahab_commit command

On Mon, Jul 14, 2025 at 10:07:29PM +0000, John Ripple wrote:
>The ahab_commit command allows the user to commit into the SECO fuses
>that control the SRK key revocation information. This is used to Revoke
>compromised SRK keys.
>
>To use ahab_commit, the boot container must be built with an SRK
>revocation bit mask that is not 0x0. For the SPSDK provided by NXP, this
>means setting the 'srk_revoke_mask' option in the config file used to
>sign the boot container. The 'ahab_commit 0x10' can then be used to commit
>the SRK revocation information into the SECO fuses.
>
>Signed-off-by: John Ripple <john.ripple@keysight.com>
>---
>
> arch/arm/mach-imx/imx8/ahab.c  | 27 +++++++++++++++++++++++++++
> drivers/misc/imx8/scu_api.c    | 29 +++++++++++++++++++++++++++++
> include/firmware/imx/sci/sci.h |  6 ++++++
> 3 files changed, 62 insertions(+)
>
>diff --git a/arch/arm/mach-imx/imx8/ahab.c b/arch/arm/mach-imx/imx8/ahab.c
>index 324e010bb2c..f9a425c899c 100644
>--- a/arch/arm/mach-imx/imx8/ahab.c
>+++ b/arch/arm/mach-imx/imx8/ahab.c
>@@ -401,6 +401,27 @@ static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,
> 	return 0;
> }
> 
>+static int do_ahab_commit(struct cmd_tbl *cmdtp, int flag, int argc,
>+			  char *const argv[])
>+{
>+	u32 info;
>+
>+	if (argc < 2)
>+		return CMD_RET_USAGE;
>+
>+	info = simple_strtoul(argv[1], NULL, 16);
>+	printf("Commit index is 0x%x\n", info);
>+
>+	if (sc_seco_commit(-1, &info)) {
>+		printf("Error in AHAB commit\n");
>+		return -EIO;
>+	}
>+
>+	printf("AHAB commit succeeded.\n");
>+
>+	return CMD_RET_SUCCESS;
>+}
>+
> U_BOOT_CMD(auth_cntr, CONFIG_SYS_MAXARGS, 1, do_authenticate,
> 	   "autenticate OS container via AHAB",
> 	   "addr\n"
>@@ -416,3 +437,9 @@ U_BOOT_CMD(ahab_close, CONFIG_SYS_MAXARGS, 1, do_ahab_close,
> 	   "Change AHAB lifecycle to OEM closed",
> 	   ""
> );
>+
>+U_BOOT_CMD(ahab_commit, CONFIG_SYS_MAXARGS, 1, do_ahab_commit,
>+	   "commit into the fuses any new SRK revocation information that have been found\n"
>+	   "into the NXP (SECO FW) and OEM containers. For SRK revocation use 0x10 for the value.",
>+	   ""
>+);
>diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
>index a40c8badf9a..ba93ff9bd74 100644
>--- a/drivers/misc/imx8/scu_api.c
>+++ b/drivers/misc/imx8/scu_api.c
>@@ -1287,3 +1287,32 @@ int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data)
> 
> 	return ret;
> }
>+
>+int sc_seco_commit(sc_ipc_t ipc, u32 *info)
>+{
>+	struct udevice *dev = gd->arch.scu_dev;
>+	struct sc_rpc_msg_s msg;
>+	int size = sizeof(struct sc_rpc_msg_s);
>+	int ret;
>+
>+	/* Fill in header */
>+	RPC_VER(&msg) = SC_RPC_VERSION;
>+	RPC_SIZE(&msg) = 2U;
>+	RPC_SVC(&msg) = (u8)SC_RPC_SVC_SECO;
>+	RPC_FUNC(&msg) = (u8)SECO_FUNC_COMMIT;
>+
>+	/* Fill in send message */
>+	RPC_U32(&msg, 0U) = info;

This should be '*info';

>+
>+	/* Call RPC */
>+	ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
>+
>+	/* Copy out result */
>+	ret = (int)RPC_R8(&msg);
>+
>+	/* Copy out receive message */
>+	*info = RPC_U32(&msg, 0U);

	if (!ret)
		*info = RPC_U32(&msg, 0U);

>+
>+	/* Return result */
>+	return ret;
>+}

Regards,
Peng

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2] imx8: Add ahab_commit command for imx8
  2025-07-15  3:47 ` Peng Fan
@ 2025-08-15 16:49   ` John Ripple
  2025-08-18  4:33     ` Peng Fan
  0 siblings, 1 reply; 11+ messages in thread
From: John Ripple @ 2025-08-15 16:49 UTC (permalink / raw)
  To: u-boot@lists.denx.de
  Cc: alexander.sverdlin@siemens.com, andrej.valek@siemens.com,
	festevam@gmail.com, hs@denx.de, uboot-imx@nxp.com,
	peng.fan@nxp.com, sr@denx.de, sbabic@nabladev.com,
	trini@konsulko.com, Peng Fan

The ahab_commit command allows the user to commit into the SECO fuses
that control the SRK key revocation information. This is used to Revoke
compromised SRK keys.

To use ahab_commit, the boot container must be built with an SRK
revocation bit mask that is not 0x0. For the SPSDK provided by NXP, this
means setting the 'srk_revoke_mask' option in the config file used to
sign the boot container. The 'ahab_commit 0x10' can then be used to commit
the SRK revocation information into the SECO fuses.

Signed-off-by: John Ripple <john.ripple@keysight.com>
---
Changes in v2:
- Changed patch name to have imx8.
---

 arch/arm/mach-imx/imx8/ahab.c  | 27 +++++++++++++++++++++++++++
 drivers/misc/imx8/scu_api.c    | 29 +++++++++++++++++++++++++++++
 include/firmware/imx/sci/sci.h |  6 ++++++
 3 files changed, 62 insertions(+)

diff --git a/arch/arm/mach-imx/imx8/ahab.c b/arch/arm/mach-imx/imx8/ahab.c
index 324e010bb2c..f9a425c899c 100644
--- a/arch/arm/mach-imx/imx8/ahab.c
+++ b/arch/arm/mach-imx/imx8/ahab.c
@@ -401,6 +401,27 @@ static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,
 	return 0;
 }
 
+static int do_ahab_commit(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
+{
+	u32 info;
+
+	if (argc < 2)
+		return CMD_RET_USAGE;
+
+	info = simple_strtoul(argv[1], NULL, 16);
+	printf("Commit index is 0x%x\n", info);
+
+	if (sc_seco_commit(-1, &info)) {
+		printf("Error in AHAB commit\n");
+		return -EIO;
+	}
+
+	printf("AHAB commit succeeded.\n");
+
+	return CMD_RET_SUCCESS;
+}
+
 U_BOOT_CMD(auth_cntr, CONFIG_SYS_MAXARGS, 1, do_authenticate,
 	   "autenticate OS container via AHAB",
 	   "addr\n"
@@ -416,3 +437,9 @@ U_BOOT_CMD(ahab_close, CONFIG_SYS_MAXARGS, 1, do_ahab_close,
 	   "Change AHAB lifecycle to OEM closed",
 	   ""
 );
+
+U_BOOT_CMD(ahab_commit, CONFIG_SYS_MAXARGS, 1, do_ahab_commit,
+	   "commit into the fuses any new SRK revocation information that have been found\n"
+	   "into the NXP (SECO FW) and OEM containers. For SRK revocation use 0x10 for the value.",
+	   ""
+);
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
index 8985ab6584d..839d20116df 100644
--- a/drivers/misc/imx8/scu_api.c
+++ b/drivers/misc/imx8/scu_api.c
@@ -1286,3 +1286,32 @@ int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data)
 
 	return ret;
 }
+
+int sc_seco_commit(sc_ipc_t ipc, u32 *info)
+{
+	struct udevice *dev = gd->arch.scu_dev;
+	struct sc_rpc_msg_s msg;
+	int size = sizeof(struct sc_rpc_msg_s);
+	int ret;
+
+	/* Fill in header */
+	RPC_VER(&msg) = SC_RPC_VERSION;
+	RPC_SIZE(&msg) = 2U;
+	RPC_SVC(&msg) = (u8)SC_RPC_SVC_SECO;
+	RPC_FUNC(&msg) = (u8)SECO_FUNC_COMMIT;
+
+	/* Fill in send message */
+	RPC_U32(&msg, 0U) = info;
+
+	/* Call RPC */
+	ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+
+	/* Copy out result */
+	ret = (int)RPC_R8(&msg);
+
+	/* Copy out receive message */
+	*info = RPC_U32(&msg, 0U);
+
+	/* Return result */
+	return ret;
+}
diff --git a/include/firmware/imx/sci/sci.h b/include/firmware/imx/sci/sci.h
index 588f3671103..876d52cac35 100644
--- a/include/firmware/imx/sci/sci.h
+++ b/include/firmware/imx/sci/sci.h
@@ -144,6 +144,7 @@ int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data);
 int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access,
 			  u32 *data0, u32 *data1, u32 *data2, u32 *data3,
 			  u32 *data4, u8 size);
+int sc_seco_commit(sc_ipc_t ipc, u32 *info);
 #else
 /* PM API*/
 static inline int sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
@@ -383,6 +384,11 @@ static inline int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access, u32 *dat
 	return -EOPNOTSUPP;
 }
 
+static inline int sc_seco_commit(sc_ipc_t ipc, u32 *info)
+{
+	return -EOPNOTSUPP;
+}
+
 static inline void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type)
 {
 }
base-commit: 0c558bbad9e7581808b358091d1fd979f860e8ac
branch: master

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2] imx8: Add ahab_commit command for imx8
  2025-08-15 16:49   ` [PATCH v2] imx8: " John Ripple
@ 2025-08-18  4:33     ` Peng Fan
  2025-08-18 15:43       ` [PATCH v2] imx8: Add ahab_commit command John Ripple
  2025-09-08 21:18       ` [PATCH v3] " John Ripple
  0 siblings, 2 replies; 11+ messages in thread
From: Peng Fan @ 2025-08-18  4:33 UTC (permalink / raw)
  To: John Ripple
  Cc: u-boot@lists.denx.de, alexander.sverdlin@siemens.com,
	andrej.valek@siemens.com, festevam@gmail.com, hs@denx.de,
	uboot-imx@nxp.com, peng.fan@nxp.com, sr@denx.de,
	sbabic@nabladev.com, trini@konsulko.com

On Fri, Aug 15, 2025 at 04:49:07PM +0000, John Ripple wrote:
>The ahab_commit command allows the user to commit into the SECO fuses
>that control the SRK key revocation information. This is used to Revoke
>compromised SRK keys.
>
>To use ahab_commit, the boot container must be built with an SRK
>revocation bit mask that is not 0x0. For the SPSDK provided by NXP, this
>means setting the 'srk_revoke_mask' option in the config file used to
>sign the boot container. The 'ahab_commit 0x10' can then be used to commit
>the SRK revocation information into the SECO fuses.
>
>Signed-off-by: John Ripple <john.ripple@keysight.com>
>---
>Changes in v2:
>- Changed patch name to have imx8.

Please address all comments in V1.

Thanks,
Peng

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2] imx8: Add ahab_commit command
  2025-08-18  4:33     ` Peng Fan
@ 2025-08-18 15:43       ` John Ripple
  2025-09-08 21:18       ` [PATCH v3] " John Ripple
  1 sibling, 0 replies; 11+ messages in thread
From: John Ripple @ 2025-08-18 15:43 UTC (permalink / raw)
  To: Peng Fan
  Cc: u-boot@lists.denx.de, alexander.sverdlin@siemens.com,
	festevam@gmail.com, hs@denx.de, uboot-imx@nxp.com,
	peng.fan@nxp.com, sr@denx.de, sbabic@nabladev.com,
	trini@konsulko.com

>>The ahab_commit command allows the user to commit into the SECO fuses
>>that control the SRK key revocation information. This is used to Revoke
>>compromised SRK keys.
>>
>>To use ahab_commit, the boot container must be built with an SRK
>>revocation bit mask that is not 0x0. For the SPSDK provided by NXP, this
>>means setting the 'srk_revoke_mask' option in the config file used to
>>sign the boot container. The 'ahab_commit 0x10' can then be used to commit
>>the SRK revocation information into the SECO fuses.
>>
>>Signed-off-by: John Ripple <john.ripple@keysight.com>
>>---
>>Changes in v2:
>>- Changed patch name to have imx8.
>
>Please address all comments in V1.
>
>Thanks,
>Peng

Sorry if this isn't the correct format, I haven't used the U-Boot mailing list before. Does this patch heading look good or should I change this to a v3 with a new thread?

Thanks,
John

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3] imx8: Add ahab_commit command
  2025-08-18  4:33     ` Peng Fan
  2025-08-18 15:43       ` [PATCH v2] imx8: Add ahab_commit command John Ripple
@ 2025-09-08 21:18       ` John Ripple
  2025-09-09  2:37         ` Peng Fan
                           ` (3 more replies)
  1 sibling, 4 replies; 11+ messages in thread
From: John Ripple @ 2025-09-08 21:18 UTC (permalink / raw)
  To: peng.fan
  Cc: alexander.sverdlin, andrej.valek, festevam, hs, john.ripple,
	peng.fan, sbabic, sr, trini, u-boot, uboot-imx

The ahab_commit command allows the user to commit into the SECO fuses
that control the SRK key revocation information. This is used to Revoke
compromised SRK keys.

To use ahab_commit, the boot container must be built with an SRK
revocation bit mask that is not 0x0. For the SPSDK provided by NXP, this
means setting the 'srk_revoke_mask' option in the config file used to
sign the boot container. The 'ahab_commit 0x10' can then be used to commit
the SRK revocation information into the SECO fuses.

Signed-off-by: John Ripple <john.ripple@keysight.com>
---
Changes in v2:
- Changed patch name to have imx8.

Changes in v3:
- Changed patch name to only have imx8 at the start.
- Add error checking for sc_seco_commit message.
---

 arch/arm/mach-imx/imx8/ahab.c  | 27 +++++++++++++++++++++++++++
 drivers/misc/imx8/scu_api.c    | 30 ++++++++++++++++++++++++++++++
 include/firmware/imx/sci/sci.h |  6 ++++++
 3 files changed, 63 insertions(+)

diff --git a/arch/arm/mach-imx/imx8/ahab.c b/arch/arm/mach-imx/imx8/ahab.c
index 324e010bb2c..f9a425c899c 100644
--- a/arch/arm/mach-imx/imx8/ahab.c
+++ b/arch/arm/mach-imx/imx8/ahab.c
@@ -401,6 +401,27 @@ static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,
 	return 0;
 }
 
+static int do_ahab_commit(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
+{
+	u32 info;
+
+	if (argc < 2)
+		return CMD_RET_USAGE;
+
+	info = simple_strtoul(argv[1], NULL, 16);
+	printf("Commit index is 0x%x\n", info);
+
+	if (sc_seco_commit(-1, &info)) {
+		printf("Error in AHAB commit\n");
+		return -EIO;
+	}
+
+	printf("AHAB commit succeeded.\n");
+
+	return CMD_RET_SUCCESS;
+}
+
 U_BOOT_CMD(auth_cntr, CONFIG_SYS_MAXARGS, 1, do_authenticate,
 	   "autenticate OS container via AHAB",
 	   "addr\n"
@@ -416,3 +437,9 @@ U_BOOT_CMD(ahab_close, CONFIG_SYS_MAXARGS, 1, do_ahab_close,
 	   "Change AHAB lifecycle to OEM closed",
 	   ""
 );
+
+U_BOOT_CMD(ahab_commit, CONFIG_SYS_MAXARGS, 1, do_ahab_commit,
+	   "commit into the fuses any new SRK revocation information that have been found\n"
+	   "into the NXP (SECO FW) and OEM containers. For SRK revocation use 0x10 for the value.",
+	   ""
+);
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
index 8985ab6584d..0337525774e 100644
--- a/drivers/misc/imx8/scu_api.c
+++ b/drivers/misc/imx8/scu_api.c
@@ -1286,3 +1286,33 @@ int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data)
 
 	return ret;
 }
+
+int sc_seco_commit(sc_ipc_t ipc, u32 *info)
+{
+	struct udevice *dev = gd->arch.scu_dev;
+	struct sc_rpc_msg_s msg;
+	int size = sizeof(struct sc_rpc_msg_s);
+	int ret;
+
+	/* Fill in header */
+	RPC_VER(&msg) = SC_RPC_VERSION;
+	RPC_SIZE(&msg) = 2U;
+	RPC_SVC(&msg) = (u8)SC_RPC_SVC_SECO;
+	RPC_FUNC(&msg) = (u8)SECO_FUNC_COMMIT;
+
+	/* Fill in send message */
+	RPC_U32(&msg, 0U) = *info;
+
+	/* Call RPC */
+	ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+
+	/* Copy out result */
+	ret = (int)RPC_R8(&msg);
+
+	/* Copy out receive message */
+	if (!ret)
+		*info = RPC_U32(&msg, 0U);
+
+	/* Return result */
+	return ret;
+}
diff --git a/include/firmware/imx/sci/sci.h b/include/firmware/imx/sci/sci.h
index 588f3671103..876d52cac35 100644
--- a/include/firmware/imx/sci/sci.h
+++ b/include/firmware/imx/sci/sci.h
@@ -144,6 +144,7 @@ int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data);
 int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access,
 			  u32 *data0, u32 *data1, u32 *data2, u32 *data3,
 			  u32 *data4, u8 size);
+int sc_seco_commit(sc_ipc_t ipc, u32 *info);
 #else
 /* PM API*/
 static inline int sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
@@ -383,6 +384,11 @@ static inline int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access, u32 *dat
 	return -EOPNOTSUPP;
 }
 
+static inline int sc_seco_commit(sc_ipc_t ipc, u32 *info)
+{
+	return -EOPNOTSUPP;
+}
+
 static inline void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type)
 {
 }
base-commit: 7a4f3c5652157cbb3d26a7728bfe537ea483efc9
branch: master

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] imx8: Add ahab_commit command
  2025-09-08 21:18       ` [PATCH v3] " John Ripple
@ 2025-09-09  2:37         ` Peng Fan
  2025-09-09 19:53           ` [PATCH v4] " John Ripple
  2025-09-09  5:11         ` [PATCH v3] " Heiko Schocher
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Peng Fan @ 2025-09-09  2:37 UTC (permalink / raw)
  To: John Ripple
  Cc: alexander.sverdlin, andrej.valek, festevam, hs, peng.fan, sbabic,
	sr, trini, u-boot, uboot-imx

On Mon, Sep 08, 2025 at 03:18:38PM -0600, John Ripple wrote:
>The ahab_commit command allows the user to commit into the SECO fuses
>that control the SRK key revocation information. This is used to Revoke
>compromised SRK keys.
>
>To use ahab_commit, the boot container must be built with an SRK
>revocation bit mask that is not 0x0. For the SPSDK provided by NXP, this
>means setting the 'srk_revoke_mask' option in the config file used to
>sign the boot container. The 'ahab_commit 0x10' can then be used to commit
>the SRK revocation information into the SECO fuses.
>
>Signed-off-by: John Ripple <john.ripple@keysight.com>

Reviewed-by: Peng Fan <peng.fan@nxp.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] imx8: Add ahab_commit command
  2025-09-08 21:18       ` [PATCH v3] " John Ripple
  2025-09-09  2:37         ` Peng Fan
@ 2025-09-09  5:11         ` Heiko Schocher
  2025-09-09 10:40         ` Fabio Estevam
  2025-09-22 14:20         ` Fabio Estevam
  3 siblings, 0 replies; 11+ messages in thread
From: Heiko Schocher @ 2025-09-09  5:11 UTC (permalink / raw)
  To: John Ripple, peng.fan
  Cc: alexander.sverdlin, andrej.valek, festevam, hs, peng.fan, sbabic,
	sr, trini, u-boot, uboot-imx

Hello John,

On 08.09.25 23:18, John Ripple wrote:
> The ahab_commit command allows the user to commit into the SECO fuses
> that control the SRK key revocation information. This is used to Revoke
> compromised SRK keys.
> 
> To use ahab_commit, the boot container must be built with an SRK
> revocation bit mask that is not 0x0. For the SPSDK provided by NXP, this
> means setting the 'srk_revoke_mask' option in the config file used to
> sign the boot container. The 'ahab_commit 0x10' can then be used to commit
> the SRK revocation information into the SECO fuses.
> 
> Signed-off-by: John Ripple <john.ripple@keysight.com>
> ---
> Changes in v2:
> - Changed patch name to have imx8.
> 
> Changes in v3:
> - Changed patch name to only have imx8 at the start.
> - Add error checking for sc_seco_commit message.
> ---
> 
>   arch/arm/mach-imx/imx8/ahab.c  | 27 +++++++++++++++++++++++++++
>   drivers/misc/imx8/scu_api.c    | 30 ++++++++++++++++++++++++++++++
>   include/firmware/imx/sci/sci.h |  6 ++++++
>   3 files changed, 63 insertions(+)

Thanks!

Reviewed-by: Heiko Schocher <hs@nabladev.com>

just a nitpick...

[...]
> diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
> index 8985ab6584d..0337525774e 100644
> --- a/drivers/misc/imx8/scu_api.c
> +++ b/drivers/misc/imx8/scu_api.c
> @@ -1286,3 +1286,33 @@ int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data)
>   
>   	return ret;
>   }
> +
> +int sc_seco_commit(sc_ipc_t ipc, u32 *info)
> +{
> +	struct udevice *dev = gd->arch.scu_dev;
> +	struct sc_rpc_msg_s msg;
> +	int size = sizeof(struct sc_rpc_msg_s);
> +	int ret;
> +
> +	/* Fill in header */
> +	RPC_VER(&msg) = SC_RPC_VERSION;
> +	RPC_SIZE(&msg) = 2U;
> +	RPC_SVC(&msg) = (u8)SC_RPC_SVC_SECO;
> +	RPC_FUNC(&msg) = (u8)SECO_FUNC_COMMIT;
> +
> +	/* Fill in send message */
> +	RPC_U32(&msg, 0U) = *info;
> +
> +	/* Call RPC */
> +	ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
> +
> +	/* Copy out result */
> +	ret = (int)RPC_R8(&msg);
> +
> +	/* Copy out receive message */
> +	if (!ret)
> +		*info = RPC_U32(&msg, 0U);
> +
> +	/* Return result */

Do we really need this comment?

> +	return ret;
> +}

bye,
Heiko
-- 
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office@nabladev.com
Geschäftsführer : Stefano Babic

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] imx8: Add ahab_commit command
  2025-09-08 21:18       ` [PATCH v3] " John Ripple
  2025-09-09  2:37         ` Peng Fan
  2025-09-09  5:11         ` [PATCH v3] " Heiko Schocher
@ 2025-09-09 10:40         ` Fabio Estevam
  2025-09-22 14:20         ` Fabio Estevam
  3 siblings, 0 replies; 11+ messages in thread
From: Fabio Estevam @ 2025-09-09 10:40 UTC (permalink / raw)
  To: John Ripple
  Cc: peng.fan, alexander.sverdlin, andrej.valek, hs, peng.fan, sbabic,
	sr, trini, u-boot, uboot-imx

Hi John,

This version looks better, but error handling could be improved:

On Mon, Sep 8, 2025 at 6:18 PM John Ripple <john.ripple@keysight.com> wrote:

> +static int do_ahab_commit(struct cmd_tbl *cmdtp, int flag, int argc,
> +                         char *const argv[])
> +{
> +       u32 info;
> +
> +       if (argc < 2)
> +               return CMD_RET_USAGE;
> +
> +       info = simple_strtoul(argv[1], NULL, 16);
> +       printf("Commit index is 0x%x\n", info);
> +
> +       if (sc_seco_commit(-1, &info)) {
> +               printf("Error in AHAB commit\n");
> +               return -EIO;
> +       }

What about:

ret = sc_seco_commit(-1, &info);
if (ret) {
    printf("Error in AHAB commit: %d\n", ret);
    return ret;
}

> +int sc_seco_commit(sc_ipc_t ipc, u32 *info)
> +{
> +       struct udevice *dev = gd->arch.scu_dev;
> +       struct sc_rpc_msg_s msg;
> +       int size = sizeof(struct sc_rpc_msg_s);
> +       int ret;
> +
> +       /* Fill in header */
> +       RPC_VER(&msg) = SC_RPC_VERSION;
> +       RPC_SIZE(&msg) = 2U;
> +       RPC_SVC(&msg) = (u8)SC_RPC_SVC_SECO;
> +       RPC_FUNC(&msg) = (u8)SECO_FUNC_COMMIT;
> +
> +       /* Fill in send message */
> +       RPC_U32(&msg, 0U) = *info;
> +
> +       /* Call RPC */
> +       ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);

 It is better to check the value of 'ret' and return immediately in
case of error:

 ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
 if (ret)
     return ret;

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4] imx8: Add ahab_commit command
  2025-09-09  2:37         ` Peng Fan
@ 2025-09-09 19:53           ` John Ripple
  0 siblings, 0 replies; 11+ messages in thread
From: John Ripple @ 2025-09-09 19:53 UTC (permalink / raw)
  To: peng.fan
  Cc: alexander.sverdlin, andrej.valek, festevam, hs, john.ripple,
	peng.fan, sbabic, sr, trini, u-boot, uboot-imx

The ahab_commit command allows the user to commit into the SECO fuses
that control the SRK key revocation information. This is used to Revoke
compromised SRK keys.

To use ahab_commit, the boot container must be built with an SRK
revocation bit mask that is not 0x0. For the SPSDK provided by NXP, this
means setting the 'srk_revoke_mask' option in the config file used to
sign the boot container. The 'ahab_commit 0x10' can then be used to commit
the SRK revocation information into the SECO fuses.

Signed-off-by: John Ripple <john.ripple@keysight.com>
---
Changes in v2:
- Changed patch name to have imx8.

Changes in v3:
- Changed patch name to only have imx8 at the start.
- Add error checking for sc_seco_commit message.

Changes in v4:
- Better error handling.
- Removed unnecessary comments.
---

 arch/arm/mach-imx/imx8/ahab.c  | 29 +++++++++++++++++++++++++++++
 drivers/misc/imx8/scu_api.c    | 31 +++++++++++++++++++++++++++++++
 include/firmware/imx/sci/sci.h |  6 ++++++
 3 files changed, 66 insertions(+)

diff --git a/arch/arm/mach-imx/imx8/ahab.c b/arch/arm/mach-imx/imx8/ahab.c
index 324e010bb2c..f13baa871cc 100644
--- a/arch/arm/mach-imx/imx8/ahab.c
+++ b/arch/arm/mach-imx/imx8/ahab.c
@@ -401,6 +401,29 @@ static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,
 	return 0;
 }
 
+static int do_ahab_commit(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
+{
+	u32 info;
+	int ret;
+
+	if (argc < 2)
+		return CMD_RET_USAGE;
+
+	info = simple_strtoul(argv[1], NULL, 16);
+	printf("Commit index is 0x%x\n", info);
+
+	ret = sc_seco_commit(-1, &info);
+	if (ret) {
+		printf("Error in AHAB commit\n");
+		return ret;
+	}
+
+	printf("AHAB commit succeeded.\n");
+
+	return CMD_RET_SUCCESS;
+}
+
 U_BOOT_CMD(auth_cntr, CONFIG_SYS_MAXARGS, 1, do_authenticate,
 	   "autenticate OS container via AHAB",
 	   "addr\n"
@@ -416,3 +439,9 @@ U_BOOT_CMD(ahab_close, CONFIG_SYS_MAXARGS, 1, do_ahab_close,
 	   "Change AHAB lifecycle to OEM closed",
 	   ""
 );
+
+U_BOOT_CMD(ahab_commit, CONFIG_SYS_MAXARGS, 1, do_ahab_commit,
+	   "commit into the fuses any new SRK revocation information that have been found\n"
+	   "into the NXP (SECO FW) and OEM containers. For SRK revocation use 0x10 for the value.",
+	   ""
+);
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
index 8985ab6584d..d9cc7acb970 100644
--- a/drivers/misc/imx8/scu_api.c
+++ b/drivers/misc/imx8/scu_api.c
@@ -1286,3 +1286,34 @@ int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data)
 
 	return ret;
 }
+
+int sc_seco_commit(sc_ipc_t ipc, u32 *info)
+{
+	struct udevice *dev = gd->arch.scu_dev;
+	struct sc_rpc_msg_s msg;
+	int size = sizeof(struct sc_rpc_msg_s);
+	int ret;
+
+	/* Fill in header */
+	RPC_VER(&msg) = SC_RPC_VERSION;
+	RPC_SIZE(&msg) = 2U;
+	RPC_SVC(&msg) = (u8)SC_RPC_SVC_SECO;
+	RPC_FUNC(&msg) = (u8)SECO_FUNC_COMMIT;
+
+	/* Fill in send message */
+	RPC_U32(&msg, 0U) = *info;
+
+	/* Call RPC */
+	ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+	if (ret)
+		return ret;
+
+	/* Copy out result */
+	ret = (int)RPC_R8(&msg);
+
+	/* Copy out receive message */
+	if (!ret)
+		*info = RPC_U32(&msg, 0U);
+
+	return ret;
+}
diff --git a/include/firmware/imx/sci/sci.h b/include/firmware/imx/sci/sci.h
index 588f3671103..876d52cac35 100644
--- a/include/firmware/imx/sci/sci.h
+++ b/include/firmware/imx/sci/sci.h
@@ -144,6 +144,7 @@ int sc_seco_secvio_dgo_config(sc_ipc_t ipc, u8 id, u8 access, u32 *data);
 int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access,
 			  u32 *data0, u32 *data1, u32 *data2, u32 *data3,
 			  u32 *data4, u8 size);
+int sc_seco_commit(sc_ipc_t ipc, u32 *info);
 #else
 /* PM API*/
 static inline int sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
@@ -383,6 +384,11 @@ static inline int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access, u32 *dat
 	return -EOPNOTSUPP;
 }
 
+static inline int sc_seco_commit(sc_ipc_t ipc, u32 *info)
+{
+	return -EOPNOTSUPP;
+}
+
 static inline void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type)
 {
 }
base-commit: 1a7882de8c859467ce931ed23761db1e391aeaff
branch: master

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] imx8: Add ahab_commit command
  2025-09-08 21:18       ` [PATCH v3] " John Ripple
                           ` (2 preceding siblings ...)
  2025-09-09 10:40         ` Fabio Estevam
@ 2025-09-22 14:20         ` Fabio Estevam
  3 siblings, 0 replies; 11+ messages in thread
From: Fabio Estevam @ 2025-09-22 14:20 UTC (permalink / raw)
  To: John Ripple
  Cc: peng.fan, alexander.sverdlin, andrej.valek, hs, peng.fan, sbabic,
	sr, trini, u-boot, uboot-imx

On Mon, Sep 8, 2025 at 6:18 PM John Ripple <john.ripple@keysight.com> wrote:
>
> The ahab_commit command allows the user to commit into the SECO fuses
> that control the SRK key revocation information. This is used to Revoke
> compromised SRK keys.
>
> To use ahab_commit, the boot container must be built with an SRK
> revocation bit mask that is not 0x0. For the SPSDK provided by NXP, this
> means setting the 'srk_revoke_mask' option in the config file used to
> sign the boot container. The 'ahab_commit 0x10' can then be used to commit
> the SRK revocation information into the SECO fuses.
>
> Signed-off-by: John Ripple <john.ripple@keysight.com>

Applied to next, thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-09-22 14:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 22:07 [PATCH] Add ahab_commit command for imx8 John Ripple
2025-07-15  3:47 ` Peng Fan
2025-08-15 16:49   ` [PATCH v2] imx8: " John Ripple
2025-08-18  4:33     ` Peng Fan
2025-08-18 15:43       ` [PATCH v2] imx8: Add ahab_commit command John Ripple
2025-09-08 21:18       ` [PATCH v3] " John Ripple
2025-09-09  2:37         ` Peng Fan
2025-09-09 19:53           ` [PATCH v4] " John Ripple
2025-09-09  5:11         ` [PATCH v3] " Heiko Schocher
2025-09-09 10:40         ` Fabio Estevam
2025-09-22 14:20         ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox