You are not logged in.

#2226 2014-06-27 19:35:00

random_user9547
Member
Registered: 2014-06-27
Posts: 5

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

Slabity wrote:

Could you post the result of `lspci -v`? The section related to your graphics card.

Yes. Here:

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Bonaire XT [Radeon HD 7790/8770 / R9 260 OEM] (prog-if 00 [VGA controller])
        Subsystem: Hightech Information System Ltd. Radeon HD 7790 TurboDuo
        Flags: bus master, fast devsel, latency 0, IRQ 10
        Memory at a0000000 (64-bit, prefetchable) [size=256M]
        Memory at b0000000 (64-bit, prefetchable) [size=8M]
        I/O ports at e000 [size=256]
        Memory at fea00000 (32-bit, non-prefetchable) [size=256K]
        Expansion ROM at fea40000 [disabled] [size=128K]
        Capabilities: [48] Vendor Specific Information: Len=08 <?>
        Capabilities: [50] Power Management version 3
        Capabilities: [58] Express Legacy Endpoint, MSI 00
        Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Capabilities: [150] Advanced Error Reporting
        Capabilities: [270] #19
        Capabilities: [2b0] Address Translation Service (ATS)
        Capabilities: [2c0] #13
        Capabilities: [2d0] #1b
        Kernel driver in use: vfio-pci
        Kernel modules: radeon

01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Device 0002
        Subsystem: Hightech Information System Ltd. Device 0002
        Flags: bus master, fast devsel, latency 0, IRQ 7
        Memory at fea60000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: [48] Vendor Specific Information: Len=08 <?>
        Capabilities: [50] Power Management version 3
        Capabilities: [58] Express Legacy Endpoint, MSI 00
        Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Capabilities: [150] Advanced Error Reporting
        Kernel driver in use: vfio-pci
        Kernel modules: snd_hda_intel

Offline

#2227 2014-06-27 20:24:42

Slabity
Member
Registered: 2013-12-29
Posts: 40

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

random_user9547 wrote:
Slabity wrote:

Could you post the result of `lspci -v`? The section related to your graphics card.

Yes. Here:

Add these parameters to your kernel's command line:

intel_iommu=on pcie_acs_override=downstream

You may need to replace intel_iommu with the AMD equivelant, which I don't know off the top of my head.

Offline

#2228 2014-06-27 20:46:40

_pheinrich_
Member
Registered: 2014-05-26
Posts: 53

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

I got it to WORK !!! partly big_smile

I can successfully passthrough my GTX 260 and I see the seabios on the output of that gpu.
Now my problem is how to stop it ... if I cancel the qemu command the seabios does not go down.

Next problem is how to use the host keyboard in the vm? Do I have to plug a second keyboard and passthrough it?

Is it possible to redirect the output of the gpu into a qemu window ?

I configured my existing qemu img like this

-drive file=/srv/media/Data/qemu/win7/win7.qcow2,id=disk,format=qcow2 -device ide-hd,bus=ide.0,drive=disk

But seabios says "Boot failded: could not read the boot disk"

Last edited by _pheinrich_ (2014-06-27 20:47:40)

Offline

#2229 2014-06-27 20:53:49

sinny
Member
Registered: 2014-05-24
Posts: 75

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

_pheinrich_ wrote:

I got it to WORK !!! partly :D

I can successfully passthrough my GTX 260 and I see the seabios on the output of that gpu.
Now my problem is how to stop it ... if I cancel the qemu command the seabios does not go down.

Next problem is how to use the host keyboard in the vm? Do I have to plug a second keyboard and passthrough it?

Is it possible to redirect the output of the gpu into a qemu window ?

I configured my existing qemu img like this

-drive file=/srv/media/Data/qemu/win7/win7.qcow2,id=disk,format=qcow2 -device ide-hd,bus=ide.0,drive=disk

But seabios says "Boot failded: could not read the boot disk"

