QEMU Arm how to passthrough a PCI Card?
Make sure you go through the steps outlined in this section, 13.3.4. PCI Pass-Through, of the docs, titled: Chapter 13. Running Virtual Machines with qemu-kvm.
excerpt
Procedure 13.1. Configuring PCI Pass-Through
-
Make sure that CONFIG_DMAR_DEFAULT_ON is set in the host's running Kernel:
$ grep CONFIG_DMAR_DEFAULT_ON /boot/config-`uname -r`
If this option is not set, edit your boot loader configuration and add intel_iommu=on (Intel machines) or iommu=pt iommu=1 (AMD machines). Then reboot the host machine.
Check that IOMMU is actively enabled and recognized on the host. Run dmesg | grep -e DMAR -e IOMMU on Intel machines, or dmesg | grep AMD-Vi on AMD machines. If you get no output, check carefully if your hardware supports IOMMU (VT-d) and check that it has been enabled in BIOS.
-
Identify the host PCI device to assign to the guest.
tux@vmhost:~> lspci -nn [...] 00:1b.0 Audio device [0403]: Intel Corporation 82801H (ICH8 Family) \ HD Audio Controller [8086:284b] (rev 02) [...] Note down the device (00:1b.0) and vendor (8086:284b) ID.
-
Unbind the device from host Kernel driver and bind it to the PCI stub driver.
tux@vmhost:~> modprobe pci_stub tux@vmhost:~> echo "8086 284b" > /sys/bus/pci/drivers/pci-stub/new_id tux@vmhost:~> echo "0000:00:1b.0" > /sys/bus/pci/devices/0000:00:1b.0/driver/unbind tux@vmhost:~> echo "0000:00:1b.0" > /sys/bus/pci/drivers/pci-stub/bind
-
Now run the VM Guest with the PCI device assigned.
qemu-kvm [...] -device pci-assign,host=00:1b.0
QEMU/KVM ARM support
According to the changelog for version 1.5 & 1.6 ARM is supported in the following ways:
1.5
- This release has initial support of KVM for the ARM architecture. This requires a 3.9 or better Linux kernel and a Cortex-A15 CPU.
- The Zynq board provides a SD host controller interface.
- The PCI controller model for VersatilePB and Realview boards has been significantly improved in functionality (including MMIO BAR support and a correct PCI IRQ mapping). Note that Linux kernels currently do not take advantage of this; however we autodetect kernels that expect the behaviour of an old broken QEMU and fall back to that. (The old IRQ behaviour can be forced with "-global versatile_pci.broken-irq-mapping=1" if absolutely necessary.)
- Incorrect handling of the SRS instruction in Thumb mode has been fixed.
- Performance of TCG emulation of ARM targets is improved over previous releases.
- Migration and vm save/load now works correctly on the vexpress-a15 and vexpress-a9 models.
1.6
- The 32-bit ARMv8 LDA/STL instructions for load-acquire/store-release are supported (only with -cpu any); the remainder of the new v8 instructions will follow in a future release.
- The vexpress-a9 and vexpress-a15 boards have experimental support for virtio devices via a virtio-mmio transport. Note that the virtio command lines used with x86 systems won't work as they will create PCI virtio devices; use the devices "virtio-blk-device", "virtio-net-device", etc instead. Note that this functionality may change in future releases.
- The -initrd option now accepts ramdisks with a U-Boot header.
- A model of the Calxeda ECX-2000 / Midway system is now supported ("midway").
Related videos on Youtube
limovala
Updated on September 18, 2022Comments
-
limovala over 1 year
I'm trying to access a PCI WiFi adapter on a QEMU, simulating vexpress-a9 board.
I'm following is this tutorial which shares a passthrough PCI card of the host machine to a guest machine running on qemu-kvm. But I think its not applicable for qemu-system-arm.
- Is it possible to passthrough PCI using qemu-system-arm for vexpress-a9?
- Is there any way to access a PCI card as a USB device in the guest OS? or a host USB device in the guest OS?
Here's what I'm doing:
$ qemu-system-arm \ -kernel ./zImage \ -M vexpress-a9 \ -cpu cortex-a9 \ -m 1024 \ -smp 2 \ -serial stdio \ -append "root=/dev/mmcblk0p1 rootfstype=ext4 rw raid=noautodetect console=ttyAMA0,38400n8 rootwait devtmpfs.mount=0 vmalloc=256MB mem=1024M" \ -sd ./vexpress-quantal.img