Gpu passthrough not working on ubuntu 18.04

I am going based off of Ubuntu 17.04 -- VFIO PCIe Passthrough & Kernel Update (4.14-rc1) to get my amd card to show up using vfio but instead it is using the radeon driver
also my iommucheck script is showing up with the correct output

02:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Curacao PRO [Radeon R7 370 / R9 270/370 OEM] [1002:6811] (prog-if 00 [VGA controller])
Subsystem: ASUSTeK Computer Inc. Curacao PRO [Radeon R7 370 / R9 270/370 OEM] [1043:048d]
Flags: bus master, fast devsel, latency 0, IRQ 52, NUMA node 0
Memory at c0000000 (64-bit, prefetchable) [size=256M]
Memory at fe500000 (64-bit, non-prefetchable) [size=256K]
I/O ports at d000 [size=256]
Expansion ROM at fe540000 [disabled] [size=128K]
Capabilities:
Kernel driver in use: radeon
Kernel modules: radeon, amdgpu
IOMMU Group 17 02:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Curacao PRO [Radeon R7 370 / R9 270/370 OEM] [1002:6811]
IOMMU Group 17 02:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] [1002:aab0]

Is there something I am missing?

The contents of the files below would help in diagnosis.
/etc/modprobe.d/vfio_pci.conf
/etc/modprobe.d/amdgpu.conf
/etc/modules
/etc/initramfs-tools/modules
the line- GRUB_CMDLINE_LINUX_DEFAULT= in /etc/default/grub

Also, have you updated your initramfs for all kernels and rebooted? Anytime you do something with modules/modprobe config you should update initramfs.

/etc/modprobe.d/vfio_pci.conf
options vfio_pci ids=1002:6811,1002:aab0

/etc/modprobe.d/amdgpu.conf
softdep amdgpu pre: vfio vfio_pci

/etc/modules
vfio
vfio_iommu_type1
vfio_pci ids=1002:6811,1002:aab0

/etc/initramfs-tools/modules
softdep amdgpu pre: vfio vfio_pci
vfio
vfio_iommu_type1
vfio_virqfd
options vfio_pci ids=1002:6811,1002:aab0
vfio_pci ids=1002:6811,1002:aab0
vfio_pci
amdgpu

/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash amd_iommu=on”

I had to manually add the vfio and vfio-pci drivers to my initrd then manually rebuild my initrd but I have set this up in the last few days and it worked fine.

how do I do that?

do lsinitrd to see whats on there first

if not do update-initramfs -u
because it looks like you have the right things listed in initramfs-tools/modules

so curious whats going on there.

I keep getting this as the output
sudo lsinitrd
No specified and the default image ‘/boot/initramfs-4.15.0-22-generic.img’ cannot be accessed!

also just an update, my audio is now using vfio-pci but not my video

any other ideas?

So after initramfs update and reboot, the gpu video is still showing kernel driver radeon? And the GPU audio is showing vfio?

That is correct

Um, as the pci id’s look correct, it could be that radeon still is loading before vfio.

Aren’t radeon and amdgpu different drivers/modules? If so, your gpu is using Radeon and you have amdgpu as your softdep after vfio. So maybe also softdep Radeon and update initramfs and reboot? All of my newer cards are Nvidia(mining… sigh) so I don’t know the specifics of amd drivers.

If still does not work you could try blacklisting radeon/amdgpu if your host gpu is using a different driver(ie a nvidia or intel chip).

1 Like

that did it :slight_smile: THANKS

/etc/modprobe.d/radeon.conf
softdep radeon pre: vfio vfio_pci

/etc/initramfs-tools/modules
softdep radeon pre: vfio vfio_pci
vfio
vfio_iommu_type1
vfio_virqfd
options vfio_pci ids=1002:6811,1002:aab0
vfio_pci ids=1002:6811,1002:aab0
vfio_pci
radeon