some of your questions were discussed in this topic already

please bother reading up a bit or using search - value the time and effort of other people.

Offline

#2230 2014-06-27 21:10:34

_pheinrich_
Member
Registered: 2014-05-26
Posts: 53

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

thank you!

every time I use the search function like "qemu passthrough keyboard" or something else I get this post ... the first page.
After reading 15 pages I haven't found some useful hints.

Offline

#2231 2014-06-27 21:35:13

random_user9547
Member
Registered: 2014-06-27
Posts: 5

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

Slabity wrote:

Add these parameters to your kernel's command line:

intel_iommu=on pcie_acs_override=downstream

You may need to replace intel_iommu with the AMD equivelant, which I don't know off the top of my head.

It turns out the amd equivelant is

iommu=pt iommu=1

Adding it did not help.

With

iommu=pt iommu=1

and/or

iommu=pt iommu=1 pcie_acs_override=downstream

dmesg shows that AMD-Vi is enabled, which would imply that iommu is activated.

with

vfio_iommu_type1.allow_unsafe_interrupts=1 iommu=pt iommu=1 pcie_acs_override=downstream

dmesg does not show AMD-Vi activated.

None of the lines helped, I still get the same error.

The qemu line I am running is:

gksu "qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host \
-smp 2,sockets=1,cores=2,threads=1 \
-bios /usr/share/qemu/bios.bin -vga none \
-drive file=/home/<user>/windows.img,id=disk,format=raw -device ide-hd,bus=ide.0,drive=disk \
-device ioh3420,bus=pcie.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,x-vga=on \
-device vfio-pci,host=01:00.1,bus=root.1,addr=00.1"

Am I maybe invoking the qemu line incorrectly?

Offline

#2232 2014-06-27 21:39:25

andy123
Member
Registered: 2011-11-04
Posts: 169
Website

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

Slabity wrote:
andy123 wrote:

Or try pulseaudio over network (127.0.0.1). That's what I do.

What's your method of doing this?

I enabled network "input" for my pulseaudio like this in /etc/pulse/default.pa

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1

Setting these environment variables should to the job for qemu.

export QEMU_AUDIO_DRV=pa
export PULSE_SERVER=127.0.0.1
export QEMU_PA_SERVER=127.0.0.1

I don't know if you can do input (aka microphones) this way  but I've used this for output the last few months.


i'm sorry for my poor english wirting skills…

Offline

#2233 2014-06-28 15:42:29

abdullah
Member
Registered: 2014-06-10
Posts: 34

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

While connecting a second screen to the passed through card, there would no be output ?
I think it is strange, or I did something wrong.

Offline

#2234 2014-06-28 16:45:57

Slabity
Member
Registered: 2013-12-29
Posts: 40

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

andy123 wrote:
Slabity wrote:
andy123 wrote:

Or try pulseaudio over network (127.0.0.1). That's what I do.

What's your method of doing this?

I enabled network "input" for my pulseaudio like this in /etc/pulse/default.pa

load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1

Setting these environment variables should to the job for qemu.

export QEMU_AUDIO_DRV=pa
export PULSE_SERVER=127.0.0.1
export QEMU_PA_SERVER=127.0.0.1

I don't know if you can do input (aka microphones) this way  but I've used this for output the last few months.

Beautiful! This even works with libvirt + virt-manager!

Offline

#2235 2014-06-28 19:14:51

kameloc
Member
Registered: 2014-06-28
Posts: 11

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

I'm attempting to follow the instructions from the OP and am having some trouble.

Hardware:
CPU: Intel i7-4790
Motherboard: GA-Z97N-WIFI
Host GPU: Intel HD Graphics 4600
Passthrough GPU: EVGA NVIDIA GTX 550Ti

Relevant package information:
Qemu 2.0.50
SeaBIOS 1.7.5
Linux Kernel 3.15.2

Steps taken to configure so far:

1. Enabled VT-d in BIOS
2. Aded intel_iommu=on in my kernel parameters. It also says I need VT-d working. Is there a way to check if it's working without just trying to implement VGA-passthrough? I checked through dmesg and found that IOMMU is enabled, is that enough?

$ dmesg | grep IOMMU

[    0.000000] Intel-IOMMU: enabled
[    0.018572] dmar: IOMMU 0: reg_base_addr fed90000 ver 1:0 cap c0000020660462 ecap f0101a
[    0.018575] dmar: IOMMU 1: reg_base_addr fed91000 ver 1:0 cap d2008c20660462 ecap f010da
[    0.018640] IOAPIC id 8 under DRHD base  0xfed91000 IOMMU 1
[    0.464684] IOMMU 0 0xfed90000: using Queued invalidation
[    0.464685] IOMMU 1 0xfed91000: using Queued invalidation
[    0.464686] IOMMU: Setting RMRR:
[    0.464694] IOMMU: Setting identity map for device 0000:00:02.0 [0xcb000000 - 0xcf1fffff]
[    0.464978] IOMMU: Setting identity map for device 0000:00:14.0 [0xc9e7f000 - 0xc9e8dfff]
[    0.464996] IOMMU: Setting identity map for device 0000:00:1a.0 [0xc9e7f000 - 0xc9e8dfff]
[    0.465011] IOMMU: Setting identity map for device 0000:00:1d.0 [0xc9e7f000 - 0xc9e8dfff]
[    0.465023] IOMMU: Prepare 0-16MiB unity mapping for LPC
[    0.465028] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]

3. Blacklisted nouveau in /etc/modprobe.d/blacklist.conf
4. Found the 550Ti's PCI information

$ lspci

01:00.0 VGA compatible controller: NVIDIA Corporation GF116 [GeForce GTX 550 Ti] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GF116 High Definition Audio Controller (rev a1)

5. Used the provided vfio-bind bash script to bind the GPU

vfio-bind 0000:01:00.0 0000:01:00.1

6. Tried starting up the BIOS to test passthrough GPU

qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host \
-smp 4,cores=4, \
-bios /usr/share/qemu/bios.bin -vga none \
-device ioh3420,bus=pcie.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,x-vga=on \
-device vfio-pci,host=01:00.1,bus=root.1,addr=00.1

When I do this a compat_monitor0 console opens on my main display and then qemu crashes with:

KVM internal error. Suberror: 1
emulation failure
EAX=000000d9 EBX=00000000 ECX=0000bd53 EDX=000003d4
ESI=00009e49 EDI=0000823b EBP=0000fc6a ESP=0000822e
EIP=000a0000 EFL=00010086 [--S--P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0000 00000000 ffffffff 00809300
CS =0000 00000000 ffffffff 00809b00
SS =0000 00000000 ffffffff 00809300
DS =0000 00000000 ffffffff 00809300
FS =0000 00000000 ffffffff 00809300
GS =0000 00000000 ffffffff 00809300
LDT=0000 00000000 0000ffff 00008200
TR =0000 00000000 0000ffff 00008b00
GDT=     000f6e98 00000037
IDT=     00000000 000003ff
CR0=00000010 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000000
Code=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <ff> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

I terminated it and just tried starting qemu again and got a different error:

Device option ROM contents are probably invalid (check dmesg). Skip option ROM probe with rombar=0, or load from file with romfile=

Checking dmesg:

$ dmesg | tail

[    4.873454] IPv6: ADDRCONF(NETDEV_CHANGE): eno1: link becomes ready
[   32.469712] fuse init (API version 7.23)
[   71.008187] VFIO - User Level meta-driver version: 0.3
[   72.716407] vfio-pci 0000:01:00.0: enabling device (0000 -> 0003)
[   76.093483] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   76.093527] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   76.093538] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   76.093550] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   78.735841] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[  108.173362] vfio-pci 0000:01:00.0: Invalid ROM contents

