hujun260 opened a new pull request, #21663:
URL: https://github.com/apache/nuttx/pull/21663

   # NuttX PR Description
   
   ## Title
   
   arch/arm64: add NuttX SPD SMC function IDs to syscall.h
   
   ## Description
   
   This PR adds the ARM64 Secure Payload Dispatcher (SPD) SMC function IDs used
   for communication between the NuttX TEE at BL32 and the EL3 runtime at BL31 
in
   TrustZone dual-OS configurations.
   
   ## Changes
   
   Add the following SMC function IDs to `arch/arm64/include/syscall.h` using 
the
   ARM SMCCC `ARM_SMCCC_CALL_VAL` macro:
   
   - `ARM64_SMCCC_NUTTX_TEE_IDLE`
     - Yielding SMC64 call.
     - Owner entity number (OEN): 63.
     - Function number: 1.
   - `ARM64_SMCCC_NUTTX_REE_IDLE`
     - Yielding SMC64 call.
     - Owner entity number (OEN): 63.
     - Function number: 2.
   - `ARM64_SMCCC_NUTTX_SEND_SECURE_SGI`
     - Fast SMC64 call.
     - Owner entity number (OEN): 63.
     - Function number: 0.
   
   These identifiers provide a common interface for:
   
   - TEE-to-BL31 idle/yield requests.
   - REE-to-BL31 idle/yield requests.
   - Sending secure SGIs through the EL3 firmware.
   
   ## Motivation
   
   Expose the NuttX SPD SMC ABI at the ARM64 architecture level so that BL32 TEE
   and BL31 EL3 code can use consistent function IDs for idle handling and 
secure
   interrupt delivery.
   
   ## Runtime Testing
   
   The following runtime log was captured from the Vela QEMU ARM64 TrustZone
   environment using the `qemu-arm64-v8a-ap` configuration with four Cortex-A53
   CPUs and Trusted Firmware-A.
   
   ### Trusted Firmware-A and SPD initialization
   
   ```text
   NOTICE:  Booting Trusted Firmware
   NOTICE:  BL1: v2.14.0(debug):fb1381d84
   INFO:    BL2: Loading image id 4
   INFO:    Handoff to BL32
   NOTICE:  BL2: Loading image id 5
   NOTICE:  BL31: Initializing runtime services
   INFO:    NUTTXSPD: BL32 ep=0xe100000
   INFO:    BL31: Initializing BL32
   INFO:    NUTTXSPD: BL32 CPU0 entry done
   INFO:    NUTTXSPD: BL32 CPU1 entry done
   INFO:    NUTTXSPD: BL32 CPU2 entry done
   INFO:    NUTTXSPD: BL32 CPU3 entry done
   INFO:    NUTTXSPD: CPU3 on_finish done
   INFO:    NUTTXSPD: CPU2 on_finish done
   INFO:    NUTTXSPD: CPU1 on_finish done
   INFO:    Entry point address = 0x40280000
   ```
   
   ### AP and TEE initialization
   
   ```text
   0.383143  8 I 0 ap pci_ivshmem_probe: shmem addr=0x8000400000 size=4194304 
reg=0x10001100
   0.393617  8 I 0 ap board_init_emmc: GPT partitions registered
   NuttX  12.7.2 49d23ab02201-dirty Nov 10 2026 13:39:07 arm64 ap
   
   21 I 0 tee D/TC:0 21 call_initcalls:40 level 1 register_time_source()
   21 I 0 tee D/TC:0 21 call_initcalls:40 level 3 tee_cryp_init()
   21 I 0 tee D/TC:0 21 call_initcalls:40 level 4 host_fs_init()
   21 I 0 tee D/TC:0 21 host_fs_init:162 host fs init success
   21 I 0 tee D/TC:0 21 call_initcalls:40 level 6 default_mobj_init()
   ```
   
   ### AP-side `ostest`
   
   ```text
   qemu-armv8a-ap> ostest
   ...
   user_main: smp call test
   cpu_call_test: Call cpu 0, wait
   cpu_call_test: Call cpu 1, wait
   cpu_call_test: Call cpu 2, wait
   cpu_call_test: Call cpu 3, wait
   cpu_call_test: Call multi cpu, wait
   cpu_call_test: Test success
   user_main: Exiting
   ostest_main: Exiting with status 0
   ```
   
   ### TEE-side `ostest`
   
   ```text
   tee> ostest
   ...
   user_main: smp call test
   cpu_call_test: Call cpu 0, wait
   cpu_call_test: Call cpu 1, wait
   cpu_call_test: Call cpu 2, wait
   cpu_call_test: Call cpu 3, wait
   cpu_call_test: Call multi cpu, wait
   cpu_call_test: Test success
   user_main: Exiting
   ostest_main: Exiting with status 0
   ```
   
   ## Testing Status
   
   - [x] Runtime-tested on Vela QEMU ARM64 TrustZone
   - [x] BL31 and BL32 initialization completed
   - [x] AP-side `ostest` completed with status 0
   - [x] TEE-side `ostest` completed with status 0
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to