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

   # NuttX PR Description
   
   ## Title
   
   tee: Refactor OP-TEE shared memory and move TEE functionality
   
   ## Description
   
   This PR contains the following three commits:
   
   1. **Modify OP-TEE driver shared memory allocation mechanism**
      - Allocate shared memory from the RPMsg shared-memory area.
      - Add a callback for map-memory allocation.
      - Remove `CONFIG_OPTEE_OPENVELA_COMPAT` and add TEE shared-memory size 
configuration.
      - Register shared memory.
      - Update the `vaddr` and `paddr` types in `struct optee_shm` to eliminate 
compile-time warnings.
   
   2. **idr: Update the IDR interface to support pointer-to-pointer mapping**
      - Extend the IDR interface to support pointer-to-pointer mappings 
required by the OP-TEE changes.
      - Update the related IDR implementation and affected users, including the 
9P client.
   
   3. **tee: Move the 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 include paths and configuration references for the new directory 
layout.
   
   ## Motivation
   
   Improve OP-TEE shared-memory management, support allocation from the RPMsg 
shared-memory area, remove obsolete compatibility configuration, and organize 
TEE functionality under a dedicated driver directory.
   
   ## Testing
   
   - [ ] Compile-tested
   - [ ] Runtime-tested on target hardware
   
   ### QEMU runtime test
   
   The change was tested with the Vela QEMU ARM64 platform using the following
   runtime configuration:
   
   - Board: `qemu-arm64-v8a-ap`
   - CPU: Cortex-A53
   - SMP: 4 CPUs
   - Memory: 1057 MiB
   - Shared memory: 4 MiB ivshmem region
   - GDB server: TCP port `7775`
   
   The boot log shows that the AP and TEE images were loaded successfully and 
that
   the TEE shared-memory device was detected:
   
   ```text
   INFO:    NUTTXSPD: BL32 ep=0xe100000
   INFO:    NUTTXSPD: BL32 CPU0 entry done
   INFO:    NUTTXSPD: BL32 CPU3 entry done
   INFO:    NUTTXSPD: BL32 CPU2 entry done
   INFO:    NUTTXSPD: BL32 CPU1 entry done
   INFO:    Entry point address = 0x40280000
   0.383143  8 I 0 ap pci_ivshmem_probe: shmem addr=0x8000400000 size=4194304 
reg=0x10001100
   NuttX  12.7.2 49d23ab02201-dirty Nov 10 2026 13:39:07 arm64 ap
   ```
   
   ### AP-side `ostest`
   
   The AP-side `ostest` completed successfully with status 0:
   
   ```text
   qemu-armv8a-ap> ostest
   ...
   cpu_call_test: Call multi cpu, wait
   cpu_call_test: Test success
   
   Final memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     359c280   359c280
   ordblks        53        58
   mxordblk  34d42c0  34cc2c0
   uordblks    c3d30    c5080
   fordblks  34d8550  34d7200
   user_main: Exiting
   ostest_main: Exiting with status 0
   ```
   
   The AP test also covered standard I/O, environment variables, FPU, task
   restart, waitpid/waitid, work queues, synchronization primitives, timers,
   signals, barriers, scheduler locking, `vfork()`, and SMP calls. The expected
   special-delay cases reported one `Invalid` case and one `Timeout` case as 
part
   of the test's built-in negative coverage.
   
   ### TEE-side `ostest`
   
   The TEE-side `ostest` also completed successfully with status 0:
   
   ```text
   tee> ostest
   ...
   cpu_call_test: Call multi cpu, wait
   cpu_call_test: Test success
   
   Final memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena      bc0000   bc0000
   ordblks         2        6
   mxordblk   bab4c0   b969b0
   uordblks    13c00    1d270
   fordblks   bac400   ba2d50
   user_main: Exiting
   ostest_main: Exiting with status 0
   ```
   
   The TEE initialization log confirms that the TEE crypto and filesystem
   initialization completed:
   
   ```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()
   ```
   
   The full QEMU console capture is available in the test log associated with
   this PR.
   


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