I decided to try qemu-git as well and have the same results.

I know my components are very new (at least my CPU and motherboard are) so I can't rule them out of being the problem. I'd really appreciate it if anyone could help me narrow things down.

Offline

#2236 2014-06-28 20:36:16

nbhs
Member
From: Montevideo, Uruguay
Registered: 2013-05-02
Posts: 402

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

kameloc wrote:

I'm attempting to follow the instructions from the OP and am having some trouble.

Hardware:
CPU: Intel i7-4790
Motherboard: GA-Z97N-WIFI
Host GPU: Intel HD Graphics 4600
Passthrough GPU: EVGA NVIDIA GTX 550Ti

Relevant package information:
Qemu 2.0.50
SeaBIOS 1.7.5
Linux Kernel 3.15.2

Steps taken to configure so far:

1. Enabled VT-d in BIOS
2. Aded intel_iommu=on in my kernel parameters. It also says I need VT-d working. Is there a way to check if it's working without just trying to implement VGA-passthrough? I checked through dmesg and found that IOMMU is enabled, is that enough?

$ dmesg | grep IOMMU

[    0.000000] Intel-IOMMU: enabled
[    0.018572] dmar: IOMMU 0: reg_base_addr fed90000 ver 1:0 cap c0000020660462 ecap f0101a
[    0.018575] dmar: IOMMU 1: reg_base_addr fed91000 ver 1:0 cap d2008c20660462 ecap f010da
[    0.018640] IOAPIC id 8 under DRHD base  0xfed91000 IOMMU 1
[    0.464684] IOMMU 0 0xfed90000: using Queued invalidation
[    0.464685] IOMMU 1 0xfed91000: using Queued invalidation
[    0.464686] IOMMU: Setting RMRR:
[    0.464694] IOMMU: Setting identity map for device 0000:00:02.0 [0xcb000000 - 0xcf1fffff]
[    0.464978] IOMMU: Setting identity map for device 0000:00:14.0 [0xc9e7f000 - 0xc9e8dfff]
[    0.464996] IOMMU: Setting identity map for device 0000:00:1a.0 [0xc9e7f000 - 0xc9e8dfff]
[    0.465011] IOMMU: Setting identity map for device 0000:00:1d.0 [0xc9e7f000 - 0xc9e8dfff]
[    0.465023] IOMMU: Prepare 0-16MiB unity mapping for LPC
[    0.465028] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]

3. Blacklisted nouveau in /etc/modprobe.d/blacklist.conf
4. Found the 550Ti's PCI information

$ lspci

01:00.0 VGA compatible controller: NVIDIA Corporation GF116 [GeForce GTX 550 Ti] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GF116 High Definition Audio Controller (rev a1)

5. Used the provided vfio-bind bash script to bind the GPU

vfio-bind 0000:01:00.0 0000:01:00.1

6. Tried starting up the BIOS to test passthrough GPU

qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host \
-smp 4,cores=4, \
-bios /usr/share/qemu/bios.bin -vga none \
-device ioh3420,bus=pcie.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,x-vga=on \
-device vfio-pci,host=01:00.1,bus=root.1,addr=00.1

When I do this a compat_monitor0 console opens on my main display and then qemu crashes with:

KVM internal error. Suberror: 1
emulation failure
EAX=000000d9 EBX=00000000 ECX=0000bd53 EDX=000003d4
ESI=00009e49 EDI=0000823b EBP=0000fc6a ESP=0000822e
EIP=000a0000 EFL=00010086 [--S--P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0000 00000000 ffffffff 00809300
CS =0000 00000000 ffffffff 00809b00
SS =0000 00000000 ffffffff 00809300
DS =0000 00000000 ffffffff 00809300
FS =0000 00000000 ffffffff 00809300
GS =0000 00000000 ffffffff 00809300
LDT=0000 00000000 0000ffff 00008200
TR =0000 00000000 0000ffff 00008b00
GDT=     000f6e98 00000037
IDT=     00000000 000003ff
CR0=00000010 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000000
Code=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <ff> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

I terminated it and just tried starting qemu again and got a different error:

Device option ROM contents are probably invalid (check dmesg). Skip option ROM probe with rombar=0, or load from file with romfile=

Checking dmesg:

$ dmesg | tail

[    4.873454] IPv6: ADDRCONF(NETDEV_CHANGE): eno1: link becomes ready
[   32.469712] fuse init (API version 7.23)
[   71.008187] VFIO - User Level meta-driver version: 0.3
[   72.716407] vfio-pci 0000:01:00.0: enabling device (0000 -> 0003)
[   76.093483] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   76.093527] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   76.093538] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   76.093550] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   78.735841] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[  108.173362] vfio-pci 0000:01:00.0: Invalid ROM contents

I decided to try qemu-git as well and have the same results.

I know my components are very new (at least my CPU and motherboard are) so I can't rule them out of being the problem. I'd really appreciate it if anyone could help me narrow things down.

You need the i915  vgaarb patch

Offline

#2237 2014-06-28 22:05:29

kameloc
Member
Registered: 2014-06-28
Posts: 11

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

nbhs wrote:

You need the i915  vgaarb patch

Thanks for the reply. I compiled a custom kernel with this patch and have the same errors

# ./vfio-bind 0000:01:00.0 0000:01:00.1
# qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host \
> -smp 4,cores=4, \
> -bios /usr/share/qemu/bios.bin -vga none \
> -device ioh3420,bus=pcie.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,x-vga=on \
> -device vfio-pci,host=01:00.1,bus=root.1,addr=00.1
KVM internal error. Suberror: 1
emulation failure
EAX=00000002 EBX=00000000 ECX=0000915e EDX=000003d4
ESI=00009e49 EDI=0000823b EBP=0000a50c ESP=00008232
EIP=000a0000 EFL=00010086 [--S--P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0000 00000000 ffffffff 00809300
CS =0000 00000000 ffffffff 00809b00
SS =0000 00000000 ffffffff 00809300
DS =0000 00000000 ffffffff 00809300
FS =0000 00000000 ffffffff 00809300
GS =0000 00000000 ffffffff 00809300
LDT=0000 00000000 0000ffff 00008200
TR =0000 00000000 0000ffff 00008b00
GDT=     000f6ee8 00000037
IDT=     00000000 000003ff
CR0=00000010 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000000
Code=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <ff> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^Cqemu: terminating on signal 2
# qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host \
> -smp 4,cores=4, \
> -bios /usr/share/qemu/bios.bin -vga none \
> -device ioh3420,bus=pcie.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,x-vga=on \
> -device vfio-pci,host=01:00.1,bus=root.1,addr=00.1
qemu-system-x86_64: vfio-pci: Cannot read device rom at 0000:01:00.0
Device option ROM contents are probably invalid (check dmesg).
Skip option ROM probe with rombar=0, or load from file with romfile=
^Cqemu: terminating on signal 2
# dmesg | tail
[   14.426903] fuse init (API version 7.23)
[   17.469829] snd_hda_intel 0000:00:1b.0: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.
[   27.583355] VFIO - User Level meta-driver version: 0.3
[   34.290376] vfio-pci 0000:01:00.0: enabling device (0000 -> 0003)
[   37.692780] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   37.692822] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   37.692832] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   37.692841] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   40.177371] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   54.267555] vfio-pci 0000:01:00.0: Invalid ROM contents

Offline

#2238 2014-06-28 23:21:44

dwe11er
Member
Registered: 2014-03-18
Posts: 73

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

kameloc wrote:
nbhs wrote:

You need the i915  vgaarb patch

Thanks for the reply. I compiled a custom kernel with this patch and have the same errors

