HOW-TO make dual-boot obsolete using kvm VGA passthrough

Questions about virtualization software
Forum rules
Before you post please read how to get help
powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Tue Aug 21, 2018 4:42 pm

I made some updates to my tutorial and added instructions to run the Windows VM in user mode, that is as non-root user.
See: https://heiko-sieger.info/running-windo ... e_non-root

It seems rather trivial now with Linux Mint 19. Obviously Ubuntu (and perhaps Linux Mint) have worked hard to better integrate qemu/kvm into the distribution. There seem to be no permission issues, as far as I can see. Please let me know if you tried it and it worked / didn't work.
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Thu Aug 30, 2018 12:56 pm

I added a new tutorial for Installing a Linux Mint 19 (Ubuntu 18.04) VM with VGA Passthrough , as well as a post arguing in favor of a Linux Virtual Gaming Machine.

Once you installed Windows as a virtual machine with VGA passthrough, it's easy to create a Linux VM that can use the same graphics card you use for your Windows VM (of course, not while Windows is running!).

This should even further help migrate from Windows to Linux.

The nice thing is that I can experiment with the Linux gaming VM all the while my host system stays untouched and untainted by wine etc.

If you follow my tutorial, add the

Code: Select all

runas=<username> \
beneath the qemu... command to run the Linux VM in unprivileged mode. (<username> must first be added to the groups kvm and perhaps libvirt before this works.)
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

driz
Level 1
Level 1
Posts: 24
Joined: Mon May 12, 2014 3:38 pm

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by driz » Sun Sep 02, 2018 7:46 pm

hey all, been a while since I've posted, but today I built a new system for my parents. They needed two work stations and were about to buy a laptop. I ended up building them a system (very similar to my girls') for about 500$. Everything was going perfect, but I couldn't get the windows iso to boot and had never encountered this issue before. I came back here to discuss it and found you have a new blog @powerhouse, i ran through it and you had the exact solution. I was lazy and just rsynced my ovmf stuff over to their system, i read https://heiko-sieger.info/running-windo ... ont_boot_2 and this fixed it perfectly.

as usual, thanks for your efforts!

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Mon Sep 03, 2018 5:21 pm

driz wrote:
Sun Sep 02, 2018 7:46 pm
hey all, been a while since I've posted, but today I built a new system for my parents. They needed two work stations and were about to buy a laptop. I ended up building them a system (very similar to my girls') for about 500$. Everything was going perfect, but I couldn't get the windows iso to boot and had never encountered this issue before. I came back here to discuss it and found you have a new blog @powerhouse, i ran through it and you had the exact solution. I was lazy and just rsynced my ovmf stuff over to their system, i read https://heiko-sieger.info/running-windo ... ont_boot_2 and this fixed it perfectly.

as usual, thanks for your efforts!
That's good news! I'm glad my website remains useful. How are the girls getting along with their virtual Windows PCs?
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

driz
Level 1
Level 1
Posts: 24
Joined: Mon May 12, 2014 3:38 pm

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by driz » Sun Sep 16, 2018 10:53 pm

powerhouse wrote:
Mon Sep 03, 2018 5:21 pm
That's good news! I'm glad my website remains useful. How are the girls getting along with their virtual Windows PCs?
Still running great! I keep trying to think of things to beef it up, but until they get into better games, it's just perfect man. I do wish everything could be put to sleep, but we can't have it all :D

mint_user1234
Level 1
Level 1
Posts: 3
Joined: Sun Sep 02, 2018 2:10 pm

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by mint_user1234 » Wed Sep 19, 2018 4:23 pm

Can someone help me?
I am having Problem isolating the GPU. I tried
viewtopic.php?f=231&t=212692&start=40#p1173262
https://pastebin.com/WSmrFtpL
and the one from Archwiki.

but it does not work:

dmesg | grep -i vfio
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-20-generic root=UUID=ad7ad043-8c9e-4133-b8f1-64807ba4546f ro iommu=1 amd_iommu=on rd.driver.pre=vfio-pci quiet splash vt.handoff=1
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-20-generic root=UUID=ad7ad043-8c9e-4133-b8f1-64807ba4546f ro iommu=1 amd_iommu=on rd.driver.pre=vfio-pci quiet splash vt.handoff=1

lspci:

07:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM206 [GeForce GTX 960] [10de:1401] (rev a1)
Subsystem: Micro-Star International Co., Ltd. [MSI] GM206 [GeForce GTX 960] [1462:3205]
Kernel driver in use: nouveau

What am I doing wrong? :/



I think my GPU does not support UEFI:

sudo ./rom-parser /tmp/image.rom
Valid ROM signature found @0h, PCIR offset 1a0h
PCIR: type 0 (x86 PC-AT), vendor: 10de, device: 1401, class: 030000
PCIR: revision 0, vendor revision: 1
Valid ROM signature found @e400h, PCIR offset 77ddh
Speicherzugriffsfehler

Do I need to flash the GPU-BIOS? The Isolation should work despite this, right?

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Thu Sep 20, 2018 4:58 pm

mint_user1234 wrote:
Wed Sep 19, 2018 4:23 pm
Can someone help me?
I am having Problem isolating the GPU. I tried
viewtopic.php?f=231&t=212692&start=40#p1173262
https://pastebin.com/WSmrFtpL
and the one from Archwiki.

but it does not work:

dmesg | grep -i vfio
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-20-generic root=UUID=ad7ad043-8c9e-4133-b8f1-64807ba4546f ro iommu=1 amd_iommu=on rd.driver.pre=vfio-pci quiet splash vt.handoff=1
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-20-generic root=UUID=ad7ad043-8c9e-4133-b8f1-64807ba4546f ro iommu=1 amd_iommu=on rd.driver.pre=vfio-pci quiet splash vt.handoff=1

lspci:

07:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM206 [GeForce GTX 960] [10de:1401] (rev a1)
Subsystem: Micro-Star International Co., Ltd. [MSI] GM206 [GeForce GTX 960] [1462:3205]
Kernel driver in use: nouveau

What am I doing wrong? :/



I think my GPU does not support UEFI:

sudo ./rom-parser /tmp/image.rom
Valid ROM signature found @0h, PCIR offset 1a0h
PCIR: type 0 (x86 PC-AT), vendor: 10de, device: 1401, class: 030000
PCIR: revision 0, vendor revision: 1
Valid ROM signature found @e400h, PCIR offset 77ddh
Speicherzugriffsfehler

Do I need to flash the GPU-BIOS? The Isolation should work despite this, right?
Let me get this right: Do you have 2 identical GPU (2x GTX 960)?

If not, just follow the regular guide here: https://heiko-sieger.info/running-windo ... assthrough.

This tutorial uses UEFI passthrough. Check https://www.techpowerup.com/vgabios/ to see if your card has an UEFI BIOS. Also see my tutorial to check for the current BIOS used in the GPU.

You may find an UEFI BIOS for your card under the above link.

If your card doesn't support UEFI and there is no UEFI BIOS, you can still make it work using Seabios. The differences to my tutorial are relatively minor. However, there are disadvantages to using the Seabios approach.
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Mon Oct 29, 2018 7:48 am

I've added a short tutorial for running a Linux VM with VGA passthrough here: viewtopic.php?f=231&t=280540.

If, like me, you use the more powerful GPU for your Windows guest, installing a Linux VM with passthrough allows you to run demanding Linux games with your dedicated gaming GPU. It's real neat.

I also use the Linux VM to test new software or settings.
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Wed Dec 12, 2018 6:53 pm

I've updated and fixed my tutorial. Note the following changes to the qemu script:

Code: Select all

-usb \
-device usb-host,vendorid=0x045e,productid=0x076c \
-device usb-host,vendorid=0x045e,productid=0x0750 \
-usb enables USB support and -device usb-host… assigns the USB host devices mouse (045e:076c) and keyboard (045e:0750) to the guest. Replace the device IDs with the ones you found using the lsusb command in Part 3 above!
Note the new syntax. There are also many more options that you can find here: file:///usr/share/doc/qemu-system-common/qemu-doc.html.

There are three options to assign host devices to guests. Here the syntax:

Code: Select all

-usb \
-device usb-kbd \
-device usb-mouse \
passes through the keyboard and mouse to the VM. When using this option, remove the -vga none and -nographic options from the script to enable switching back and forth between Windows VM and Linux host using CTRL+ALT.

Code: Select all

-usb \
-device usb-host,hostbus=bus,hostaddr=addr \
passes through the host device identified by bus and addr.

-

Code: Select all

usb \
-device usb-host,vendorid=vendor,productid=product \
passes through the host device identified by vendor and product ID.

