Skip to contentSkip to conversation

arm-bsp/trusted-firmware-m: corstone1000: Drive NPU reset via ext sys ctrl

PATCH New Michael Safwat 1 participant 2 messages Apr 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 arm-bsp/trusted-firmware-m: corstone1000: Drive NPU reset via ext sys ctrl

- Derive host base addresses from offsets and add ext sys reset bitfields
- Deassert CPUWAIT with a bitmask
- Enable ext sys boot handling for Corstone1000 with Cortex-A320
- Add the new downstream TF‑M patches to the recipe

---
 ...ive-host-base-addresses-from-offsets.patch | 111 ++++++++++++++++++
 ...NPU-via-external-system-reset-contro.patch |  75 ++++++++++++
 .../trusted-firmware-m-corstone1000.inc       |   2 +
 3 files changed, 188 insertions(+)
 create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0044-plat-cs1k-Derive-host-base-addresses-from-offsets.patch
 create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0045-plat-cs1k-Drive-NPU-via-external-system-reset-contro.patch
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0044-plat-cs1k-Derive-host-base-addresses-from-offsets.patch new file +111 -0
new file mode 100644
index 00000000..a83ca6e9
@@ -0,0 +1,111 @@
+From 37cac6c86f10340382ff950e5e0323f2efbe5ed3 Mon Sep 17 00:00:00 2001
+From: Michael Safwat <[email protected]>
+Date: Wed, 8 Apr 2026 13:02:47 +0100
+Subject: [PATCH 1/2] plat: cs1k: Derive host base addresses from offsets
+
+Define explicit host register offsets and compute base addresses
+from the common host address space base. This keeps the map
+consistent, and also makes it easy to relocate all addresses if the
+base addresses change.
+
+Define External System Reset Control bitfields and use them to
+de-assert CPUWAIT when booting the external system, so we can touch
+only the bit of interest instead of zeroing the whole register.
+
+Change-Id: Id228351926fc846d28d5bf4e4180a995057154b1
+Signed-off-by: Michael Safwat <[email protected]>
+Upstream-Status: Backport [d73cc1dbc2eb72af02de740926f7b3c889bbac4b]
+---
+ .../Device/Include/platform_base_address.h    | 52 ++++++++++++++-----
+ .../arm/corstone1000/tfm_hal_multi_core.c     |  5 +-
+ 2 files changed, 41 insertions(+), 16 deletions(-)
+
+diff --git a/platform/ext/target/arm/corstone1000/Device/Include/platform_base_address.h b/platform/ext/target/arm/corstone1000/Device/Include/platform_base_address.h
+index 3908d69bc..62ee7d049 100644
+--- a/platform/ext/target/arm/corstone1000/Device/Include/platform_base_address.h
++++ b/platform/ext/target/arm/corstone1000/Device/Include/platform_base_address.h
+@@ -68,23 +68,49 @@
+ /* Host base addresses from the SE perspective - partial list, only the ones
+  * required by the SE are defined here */
+ #define CORSTONE1000_HOST_ADDRESS_SPACE_BASE       (0x60000000U) /* Host Address Space                */
+-#define CORSTONE1000_HOST_BIR_BASE                 (0x60000000U) /* Boot Instruction Register         */
+-#define CORSTONE1000_HOST_TRUSTED_RAM_BASE         (0x62000000U) /* Secure RAM                        */
+-#define CORSTONE1000_HOST_XNVM_BASE                (0x68000000U) /* XNVM                              */
+-#define CORSTONE1000_HOST_BASE_SYSTEM_CONTROL_BASE (0x7A010000U) /* Host SCB                          */
+-#define CORSTONE1000_EXT_SYS_RESET_REG             (0x7A010310U) /* external system (cortex-M3)       */
+-#define CORSTONE1000_HOST_FIREWALL_BASE            (0x7A800000U) /* Host Firewall                     */
+-#define CORSTONE1000_HOST_INT_APBCOM_BASE          (0x7B900000U) /* Internal APBCOM                   */
+-#define CORSTONE1000_HOST_FPGA_SCC_REGISTERS       (0x80000000U) /* FPGA SCC Registers                */
+-#define CORSTONE1000_HOST_SE_SECURE_FLASH_BASE_FVP (0x80010000U) /* SE Flash                          */
+-#define CORSTONE1000_HOST_AXI_QSPI_CTRL_REG_BASE   (0x80050000U) /* AXI QSPI Controller               */
+-#define CORSTONE1000_HOST_AXI_QSPI_CTRL_REG_BASE_SE_SECURE_FLASH (0x90010000U) /* AXI QSPI Controller for SE FLash  */
+-#define CORSTONE1000_HOST_DRAM_UEFI_CAPSULE        (0xA0000000U) /* 1.5 GB DDR                        */
+ 
++/* Registers offsets - partial list, only the ones
++ * required by the SE are defined here */
++#define CORSTONE1000_HOST_BIR_OFFSET                                           (0x00000000U)
++#define CORSTONE1000_HOST_CVM_OFFSET                                           (0x02000000U)
++#define CORSTONE1000_HOST_XNVM_OFFSET                                          (0x08000000U)
++#define CORSTONE1000_HOST_BASE_SYSTEM_CONTROL_BASE_OFFSET                      (0x1A010000U)
++#define CORSTONE1000_HOST_EXT_SYS0_RST_CTRL_OFFSET                             (0x310U)
++#define CORSTONE1000_HOST_FIREWALL_BASE_OFFSET                                 (0x1A800000U)
++#define CORSTONE1000_HOST_INT_APBCOM_BASE_OFFSET                               (0x1B900000U)
++/* The below offsets have been derived from the reserved section.*/
++#define CORSTONE1000_HOST_FPGA_SCC_REGISTERS_OFFSET                            (0x20000000U)
++#define CORSTONE1000_HOST_SE_SECURE_FLASH_BASE_FVP_OFFSET                      (0x20010000U)
++#define CORSTONE1000_HOST_AXI_QSPI_CTRL_REG_BASE_OFFSET                        (0x20050000U)
++#define CORSTONE1000_HOST_AXI_QSPI_CTRL_REG_BASE_SE_SECURE_FLASH_OFFSET        (0x30010000U)
++#define CORSTONE1000_HOST_DRAM_UEFI_CAPSULE_OFFSET                             (0x40000000U)
++#define CORSTONE1000_HOST_DSU_120T_BASE_OFFSET                                 (0x60910000U)
++
++/* Register Addresses */
++#define CORSTONE1000_HOST_BIR_BASE                 (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_BIR_OFFSET)                                                  /* Boot Instruction Register */
++#define CORSTONE1000_HOST_TRUSTED_RAM_BASE         (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_CVM_OFFSET)                                                  /* On-chip Volatile Memory */
++#define CORSTONE1000_HOST_XNVM_BASE                (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_XNVM_OFFSET)                                                 /* eXecute-in-place Non-volatile Memory */
++#define CORSTONE1000_HOST_BASE_SYSTEM_CONTROL_BASE (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_BASE_SYSTEM_CONTROL_BASE_OFFSET)                             /* Security Control Bits */
++#define CORSTONE1000_EXT_SYS_RESET_REG             (CORSTONE1000_HOST_BASE_SYSTEM_CONTROL_BASE + CORSTONE1000_HOST_EXT_SYS0_RST_CTRL_OFFSET)                              /* External System (Cortex-M3) */
++#define CORSTONE1000_HOST_FIREWALL_BASE            (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_FIREWALL_BASE_OFFSET)                                        /* System Firewall */
++#define CORSTONE1000_HOST_INT_APBCOM_BASE          (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_INT_APBCOM_BASE_OFFSET)                                      /* Internal Advanced Peripheral Bus Communication */
++#define CORSTONE1000_HOST_FPGA_SCC_REGISTERS       (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_FPGA_SCC_REGISTERS_OFFSET)                                   /* FPGA Serial Communication Controller Registers */
++#define CORSTONE1000_HOST_SE_SECURE_FLASH_BASE_FVP (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_SE_SECURE_FLASH_BASE_FVP_OFFSET)                             /* Secure Enclave Flash */
++#define CORSTONE1000_HOST_AXI_QSPI_CTRL_REG_BASE   (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_AXI_QSPI_CTRL_REG_BASE_OFFSET)                               /* AXI QSPI Controller */
++#define CORSTONE1000_HOST_AXI_QSPI_CTRL_REG_BASE_SE_SECURE_FLASH (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_AXI_QSPI_CTRL_REG_BASE_SE_SECURE_FLASH_OFFSET) /* AXI QSPI Controller for SE FLash  */
++#define CORSTONE1000_HOST_DRAM_UEFI_CAPSULE        (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_DRAM_UEFI_CAPSULE_OFFSET)                                    /* DDR RAM (1.5 GB) */
+ #ifdef CORSTONE1000_DSU_120T
+-#define CORSTONE1000_HOST_DSU_120T_BASE            (0xC0910000U) /* DSU-120T PPU                      */
++#define CORSTONE1000_HOST_DSU_120T_BASE            (CORSTONE1000_HOST_ADDRESS_SPACE_BASE + CORSTONE1000_HOST_DSU_120T_BASE_OFFSET)                                        /* DynamIQ Shared Unit-120 Power Policy Units */
+ #endif
+ 
++/* Bit definition for External System Reset Control register */
++#define CORSTONE1000_EXT_SYS_RESET_REG_CPUWAIT_Pos           (0U) // CPU Wait Control. 0b0 - External System's CPUWAIT signal is de-asserted. 0b1 - External System's CPUWAIT signal is asserted.
++#define CORSTONE1000_EXT_SYS_RESET_REG_CPUWAIT_Msk           (0x1UL << CORSTONE1000_EXT_SYS_RESET_REG_CPUWAIT_Pos)  // 1 bit
++#define CORSTONE1000_EXT_SYS_RESET_REG_RST_REQ_Pos           (1U) // Reset Request for External System. 0b0 - No Reset Requested. 0b1 - Reset Requested.
++#define CORSTONE1000_EXT_SYS_RESET_REG_RST_REQ_Msk           (0x1UL << CORSTONE1000_EXT_SYS_RESET_REG_RST_REQ_Pos)  // 1 bit
++#define CORSTONE1000_EXT_SYS_RESET_REG_Reserved_Pos          (2U) // Reserved.
++#define CORSTONE1000_EXT_SYS_RESET_REG_Reserved_Msk          (0x3FFFFFFFUL << CORSTONE1000_EXT_SYS_RESET_REG_Reserved_Pos)  // 30 bits
++
+ /* Map Component definitions to Corstone definitions */
+ #define CC3XX_BASE_S        CORSTONE1000_CRYPTO_ACCELERATOR_BASE
+ 
+diff --git a/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c b/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c
+index 9a785bfa0..76360b507 100644
+--- a/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c
++++ b/platform/ext/target/arm/corstone1000/tfm_hal_multi_core.c
+@@ -26,12 +26,11 @@
+ #define AA64nAA32_MASK (1 << 3)
+ 
+ #ifdef EXTERNAL_SYSTEM_SUPPORT
+-void tfm_external_system_boot()
++void tfm_external_system_boot(void)
+ {
+     volatile uint32_t *ext_sys_reset_ctl_reg = (uint32_t *)(CORSTONE1000_EXT_SYS_RESET_REG);
+ 
+-    /* de-assert CPU_WAIT signal*/
+-    *ext_sys_reset_ctl_reg = 0x0;
++    *ext_sys_reset_ctl_reg &= ~(CORSTONE1000_EXT_SYS_RESET_REG_CPUWAIT_Msk);
+ }
+ #endif
+ 
+-- 
+2.43.0
+
meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0045-plat-cs1k-Drive-NPU-via-external-system-reset-contro.patch new file +75 -0

