# Qemu/Libvirt: host doesn't support passthrough of pci

## musv

Hi there, 

in order to root my new tablet I got the idea to get the needed modules by starting a virtual machine. 

For that reason I wanted to pass the USB controller to the guest. My computer is a Dell T5500 workstation, which supports vm-x. It's enabled in the BIOS and compiled into the kernel. Moreover I put intel_iommu=y to the Grub parameters. 

```
[    0.000000] Command line: BOOT_IMAGE=/boot/bzImage-472 root=/dev/sda3 ro CONSOLE=/dev/tty1 acpi_enforce_resources=lax snd-virtuoso.index=0 snd-hda-intel.index=1 init=/usr/lib/systemd/systemd rootfstype=btrfs vga=791 intel_iommu=on

[    0.000000] Kernel command line: BOOT_IMAGE=/boot/bzImage-472 root=/dev/sda3 ro CONSOLE=/dev/tty1 acpi_enforce_resources=lax snd-virtuoso.index=0 snd-hda-intel.index=1 init=/usr/lib/systemd/systemd rootfstype=btrfs vga=791 intel_iommu=on

[    0.000000] DMAR: IOMMU enabled

[    0.079783] DMAR-IR: IOAPIC id 10 under DRHD base  0xdfffe000 IOMMU 0

[    0.079788] DMAR-IR: IOAPIC id 9 under DRHD base  0xfedc0000 IOMMU 1

[    0.079792] DMAR-IR: IOAPIC id 8 under DRHD base  0xfedc0000 IOMMU 1

[    1.328055] iommu: Adding device 0000:00:00.0 to group 0

[    1.328071] iommu: Adding device 0000:00:01.0 to group 1

[    1.328085] iommu: Adding device 0000:00:03.0 to group 2

[    1.328099] iommu: Adding device 0000:00:07.0 to group 3

[    1.328133] iommu: Adding device 0000:00:14.0 to group 4

[    1.328147] iommu: Adding device 0000:00:14.1 to group 4

[    1.328161] iommu: Adding device 0000:00:14.2 to group 4

[    1.328197] iommu: Adding device 0000:00:1a.0 to group 5

[    1.328211] iommu: Adding device 0000:00:1a.1 to group 5

[    1.328224] iommu: Adding device 0000:00:1a.2 to group 5

[    1.328238] iommu: Adding device 0000:00:1a.7 to group 5

[    1.328253] iommu: Adding device 0000:00:1b.0 to group 6

[    1.328281] iommu: Adding device 0000:00:1c.0 to group 7

[    1.328298] iommu: Adding device 0000:00:1c.5 to group 7

[    1.328333] iommu: Adding device 0000:00:1d.0 to group 8

[    1.328348] iommu: Adding device 0000:00:1d.1 to group 8

[    1.328362] iommu: Adding device 0000:00:1d.2 to group 8

[    1.328376] iommu: Adding device 0000:00:1d.7 to group 8

[    1.328391] iommu: Adding device 0000:00:1e.0 to group 9

[    1.328421] iommu: Adding device 0000:00:1f.0 to group 10

[    1.328436] iommu: Adding device 0000:00:1f.2 to group 10

[    1.328451] iommu: Adding device 0000:00:1f.3 to group 10

[    1.328467] iommu: Adding device 0000:01:00.0 to group 11

[    1.328484] iommu: Adding device 0000:03:00.0 to group 12

[    1.328493] iommu: Adding device 0000:06:00.0 to group 7

[    1.328501] iommu: Adding device 0000:07:04.0 to group 9

[    1.328515] iommu: Adding device 0000:20:07.0 to group 13

[    1.328530] iommu: Adding device 0000:20:09.0 to group 14

[    1.328562] iommu: Adding device 0000:20:14.0 to group 15

[    1.328579] iommu: Adding device 0000:20:14.1 to group 15

[    1.328595] iommu: Adding device 0000:20:14.2 to group 15

[    1.328620] iommu: Adding device 0000:3f:00.0 to group 16

[    1.328637] iommu: Adding device 0000:3f:00.1 to group 16

[    1.328683] iommu: Adding device 0000:3f:02.0 to group 17

[    1.328699] iommu: Adding device 0000:3f:02.1 to group 17

[    1.328716] iommu: Adding device 0000:3f:02.2 to group 17

[    1.328732] iommu: Adding device 0000:3f:02.3 to group 17

[    1.328747] iommu: Adding device 0000:3f:02.4 to group 17

[    1.328763] iommu: Adding device 0000:3f:02.5 to group 17

[    1.328800] iommu: Adding device 0000:3f:03.0 to group 18

[    1.328817] iommu: Adding device 0000:3f:03.1 to group 18

[    1.328834] iommu: Adding device 0000:3f:03.2 to group 18

[    1.328850] iommu: Adding device 0000:3f:03.4 to group 18

[    1.328886] iommu: Adding device 0000:3f:04.0 to group 19

[    1.328903] iommu: Adding device 0000:3f:04.1 to group 19

[    1.328920] iommu: Adding device 0000:3f:04.2 to group 19

[    1.328937] iommu: Adding device 0000:3f:04.3 to group 19

[    1.328973] iommu: Adding device 0000:3f:05.0 to group 20

[    1.328991] iommu: Adding device 0000:3f:05.1 to group 20

[    1.329008] iommu: Adding device 0000:3f:05.2 to group 20

[    1.329025] iommu: Adding device 0000:3f:05.3 to group 20

[    1.329074] iommu: Adding device 0000:3f:06.0 to group 21

[    1.329093] iommu: Adding device 0000:3f:06.1 to group 21

[    1.329110] iommu: Adding device 0000:3f:06.2 to group 21

[    1.329128] iommu: Adding device 0000:3f:06.3 to group 21
```

