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

   # NuttX PR Description
   
   ## Title
   
   tee: reorganize OP-TEE drivers and preserve runtime capabilities
   
   ## Description
   
   This PR contains the following three commits:
   
   1. **tee: Move TEE functionality to a separate directory**
      - Move the OP-TEE and TEE-related implementation from `drivers/misc` to
        `drivers/tee`.
      - Add the corresponding Kconfig, Makefile, Make.defs, and CMake 
integration.
      - Update the TEE source and header paths for the new directory layout.
   
   2. **drivers/tee/optee: Simplify memory map entry handling in `shm_mmap`**
      - Remove the unnecessary `mm_map_find()` lookup.
      - Use the already-resolved `mm_map_entry_s` passed to `optee_shm_mmap()`.
      - Simplify the mapping path and reduce redundant memory lookups.
   
   3. **tee: Fix `gen_caps` overwrite in `optee_ioctl_version`**
      - Initialize `gen_caps` with the base OP-TEE capabilities first.
      - OR in runtime capabilities from `priv->capabilities` afterwards.
      - Preserve capabilities such as `TEE_GEN_CAP_REG_MEM` when reporting the
        driver version to userspace.
   
   ## Motivation
   
   Organize TEE drivers under a dedicated directory, simplify shared-memory mmap
   handling, and ensure that runtime-detected OP-TEE capabilities are not lost
   when `TEE_IOC_VERSION` is queried.
   
   ## Runtime Testing
   
   The changes were tested with the Vela QEMU ARM64 TrustZone environment using
   the `qemu-arm64-v8a-ap` configuration:
   
   - CPU: Cortex-A53
   - SMP: 4 CPUs
   - Memory: 1057 MiB
   - Shared memory: 4 MiB ivshmem region
   - GDB server: TCP port `7775`
   
   ### Trusted Firmware-A and NuttX startup
   
   ```text
   NOTICE:  Booting Trusted Firmware
   NOTICE:  BL1: v2.14.0(debug):fb1381d84
   INFO:    BL2: Loading image id 4
   INFO:    Handoff to BL32
   NOTICE:  BL31: Booting BL31
   INFO:    NUTTXSPD: BL32 ep=0xe100000
   INFO:    BL32 CPU0 entry done
   INFO:    BL32 CPU1 entry done
   INFO:    BL32 CPU2 entry done
   INFO:    BL32 CPU3 entry done
   INFO:    Entry point address = 0x40280000
   ```
   
   ### AP shared-memory initialization
   
   ```text
   0.382308  8 I 0 ap pci_sdhci_probe: SDHCI controller at 10001000 irq=37
   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 arm64 ap
   ```
   
   ### TEE initialization
   
   ```text
   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
   
   - [ ] Compile-tested with all OP-TEE SMC, socket, and supplicant variants
   - [x] Runtime-tested on Vela QEMU ARM64 TrustZone
   - [x] AP-side `ostest` completed with status 0
   - [x] TEE-side `ostest` completed with status 0
   - [ ] Directly verified `TEE_IOC_VERSION` reports `TEE_GEN_CAP_REG_MEM`
   


-- 
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]

  • [PR] tee: reorganize OP-TEE d... hujun260 (via GitHub) via commits

Reply via email to