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: 1067
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: 1067
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: 1067
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: 1
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: 1067
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: 1067
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: 1067
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

Post Reply

Return to “Virtualization”