Please let me know how it works.

I've also written a post on SSD/HDD drive performance tuning. See the new Qemu drive options here: Tuning VM Disk Performance.
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Thu Dec 27, 2018 9:14 am

I made some important updates to my tutorial. Again and again users reported that they get a black screen when the Windows VM boots. This seems to be a common issue with the new Ryzen low and midrange boards. It also happens when you try to pass through the primary graphics card (the one used by the host).

It has to do with the system creating a shadow BIOS of the GPU you want to pass through, and handing that shadow BIOS to the VM. Unfortunately the shadow BIOS is not a 1:1 copy of the original BIOS, so the guest cannot boot with it. The solution is either to prevent the system from initializing the passthrough GPU at host boot. Or to return the passthrough CPU to its "virgin" state by booting the guest with the original BIOS using the romfile=/path/to/GPU_BIOS.dump option.

How to dump the GPU BIOS into a file and then load it via the VM start script is described here: https://heiko-sieger.info/running-windo ... assthrough.
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

Gebonimo
Level 1
Level 1
Posts: 33
Joined: Tue Dec 04, 2018 8:08 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by Gebonimo » Thu Jan 03, 2019 2:56 pm

I'm having problem. The Win10.iso is not detected by your script.

I've change this line in my script

Code: Select all

-drive file=/home/gebo/Documents/vm/win10.iso , index=1, media=cdrom \
and it's says "No bootable device found" and
Boot failed: Could not read from CD ROM (code 0003)
But when i do the

Code: Select all

qemu-system-x86_64 -cdrom /home/gebo/Documents/vm/win10.iso
command, the CD is starting.

What should I change in your script ?

I've search around for the "-driver" part but find nothing helpful.

Thanks.

EDIT : Also, the terminal returns the line
./vm.sh: ligne 23: -smp : commande introuvable
after executing your script.
Linux Mint 19

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Fri Jan 04, 2019 4:51 pm

1. You can also use the -cdrom option.
2. Remove the spaces on your -drive ..., ..., line like:

Code: Select all

-drive file=/home/gebo/Documents/vm/win10.iso,index=1,media=cdrom \
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

Gebonimo
Level 1
Level 1
Posts: 33
Joined: Tue Dec 04, 2018 8:08 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by Gebonimo » Sat Jan 05, 2019 4:39 pm

OK thanks I did and it's working fine. I can install W10.

BUt as soon as I try to install my AMD Radeon R9 270X/370 driver I have BSOD. I'm searching on the internet a solution since I've tried you fix.

Thanks dude

EDIT : I was wondering also, how can i make snapshot of my vm using you script ?

Thanks
Linux Mint 19

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Mon Jan 07, 2019 7:07 am

@Gebonima:

By "tried your fix", do you mean https://heiko-sieger.info/running-windo ... er_Windows?

Did you run all the tests prior to running the script? Are your IOMMU groups good?

If your passthrough GPU is in PCIe slot 1, some motherboards may initialize that GPU at boot as primary VGA. In this case, you can either swap the GPUs - put your passthrough GPU in slot 2 and the host GPU in slot 1 - or follow the instructions here: https://heiko-sieger.info/running-windo ... assthrough.

When you run the script, do you see any errors? Also, please post your script (only the qemu... part).

Good luck!

Heiko
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

Gebonimo
Level 1
Level 1
Posts: 33
Joined: Tue Dec 04, 2018 8:08 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by Gebonimo » Mon Jan 07, 2019 1:31 pm

powerhouse wrote:
Mon Jan 07, 2019 7:07 am
@Gebonima:

By "tried your fix", do you mean https://heiko-sieger.info/running-windo ... er_Windows?

Did you run all the tests prior to running the script? Are your IOMMU groups good?

If your passthrough GPU is in PCIe slot 1, some motherboards may initialize that GPU at boot as primary VGA. In this case, you can either swap the GPUs - put your passthrough GPU in slot 2 and the host GPU in slot 1 - or follow the instructions here: https://heiko-sieger.info/running-windo ... assthrough.

When you run the script, do you see any errors? Also, please post your script (only the qemu... part).

Good luck!

Heiko
@powerhouse

Hi thanks for you answer.

Here is my script :

Code: Select all

