yangsong8-a1 opened a new pull request, #22198:
URL: https://github.com/apache/nuttx/pull/22198
## Summary
Add a PCI ivshmem-based ramdisk driver (`pci_ramdisk_ivshmem.c`) that
exposes the shared memory region of an ivshmem device as a block device
(`/dev/ivshm<N>`). The ivshmem device id table is configured via
`CONFIG_PCI_RAMDISK_IVSHMEM_IDTABLE`.
## Impact
New driver, no existing code is affected. Adds:
- `CONFIG_PCI_RAMDISK_IVSHMEM` and `CONFIG_PCI_RAMDISK_IVSHMEM_IDTABLE`
- `pci_ramdisk_ivshmem.c` and registration in `pci_drivers.c`
- Build rules in `Make.defs` and `CMakeLists.txt`
## Testing
Ubuntu 22.04, aarch64-none-elf-gcc 13.2.Rel1, QEMU 6.2. qemu-armv8a:nsh
with PCI, PCI_IVSHMEM, PCI_RAMDISK_IVSHMEM (id table "0"), FS_FAT and PCI
debug output, CMake, no new warnings.
qemu-system-aarch64 -cpu cortex-a53 -nographic
-machine virt,virtualization=on,gic-version=3 -net none
-object
memory-backend-file,id=shm0,size=1M,share=on,mem-path=/dev/shm/nx-ivshm
-device ivshmem-plain,memdev=shm0 -kernel nuttx
Console lines that mention ivshm, plus the NSH commands:
pci_register_ramdisk_ivshmem_driver: Register ramdisk ivshmem driver, id=0
ivshmem_probe: shmem addr=0x8000000000 size=1048576 reg=0x10000000
ramdisk_ivshmem_probe: Ramdisk ivshmem /dev/ivshm0 buffer: 0x8000000000
size: 1048576 sectors: 2048
nsh> ls /dev
ivshm0
nsh> mkfatfs /dev/ivshm0
nsh> mount -t vfat /dev/ivshm0 /mnt
nsh> echo hello-ivshmem-ramdisk > /mnt/a.txt
nsh> cat /mnt/a.txt
hello-ivshmem-ramdisk
nsh> umount /mnt
nsh>
The FAT image and the file are in the host's /dev/shm/nx-ivshm
afterwards (`strings` shows "FAT12", "A TXT" and
"hello-ivshmem-ramdisk").
--
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]