75 lines not on this page · raw message

meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc +2 -0
index ff3a87a9..55f48a3c 100644
@@ -75,6 +75,8 @@ SRC_URI:append:corstone1000 = " \
     file://0041-plat-cs1k-Changed-to-use-new-GPT-library.patch \
     file://0042-plat-cs1k-Move-variable-from-stack-to-data.patch \
     file://0043-plat-cs1k-Create-and-remove-FWU-image-partitions.patch \
+    file://0044-plat-cs1k-Derive-host-base-addresses-from-offsets.patch \
+    file://0045-plat-cs1k-Drive-NPU-via-external-system-reset-contro.patch \
     "
 
 SRCREV_tfm-psa-adac:corstone1000 = "f2809ae231be33a1afcd7714f40756c67d846c88"
#1 lore raw

PATCH 2/2 arm-bsp/docs: corstone1000: Drop A320 reboot workaround note

Remove the user-guide warning and rebuild steps for the disable_module_autoloading workaround on Corstone-1000 with Cortex-A320.

With the NPU reset issue fixed, this workaround is no longer needed.

---
 .../documentation/corstone1000/user-guide.rst | 39 -------------------
 1 file changed, 39 deletions(-)
meta-arm-bsp/documentation/corstone1000/user-guide.rst +0 -39
index ef1f48b7..e38fd1e8 100644
@@ -865,45 +865,6 @@ The results can be fetched from the `acs_results` folder in the ``BOOT`` partiti
 Capsule Update
 --------------
 
