I have tried to setup a Virtual Machine in qemu to install Windows 10
I have successed to launch the virtual machine, to install Windows 10 and to connect it from a remote SPICE client
But I have successed only without VGA Passthrough !!!
Once I try to give the virtual machine a graphic card it's not possible to access the machine with SPICE client and the process is completly blocked !
I can't even kill the qemu process with a kill -9 PID of [qemu process]
The hardware is new and I have tried to follow a lot of guide but none gave me the solution
---------------------------------------------------------------------------------------
--- Here is my hardware setup : ---
Gigabyte TRX40 Designare
AMD Threadripper 3960x
AMD Radeon RX480
This computer is attached to the network and I don't plan to use it as a desktop with screen
I have an other one from where I connect to the virtual machine with SPICE client. (SPICE client is really fast !)
---------------------------------------------------------------------------------------
What I have done :
I have installed Debian Buster with a ssh server and nothing more
I have installed qemu and KVM
I have successed to install Windows 10 with a remote SPICE client and I can start and stop the virtual machine without any problem when I use this command
- Code: Select all
qemu-system-x86_64 -name windows10_vm -uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -k fr-ch -machine type=pc-i440fx-3.1,accel=kvm -cpu host -smp 8,sockets=1,cores=8,threads=1 -m 16G -rtc clock=host,base=localtime -serial none -parallel none -soundhw hda -usb -device usb-tablet -boot order=dc -drive id=disk0,if=virtio,cache=none,format=raw,file=/dev/disk -drive file=/directory/ISO/Win10x64.iso,index=1,media=cdrom -drive file=/directory/virtio-win-0.1.171.iso,index=2,media=cdrom -spice port="5900",addr="0.0.0.0",disable-ticketing -vga qxl
---------------------------------------------------------------------------------------
After that I decided to try to enable VGA Passthrough
I have done the following :
-> enabled IOMMU in the BIOS
-> then search the id of the graphical card
- Code: Select all
root@nightmare # lspci -v
...
21:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480] (rev c7) (prog-if 00 [VGA controller])
21:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590]
...
there is nothing more in this IOMMU group so as what I have understood it's ok if I'm not wrong ?
then create a file to enable vfio module for the graphical card
- Code: Select all
root@nightmare # cat /etc/modprobe.d/vfio.conf
options vfio-pci ids=1002:67df,1002:aaf0
options vfio-pci disable_vga=1
then create a file to blacklist amdgpu
- Code: Select all
root@nightmare # cat /etc/modprobe.d/blacklist.conf
blacklist amdgpu
and after that add parameters to the /etc/default/grub.conf
first parameters enable IOMMU and second to disable the EFI/VESA framebuffer
- Code: Select all
root@nightmare # cat /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on video=vesafb:off,efifb:off"
---------------------------------------------------------------------------------------
So I thought it was ok to start the virtual machine and the VGA passthrough will work but no...
I tried to start the virtual with the new command line with this :
- Code: Select all
qemu-system-x86_64 -name windows10_vm -uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -k fr-ch -machine type=pc-i440fx-3.1,accel=kvm -cpu host -smp 8,sockets=1,cores=8,threads=1 -m 16G -rtc clock=host,base=localtime -serial none -parallel none -soundhw hda -usb -device usb-tablet -boot order=dc -drive id=disk0,if=virtio,cache=none,format=raw,file=/dev/disk -drive file=/directory/ISO/Win10_2004_French_x64.iso,index=1,media=cdrom -drive file=/directory/virtio-win-0.1.171.iso,index=2,media=cdrom -spice port="5900",addr="0.0.0.0",disable-ticketing -vga qxl -device vfio-pci,host=21:00.0,multifunction=on -device vfio-pci,host=21:00.1
And I get a return error as this one from qemu
- Code: Select all
qemu-system-x86_64: -device vfio-pci,host=21:00.0,multifunction=on: vfio 0000:21:00.0: failed to setup container for group 24: failed to set iommu for container: Operation not permitted
I searched what it was about and I found that there is a problem about "unsafe_interrupts" to allow VGA passthrough
- Code: Select all
root@nightmare # dmesg | grep 'remapping'
AMD-Vi: Disabling interrupt remapping
vfio_iommu_type1_attach_group: No interrupt remapping support. Use the module param "allow_unsafe_interrupts" to enable VFIO IOMMU support on this platform
So I should add an other parameter to /etc/default/grub
- Code: Select all
root@nightmare # cat /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet amd_iommu=on video=vesafb:off,efifb:off vfio_iommu_type1.allow_unsafe_interrupts=1"
But after that I still have this message with dmesg | grep remapping
- Code: Select all
AMD-Vi: Disabling interrupt remapping
Why does this not work ?
I have followed a lot of guide but there is nothing more about this problem... it should work but no ???
What shall I do then ?