# ./vfio-bind 0000:01:00.0 0000:01:00.1
# qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host \
> -smp 4,cores=4, \
> -bios /usr/share/qemu/bios.bin -vga none \
> -device ioh3420,bus=pcie.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,x-vga=on \
> -device vfio-pci,host=01:00.1,bus=root.1,addr=00.1
KVM internal error. Suberror: 1
emulation failure
EAX=00000002 EBX=00000000 ECX=0000915e EDX=000003d4
ESI=00009e49 EDI=0000823b EBP=0000a50c ESP=00008232
EIP=000a0000 EFL=00010086 [--S--P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0000 00000000 ffffffff 00809300
CS =0000 00000000 ffffffff 00809b00
SS =0000 00000000 ffffffff 00809300
DS =0000 00000000 ffffffff 00809300
FS =0000 00000000 ffffffff 00809300
GS =0000 00000000 ffffffff 00809300
LDT=0000 00000000 0000ffff 00008200
TR =0000 00000000 0000ffff 00008b00
GDT=     000f6ee8 00000037
IDT=     00000000 000003ff
CR0=00000010 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000000
Code=00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 <ff> ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^Cqemu: terminating on signal 2
# qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host \
> -smp 4,cores=4, \
> -bios /usr/share/qemu/bios.bin -vga none \
> -device ioh3420,bus=pcie.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,x-vga=on \
> -device vfio-pci,host=01:00.1,bus=root.1,addr=00.1
qemu-system-x86_64: vfio-pci: Cannot read device rom at 0000:01:00.0
Device option ROM contents are probably invalid (check dmesg).
Skip option ROM probe with rombar=0, or load from file with romfile=
^Cqemu: terminating on signal 2
# dmesg | tail
[   14.426903] fuse init (API version 7.23)
[   17.469829] snd_hda_intel 0000:00:1b.0: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.
[   27.583355] VFIO - User Level meta-driver version: 0.3
[   34.290376] vfio-pci 0000:01:00.0: enabling device (0000 -> 0003)
[   37.692780] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   37.692822] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   37.692832] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   37.692841] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   40.177371] [drm:intel_uncore_check_errors] *ERROR* Unclaimed register before interrupt
[   54.267555] vfio-pci 0000:01:00.0: Invalid ROM contents

