fs/v9fs: Add KERNEL build support and enable v9fs for qemu-armv7a knsh #18343
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds VirtIO 9P filesystem (v9fs) support for BUILD_KERNEL configuration and enables it on the qemu-armv7a knsh board.
Changes
Add up_addrenv_va_to_pa() conversion for buffer addresses in v9fs client read/write operations
This is required because in kernel build mode, virtual addresses need to be converted to physical addresses for VirtIO device DMA operations
Limit read/write transfer size to page boundary (CONFIG_MM_PGSIZE) in kernel build
This handles non-contiguous physical memory pages - each transfer stays within a single physical page
Use bufptr instead of directly modifying buffer pointer for proper iteration
Enable CONFIG_DEVICE_TREE=y
Enable CONFIG_DRIVERS_VIRTIO=y and CONFIG_DRIVERS_VIRTIO_MMIO=y
Enable CONFIG_FS_V9FS=y and CONFIG_V9FS_VIRTIO_9P=y
Adjust RAM settings: start from 0x40100000 with size 15728640 to accommodate FDT
Add documentation for launching KNSH with VirtIO 9P filesystem
Include QEMU command with -fsdev and -device virtio-9p-device options
Document mount command: mount -t v9fs -o trans=virtio,tag=share /share
Testing
CI-test, qemu-v7a v9fs mount and ls check if working for review hostfiles.
test result:
ostest_main: Exiting with status 0 nsh> ls -l /share/nuttx -rwxrwxr-x 3367716 /share/nuttx