qemu-system-x86_64 \
-name $vmname,process=$vmname \
-machine type=pc,accel=kvm \
-cpu host \
-smp 4,sockets=1,cores=2,threads=2 \
-m 8G \
-balloon none \
-rtc clock=host,base=localtime \
-serial none \
-parallel none \
-soundhw hda \
-usb \
-device usb-kbd \
-device usb-mouse \
-device ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on \
-device vfio-pci,host=01:00.1,bus=root.1,addr=00.1 \
-drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=/tmp/my_vars.fd \
-boot order=dc \
-drive file=/home/gebo/Documents/vm/win10.iso,index=1,media=cdrom \
-drive id=disk0,if=virtio,cache=none,format=raw,file=/media/gebo/win10.img \
-netdev type=tap,id=net0,ifname=vmtap0,vhost=on \
-device virtio-net-pci,netdev=net0,mac=00:16:3e:00:01:01
exit 0
fi
I have to mention that I have only one GPU, so it's on the PCI1 slot on my motherboard.

Here are all the results of the checking config

Code: Select all

gebo@gebo-H87-HD3:~$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
gebo@gebo-H87-HD3:~$ lsmod | grep kvm 
kvm_intel             212992  0
kvmgt                  28672  0
mdev                   24576  2 kvmgt,vfio_mdev
vfio                   32768  4 kvmgt,vfio_mdev,vfio_iommu_type1,vfio_pci
kvm                   630784  2 kvmgt,kvm_intel
irqbypass              16384  2 vfio_pci,kvm
gebo@gebo-H87-HD3:~$ lsmod | grep vfio
vfio_pci               49152  0
vfio_virqfd            16384  1 vfio_pci
vfio_mdev              16384  0
mdev                   24576  2 kvmgt,vfio_mdev
vfio_iommu_type1       28672  0
vfio                   32768  4 kvmgt,vfio_mdev,vfio_iommu_type1,vfio_pci
irqbypass              16384  2 vfio_pci,kvm
gebo@gebo-H87-HD3:~$ qemu-system-x86_64 --version
QEMU emulator version 2.11.1(Debian 1:2.11+dfsg-1ubuntu7.9)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
gebo@gebo-H87-HD3:~$ lspci -kn | grep -A 2 01:00
01:00.0 0300: 1002:6810
	Subsystem: 174b:e271
	Kernel driver in use: vfio-pci
--
01:00.1 0403: 1002:aab0
	Subsystem: 174b:aab0
	Kernel driver in use: vfio-pci
gebo@gebo-H87-HD3:~$ dmesg | grep VFIO
[    1.399747] VFIO - User Level meta-driver version: 0.3
So here everything is fine.

I just realised that I have one more device in my IOMMU group :

Code: Select all

/sys/kernel/iommu_groups/1/devices/0000:00:01.0
/sys/kernel/iommu_groups/1/devices/0000:01:00.0
/sys/kernel/iommu_groups/1/devices/0000:01:00.1
My GPU is 0000:01:00.x
I'll follow your guide to solve this but it might comes from here no ? That's the only thing that is not correct imo.
This is th device in IOMMU group

Code: Select all

lspci -s 00:01.0
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06)
  
Thanks dude.

EDIT : I've changed the slot so now it's ok I have my GPU in its own IOMMU group but still when I'm booting my VM it's the default graphic card loaded. And always when I try to disable it, it freeze my VM, just like I need to plug the GPU physically into the screen.
Linux Mint 19

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Tue Jan 08, 2019 4:57 pm

@Gebonimo:
I have to mention that I have only one GPU, so it's on the PCI1 slot on my motherboard.
My tutorial and script is for 2 GPU - one for the host (Linux), the other for the VM.

Obviously when you boot the host, you have a working display, which means your GPU is initialized by Linux. If you want to pass it to the VM, you need to reset it and bind it to the vfio-pci driver.

The good news is that there is a script and instructions that can handle single GPU setups - I have linked to it under References, here is the direct link: https://gitlab.com/YuriAlek/vfio/wikis/Use/#windows.

Please be aware that the instructions given there are for Arch Linux. You should be fine with what you installed when you followed my tutorial. Please bear in mind that Yuri's script and wiki is still a work in progress. You will have to add the variables.

You will also need a copy of your vBIOS. Here is an excellent video on how to obtain it and fix it for KVM: https://www.youtube.com/watch?v=1IP-h9IKof0.

The simplest thing you can do: install a low-cost (perhaps an old/spare) graphics card for your host. Linux will work fine with it.