-.. warning::
-
-    The **Corstone-1000 with Cortex-A320 FVP** becomes unresponsive when the Linux kernel driver for the
-    Ethos-U85 NPU loads automatically after a software reboot.
-    This behavior results from a power reset control issue in the **Corstone-1000 with Cortex-A320 FVP** model.
-    To prevent the failure and complete the test successfully,
-    rebuild the **Corstone-1000 with Cortex-A320** firmware image using the following steps:
-
-
-    #. Clone the `iot-platform-assets` repository to your ``${WORKSPACE}``.
-
-        .. code-block:: console
-
-            cd ${WORKSPACE}
-            git clone https://git.gitlab.arm.com/arm-reference-solutions/iot-platform-assets.git \
-            -b CORSTONE1000-2025.12
-
-    #. Copy the disable ethosu driver Git patch file to your copy of `meta-arm`.
-
-        .. code-block:: console
-
-            cp -f iot-platform-assets/corstone1000/disable_module_autoloading/0001-arm-bsp-linux-corstone1000-a320-disable-ethosu-confi.patch \
-            ${WORKSPACE}/meta-arm/
-
-    #. Apply the Git patch to `meta-arm`.
-
-        .. code-block:: console
-
-            cd ${WORKSPACE}/meta-arm/
-            git apply 0001-arm-bsp-linux-corstone1000-a320-disable-ethosu-confi.patch
-            cd ${WORKSPACE}
-
-    #. Re-Build the **Corstone-1000 with Cortex-A320 FVP** software stack as follows:
-
-        .. code-block:: console
-
-            kas build meta-arm/kas/corstone1000-fvp.yml:meta-arm/ci/debug.yml:meta-arm/kas/corstone1000-a320.yml
-
-
 .. important::
 
     Payload GUIDs (``${BL2_GUID}``, ``${TFM_S_GUID}``, ``${FIP_GUID}``, and ``${INITRAMFS_GUID}``)