# kernel 4.7.0 breaks pci passthrough [SOLVED]

## Fran

I'm getting these errors since updating the kernel:

qemu-system-x86_64: -device vfio-pci,host=01:00.0,multifunction=on,x-vga=on,romfile=/home/fran/sync/vm/Sapphire.R9270X.2048.131209.rom: Failed to add group 1 to KVM VFIO device: Invalid argument

qemu-system-x86_64: -device vfio-pci,host=00:1b.0: Failed to add group 7 to KVM VFIO device: Invalid argument

Has anyone tried pci passthrough with kernel 4.7.0? Did you have to change anything to make it work?

(edit) Solution below.Last edited by Fran on Sat Aug 20, 2016 6:55 pm; edited 1 time in total

----------

## Myu

Not yet, that's interesting to know, I will give it a try when I get the chance, right now it works fine with 4.6.5

----------

## Myu

It still works for me with 4.7.0 but I'm not passing a UEFI bios ROM for my card like you do so that may be an hint...

----------

## Fran

Crap. Tried with other options and still doesn't work. 

I hope I'm not the only one... don't want to get stuck in 4.6 forever.

----------

## zino

@Fran. Have you by any chance set

```
CONFIG_TRIM_UNUSED_KSYMS=y
```

in you kernel config? If so, try to unset it and recompile your kernel (and reboot, of course). I've just tested this with hardened-sources-4.7.1 and this newly introduced kernel option seems to actually cause the issues you mentioned.

----------

## Buffoon

I think this kernel option is safe only if you have no out of kernel modules.

----------

## Fran

 *zino wrote:*   

> @Fran. Have you by any chance set
> 
> ```
> CONFIG_TRIM_UNUSED_KSYMS=y
> ```
> ...

 

THANK YOU! Setting it to =n makes pci passthrough work again with 4.7.1 (and with 4.8-rc2).

I didn't think it could affect qemu, since kvm is part of the kernel and by the description of the option it looked as if only out-of-kernel modules could be affected (I don't have any so I set it to =y).

----------