I you need a powerful GPU for Linux, for example for gaming under Linux, read my post Linux Virtual Gaming Machine.

I hope this helps.
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

Gebonimo
Level 1
Level 1
Posts: 33
Joined: Tue Dec 04, 2018 8:08 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by Gebonimo » Wed Jan 09, 2019 8:10 am

When I mean I have only one GPu it's besides my motherboard Graphic Card.

I've change the AMD GPU to the "Crossfire" Slot to let it have its own IOMMU groupe (now it's 5:00.0/1)

Actually my linux distro is booting on the Intel Graphic Card (set up in BIOS). So my AMG GPU is not in use when I'm launching the VM. As you can see here :

Code: Select all

gebo@gebo-H87-HD3:~$ lspci -kn | grep -A 2 05:00
05:00.0 0300: 1002:6810
	Subsystem: 174b:e271
	Kernel driver in use: vfio-pci
--
05:00.1 0403: 1002:aab0
	Subsystem: 174b:aab0
	Kernel driver in use: vfio-pci
I'm looking for solution in W10 because it seems like it has trouble with some GPU. My VM use the Microsoft Default Card and doesn't want to use the AMD Radeon one. And everytime I try to install a NEW driver, it has BSOD. For the old ones it's ok.

I'll try to add driver manually by adding the .inf from the device manager. I think the problem is here.
Linux Mint 19

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Thu Jan 10, 2019 10:46 am

Gebonimo wrote:
Wed Jan 09, 2019 8:10 am
When I mean I have only one GPu it's besides my motherboard Graphic Card.

I've change the AMD GPU to the "Crossfire" Slot to let it have its own IOMMU groupe (now it's 5:00.0/1)

Actually my linux distro is booting on the Intel Graphic Card (set up in BIOS). So my AMG GPU is not in use when I'm launching the VM. As you can see here :

Code: Select all

gebo@gebo-H87-HD3:~$ lspci -kn | grep -A 2 05:00
05:00.0 0300: 1002:6810
	Subsystem: 174b:e271
	Kernel driver in use: vfio-pci
--
05:00.1 0403: 1002:aab0
	Subsystem: 174b:aab0
	Kernel driver in use: vfio-pci
I'm looking for solution in W10 because it seems like it has trouble with some GPU. My VM use the Microsoft Default Card and doesn't want to use the AMD Radeon one. And everytime I try to install a NEW driver, it has BSOD. For the old ones it's ok.

I'll try to add driver manually by adding the .inf from the device manager. I think the problem is here.
Some AMD cards don't behave nice. Since you already tried the AMD workaround I described in my tutorial and it doesn't work, search your specific card and the term "passthrough" on the web and see if others report issues.

EDIT: Check to see if there is a motherboard BIOS update. What's your motherboard?

If you can't find a working solution, create a VGA BIOS dump following my instructions here: https://heiko-sieger.info/running-windo ... assthrough. Add the romfile=/path/to/GPU_BIOS.dump option to the line:

Code: Select all

-device ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1
something like:

Code: Select all

-device ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1,romfile=/path/to/GPU_BIOS.dump
In some cases the video BIOS needs to be loaded. If the above doesn't work, download the vBIOS for your card from techpowerup (see my tutorial for link), then edit it as shown in the video I linked to under https://heiko-sieger.info/running-windo ... th_Windows.
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

powerhouse
Level 6
Level 6
Posts: 1077
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse » Mon Jan 21, 2019 11:42 am

I've rewritten the part that deals with vfio-pci binding to the passthrough graphics card - see https://heiko-sieger.info/running-windo ... assthrough. My preferred method now is "module alias" as described in the tutorial.

I've also written a post on different methods to bind the vfio-pci driver to the graphics card, see https://heiko-sieger.info/blacklisting-graphics-driver/. This includes a script that works when identical graphics cards are used with both the host and the guest.

I did test these different methods, and all of the methods work for me. But that doesn't mean it will work on your system.

Please provide feedback on how it worked for you.

Specifically I need to know if my suggested "module alias" method works without blacklisting graphics drivers. Please let me know.
Asus Sabertooth X79, i7 3930K CPU, 8x4GB Kingston DDR3, Noctua NH-D14 CPU cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Sandisk 120GB + Samsung EVO 860 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

Post Reply

Return to “Virtualization”