bkk19 openamp shared memory for large data€¦ · bkk19 openamp shared memory for large data...
TRANSCRIPT
![Page 1: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/1.jpg)
BKK19 OpenAMP Shared Memory for Large DataFollowing slides contain some useful links and resources. Any questions, please email [email protected]
![Page 2: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/2.jpg)
Large Data Shared Memory Issues in OpenAMP● huge data memory allocation
○ Accessible by both application and coprocessor
○ Zero copy
● memory address mapping for coprocessor● memory synchronization
![Page 3: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/3.jpg)
Huge Data Shared Memory Use Cases● Shared memory is statically-defined
SHM
Application Processor
System MemApplication Processor
Coprocessor
Coprocessor System Mem
CoprocessorCoprocessor
![Page 4: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/4.jpg)
Huge Data Shared Memory Use Cases● Shared memory is from the application processor system memory
Application Processor
System MemApplication Processor
Coprocessor
Coprocessor System Mem
SHM
CoprocessorCoprocessor
![Page 5: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/5.jpg)
Huge Data Shared Memory Use Cases● Shared memory is from the application address space
Application
Coprocessor
Application Address Space
SHMIOMMU
CoprocessorCoprocessor
![Page 6: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/6.jpg)
Libmetal Shared Memory Abstraction
Applicaiton
Libmetal
OS Environment
Memory
Devicemetal_shmem_open()
Memory allocator Device driver
SHM
metal_shmem_attach()
shm shm
metal_shmem_sync
shm
![Page 7: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/7.jpg)
Libmetal Shared Memory Abstraction• metal_shm_open() – allocate shared memory if it is not allocated• metal_shm_attach() – attach shared memory to device, mmap the memory for the
device driver, allocate locks, etc.• metal_shm_sync_for_cpu() – stop device shared memory access, and allow CPU
access.• metal_shm_sync_for_device() – stop CPU shared memory access, and allow device
access.
![Page 8: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/8.jpg)
Libmetal Shared Memory Abstraction With RPMsg and Remtoeproc Option• RPMsg: Remote Processor Messaging
• Pass shared memory information to coprocessor• Memory sync
• Remoteproc: Manage coprocessor resources• Coprocessor shared memory management
• Only remoteproc knows about the device address of the shared memory
• Low level IPC (notification)
![Page 9: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/9.jpg)
Libmetal Shared Memory With Remoteproc in Linux – DMA buf
Application Coprocessor
libmetal
Allocator(ION…)
Remoteproc ioctl to import DMA buf
Linux Kernel
metal_shm_open() metal_shm_attach() metal_shm_sync
DMA buf
DMA buf fd
DMA buf fd
va,dev_addr
DMA buf fd dev addr, size
Sync_r/Sync_w,Ack
RPMsg
dev_addr, size
Sync_r/Sync_w,Ack
Shm size
![Page 10: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/10.jpg)
RPMsg for Shared Memory SyncRPMsg SHM Endpoint A
RPMsg SHM Endpoint BApp A App B
rpmsg_sync(da, len, w_req) rpmsg_sync_resp(callback)
RPMsg(req_w, da, len)
callback(req_w, da, len)
rpmsg_sync(ack_w, da)RPMsg(ack_w, da)
![Page 11: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/11.jpg)
Libmetal Shared Memory With Remoteproc in Linux – IOMMU
Application Coprocessor
libmetal
Remoteproc ioctl to do
Dma mmap
Linux Kernel
metal_shm_open() metal_shm_attach() metal_shm_sync
va, dev_addr, size
Sync_r/Sync_w,Ack
RPMsg
dev_addr, size
Sync_r/Sync_w,Ack
shm size
mmap()
va, size
dev_addr
![Page 12: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/12.jpg)
Libmetal Shared Memory With Remoteproc in Linux – Remoteproc Static Shared Memory
Application Coprocessor
libmetal
Remoteproc ioctl to do DMA allocation
Linux Kernel
metal_shm_open() metal_shm_attach() metal_shm_sync
dma_buf fd,va, dev_addr
dev_addr, size
Sync_r/Sync_w,Ack
RPMsg
dev_addr, size
Sync_r/Sync_w,Ack
shm size
DMA buf
dma buf fd
![Page 13: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/13.jpg)
Remoteproc Carveouts
virtual address
DMA address
Len
Device address
![Page 14: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/14.jpg)
Open Questions● Is there a way for a RPMsg device to know about its attached remoteproc device?
○ Remoteproc can verify the shared memory and returns the remote address mapping.● Userspace remoteproc and RPMsg?
![Page 15: BKK19 OpenAMP Shared Memory for Large Data€¦ · BKK19 OpenAMP Shared Memory for Large Data Following slides contain some useful links and resources. Any questions, please email](https://reader030.vdocuments.site/reader030/viewer/2022041104/5f0507db7e708231d410ea10/html5/thumbnails/15.jpg)
Thank youJoin Linaro to accelerate deployment of your Arm-based solutions through collaboration