0000:00:1a.7 is the USB controller I wanted to pass to the guest machine. In Virtmanager I can add the device to the guest configuration. But when I try to start the vm I get:

```
  if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)

libvirtError: Unsupported configuration: host doesn't support passthrough of host PCI devices
```

What's wrong here? Do I have to add a useflag to enable the pci passthrough?

```
[U] app-emulation/qemu

...

     Installierte Versionen: 2.6.0(22:41:52 25.08.2016)(aio alsa bzip2 caps curl fdt filecaps gnutls gtk jpeg kernel_linux lzo ncurses nfs nls opengl pin-upstream-blobs png pulseaudio python python_targets_python2_7 qemu_softmmu_targets_arm qemu_softmmu_targets_x86_64 qemu_user_targets_arm sdl seccomp spice ssh static-user threads usb usbredir uuid vhost-net vnc xattr xfs
```

```
[U] app-emulation/libvirt

...

Installierte Versionen: 2.1.0-r1(0/2.1.0)(22:52:15 21.08.2016)(caps elibc_glibc libvirtd macvtap nfs nls parted pcap policykit qemu udev vepa virt-network
```

----------

## deagol

I got VT-d working in the past with Gentoo and libvirt, but riped out the support for that quite some time ago and can't show you my config now... I would say first make sure that the PCI device is really unused after boot and bound to the stup driver. Could be libvirt is managin that somewow, but I think I had a boot varible for that...

It also may be tricky for libvirt to unbind one device from the usb driver, I don't know a obvious way to do that without unloading the driver first.

When I set it up the best docu was from Xen, but nowadays this seems to cover the needed steps well:

http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM

Chances are you can find out what's wrong when following guide above.

Good luck!

----------

## zino

Check out this blog post by Alex Williamson first:

http://vfio.blogspot.nl/2016/09/intel-iommu-enabled-it-doesnt-mean-what.html

Does the Dell T5500 feature  an Intel 55x0 chipset? If yes, you might get things working by allowing unsafe interrupts:

```
# echo Y > /sys/module/vfio_iommu_type1/parameters/allow_unsafe_interrupts
```

But be sure to understand the security implications of doing so. It's called "unsafe" for a reason. (Have a look at Question 8 in https://vfio.blogspot.ch/2014/08/vfiovga-faq.html for a quick explanation.)

----------

