Answer the question
In order to leave comments, you need to log in
How to properly organize VGA-passthrought in qemu-kvm?
I'm trying to set up forwarding a Radeon R7 240 video card to a virtual machine (windows7).
When using ATI Open Source (radeon) I encountered a problem that pci-stub does not block the card and when trying to do:
echo 0000:06:00.0 > /sys/bus/pci/devices/0000\:06\:00.0/driver/unbind
dmesg | grep pci-stub
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.19.0-25-generic root=UUID=0e0cb9d5-fbcf-4a95-88cd-41219cd6c3e2 ro amd_iommu=on max_loop=64 iommu=pt iommu=1 amd_iommu=fullflush pci-stub.ids=1002:6613,1002:aab0 quiet splash modeset=1 vt.handoff=7
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.19.0-25-generic root=UUID=0e0cb9d5-fbcf-4a95-88cd-41219cd6c3e2 ro amd_iommu=on max_loop=64 iommu=pt iommu=1 amd_iommu=fullflush pci-stub.ids=1002:6613,1002:aab0 quiet splash modeset=1 vt.handoff=7
[ 3.761629] pci-stub: add 1002:6613 sub=FFFFFFFF:FFFFFFFF cls=00000000/00000000
[ 3.761645] pci-stub 0000:06:00.0: claimed by stub
[ 3.761652] pci-stub: add 1002:AAB0 sub=FFFFFFFF:FFFFFFFF cls=00000000/00000000
[ 3.761663] pci-stub 0000:06:00.1: claimed by stub
[ 4.902238] pci-stub 0000:06:00.0: enabling device (0000 -> 0003)
qemu-system-x86_64: -device vfio-pci,host=06:00.0: vfio: Error: Failed to setup INTx fd: Device or resource busy
qemu-system-x86_64: -device vfio-pci,host=06:00.0: Device initialization failed.
qemu-system-x86_64: -device vfio-pci,host=06:00.0: Device 'vfio-pci' could not be initialized
dmesg | tail | grep vfio
[ 435.580406] vfio_ecap_init: 0000:06:00.0 hiding ecap [email protected]
[ 435.586186] genirq: Flags mismatch irq 45. 00000080 (vfio-intx(0000:06:00.0)) vs. 00000820 (fglrx[0]@PCI:6:0:0)
lspci -nn | grep Radeon
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Juniper XT [Radeon HD 6770] [1002:68ba]
01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Juniper HDMI Audio [Radeon HD 5700 Series] [1002:aa58]
06:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Oland PRO [Radeon R7 240] [1002:6613]
06:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] [1002:aab0]
dmesg | grep IOMMU
[ 1.246790] AMD-Vi: Found IOMMU at 0000:00:00.2 cap 0x40
[ 4.547794] AMD IOMMUv2 driver by Joerg Roedel <[email protected]>
[ 4.547797] AMD IOMMUv2 functionality not available on this system
[ 4.902081] <6>[fglrx] IOMMU is enabled, CrossFire are not supported on this platform
[ 4.902082] <6>[fglrx] Disable IOMMU in BIOS options or kernel boot parameters to support CF
cat /etc/default/grub
GRUB_CMDLINE_LINUX="amd_iommu=on max_loop=64 iommu=pt iommu=1 amd_iommu=fullflush pci-stub.ids=1002:6613,1002:aab0"
Answer the question
In order to leave comments, you need to log in
After updating the kernel to:
uname -r
4.1.0-040100rc2-generic
cat /etc/modprobe.d/vfio-pci.conf
options vfio-pci ids=1002:6613,1002:aab0
cat /etc/modprobe.d/radeon.conf
softdep radeon pre: vfio vfio_pci
install radeon /sbin/modprobe vfio; /sbin/modprobe vfio_pci
cat /etc/modprobe.d/drm.conf
softdep drm pre: vfio vfio_pci post: radeon
softdep drm_kms_helper pre: vfio vfio_pci post: radeon
install drm /sbin/modprobe vfio; /sbin/modprobe vfio_pci
rm -f /lib/firmware/radeon/OLAND*.bin
update-initramfs -u
init 6
06:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Oland PRO [Radeon R7 240] [1002:6613] (prog-if 00 [VGA controller])
Subsystem: ASUSTeK Computer Inc. Device [1043:04c5]
Flags: bus master, fast devsel, latency 0, IRQ 46
Memory at b0000000 (64-bit, prefetchable) [size=256M]
Memory at fe700000 (64-bit, non-prefetchable) [size=256K]
I/O ports at c000 [size=256]
Expansion ROM at fe740000 [disabled] [size=128K]
Capabilities: <access denied>
Kernel driver in use: vfio-pci
06:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] [1002:aab0]
Subsystem: ASUSTeK Computer Inc. Device [1043:aab0]
Flags: bus master, fast devsel, latency 0, IRQ 21
Memory at fe760000 (64-bit, non-prefetchable) [size=16K]
Capabilities: <access denied>
Kernel driver in use: vfio-pci
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question