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

   ## Summary
   
   This series adds a Linux-style DMA-BUF framework and a system heap allocator 
to NuttX.
   
   ### 1. drivers/dma-buf: add DMA-BUF framework
   
   * Shared buffer objects with fd-based export/import
   * Userspace uAPI close to Linux (`DMA_BUF_IOCTL_SYNC`, `DMA_BUF_SET_NAME`)
   * Atomic refcounting; `close()` drops the reference
   * `mmap()` holds a reference for the lifetime of the mapping so the buffer 
cannot be released while the mapping is still valid
   
   ### 2. drivers/dma-buf: add system heap allocator
   
   * `/dev/dma_heap/system` with `DMA_BUF_HEAP_IOCTL_ALLOC` (Linux dma-heap 
model)
   * 32-byte aligned payloads for DMA-capable importers
   * Device-mapped CPU access brackets dcache invalidate/flush
   * On flat / non-addrenv builds, the CPU virtual address is used as the DMA 
address
   
   ## Testing
   
   On `sim:nsh` with `CONFIG_DMABUF_HEAPS=y`:
   
   ```
   nsh> ls /dev/dma_heap
   /dev/dma_heap:
    system
   nsh> dmabuf_test
   ALLOC ok fd=4 len=4096
   MMAP close-while-mapped ok
   SYNC ok
   dmabuf_test PASSED
   ```
   
   `tools/checkpatch.sh -f` passes for all new files.
   
   The smoke test covers ALLOC, mmap, close-while-mapped refcounting, and 
`DMA_BUF_IOCTL_SYNC`.
   


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