foxlet / macOS-Simple-KVM

Tools to set up a quick macOS VM in QEMU, accelerated by KVM.
13.55k stars 1.14k forks source link

[Ubuntu 20.04][GPU Passthrough] failed to open /dev/vfio/1 #497

Open ortizman opened 2 years ago

ortizman commented 2 years ago

I followed this repo's guide on GPU passthrouth (https://github.com/foxlet/macOS-Simple-KVM/blob/master/docs/guide-passthrough.md) and I get the following error when I want to run basic.sh

$ ./basic.sh 
qemu-system-x86_64: -device vfio-pci,host=0000:00:02.0,multifunction=on: vfio 0000:00:02.0: failed to open /dev/vfio/1: No such file or directory

In my /etc/default/grub file I have the change

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on iommu=pt pcie_aspm=off vfio_iommu_type1.allow_unsafe_interrupts=1 vfio_pci.disable_vga=1 vfio_pci.disable_idle_d3=1 vfio-pci-ids=8086:9a49,8086:a0c8"

I updated the initramfs without problems (sudo update-initramfs -u -k all)

And I have VT-x enabled in the BIOS

dmesg | grep "IOMMU" gives back to me

[ 0.033906] DMAR: IOMMU enabled
[ 0.069581] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 3
[ 0.505730] pci 0000:00:02.0: DMAR: Skip IOMMU disabling for graphics

lspci -nnv | grep "VGA"

0000:00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:9a49] (rev 01) (prog-if 00 [VGA controller])

lspci -nnv | grep "audio"

0000:00:1f.3 Multimedia audio controller [0401]: Intel Corporation Device [8086:a0c8] (rev 20)
    Kernel driver in use: sof-audio-pci

$ uname -a Linux book1 5.11.0-25-generic #27~20.04.1-Ubuntu SMP Tue Jul 13 17:41:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

My compurator is an ASUS ZenBook with Intel i7 1165g7 (iRIS xe)

I appreciate some help!

busycat commented 2 years ago

Any Update

ghost commented 2 years ago

I know this is a pretty old issue, but can you give me your sudo ls /dev/vfio

busycat commented 2 years ago
bc@com:~$ sudo ls -lart /dev/vfio
total 0
drwxr-xr-x  2 root root      60 Nov  4 14:15 .
crw-rw-rw-  1 root root 10, 196 Nov  4 14:15 vfio
drwxr-xr-x 21 root root    5220 Nov  4 14:15 ..
bc@com:~$ sudo ls -lart /dev/vfio/vfio 
crw-rw-rw- 1 root root 10, 196 Nov  4 14:15 /dev/vfio/vfio
ghost commented 2 years ago

I have NO idea how this project works but wherever /dev/vfio/1 is defined, try replacing it with /dev/vfio/vfio

shubham-vunet commented 2 years ago

I'll check and update.

oryair1 commented 2 years ago

Has anyone solved the problem?

Zarcross-dev commented 2 years ago

We have to change /dev/vfio/1 by /dev/vfio/vfio where (i have the same problem and i tried everything) Is there a file to edit this or something, i don't understand hat are you talking about "try replacing it"

limingchina commented 11 months ago

@ortizman , maybe you can try to run "modprobe vfio-pci" first?