Skip to content

Commit

Permalink
suit: Introduce foreground DFU states
Browse files Browse the repository at this point in the history
Introduce missing values for foreground DFU in SUIT execution mode as
well as SUIT orchestrator module.

Ref: NCSDK-29996

Signed-off-by: Tomasz Chyrowicz <[email protected]>
  • Loading branch information
tomchy committed Nov 4, 2024
1 parent bf43985 commit dbc728c
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 34 deletions.
36 changes: 23 additions & 13 deletions subsys/suit/execution_mode/include/suit_execution_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,31 @@
extern "C" {
#endif

/**
* @brief SUIT orchestrator execution mode.
*
* @note Do not modify existing values.
* They are sent over SSF to the application companion images.
*/
typedef enum {
EXECUTION_MODE_STARTUP = 0,
EXECUTION_MODE_INVOKE,
EXECUTION_MODE_INVOKE_RECOVERY,
EXECUTION_MODE_INSTALL,
EXECUTION_MODE_INSTALL_RECOVERY,
EXECUTION_MODE_POST_INVOKE,
EXECUTION_MODE_POST_INVOKE_RECOVERY,
EXECUTION_MODE_FAIL_NO_MPI,
EXECUTION_MODE_FAIL_MPI_INVALID,
EXECUTION_MODE_FAIL_MPI_INVALID_MISSING,
EXECUTION_MODE_FAIL_MPI_UNSUPPORTED,
EXECUTION_MODE_FAIL_INVOKE_RECOVERY,
EXECUTION_MODE_FAIL_INSTALL_NORDIC_TOP,
EXECUTION_MODE_FAIL_STARTUP,
EXECUTION_MODE_INVOKE = 1,
EXECUTION_MODE_INVOKE_FDFU = 2,
EXECUTION_MODE_INVOKE_RECOVERY = 3,
EXECUTION_MODE_INSTALL = 4,
EXECUTION_MODE_INSTALL_FDFU = 5,
EXECUTION_MODE_INSTALL_RECOVERY = 6,
EXECUTION_MODE_POST_INVOKE = 7,
EXECUTION_MODE_POST_INVOKE_FDFU = 8,
EXECUTION_MODE_POST_INVOKE_RECOVERY = 9,
EXECUTION_MODE_FAIL_NO_MPI = 10,
EXECUTION_MODE_FAIL_MPI_INVALID = 11,
EXECUTION_MODE_FAIL_MPI_INVALID_MISSING = 12,
EXECUTION_MODE_FAIL_MPI_UNSUPPORTED = 13,
EXECUTION_MODE_FAIL_INVOKE_FDFU = 14,
EXECUTION_MODE_FAIL_INVOKE_RECOVERY = 15,
EXECUTION_MODE_FAIL_INSTALL_NORDIC_TOP = 16,
EXECUTION_MODE_FAIL_STARTUP = 17,
} suit_execution_mode_t;

/**
Expand Down
32 changes: 32 additions & 0 deletions subsys/suit/execution_mode/src/suit_execution_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ void suit_execution_mode_startup_failed(void)
case EXECUTION_MODE_FAIL_INSTALL_NORDIC_TOP:
/* SUIT processes update candiadate. */
case EXECUTION_MODE_INSTALL:
/* SUIT processes recovery as foreground update. */
case EXECUTION_MODE_INSTALL_FDFU:
/* SUIT processes recovery update. */
case EXECUTION_MODE_INSTALL_RECOVERY:
/* SUIT boots from root manifest. */
case EXECUTION_MODE_INVOKE:
/* SUIT boots from recovery manifest as foreground update. */
case EXECUTION_MODE_INVOKE_FDFU:
/* SUIT boots from recovery manifest. */
case EXECUTION_MODE_INVOKE_RECOVERY:
current_execution_mode = EXECUTION_MODE_FAIL_STARTUP;
Expand All @@ -50,10 +54,14 @@ void suit_execution_mode_startup_failed(void)
case EXECUTION_MODE_FAIL_MPI_INVALID_MISSING:
/* System not booted, MPI misconfigured. */
case EXECUTION_MODE_FAIL_MPI_UNSUPPORTED:
/* System not booted, unable to boot recovery manifest as foreground update. */
case EXECUTION_MODE_FAIL_INVOKE_FDFU:
/* System not booted, unable to boot recovery manifest. */
case EXECUTION_MODE_FAIL_INVOKE_RECOVERY:
/* System booted from root manifest. */
case EXECUTION_MODE_POST_INVOKE:
/* System booted from recovery manifest as foreground update. */
case EXECUTION_MODE_POST_INVOKE_FDFU:
/* System booted from recovery manifest. */
case EXECUTION_MODE_POST_INVOKE_RECOVERY:
/* System failed before invoking SUIT orchestrator. */
Expand All @@ -68,12 +76,16 @@ bool suit_execution_mode_booting(void)
switch (current_execution_mode) {
/* SUIT processes update candiadate. */
case EXECUTION_MODE_INSTALL:
/* SUIT processes recovery as foreground update. */
case EXECUTION_MODE_INSTALL_FDFU:
/* SUIT processes recovery update. */
case EXECUTION_MODE_INSTALL_RECOVERY:
/* System is unprovisioned, SUIT updates Nordic components. */
case EXECUTION_MODE_FAIL_INSTALL_NORDIC_TOP:
/* System booted from root manifest. */
case EXECUTION_MODE_POST_INVOKE:
/* System booted from recovery manifest as foreground update. */
case EXECUTION_MODE_POST_INVOKE_FDFU:
/* System booted from recovery manifest. */
case EXECUTION_MODE_POST_INVOKE_RECOVERY:
/* System not booted, application MPI missing. */
Expand All @@ -84,6 +96,8 @@ bool suit_execution_mode_booting(void)
case EXECUTION_MODE_FAIL_MPI_INVALID_MISSING:
/* System not booted, MPI misconfigured. */
case EXECUTION_MODE_FAIL_MPI_UNSUPPORTED:
/* System not booted, unable to boot recovery manifest as foreground update. */
case EXECUTION_MODE_FAIL_INVOKE_FDFU:
/* System not booted, unable to boot recovery manifest. */
case EXECUTION_MODE_FAIL_INVOKE_RECOVERY:
/* System failed before invoking SUIT orchestrator. */
Expand All @@ -94,6 +108,8 @@ bool suit_execution_mode_booting(void)
case EXECUTION_MODE_STARTUP:
/* SUIT boots from root manifest. */
case EXECUTION_MODE_INVOKE:
/* SUIT boots from recovery manifest as foreground update. */
case EXECUTION_MODE_INVOKE_FDFU:
/* SUIT boots from recovery manifest. */
case EXECUTION_MODE_INVOKE_RECOVERY:
break;
Expand All @@ -108,10 +124,14 @@ bool suit_execution_mode_updating(void)
switch (current_execution_mode) {
/* SUIT boots from root manifest. */
case EXECUTION_MODE_INVOKE:
/* SUIT boots from recovery manifest as foreground update. */
case EXECUTION_MODE_INVOKE_FDFU:
/* SUIT boots from recovery manifest. */
case EXECUTION_MODE_INVOKE_RECOVERY:
/* System booted from root manifest. */
case EXECUTION_MODE_POST_INVOKE:
/* System booted from recovery manifest as foreground update. */
case EXECUTION_MODE_POST_INVOKE_FDFU:
/* System booted from recovery manifest. */
case EXECUTION_MODE_POST_INVOKE_RECOVERY:
/* System not booted, application MPI missing. */
Expand All @@ -122,6 +142,8 @@ bool suit_execution_mode_updating(void)
case EXECUTION_MODE_FAIL_MPI_INVALID_MISSING:
/* System not booted, MPI misconfigured. */
case EXECUTION_MODE_FAIL_MPI_UNSUPPORTED:
/* System not booted, unable to boot recovery manifest as foreground update. */
case EXECUTION_MODE_FAIL_INVOKE_FDFU:
/* System not booted, unable to boot recovery manifest. */
case EXECUTION_MODE_FAIL_INVOKE_RECOVERY:
/* System failed before invoking SUIT orchestrator. */
Expand All @@ -132,6 +154,8 @@ bool suit_execution_mode_updating(void)
case EXECUTION_MODE_STARTUP:
/* SUIT processes update candiadate. */
case EXECUTION_MODE_INSTALL:
/* SUIT processes recovery as foreground update. */
case EXECUTION_MODE_INSTALL_FDFU:
/* SUIT processes recovery update. */
case EXECUTION_MODE_INSTALL_RECOVERY:
/* System is unprovisioned, SUIT updates Nordic components. */
Expand All @@ -150,14 +174,20 @@ bool suit_execution_mode_failed(void)
case EXECUTION_MODE_STARTUP:
/* SUIT processes update candiadate. */
case EXECUTION_MODE_INSTALL:
/* SUIT processes recovery as foreground update. */
case EXECUTION_MODE_INSTALL_FDFU:
/* SUIT processes recovery update. */
case EXECUTION_MODE_INSTALL_RECOVERY:
/* SUIT boots from root manifest. */
case EXECUTION_MODE_INVOKE:
/* SUIT boots from recovery manifest as foreground update. */
case EXECUTION_MODE_INVOKE_FDFU:
/* SUIT boots from recovery manifest. */
case EXECUTION_MODE_INVOKE_RECOVERY:
/* System booted from root manifest. */
case EXECUTION_MODE_POST_INVOKE:
/* System booted from recovery manifest as foreground update. */
case EXECUTION_MODE_POST_INVOKE_FDFU:
/* System booted from recovery manifest. */
case EXECUTION_MODE_POST_INVOKE_RECOVERY:
/* System is unprovisioned, SUIT updates Nordic components. */
Expand All @@ -172,6 +202,8 @@ bool suit_execution_mode_failed(void)
case EXECUTION_MODE_FAIL_MPI_INVALID_MISSING:
/* System not booted, MPI misconfigured. */
case EXECUTION_MODE_FAIL_MPI_UNSUPPORTED:
/* System not booted, unable to boot recovery manifest as foreground update. */
case EXECUTION_MODE_FAIL_INVOKE_FDFU:
/* System not booted, unable to boot recovery manifest. */
case EXECUTION_MODE_FAIL_INVOKE_RECOVERY:
/* System failed before invoking SUIT orchestrator. */
Expand Down
8 changes: 7 additions & 1 deletion subsys/suit/mci/src/suit_mci_nrf54h20.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ mci_err_t suit_mci_invoke_order_get(const suit_manifest_class_id_t **class_id, s
}
break;

case EXECUTION_MODE_INVOKE_FDFU:
case EXECUTION_MODE_INVOKE_RECOVERY:
if (suit_storage_mpi_class_get(SUIT_MANIFEST_SEC_TOP, &class_id[0]) !=
SUIT_PLAT_SUCCESS) {
Expand Down Expand Up @@ -143,8 +144,11 @@ mci_err_t suit_mci_independent_update_policy_get(const suit_manifest_class_id_t
* update candidate before resetting the SoC.
*/
switch (suit_execution_mode_get()) {
case EXECUTION_MODE_INVOKE_FDFU:
case EXECUTION_MODE_INVOKE_RECOVERY:
case EXECUTION_MODE_INSTALL_FDFU:
case EXECUTION_MODE_INSTALL_RECOVERY:
case EXECUTION_MODE_POST_INVOKE_FDFU:
case EXECUTION_MODE_POST_INVOKE_RECOVERY:
if ((role == SUIT_MANIFEST_APP_RECOVERY) || (role == SUIT_MANIFEST_RAD_RECOVERY)) {
*policy = SUIT_INDEPENDENT_UPDATE_DENIED;
Expand Down Expand Up @@ -248,7 +252,7 @@ mci_err_t suit_mci_signing_key_id_validate(const suit_manifest_class_id_t *class
return SUIT_PLAT_SUCCESS;
} else if ((mpi->signature_verification_policy ==
SUIT_MPI_SIGNATURE_CHECK_ENABLED_ON_UPDATE) &&
(suit_execution_mode_get() == EXECUTION_MODE_INVOKE)) {
suit_execution_mode_booting()) {
/* By allowing key_id == 0 in the invoke path, the platform will verify
* the signature only during updates.
*/
Expand Down Expand Up @@ -641,6 +645,7 @@ suit_mci_manifest_process_dependency_validate(const suit_manifest_class_id_t *pa
}
break;

case EXECUTION_MODE_INSTALL_FDFU:
case EXECUTION_MODE_INSTALL_RECOVERY:
if ((parent_role == SUIT_MANIFEST_SEC_TOP) &&
((child_role == SUIT_MANIFEST_SEC_SYSCTRL) ||
Expand All @@ -658,6 +663,7 @@ suit_mci_manifest_process_dependency_validate(const suit_manifest_class_id_t *pa
}
break;

case EXECUTION_MODE_INVOKE_FDFU:
case EXECUTION_MODE_INVOKE_RECOVERY:
if ((parent_role == SUIT_MANIFEST_SEC_TOP) &&
((child_role == SUIT_MANIFEST_SEC_SYSCTRL) ||
Expand Down
Loading

0 comments on commit dbc728c

Please sign in to comment.