This is not the right patch (it doesn't hurt tho).

Offline

#2239 2014-06-28 23:52:02

kameloc
Member
Registered: 2014-06-28
Posts: 11

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

dwe11er wrote:

This is not the right patch (it doesn't hurt tho).

Could you link me to the right patch? I tried both VGA patches from the OP with the same errors.

Offline

#2240 2014-06-29 09:44:41

_pheinrich_
Member
Registered: 2014-05-26
Posts: 53

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

Hi,

I havn't found an answer while searching if it is possible to redirect the output from a gpu passed through to a normal qemu window?

Is there an option to pass an ps/2 keyboard to the vm? I have read something about this and thought it would bind automatically but my keyboard stays in the host scope.

If I bind a usb hub with vfio-bind I can use it inside the vm, but if I shutdown the vm I would like to use that usb hub on my host again. I tried this but without luck:

/usr/bin/vfio-unbind

#!/bin/bash                                                                                                                                    
                                                                                                                                               
for dev in "$@"; do                                                                                                                            
                                                                                                                                               
        vendor=$(cat /sys/bus/pci/devices/$dev/vendor)                                                                                         
        device=$(cat /sys/bus/pci/devices/$dev/device)                                                                                         
                                                                                                                                               
        echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/remove_id                                                                         
                                                                                                                                               
        if [ -e /sys/bus/pci/devices/$dev/driver ]; then                                                                                       
                echo $dev > /sys/bus/pci/devices/$dev/driver/bind                                                                              
        fi                                                                                                                                     
                                                                                                                                               
done 

Offline

#2241 2014-06-29 14:21:27

dwe11er
Member
Registered: 2014-03-18
Posts: 73

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

kameloc wrote:
dwe11er wrote:

This is not the right patch (it doesn't hurt tho).

Could you link me to the right patch? I tried both VGA patches from the OP with the same errors.

Along with patches, you need to add 'i915.enable_hd_vgaarb=1' to kernel params. Also, you prob need to aquire vbios file for your gpu and pass it with romfile arg during the vm boot.

Offline

#2242 2014-06-29 15:42:23

sinny
Member
Registered: 2014-05-24
Posts: 75

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

kameloc wrote:
dwe11er wrote:

This is not the right patch (it doesn't hurt tho).

Could you link me to the right patch? I tried both VGA patches from the OP with the same errors.

this is what works for me (vga arbioter patch link inlcuded)

Offline

#2243 2014-06-29 15:51:48

sinny
Member
Registered: 2014-05-24
Posts: 75

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

_pheinrich_ wrote:

Hi,

I havn't found an answer while searching if it is possible to redirect the output from a gpu passed through to a normal qemu window?

can you "redirect" video from one physical computer to another physically separate one? there are certain ways for sure, most involving network. the same logic applies here

_pheinrich_ wrote:

Is there an option to pass an ps/2 keyboard to the vm? I have read something about this and thought it would bind automatically but my keyboard stays in the host scope.

If I bind a usb hub with vfio-bind I can use it inside the vm, but if I shutdown the vm I would like to use that usb hub on my host again. I tried this but without luck:


why not directly passing usb devices to qemu? in my case:

...
	-usbdevice host:04b4:0101 \
	-usbdevice host:1038:1366 \
...

specified mouse and keyboard get acquired by guest (stop interacting with host os) on its start.
when guest terminates, both keyboard and mouse get released (start interacting with host os again)

and yes, all these questions HAVE been disccussed in the thread. i know, it's pretty hard to look through all 90+ pages, but still

Offline

#2244 2014-06-29 22:47:59

abdullah
Member
Registered: 2014-06-10
Posts: 34

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

I dumped virt-manager, now using qemu through the command line, I managed to boot A windows iso, in the second screen, but! I'm facing the "Blue of Death Screen", will do more testing... \
side note: I have 2 identical keyboards, and to pass "not my host keyboard" I would need to unplug it first.

and an easy way to search the thread... use google with the parameter "site:https://bbs.archlinux.org/viewtopic.php?id=162768 "vfio" "kvm"", and add your key word at the end.

Offline

#2245 2014-06-30 04:01:34

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

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

abdullah wrote:

I dumped virt-manager, now using qemu through the command line, I managed to boot A windows iso, in the second screen, but! I'm facing the "Blue of Death Screen", will do more testing... \
side note: I have 2 identical keyboards, and to pass "not my host keyboard" I would need to unplug it first.

and an easy way to search the thread... use google with the parameter "site:https://bbs.archlinux.org/viewtopic.php?id=162768 "vfio" "kvm"", and add your key word at the end.

<hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <address bus='1' device='8'/>
      </source>
    </hostdev>

you can pass it like this with addess instead of ID.

Offline

#2246 2014-06-30 04:22:26

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

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

yeah i tested... pcie 3.0 gpus crashes with hdmi sound on gigbyte g1 sniper 3 in any port,, i belive pcie gen3 is problem... but there is no option in bios... i have option on my x77-ud3h so ill try later to lower pcie to 2.0.

Update:

after couple of days testing... i can conclude that HDMI sound on nvidia kepler+ cards (aka pcie 3.0) doesn't not work on h77 chipset and 2xxx processor.... (ill post update with 3770 when it arrives)
depending on settings, sound starts to lag in game, or if u force usage of sound like opening youtube while in game etc... eventualy windows stops responding saying Can't play sound or something like that...

it seems like mbo is changing speed of pcie (i think cause of processor pcie 2.0 vs gpu/mbo 3.0?), and when it changes sound desync and starts to lag.... turning off on output works for couple of seconds or so... (by lag i mean sound works but VERY SLOW, like 10-100 times slower, and eventualy it crashes game/windows)

tried it on 660,680,770 = same
560 = no problems, only difference is pcie2.0 vs 3.0 i guess...

on zx77-ud3h i have pcie port options in bios like, pcie mode= auto, gen1,gen2,gen3 = all starts to lag = different time to start, pcie_aspm=on/off/force

anyway usb sound card (5$) works...

About gaming performance...

I managed to get about 95%+ performace of native (even with 2 guests)... same on windows 7 or 8.1 x64, with any driver... 0 BSOD, 0 CRASHES, 0 PROBLEMS (except HDMI sound)
pcie 3.0 cards performs little slower than 2.0 in my case, i blame cpu.

i7 2600 & 2600s
G1 Sniper 3
ZX-77-UD3H
debian latest.... 3.15.1 + patches, qemu-git

Last edited by slis (2014-06-30 04:59:27)

Offline

#2247 2014-06-30 13:33:01

SpacePirate
Member
Registered: 2013-09-16
Posts: 55

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

Hi,

my setup still works fine, but I was just wondering whether it would be possible to somehow access the vms GPUs framebuffer from the host? Or is there some reason why this is impossible?

Offline

#2248 2014-06-30 13:56:40

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

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

SpacePirate wrote:

Hi,

my setup still works fine, but I was just wondering whether it would be possible to somehow access the vms GPUs framebuffer from the host? Or is there some reason why this is impossible?

Theoretically you can, but there's no code to support it.  Contributions welcome.


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

#2249 2014-06-30 18:52:28

_pheinrich_
Member
Registered: 2014-05-26
Posts: 53

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

Sry that I have to ask, but I do not know what I have done wrong that pci passthrough is not working anymore.

It was working as I used the vesa driver for my host card [6600 GT]. Now I have installed nvidia-304xx for that card.

If I try to start qemu now I get the following:

[pheinrich@ARCH ~]$ sudo win8
qemu-system-x86_64: -device vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: vfio: error, group 1 is not viable, please ensure all devices within the iommu_group are bound to their vfio bus driver.
qemu-system-x86_64: -device vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: vfio: failed to get group 1
qemu-system-x86_64: -device vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: Device initialization failed.
qemu-system-x86_64: -device vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: Device 'vfio-pci' could not be initialized

The GTX 260 should not be covered by the nvidia-304xx and it is claimed by pci-stub too.

[pheinrich@ARCH ~]$ lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation NV43 [GeForce 6600 GT] (rev a2)
02:00.0 VGA compatible controller: NVIDIA Corporation GT200 [GeForce GTX 260] (rev a1)
[pheinrich@ARCH ~]$ uname -a
Linux ARCH 3.15.1-1-acs #1 SMP PREEMPT Fri Jun 27 11:25:56 CEST 2014 x86_64 GNU/Linux
[pheinrich@ARCH ~]$ dmesg | grep pci-stub
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-linux-acs root=UUID=bd845dd5-0a31-4cd0-ae57-875c43f15c30 rw intel_iommu=on pci-stub.ids=10de:05e2
[    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux-acs root=UUID=bd845dd5-0a31-4cd0-ae57-875c43f15c30 rw intel_iommu=on pci-stub.ids=10de:05e2
[    0.779345] pci-stub: add 10DE:05E2 sub=FFFFFFFF:FFFFFFFF cls=00000000/00000000
[    0.779361] pci-stub 0000:02:00.0: claimed by stub

Last edited by _pheinrich_ (2014-06-30 18:52:40)

Offline

#2250 2014-06-30 18:55:33

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

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

The ACS patch requires a boot parameter to enable it


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

Board footer

Powered by FluxBB