vfio: Add support for platform devices
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest9 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | vfio: Fix fd leak in vfio_group_get_for_dev()vfio/ | +1 | 0 replies | |
| 2/9 | vfio: Factor out wired IRQ setup and teardowninclude/ vfio/ vfio/ | +137 | 0 replies | |
| 3/9 | vfio: Support edge-triggered wired IRQsinclude/ vfio/ vfio/ | +32 | 0 replies | |
| 4/9 | fdt: Allow fdt_irq_fn to generate multiple interruptsarm64/ hw/ hw/ +6 more | +60 | 0 replies | |
| 5/9 | fdt: Add helper to copy an FDT nodeinclude/ | +28 | 0 replies | |
| 6/9 | vfio: Reserve guest address space for VFIO platformarm64/ mips/ powerpc/ +2 more | +15 | 0 replies | |
| 7/9 | vfio: Add basic support for vfio-platformMakefile builtin-run.c include/ +2 more | +187 | 0 replies | |
| 8/9 | vfio: platform: Add interrupts supportinclude/ vfio/ | +119 | 0 replies | |
| 9/9 | vfio: platform: Take the guest node from a device tree templatebuiltin-run.c include/ vfio/ +1 more | +68 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH kvmtool 0/9] vfio: Add support for platform devices
This patch series extend VFIO support to platform devices by using VFIO-platform.
One of the main difference is how the guest discover the device, which is done through the device tree.
kvmtool can only describe:
- regs
- interrupts
However, the guest still needs a compatible string and other per device bindings.
To avoid having any hardcoded DT nodes in the source code, kvmtool will accept a dtb argument with each assigned device that will be copied to the guest node.
Patches
=======
1-4: Fixes, code refactoring and improving interrupt support. 5: DT common function.
6-8: VFIO-platform support.
9: Custom device tree support.
Patch 2 is better viewed with --color-moved
Testing
=======
Tested on Lenovo Mini-x Gen 10 (Snapdragon-X) by assigning 2 devices, QCE and BAM as follows:
echo 1dfa000.crypto > /sys/bus/platform/drivers/qcrypto/unbind echo 1dc4000.dma-controller > /sys/bus/platform/drivers/bam-dma-engine/unbind
echo "vfio-platform" > /sys/bus/platform/devices/1dfa000.crypto/driver_override echo "vfio-platform" > /sys/bus/platform/devices/1dc4000.dma-controller/driver_override
echo 1dc4000.dma-controller > /sys/bus/platform/drivers/vfio-platform/bind echo 1dfa000.crypto > /sys/bus/platform/drivers/vfio-platform/bind
./lkvm-static run --irqchip gicv3 -k Image -p "nokaslr" -d rootfs.ext2 --force-pci -c 1 --debug --vfio- platform 1dc4000.dma-controller,purwa-cryptobam.dtb --vfio-platform 1dfa000.crypto,purwa-qce.dtb
There are some fixes on the list that are needed to be able to unbind the bam device [1]
Mostafa Saleh (9):
vfio: Fix fd leak in vfio_group_get_for_dev()
vfio: Factor out wired IRQ setup and teardown
vfio: Support edge-triggered wired IRQs
fdt: Allow fdt_irq_fn to generate multiple interrupts
fdt: Add helper to copy an FDT node
vfio: Reserve guest address space for VFIO platform
vfio: Add basic support for vfio-platform
vfio: platform: Add interrupts support
vfio: platform: Take the guest node from a device tree template
Makefile | 1 + arm64/fdt.c | 36 ++-- arm64/include/kvm/kvm-arch.h | 10 +- builtin-run.c | 3 + hw/cfi_flash.c | 4 +- hw/rtc.c | 4 +- hw/serial.c | 3 +- include/kvm/fdt.h | 32 +++- include/kvm/vfio.h | 41 ++++- mips/include/kvm/kvm-arch.h | 2 + powerpc/include/kvm/kvm-arch.h | 2 + riscv/fdt.c | 2 +- riscv/include/kvm/kvm-arch.h | 7 +- riscv/irq.c | 27 ++- vfio/core.c | 152 +++++++++++++++- vfio/pci.c | 111 +----------- vfio/platform.c | 317 +++++++++++++++++++++++++++++++++ virtio/mmio.c | 10 +- x86/include/kvm/kvm-arch.h | 2 + 19 files changed, 619 insertions(+), 147 deletions(-) create mode 100644 vfio/platform.c
Signature · 1 line
2.56.0.307.g5fe7bd680c-goog