You are not logged in.

#4451 2015-03-10 20:31:44

Duelist
Member
Registered: 2014-09-22
Posts: 358

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

tritron4 wrote:

I wonder if anyone had been using asus A88x-Pro with kvm. I had it setup with xen 4.4.3 and I was able to pass R9 270 and couple of other  ati cards. I was using 1201 bios version. I had flashed latest bios 1701. I can boot windows 8.1 without ati drivers and with vga none my R 270 displays out put but the moment I had installed ati drivers the system only boots to blue screen it get stuck and does not show desktop.  I had to use this options vfio_iommu_type1 disable_hugepages=1. to work around bios bug.
Any tips on geting that motherboard working with kvm ? How I can get uefi emulation working under kvm. So far I had it load uefi but i dont see any options to boot from my hard drive,

https://docs.google.com/spreadsheet/ccc … _web#gid=0
Check there for A88X. I remember someone did this on A88X.

BTW, which CPU do you have? Since the Unified North Bridge is hidden inside the CPU, it doesn't depends much on the motherboard.

My experience is... flawful, if you can say it like that. I have Athlon x4 750k and asus F2A55, and i experience TONS OF GLITCHES, PERFORMANCE HITS AND STUFF, but at least it works.
So far:
1. x-vga is semi-working. You might get it working, but eventually i needed the mlock=on force switch(it's on by default!) and it sometimes crashed resulting in host shutdown.
2. i couldn't get hugepages working using hugetlbfs.
3. some guys report performance speed ups when using npt=0, which is counter-intuitive.
4. i've got myself a fully UEFI-compatible guest with no problems, except for broken GPU rom.


The forum rules prohibit requesting support for distributions other than arch.
I gave up. It was too late.
What I was trying to do.
The reference about VFIO and KVM VGA passthrough.

Offline

#4452 2015-03-10 20:43:52

aw
Member
Registered: 2013-10-04
Posts: 921
Website

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

Yep, int10h is a gateway to the legacy VGA BIOS and would imply that you have VGA access to the device.  It's effectively taking the legacy part of the CSM that we're trying to avoid and using it anyway.


http://vfio.blogspot.com
Looking for a more open forum to discuss vfio related uses?  Try https://www.redhat.com/mailman/listinfo/vfio-users

Offline

#4453 2015-03-10 20:54:31

Duelist
Member
Registered: 2014-09-22
Posts: 358

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

aw wrote:

Yep, int10h is a gateway to the legacy VGA BIOS and would imply that you have VGA access to the device.  It's effectively taking the legacy part of the CSM that we're trying to avoid and using it anyway.

Okay...
But how does windows7 insanertaller outputs video? It works on pure-efi OVMF, but suddenly the real system breaks when trying to output graphics.
So, the installer supports GOP, and the system doesn't? That's weird as hell, but since it windowns - i could believe that. Maybe there's a special driver loaded somewhere.. Wait a second, it said "windows can't continue installation in safe mode" somewhere.. I've forgot all the testing i've done, dang it.

BTW, my windowns 8 VM refuses to read my real win7 partition, saying it's filesystem is "RAW", while i'm able to boot from that "RAW" filesystem. Heh, broken windows.


The forum rules prohibit requesting support for distributions other than arch.
I gave up. It was too late.
What I was trying to do.
The reference about VFIO and KVM VGA passthrough.

Offline

#4454 2015-03-10 21:02:50

Naruni
Member
Registered: 2010-08-05
Posts: 34

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

aw wrote:

Yep, int10h is a gateway to the legacy VGA BIOS and would imply that you have VGA access to the device.  It's effectively taking the legacy part of the CSM that we're trying to avoid and using it anyway.

With all due respect sir, does that mean we will not have the capability (support in tianocore) of a win7 VM using a GPU that has been passed through via OVMF/VFIO?

That's a real shame, I don't have a win8 product key, and I certainly was not going to go buy one. sad

Edit: I also have not found anything relating as to why the CSM is bad, or why the CSM won't boot win7. Would you shed some light on that?

Last edited by Naruni (2015-03-10 21:03:57)

Offline

#4455 2015-03-10 21:10:55

Duelist
Member
Registered: 2014-09-22
Posts: 358

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

Naruni wrote:
aw wrote:

Yep, int10h is a gateway to the legacy VGA BIOS and would imply that you have VGA access to the device.  It's effectively taking the legacy part of the CSM that we're trying to avoid and using it anyway.

With all due respect sir, does that mean we will not have the capability (support in tianocore) of a win7 VM using a GPU that has been passed through via OVMF/VFIO?

That's a real shame, I don't have a win8 product key, and I certainly was not going to go buy one. sad

Edit: I also have not found anything relating as to why the CSM is bad, or why the CSM won't boot win7. Would you shed some light on that?

Try my theory - fetching the drivers for GPU before the install. Some OEMs do that, so there's definitely a way to do this. But it seems like windowns 7 can not into UEFI at all.

Regarding your edit - CSM includes VGA. VGA is bad. CSM will boot win7, but you won't have the advantages of UEFI.

Last edited by Duelist (2015-03-10 21:12:36)


The forum rules prohibit requesting support for distributions other than arch.
I gave up. It was too late.
What I was trying to do.
The reference about VFIO and KVM VGA passthrough.

Offline

#4456 2015-03-10 21:10:55

aw
Member
Registered: 2013-10-04
Posts: 921
Website

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

Naruni wrote:
aw wrote:

Yep, int10h is a gateway to the legacy VGA BIOS and would imply that you have VGA access to the device.  It's effectively taking the legacy part of the CSM that we're trying to avoid and using it anyway.

With all due respect sir, does that mean we will not have the capability (support in tianocore) of a win7 VM using a GPU that has been passed through via OVMF/VFIO?

That's a real shame, I don't have a win8 product key, and I certainly was not going to go buy one. sad

The benefit of OVMF for GPU assignment is when you can use it to avoid the need for VGA access to the device.  That requires a legacy-free ROM on the device, a legacy-free firmware for the VM and a legacy-free guest operating system.  Here you have a non-legacy-free operating system imposing legacy attributes on the VM firmware.  To support that, you need to re-enable VGA arbitration and all the headaches that come with it and you've lost the benefit that OVMF was meant to achieve for this use case.  If you don't have a legacy-free guest OS, don't go down this path.  Simple as that...

EDIT: imposing legacy attributes, not legacy-free attributes

Last edited by aw (2015-03-10 21:23:06)


http://vfio.blogspot.com
Looking for a more open forum to discuss vfio related uses?  Try https://www.redhat.com/mailman/listinfo/vfio-users

Offline

#4457 2015-03-10 21:23:32

Naruni
Member
Registered: 2010-08-05
Posts: 34

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

Duelist wrote:

Try my theory - fetching the drivers for GPU before the install. Some OEMs do that, so there's definitely a way to do this. But it seems like windowns 7 can not into UEFI at all.

Regarding your edit - CSM includes VGA. VGA is bad. CSM will boot win7, but you won't have the advantages of UEFI.

Thinking about that, the first approach I would try is figuring out if a driver is making that call during the install step, then replacing that driver with something that didn't make that call. On one of my notes I remember CLASSPNP.SYS causing lots of hangs when trying safe modes and such... I'll dig in a bit more.

aw wrote:

The benefit of OVMF for GPU assignment is when you can use it to avoid the need for VGA access to the device.  That requires a legacy-free ROM on the device, a legacy-free firmware for the VM and a legacy-free guest operating system.  Here you have a non-legacy-free operating system imposing legacy free attributes on the VM firmware.  To support that, you need to re-enable VGA arbitration and all the headaches that come with it and you've lost the benefit that OVMF was meant to achieve for this use case.  If you don't have a legacy-free guest OS, don't go down this path.  Simple as that...

I had completely forgotten about arbitration and that OVMF removes VGA and all it's junk. It just wasnt clicking in my head that needing to do something about the 10h call is going to bring back VGA. Thanks.

Offline

#4458 2015-03-11 07:08:16

efeu
Member
Registered: 2015-03-06
Posts: 4

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

#!/bin/bash
vfio-bind 0000:01:00.0 0000:01:00.1
qemu-system-x86_64 -enable-kvm -m 13312 -device virtio-balloon -cpu host,kvm=off -smp 8,sockets=1,cores=4,threads=2 \
-pflash /some/directory/OVMF.fd \
-rtc base=localtime,clock=host \
-vga none \
-device vfio-pci,host=01:00.0,multifunction=on,x-vga=on \
-device vfio-pci,host=01:00.1 \
-device virtio-scsi-pci,id=scsi \
-drive file=/some/directory/win81.iso,id=iso_install,if=none -device scsi-cd,drive=iso_install \
-drive file=/some/directory/windows81.raw,id=disk,format=raw,if=none,discard=on -device scsi-hd,drive=disk \
-cdrom /some/directory/virtio-win-0.1-100.iso \
-usb -usbdevice host:046d:c52b \
-usb -usbdevice host:413c:2005 \
-usb -usbdevice host:046d:c051 \
-soundhw hda \
-net tap -net nic,model=virtio,macaddr=52:54:00:12:34:57 \
-boot d

exit 0

I am using the above script to start my VM. I'd like to use virt-manager so can anyone explain to me how i come from the commands to the xml config file?

Last edited by efeu (2015-03-11 07:24:50)

Offline

#4459 2015-03-11 08:54:51

slis
Member
Registered: 2014-06-02
Posts: 127

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

http://libvirt.org/drvqemu.html#xmlimport

Try this, or check my posts for XML and change accordingly, but i use qemu-args that you should not do.

Offline

#4460 2015-03-11 10:49:01

Denso
Member
Registered: 2014-08-30
Posts: 179

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

Will these provide a full "pre-POST" ROM file ?

# cd /sys/bus/pci/devices/0000:01:00.0/
# echo 1 > rom
# cat rom > /tmp/image.rom
# echo 0 > rom

I found them of AW's blog , yet they result in a 0 byte file . dmesg afterwards :

[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:36 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents
[Wed Mar 11 13:46:58 2015] vfio-pci 0000:01:00.0: Invalid ROM contents

Any thoughts ?

Offline

#4461 2015-03-11 15:01:47

efeu
Member
Registered: 2015-03-06
Posts: 4

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

With my NVidia 520 and 970 I used GPU-Z to get the romfile.

Offline

#4462 2015-03-11 15:19:17

Denso
Member
Registered: 2014-08-30
Posts: 179

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

efeu wrote:

With my NVidia 520 and 970 I used GPU-Z to get the romfile.

It would not generate a "pre-POST" ROM as I mentioned earlier .

Offline

#4463 2015-03-11 15:29:59

tritron4
Member
Registered: 2012-04-14
Posts: 153

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

Duelist wrote:
tritron4 wrote:

I wonder if anyone had been using asus A88x-Pro with kvm. I had it setup with xen 4.4.3 and I was able to pass R9 270 and couple of other  ati cards. I was using 1201 bios version. I had flashed latest bios 1701. I can boot windows 8.1 without ati drivers and with vga none my R 270 displays out put but the moment I had installed ati drivers the system only boots to blue screen it get stuck and does not show desktop.  I had to use this options vfio_iommu_type1 disable_hugepages=1. to work around bios bug.
Any tips on geting that motherboard working with kvm ? How I can get uefi emulation working under kvm. So far I had it load uefi but i dont see any options to boot from my hard drive,

https://docs.google.com/spreadsheet/ccc … _web#gid=0
Check there for A88X. I remember someone did this on A88X.

BTW, which CPU do you have? Since the Unified North Bridge is hidden inside the CPU, it doesn't depends much on the motherboard.

My experience is... flawful, if you can say it like that. I have Athlon x4 750k and asus F2A55, and i experience TONS OF GLITCHES, PERFORMANCE HITS AND STUFF, but at least it works.
So far:
1. x-vga is semi-working. You might get it working, but eventually i needed the mlock=on force switch(it's on by default!) and it sometimes crashed resulting in host shutdown.
2. i couldn't get hugepages working using hugetlbfs.
3. some guys report performance speed ups when using npt=0, which is counter-intuitive.
4. i've got myself a fully UEFI-compatible guest with no problems, except for broken GPU rom.

I have AMD A8-6600K APU  I downgraded bios to 1401 and I can install win 8.1
I get tons of  Event logged [IO_PAGE_FAULT device=04:00.0 domain=0x0022
I tried to use ovmf but it just boots to interface and I dont see any way to boot installer

Offline

#4464 2015-03-11 17:27:25

Duelist
Member
Registered: 2014-09-22
Posts: 358

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

tritron4 wrote:
Duelist wrote:
tritron4 wrote:

I wonder if anyone had been using asus A88x-Pro with kvm. I had it setup with xen 4.4.3 and I was able to pass R9 270 and couple of other  ati cards. I was using 1201 bios version. I had flashed latest bios 1701. I can boot windows 8.1 without ati drivers and with vga none my R 270 displays out put but the moment I had installed ati drivers the system only boots to blue screen it get stuck and does not show desktop.  I had to use this options vfio_iommu_type1 disable_hugepages=1. to work around bios bug.
Any tips on geting that motherboard working with kvm ? How I can get uefi emulation working under kvm. So far I had it load uefi but i dont see any options to boot from my hard drive,

https://docs.google.com/spreadsheet/ccc … _web#gid=0
Check there for A88X. I remember someone did this on A88X.

BTW, which CPU do you have? Since the Unified North Bridge is hidden inside the CPU, it doesn't depends much on the motherboard.

My experience is... flawful, if you can say it like that. I have Athlon x4 750k and asus F2A55, and i experience TONS OF GLITCHES, PERFORMANCE HITS AND STUFF, but at least it works.
So far:
1. x-vga is semi-working. You might get it working, but eventually i needed the mlock=on force switch(it's on by default!) and it sometimes crashed resulting in host shutdown.
2. i couldn't get hugepages working using hugetlbfs.
3. some guys report performance speed ups when using npt=0, which is counter-intuitive.
4. i've got myself a fully UEFI-compatible guest with no problems, except for broken GPU rom.

I have AMD A8-6600K APU  I downgraded bios to 1401 and I can install win 8.1
I get tons of  Event logged [IO_PAGE_FAULT device=04:00.0 domain=0x0022
I tried to use ovmf but it just boots to interface and I dont see any way to boot installer

Precisely. AMD APU(and APU-based) products with Trinity and Richland microarchitecture seem to have broken IOMMU.
It gets IO_PAGE_FAULT everywhere when using x-vga. However, on rare occasions, when the weather on mars is partly cloudy with mild winds, it might work. Just as i stated before.
Check out huge errata list on those CPUs:
http://amd-dev.wpengine.netdna-cdn.com/ … _Guide.pdf

When using OVMF everything is much more stable.
If you can't find your disks inside OVMF, you're just doing something wrong.
Check out how i attached my disks:

-device ahci \
-device virtio-scsi-pci \
-device scsi-cd,drive=install \
-device ide-cd,bus=ide.1,drive=virtiocd \
-drive file=/mnt/hdd/qemu/windows8.iso,id=install,if=none \
-drive file=/mnt/hdd/qemu/virtio.iso,id=virtiocd,if=none \

Again, i don't remember which scsi controller works, but since it's temporary - just add both. You can pin-point that to one, if you want.
The main disk is connected that way:

-device virtio-blk-pci,drive=disk1 \
-drive file=/mnt/hdd/qemu/win8.img,id=disk1,format=raw,if=none \

Please note that i am using -M pc and also -boot menu=on(though i'm not sure this option is relevant with OVMF, you can just drop it out after the initial setup).

You MUST have UEFI-bootable iso image. Otherwise it won't work, obviously. Use ovmf-pure-efi, not -with-csm one.

Downgrading bios doesn't matter much - i've tried every bios for my motherboard with IOMMU support, observing no difference at all, so, i guess, latest is best.

Last edited by Duelist (2015-03-11 17:30:38)


The forum rules prohibit requesting support for distributions other than arch.
I gave up. It was too late.
What I was trying to do.
The reference about VFIO and KVM VGA passthrough.

Offline

#4465 2015-03-12 00:24:31

tritron4
Member
Registered: 2012-04-14
Posts: 153

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

Well I got kvm working windows 8.1 options vfio_iommu_type1 disable_hugepages=1 I wonder if there is a way to pass

Offline

#4466 2015-03-12 18:59:59

Duelist
Member
Registered: 2014-09-22
Posts: 358

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

https://msdn.microsoft.com/en-us/library/hh824938.aspx
Handy link for those who migrate from disk interface to disk interface often.
How-to avoid BSOD 7B after changing VM's configuration.


The forum rules prohibit requesting support for distributions other than arch.
I gave up. It was too late.
What I was trying to do.
The reference about VFIO and KVM VGA passthrough.

Offline

#4467 2015-03-12 19:02:43

mbirkis
Member
Registered: 2013-12-12
Posts: 18

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

aw wrote:
mbirkis wrote:

I have been searching abit in this forum and on aw's vfio blog faq. When going through the talking points you had aw i got the impression that if i switch to using OVMF and UEFI on my windows8.1 guest, the vga arbiter issue with Nvidia proprietary host drivers is a non issue (your faq question 9) and i can install and use the nvidia driver on the host without patching?

Sorry if this question has been answered before i just had a hard time finding the answer that looked obvious from your talking points "VFIO, OVMF, GPU, and You ".

It's my understanding that this is true.  The problem with the nvidia proprietary driver on the host is that it takes the VGA arbiter lock and never releases it.  The expected usage model for the VGA arbiter is that the lock is held only while accesses to the legacy VGA space are being used.  The lock is then released allowing other users of the arbiter a chance to acquire the lock and perform their access.  This is how pseudo-concurrent VGA access works with multiple VGA assignment VMs.  Therefore, so long as our VM is not performing VGA accesses, which can be enforced by disabling CONFIG_VFIO_PCI_VGA (or a vfio-pci module option I intend to add), there is no need to patch the host nvidia driver to prevent VGA locking.

Note however that while OVMF generally implies legacy-free, there is a legacy compatibility module, the CSM, available in some OVMF builds.  The CSM will potentially do legacy VGA accesses and put you back in the position of needing to patch host drivers for VGA arbitration.  You therefore want to make use of the "pure" version of OVMF to avoid this.  On Fedora, the OVMF file to use is /usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd (avoid the "with-csm" versions).  Your builds may name them differently.

Just got around to testing this on my setup and so far it works without issues. I am now running standard Arch kernel, libvirt, ovmf etc. With the proprietary Nvidia driver for Host.

Thank you so much for all the awesome work and guideance you have given on this subject.

Offline

#4468 2015-03-14 18:50:23

Denso
Member
Registered: 2014-08-30
Posts: 179

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

A GLORIOUS UPDATE :

I used "nvagetbios" to get a full "pre-POST" ROM dump for BOTH of my NVIDIA cards (GT610 + GTX770) .

I had to make the cards I want to dump the ROMs from secondary in the host's perspective for this to succeed .

nvagetbios -c 1 -s prom > /VMs/GT610.rom

AND

nvagetbios -c 2 -s prom > /VMs/GTX770.rom

-c 1 & -c 2 are the cards numbers which we want to dump . 0 being the host's primary obviously .

Each card threw a 1MB ROM file , as opposed to 164K files dumped from GPU-Z .

I used these in my VMs , and got these results :

1 - The GT610 no longer have rebooting issues , I can now reboot from within Windows without a problem . (It used to give a black screen) .

2 - I can now passthrough the GTX770 while it is the PRIMARY GPU of the host ! No issues at all (headless server) .

nvagetbios is part of envytools-git package (AUR) .

Hope this helps ! smile

Last edited by Denso (2015-03-14 18:54:24)

Offline

#4469 2015-03-14 20:33:35

tritron4
Member
Registered: 2012-04-14
Posts: 153

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

So is there virt manager package that supports ovmf? I am testing my hp server with kvm ovmf and I had installed server 2012 R2 as a test  and it boots and with cirrus it freezes.
What I am doing wrong. Is there a special vga bios for radeon R9 270 for uefi ?

#/bin/sh!
/usr/bin/qemu-system-x86_64 -enable-kvm -M q35 -m 2048 -cpu host \
-smp 4,sockets=2,cores=2,threads=1 -vga cirrus -spice port=5910,addr=0.0.0.0,disable-ticketing  \
-drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/ovmf_x64.bin -drive if=pflash,format=raw,file=/usr/share/ovmf/ovmf_x64.bin \
-device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
-device virtio-scsi-pci,id=scsi \
-net nic,model=e1000,macaddr=64:C5:63:4D:A4:44 -net bridge,br=xenbr0 \
-drive file=/data/kvm/win.img,id=disk,format=raw,if=none -device scsi-hd,drive=disk \
-drive file=/home/kvm/iso/en_windows_server_2012_r2.iso,id=isocd,if=none -device scsi-cd,drive=isocd \
-drive file=/home/kvm/iso/virtio-win-0.1-100.iso,id=isocd2,if=none -device ide-cd,drive=isocd2

Offline

#4470 2015-03-15 09:20:56

lersek
Member
Registered: 2015-03-15
Posts: 38

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

Naruni wrote:
aw wrote:

Yep, int10h is a gateway to the legacy VGA BIOS and would imply that you have VGA access to the device.  It's effectively taking the legacy part of the CSM that we're trying to avoid and using it anyway.

With all due respect sir, does that mean we will not have the capability (support in tianocore) of a win7 VM using a GPU that has been passed through via OVMF/VFIO?

That's a real shame, I don't have a win8 product key, and I certainly was not going to go buy one. :(

Edit: I also have not found anything relating as to why the CSM is bad, or why the CSM won't boot win7. Would you shed some light on that?

Upstream OVMF co-maintainer here. Finally decided to register an account and chime in. Alex has been holding the front alone for way too long. :) I've been lurking around as r/o, but today I'll comment too.

So, I continue to see a lot of confusion both in the questions here and in the guides in the archlinux wiki (which is regrettable, because the archlinux wiki is usually one of the best sources of user-oriented technical info on the tubes). I'm happy to announce here too that the OVMF whitepaper has been released recently, and it should answer most, if not all, your questions (and probably even questions you have not had thus far) regarding OVMF. You can find the whitepaper (plaintext edition) in the KVM wiki or in my personal webspace.

Specifically, as to the question whether Win7 / Windows 2008 R2 can be used with OVMF (without a CSM): yes, it can; and you should be able to do GPU passthrough as well.

First, just for installing & then booting a Win7 or Windows 2008 R2 guest, please refer to the following sections in the whitepaper:

  • Supported guest operating systems | Notes about Windows Server 2008 R2
  • Compatibility Support Module (CSM)

    -- strictly as background material only, you do not need to do anything with this

  • Select features | Video driver

Windows 2008 R2 is a UEFI system "in general", it's just its stock (default) video driver that has this inconvenient dependency on Int10h. So, OVMF (the "pure" build, no CSM) fakes an Int10h handler for just this OS, which is pretty raw, but enough for the user to install the guest, and then to update / install "real" video drivers that do not have this Int10h dependency (and then other resolutions and S3 etc become available.)

In short,

  1. You should create a virtual machine with two video adapters. The first should be QXL, the second should be your passthru GPU. Use the "pure UEFI" build of OVMF from Gerd's package.

  2. QXL will allow you to install Win7 / Win2008R2 in 1024x768x32.

  3. Update the guest's video driver for the QXL card from the stock windows driver (which OVMF fools, with regard to Int10h, see the material above) to the real QXL XDDM driver. Look at http://www.spice-space.org/download.html , under Guest | Windows binaries.

  4. Install the driver for your secondary (passthru) GPU.

  5. Potentially mark the secondary (passthru) GPU as primary desktop provider.

Admittedly, I did not test the "GPU passthru" part with Windows 2008 R2 (only with Windows Server 2012 R2), but the OS installation I definitely tested, and I don't see any reason why GPU passthrough (and the dual display) should not work.

Finally, an unrelated, but nonetheless important point -- I recommend that everyone use libvirt. It supports OVMF very nicely. Please refer to the following section in the whitepaper:

Installation of OVMF guests with virt-manager and virt-install

.

Offline

#4471 2015-03-15 15:17:24

Duelist
Member
Registered: 2014-09-22
Posts: 358

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

YAY! Lazlo has finally joined us!

lersek wrote:

Windows 2008 R2 is a UEFI system "in general", it's just its stock (default) video driver that has this inconvenient dependency on Int10h. So, OVMF (the "pure" build, no CSM) fakes an Int10h handler for just this OS, which is pretty raw, but enough for the user to install the guest, and then to update / install "real" video drivers that do not have this Int10h dependency (and then other resolutions and S3 etc become available.)

Damn, i've developed a special feeling for deep problems. My guess is finally proven.

lersek wrote:

In short,

  1. You should create a virtual machine with two video adapters. The first should be QXL, the second should be your passthru GPU. Use the "pure UEFI" build of OVMF from Gerd's package.

  2. QXL will allow you to install Win7 / Win2008R2 in 1024x768x32.

  3. Update the guest's video driver for the QXL card from the stock windows driver (which OVMF fools, with regard to Int10h, see the material above) to the real QXL XDDM driver. Look at http://www.spice-space.org/download.html , under Guest | Windows binaries.

  4. Install the driver for your secondary (passthru) GPU.

  5. Potentially mark the secondary (passthru) GPU as primary desktop provider.

Let me ask an important question:
-device qxl or -device qxl-vga?

Nevermind, this is covered in OVMF whitepaper.

# A Spice QXL GPU is recommended as the primary VGA-compatible display
  # device. It is a full-featured virtual video card, with great operating
  # system driver support. OVMF supports it too.
  OPTS="$OPTS -device qxl-vga"

They are both qxl.
I usually add -device qxl for... input purposes - that way qemu creates an SDL window where it can grab keyboard and mouse. But it didn't help.
Anyway, i'll try doing your way ASAP.

By the way, i guess, we get two screens connected to the machine, one to QXL and one to GPU? That's a little bit inconvenient, i guess it's OK to drop QXL device after installing GPU's drivers.

Last edited by Duelist (2015-03-15 15:27:22)


The forum rules prohibit requesting support for distributions other than arch.
I gave up. It was too late.
What I was trying to do.
The reference about VFIO and KVM VGA passthrough.

Offline

#4472 2015-03-15 15:43:00

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,202

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

lersek wrote:

Upstream OVMF co-maintainer here. Finally decided to register an account and chime in. ...
So, I continue to see a lot of confusion both in the questions here and in the guides in the archlinux wiki (which is regrettable, because the archlinux wiki is usually one of the best sources of user-oriented technical info on the tubes). ...
I recommend that everyone use libvirt. It supports OVMF very nicely. Please refer to the following section in the whitepaper:

Installation of OVMF guests with virt-manager and virt-install

.

Every now and again a first post comes along that blows me away.  It is an honor to have you join us.
Please, don't be bashful about improving the wiki if you would like to do so.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Online

#4473 2015-03-15 16:06:29

lersek
Member
Registered: 2015-03-15
Posts: 38

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

Duelist wrote:

Anyway, i'll try doing your way ASAP.

Right, I've become curious enough to try it myself as well :)

Duelist wrote:

By the way, i guess, we get two screens connected to the machine, one to QXL and one to GPU? That's a little bit inconvenient, i guess it's OK to drop QXL device after installing GPU's drivers.

Yes, two displays. I didn't find it inconvenient with Windows Server 2012 R2. I simply would not open the QXL display with virt-manager (in fact I wouldn't even start virt-manager, just start the guest with "virsh start"). So that would cause me to lose a tiny bit of boot progress info was sent to the "main" (QXL) display, but eg. the windows login screen is already displayed on the passthru GPU (once that GPU is configured as primary desktop). I wanted to keep the QXL display just in case (troubleshooting etc).

But, yes, I guess once the GPU works okay, you might be able to drop QXL completely.

Offline

#4474 2015-03-15 16:16:55

lersek
Member
Registered: 2015-03-15
Posts: 38

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

ewaller wrote:

Please, don't be bashful about improving the wiki if you would like to do so.

Okay, I fixed two mistakes in https://wiki.archlinux.org/index.php/PC … h_via_OVMF

Offline

#4475 2015-03-15 19:32:25

lersek
Member
Registered: 2015-03-15
Posts: 38

Re: KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9

lersek wrote:
  1. You should create a virtual machine with two video adapters. The first should be QXL, the second should be your passthru GPU. Use the "pure UEFI" build of OVMF from Gerd's package.

  2. QXL will allow you to install Win7 / Win2008R2 in 1024x768x32.

  3. Update the guest's video driver for the QXL card from the stock windows driver (which OVMF fools, with regard to Int10h, see the material above) to the real QXL XDDM driver. Look at http://www.spice-space.org/download.html , under Guest | Windows binaries.

  4. Install the driver for your secondary (passthru) GPU.

  5. Potentially mark the secondary (passthru) GPU as primary desktop provider.

Admittedly, I did not test the "GPU passthru" part with Windows 2008 R2 (only with Windows Server 2012 R2), but the OS installation I definitely tested, and I don't see any reason why GPU passthrough (and the dual display) should not work.

I tested it now, with a brand new Windows 2008 R2 guest. It works. (Checked it with Unigine Valley Benchmark.)

There's one small hiccup in step 5: as soon as the pass-through GPU's driver was installed and the guest was rebooted, the QXL display stopped working (exclamation mark in device manager, code 43). However, at that point the passthrough display worked fine, so I didn't bother trying to figure out why I could not have *dual* display. I was satisfied with the one passthrough display. IOW, step 5 became mandatory / automatic, effectively.

Offline

Board footer

Powered by FluxBB