diff --git a/CODEOWNERS b/CODEOWNERS index 5082abdc0a1e..58b9c81bc84a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -368,6 +368,7 @@ /include/nrf_compress/ @nordicjm /include/nrf_rpc/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-si-muffin @nrfconnect/ncs-protocols-serialization /include/power/ @nrfconnect/ncs-co-drivers +/include/ironside/ @nrfconnect/ncs-aurora /include/sdfw/ @nrfconnect/ncs-aurora /include/sdfw/sdfw_services/extmem_remote.h @nrfconnect/ncs-charon /include/sdfw/sdfw_services/suit_service.h @nrfconnect/ncs-charon @@ -389,6 +390,7 @@ /lib/bin/lwm2m_carrier/ @nrfconnect/ncs-carrier /lib/boot_banner/ @nordicjm /lib/contin_array/ @nrfconnect/ncs-audio +/lib/cpuconf/ @nrfconnect/ncs-aurora /lib/data_fifo/ @nrfconnect/ncs-audio /lib/date_time/ @nrfconnect/ncs-modem-tre /lib/dk_buttons_and_leds/ @nrfconnect/ncs-si-muffin diff --git a/include/ironside/se/cpuconf.h b/include/ironside/se/cpuconf.h new file mode 100644 index 000000000000..c8b925e2a050 --- /dev/null +++ b/include/ironside/se/cpuconf.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#ifndef __CPUCONF_H__ +#define __CPUCONF_H__ + +#include + +#define IRONSIDE_SE_CPUCONF_SERVICE_WRONG_CPU 0x5eb2 +#define IRONSIDE_SE_CPUCONF_SERVICE_STARTING_CPU_FAILED 0x5eb0 +#define IRONSIDE_SE_CPUCONF_SERVICE_MEM_ACCESS_NOT_PERMITTED 0x5eb1 + +#define IRONSIDE_CALL_ID_CPUCONF_V0 2 + +enum { + IRONSIDE_SE_CPUCONF_INDEX_CPU, + IRONSIDE_SE_CPUCONF_INDEX_VECTOR_TABLE, + IRONSIDE_SE_CPUCONF_INDEX_CPU_WAIT, + IRONSIDE_SE_CPUCONF_INDEX_MSG, + IRONSIDE_SE_CPUCONF_INDEX_MSG_SIZE, + IRONSIDE_SE_CPUCONF_INDEX_ERR, + /* The last enum value is reserved for the number of arguments */ + IRONSIDE_SE_CPUCONF_NUM_ARGS +}; + +BUILD_ASSERT(IRONSIDE_SE_CPUCONF_NUM_ARGS <= NRF_IRONSIDE_CALL_NUM_ARGS); + +/** + * @brief Boot a local domain CPU + * + * @param cpu The CPU to be booted + * @param vector_table Pointer to the vector table used to boot the CPU. + * @param cpu_wait When this is true, the CPU will WAIT even if the CPU has clock. + * @param msg A message that can be placed in radiocore's boot report. + * @param msg_size Size of the message in bytes. + * + * @note cpu_wait is only intended to be enabled for debug purposes + * and it is only supported that a debugger resumes the CPU. + * + * @retval 0 on success or if the CPU has already booted. + * @retval -IRONSIDE_SE_CPUCONF_SERVICE_WRONG_CPU if cpu is unrecognized + * @retval -IRONSIDE_SE_CPUCONF_SERVICE_STARTING_CPU_FAILED if starting the CPU failed + * @retval -IRONSIDE_SE_CPUCONF_SERVICE_MEM_ACCESS_NOT_PERMITTED + * if the CPU does not have read access configured for the vector_table address + */ +int ironside_se_cpuconf_boot_core(NRF_PROCESSORID_Type cpu, void *vector_table, bool cpu_wait, uint8_t *msg, size_t msg_size); + +#endif /* __CPUCONF_SERVICE_H__ */ diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 705274168ab0..e445771c3c7c 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -36,6 +36,7 @@ add_subdirectory_ifdef(CONFIG_HW_UNIQUE_KEY_SRC hw_unique_key) add_subdirectory_ifdef(CONFIG_APP_JWT app_jwt) add_subdirectory_ifdef(CONFIG_MODEM_JWT modem_jwt) add_subdirectory_ifdef(CONFIG_MODEM_SLM modem_slm) +add_subdirectory_ifdef(CONFIG_IRONSIDE_SE_CPUCONF cpuconf) add_subdirectory_ifdef(CONFIG_MODEM_ATTEST_TOKEN modem_attest_token) add_subdirectory_ifdef(CONFIG_LOCATION location) add_subdirectory_ifdef(CONFIG_AT_SHELL at_shell) diff --git a/lib/Kconfig b/lib/Kconfig index 4f068905ef94..90da96a15ab1 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -38,6 +38,7 @@ rsource "hw_unique_key/Kconfig" rsource "modem_jwt/Kconfig" rsource "modem_slm/Kconfig" rsource "modem_attest_token/Kconfig" +rsource "cpuconf/Kconfig" rsource "location/Kconfig" rsource "at_shell/Kconfig" rsource "modem_antenna/Kconfig" diff --git a/lib/cpuconf/CMakeLists.txt b/lib/cpuconf/CMakeLists.txt new file mode 100644 index 000000000000..10b522b11ce6 --- /dev/null +++ b/lib/cpuconf/CMakeLists.txt @@ -0,0 +1,8 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +zephyr_library() +zephyr_library_sources(cpuconf.c) diff --git a/lib/cpuconf/Kconfig b/lib/cpuconf/Kconfig new file mode 100644 index 000000000000..aeaaf23025da --- /dev/null +++ b/lib/cpuconf/Kconfig @@ -0,0 +1,10 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +config IRONSIDE_SE_CPUCONF + bool "CPUCONF" + depends on SOC_NRF54H20_CPUAPP + select NRF_IRONSIDE_CALL diff --git a/lib/cpuconf/cpuconf.c b/lib/cpuconf/cpuconf.c new file mode 100644 index 000000000000..d31d547f3dc1 --- /dev/null +++ b/lib/cpuconf/cpuconf.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2025 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + +#include +#include + +#include + +#include +#include // Will be moved to Zephyr + +#include + +int ironside_se_cpuconf_boot_core(NRF_PROCESSORID_Type cpu, void *vector_table, bool cpu_wait, uint8_t *msg, size_t msg_size) +{ + ARG_UNUSED(msg); + ARG_UNUSED(msg_size); + + /* NCSDK-32393: msg is unused until the boot report is available */ + + struct ironside_call_buf *const buf = ironside_call_alloc(); + + buf->id = IRONSIDE_CALL_ID_CPUCONF_V0; + + buf->args[IRONSIDE_SE_CPUCONF_INDEX_CPU] = cpu; + buf->args[IRONSIDE_SE_CPUCONF_INDEX_VECTOR_TABLE] = (uint32_t)vector_table; + buf->args[IRONSIDE_SE_CPUCONF_INDEX_CPU_WAIT] = cpu_wait; + buf->args[IRONSIDE_SE_CPUCONF_INDEX_MSG] = (uint32_t)msg; + buf->args[IRONSIDE_SE_CPUCONF_INDEX_MSG_SIZE] = msg_size; + + ironside_call_dispatch(buf); + + int err = -1; // TODO COMM_FAILURE + + if (buf->status == IRONSIDE_CALL_STATUS_RSP_SUCCESS) { + err = buf->args[IRONSIDE_SE_CPUCONF_INDEX_ERR]; + } + + ironside_call_release(buf); + + return err; +} diff --git a/west.yml b/west.yml index 08ed9a39d26b..428fe84414a6 100644 --- a/west.yml +++ b/west.yml @@ -65,7 +65,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: ca2af2f1469802d7e48b18a6e8bce6436d57223c + revision: pull/2815/head import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above