You are not logged in.

#1301 2014-03-08 20:37:57

GNA
Member
Registered: 2011-02-15
Posts: 57

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

/sys/kernel/iommu_groups is empty.
My system is supporting vt-d and it should be enabled. I dont get it.
Did i miss something obvious? Thanks for help!

Offline

#1302 2014-03-08 20:43:24

pereczes
Member
Registered: 2014-03-08
Posts: 14

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

Hi,

thanks for this thread. Tried to follow the instructions, can boot into windows 7, though when installing AMD catalyst drivers the host is hanging.

relevant info:

lspci:

... (for usb keyboard for guest)
00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
... (NVIDIA for host)
01:00.0 VGA compatible controller: NVIDIA Corporation G71 [GeForce 7900 GT/GTO] (rev a1)
... (ATI for guest)
04:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cayman PRO [Radeon HD 6950]
04:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cayman/Antilles HDMI Audio [Radeon HD 6900 Series]
...

with the script mentioned @beginning of thread:

sudo vfio-bind 0000:04:00.0 0000:04:00.1 0000:00:12.0 0000:00:12.2

and my qemu command is:

/usr/local/bin/qemu-system-x86_64 \
   -M q35 \
   -vga none \
   -nographic \
   -cpu host \
   -machine accel=kvm \
   -bios /usr/local/share/qemu/bios.bin \
   -m 4096 \
   -smp 4,cores=4 \
   -drive file=win8.img,if=virtio \
   -netdev type=tap,ifname=tap0,script=no,id=net0 \
   -device virtio-net-pci,netdev=net0 \
   -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
   -device vfio-pci,host=04:00.0,bus=root.1,multifunction=on,x-vga=on,addr=0.0 \
   -device vfio-pci,host=04:00.1,bus=root.1,addr=0.1 \
   -device vfio-pci,host=00:12.0,bus=root.1 \
   -boot d

kernel: 3.13.5-031305-generic (ubuntu)

tried to unload nouveau from host card (or boot without it, by blacklisting), closed X, but whatsoever way I am doing, do not manage to have
the catalyst installed. Without catalyst it works, but need the powerfull graphics under windows with driver.

Any hints how I could narrow down the cause of host freeze?

thanks a lot in advance for your help

Offline

#1303 2014-03-09 08:10:44

AKSN74
Member
From: Taichung, Taiwan
Registered: 2014-02-18
Posts: 52

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

Hello guys, now I have another problem here.

I successfully pass-through my GTX770 into my KVM, and it works perfectly.
But I'm using Ubuntu to do this I'll try Archlinux in these days.

Here is my question.

If I want to pass-through 2 GPUs into 2 VMs (each VM have 1 GPU), and these GPU is same (Ex. Both GTX480)
Is VFIO or pci-stub will got 'conflict' when I entered hardware ID into pci-stub or VFIO?
Because same GPU have same hardware ID, and pci-stub.ids is input hardware ID only. (In bootloader cfg)

Is someone do this before?

Last edited by AKSN74 (2014-03-09 08:13:23)

Offline

#1304 2014-03-09 08:45:43

zzz3000
Member
Registered: 2014-02-16
Posts: 12

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

to pereczes
I have the same problem with intel host and Windows7 hd7750 guest...

Offline

#1305 2014-03-09 13:01:43

FruitieX
Member
Registered: 2008-07-03
Posts: 18

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

KVM VGA passthrough confirmed working with an AMD Radeon R9 280X graphics card, host is Arch and guest Windows 8.1. More relevant specs:

Mainboard: Asrock Z87M Pro4 Socket LGA 1150
CPU: Intel Core i5 4670 3.4 GHz LGA 1150
Graphics card: Asus Radeon R9 280X DirectCU II TOP 3 GB GDDR5

To pereczes and zzz3000: I initially had issues with crashing (and refusing to boot again) right after Windows would either automatically install the video drivers or after I'd do so manually (Catalyst). To fix this I:

1. Compiled latest qemu and seabios from git, used these. Had to comment out an assertion otherwise the code wouldn't compile. (probably not a great idea smile)
2. Passed through only the video card, not the HDMI audio interface on it. I'm not sure if this actually helped the cause, I'll do some further testing once I get back home tonight. In the qemu version found in Arch repos this would cause the passed through display to show garbled output but it works in the git version.

Offline

#1306 2014-03-09 13:23:57

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

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

AKSN74 wrote:

Here is my question.

If I want to pass-through 2 GPUs into 2 VMs (each VM have 1 GPU), and these GPU is same (Ex. Both GTX480)
Is VFIO or pci-stub will got 'conflict' when I entered hardware ID into pci-stub or VFIO?
Because same GPU have same hardware ID, and pci-stub.ids is input hardware ID only. (In bootloader cfg)

Is someone do this before?

If you intend to pass both through to guests, it shouldn't matter.  If you use pci-stub.ids= with the single vendor:device ID, both devices will be claimed.  You can then individually more them over to vfio-pci.  Multiple identical devices is usually only a problem if you intend one to be used by the host.


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

#1307 2014-03-09 23:37:34

mastersplinter777
Member
Registered: 2012-10-09
Posts: 8

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

Hi! I managed to successfully pass thru my Sparkle GTS450 1024M GPU to Windows 8.1 VM. But now I'm trying to do the same with OSX 10.9 guest:

spicec --host 127.0.0.1 --port 5908 &
sudo qemu-system-x86_64 \
-enable-kvm \
-bios '/opt/Qemu/OSX/bios-1.7.4-osx.bin' \
-smp 2,sockets=1,cores=2,threads=1 \
-spice port=5908,disable-ticketing \
-chardev spicevmc,id=vdagent,name=vdagent \
-device virtio-serial \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
-M q35 \
-m 4096 \
-cpu core2duo \
-rtc base=localtime \
-vga none \
-device ich9-usb-uhci1,id=usb1,bus=pcie.0 \
-usb -usbdevice host:15ca:00c3 \
-net nic,macaddr=00:00:00:8a:2b:2c,model=virtio,id=netkvm \
-net bridge \
-device ich9-intel-hda,bus=pcie.0,addr=1b.0,id=sound0 \
-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \
-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 piix4-ide,addr=1a.0,bus=pcie.0 \
-drive file='/opt/Qemu/OSX/osx.img',id=hd,format=raw -device ide-hd,bus=ide.0,drive=hd

and get message (after connecting to VM thru ssh):

NVDA,Display-A: Not usable
NVDA,Display-B: Not usable

Also, when I try to do it using AMD 7770 GPU - Chameleon just hangs with a lot of unreadable symbols.
Could you please help me to solve this problem or maybe try to do the same youself?

P.S.: In the past I used pci-assign and successfully passed my AMD GPU to VM: https://www.linux.org.ru/gallery/screen … 6#comments

Last edited by mastersplinter777 (2014-03-09 23:40:32)

Offline

#1308 2014-03-10 01:49:09

AKSN74
Member
From: Taichung, Taiwan
Registered: 2014-02-18
Posts: 52

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

aw wrote:
AKSN74 wrote:

Here is my question.

If I want to pass-through 2 GPUs into 2 VMs (each VM have 1 GPU), and these GPU is same (Ex. Both GTX480)
Is VFIO or pci-stub will got 'conflict' when I entered hardware ID into pci-stub or VFIO?
Because same GPU have same hardware ID, and pci-stub.ids is input hardware ID only. (In bootloader cfg)

Is someone do this before?

If you intend to pass both through to guests, it shouldn't matter.  If you use pci-stub.ids= with the single vendor:device ID, both devices will be claimed.  You can then individually more them over to vfio-pci.  Multiple identical devices is usually only a problem if you intend one to be used by the host.

Roger that! I'll try in these days, thanks for ur answers.

Offline

#1309 2014-03-10 07:21:44

swex
Member
Registered: 2014-03-09
Posts: 1

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

Yea! Second day and I've got it working.
Asrock Z77 Extreme3
Intel Core i7-3770
Nvidia Geforce GT640 - host
AMD Radeon HD 7750
git qemu - no patches
patched ACS kubuntu 14.04  kernel
patched nvidia host driver.

Offline

#1310 2014-03-10 10:11:10

deniv
Member
Registered: 2013-10-16
Posts: 27

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

I'm trying to get 3.14rc6 work with dirty debug registers patches (http://www.spinics.net/lists/kvm/msg100840.html). A minor annoyance is that the first patch doesn't apply cleanly, I have to do it manually. But the biggest issue is that kernel fails to compile:

arch/x86/kvm/vmx.c: In function ‘vmx_sync_dirty_debug_regs’:
arch/x86/kvm/vmx.c:5155:2: error: implicit declaration of function ‘get_debugreg’ [-Werror=implicit-function-declaration]
  get_debugreg(vcpu->arch.db[0], 0);
  ^

Can somebody help me?

Offline

#1311 2014-03-10 20:22:18

trimm
Member
Registered: 2014-03-06
Posts: 31

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

aw wrote:
keatsfonam wrote:

EDIT2:

All problems solved by avoiding letting vfio-pci take the device from pci-stub upon starting the vm with the script provided.  Thanks

What exactly does that mean?

BTW, as of this morning everything except i915 vga arbiter stuff is in upstream, kernel and qemu.


I was perhaps a tad to fast saying that my GTX670 was pass through perfectly. I also get the dreaded error code 43 error people have been having.
I keep see references to a patch of yours aw, but is this already implemented upstream or do I have to compile "qemu-vfio-vfio-pci-for-qemu-20131003.0" for my arch install? (Quoting a post you made a couple of weeks ago)

When I boot my Win8.1 install I get the following in journalctl:

Mar 10 22:10:45 arch kernel: vfio-pci 0000:01:00.0: enabling device (0000 -> 0003)
Mar 10 22:10:45 arch kernel: vfio_ecap_init: 0000:01:00.0 hiding ecap 0x19@0x900
Mar 10 22:10:54 arch kernel: kvm: zapping shadow pages for mmio generation wraparound
Mar 10 22:10:56 arch kernel: vfio-pci 0000:00:19.0: irq 48 for MSI/MSI-X

I use the following script to start my VM:

#!/bin/bash

# bind gtx 670, gpu audio and secondary network card

echo -n "Binding devices..."
sudo vfio-bind 0000:01:00.0 0000:01:00.1 0000:00:19.0
echo "done"

echo "Starting Synergy"
sudo systemctl start synergys@trimm
echo "Done"

echo -n "Disabling display VGA1..."
xrandr --output VIRTUAL1 --off --output DP1 --off --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal --output HDMI2 --off --output HDMI1 --off --output VGA1 --off

# use pulseaudio
#export QEMU_AUDIO_DRV=pa

echo -n "Starting VIRTUAL machine..."

sudo qemu-system-x86_64 \
-enable-kvm \
-M q35 \
-m 16384 \
-cpu host \
-smp 6,sockets=1,cores=6,threads=1 \
-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 \
-nographic \
-device ahci,bus=pcie.0,id=ahci \
-drive file=/var/lib/libvirt/images/Windows8.1.img,id=disk,format=raw \
-device ide-hd,bus=ahci.0,drive=disk \
-device vfio-pci,host=00:19.0,bus=pcie.0 


echo "Done"

sudo systemctl stop synergys@trimm

echo -n "Restoring display VGA1.."
xrandr --output VIRTUAL1 --off --output DP1 --off --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal --output HDMI2 --off --output HDMI1 --off --output VGA1 --mode 1920x1080 --pos 0x0 --rotate normal

echo "done"

My setup at the moment is perfect for me, the only (small?) problem is the error code 43 issue.
Any help is greatly appreciated.

Offline

#1312 2014-03-10 20:39:07

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

trimm wrote:
aw wrote:
keatsfonam wrote:

EDIT2:

All problems solved by avoiding letting vfio-pci take the device from pci-stub upon starting the vm with the script provided.  Thanks

What exactly does that mean?

BTW, as of this morning everything except i915 vga arbiter stuff is in upstream, kernel and qemu.


I was perhaps a tad to fast saying that my GTX670 was pass through perfectly. I also get the dreaded error code 43 error people have been having.
I keep see references to a patch of yours aw, but is this already implemented upstream or do I have to compile "qemu-vfio-vfio-pci-for-qemu-20131003.0" for my arch install? (Quoting a post you made a couple of weeks ago)

When I boot my Win8.1 install I get the following in journalctl:

Mar 10 22:10:45 arch kernel: vfio-pci 0000:01:00.0: enabling device (0000 -> 0003)
Mar 10 22:10:45 arch kernel: vfio_ecap_init: 0000:01:00.0 hiding ecap 0x19@0x900
Mar 10 22:10:54 arch kernel: kvm: zapping shadow pages for mmio generation wraparound
Mar 10 22:10:56 arch kernel: vfio-pci 0000:00:19.0: irq 48 for MSI/MSI-X

I use the following script to start my VM:

#!/bin/bash

# bind gtx 670, gpu audio and secondary network card

echo -n "Binding devices..."
sudo vfio-bind 0000:01:00.0 0000:01:00.1 0000:00:19.0
echo "done"

echo "Starting Synergy"
sudo systemctl start synergys@trimm
echo "Done"

echo -n "Disabling display VGA1..."
xrandr --output VIRTUAL1 --off --output DP1 --off --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal --output HDMI2 --off --output HDMI1 --off --output VGA1 --off

# use pulseaudio
#export QEMU_AUDIO_DRV=pa

echo -n "Starting VIRTUAL machine..."

sudo qemu-system-x86_64 \
-enable-kvm \
-M q35 \
-m 16384 \
-cpu host \
-smp 6,sockets=1,cores=6,threads=1 \
-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 \
-nographic \
-device ahci,bus=pcie.0,id=ahci \
-drive file=/var/lib/libvirt/images/Windows8.1.img,id=disk,format=raw \
-device ide-hd,bus=ahci.0,drive=disk \
-device vfio-pci,host=00:19.0,bus=pcie.0 


echo "Done"

sudo systemctl stop synergys@trimm

echo -n "Restoring display VGA1.."
xrandr --output VIRTUAL1 --off --output DP1 --off --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal --output HDMI2 --off --output HDMI1 --off --output VGA1 --mode 1920x1080 --pos 0x0 --rotate normal

echo "done"

My setup at the moment is perfect for me, the only (small?) problem is the error code 43 issue.
Any help is greatly appreciated.

are you using my qemu-git and seabios-git packages?

Offline

#1313 2014-03-10 21:07:27

Blind Tree Frog
Member
Registered: 2013-12-31
Posts: 27

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

Bronek wrote:
Blind Tree Frog wrote:

1) Do I need multiple video cards or can this be done with just one? ...

2) Any source I should look at to set this up from a fresh install? ...

I also plan to build such a machine, with essentially headless host and Windows running on selected cores with VGA passthrough. For the time being my plan is to use the newest stable kernel and rely on top post in this thread, since it seems to be kept up-to date (thanks nbhs !)

I've been swamped lately and I'm only now getting back to this thread, but I noticed that it looks like my first question might be doable.  So 'yay!' for that.  Skimming also seems to suggest that powering through the first post is going to be my best option for the second.

I'm planning on reinstalling my machine this week and give this another go.  Hopefully I'll get it working and be able to report back with great success.  I'll be sure to take notes.

Offline

#1314 2014-03-10 21:23:09

Blind Tree Frog
Member
Registered: 2013-12-31
Posts: 27

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

nbhs wrote:

RIght now im passing through my primary card (radeon 6950) what i did was, use pci-stub to bind it at boot and i disabled the efifb framebuffer with video=efifb:off on my grub cmdline

While using VFIO or no?

Just checking since you said this earlier...

nbhs wrote:

You should set you primary boot device as IGP instead of pcie, vfio-vga wont work on you primary vga device.

... and I wasn't sure if you've learned a different approach or if you found a setting that you didn't know about then (I'm assuming you just found the 'efifb' setting you mention above)

EDIT:
and how did i never notice post 40 about you doing this in XEN.... bah... reading is hard apparently.

Last edited by Blind Tree Frog (2014-03-10 21:45:57)

Offline

#1315 2014-03-10 21:23:37

trimm
Member
Registered: 2014-03-06
Posts: 31

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

nbhs wrote:
trimm wrote:
aw wrote:

What exactly does that mean?

BTW, as of this morning everything except i915 vga arbiter stuff is in upstream, kernel and qemu.


I was perhaps a tad to fast saying that my GTX670 was pass through perfectly. I also get the dreaded error code 43 error people have been having.
I keep see references to a patch of yours aw, but is this already implemented upstream or do I have to compile "qemu-vfio-vfio-pci-for-qemu-20131003.0" for my arch install? (Quoting a post you made a couple of weeks ago)

When I boot my Win8.1 install I get the following in journalctl:

Mar 10 22:10:45 arch kernel: vfio-pci 0000:01:00.0: enabling device (0000 -> 0003)
Mar 10 22:10:45 arch kernel: vfio_ecap_init: 0000:01:00.0 hiding ecap 0x19@0x900
Mar 10 22:10:54 arch kernel: kvm: zapping shadow pages for mmio generation wraparound
Mar 10 22:10:56 arch kernel: vfio-pci 0000:00:19.0: irq 48 for MSI/MSI-X

I use the following script to start my VM:

#!/bin/bash

# bind gtx 670, gpu audio and secondary network card

echo -n "Binding devices..."
sudo vfio-bind 0000:01:00.0 0000:01:00.1 0000:00:19.0
echo "done"

echo "Starting Synergy"
sudo systemctl start synergys@trimm
echo "Done"

echo -n "Disabling display VGA1..."
xrandr --output VIRTUAL1 --off --output DP1 --off --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal --output HDMI2 --off --output HDMI1 --off --output VGA1 --off

# use pulseaudio
#export QEMU_AUDIO_DRV=pa

echo -n "Starting VIRTUAL machine..."

sudo qemu-system-x86_64 \
-enable-kvm \
-M q35 \
-m 16384 \
-cpu host \
-smp 6,sockets=1,cores=6,threads=1 \
-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 \
-nographic \
-device ahci,bus=pcie.0,id=ahci \
-drive file=/var/lib/libvirt/images/Windows8.1.img,id=disk,format=raw \
-device ide-hd,bus=ahci.0,drive=disk \
-device vfio-pci,host=00:19.0,bus=pcie.0 


echo "Done"

sudo systemctl stop synergys@trimm

echo -n "Restoring display VGA1.."
xrandr --output VIRTUAL1 --off --output DP1 --off --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal --output HDMI2 --off --output HDMI1 --off --output VGA1 --mode 1920x1080 --pos 0x0 --rotate normal

echo "done"

My setup at the moment is perfect for me, the only (small?) problem is the error code 43 issue.
Any help is greatly appreciated.

are you using my qemu-git and seabios-git packages?


I am afraid not, this is the result while using qemu-git and seabios-git: qemu-system-x86_64: hw/pci/pcie.c:240: pcie_cap_slot_hotplug_common: Assertion `((pci_dev->devfn) & 0x07) == 0' failed.

Last edited by trimm (2014-03-10 21:24:42)

Offline

#1316 2014-03-10 21:26:10

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

trimm wrote:
nbhs wrote:
trimm wrote:

I was perhaps a tad to fast saying that my GTX670 was pass through perfectly. I also get the dreaded error code 43 error people have been having.
I keep see references to a patch of yours aw, but is this already implemented upstream or do I have to compile "qemu-vfio-vfio-pci-for-qemu-20131003.0" for my arch install? (Quoting a post you made a couple of weeks ago)

When I boot my Win8.1 install I get the following in journalctl:

Mar 10 22:10:45 arch kernel: vfio-pci 0000:01:00.0: enabling device (0000 -> 0003)
Mar 10 22:10:45 arch kernel: vfio_ecap_init: 0000:01:00.0 hiding ecap 0x19@0x900
Mar 10 22:10:54 arch kernel: kvm: zapping shadow pages for mmio generation wraparound
Mar 10 22:10:56 arch kernel: vfio-pci 0000:00:19.0: irq 48 for MSI/MSI-X

I use the following script to start my VM:

#!/bin/bash

# bind gtx 670, gpu audio and secondary network card

echo -n "Binding devices..."
sudo vfio-bind 0000:01:00.0 0000:01:00.1 0000:00:19.0
echo "done"

echo "Starting Synergy"
sudo systemctl start synergys@trimm
echo "Done"

echo -n "Disabling display VGA1..."
xrandr --output VIRTUAL1 --off --output DP1 --off --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal --output HDMI2 --off --output HDMI1 --off --output VGA1 --off

# use pulseaudio
#export QEMU_AUDIO_DRV=pa

echo -n "Starting VIRTUAL machine..."

sudo qemu-system-x86_64 \
-enable-kvm \
-M q35 \
-m 16384 \
-cpu host \
-smp 6,sockets=1,cores=6,threads=1 \
-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 \
-nographic \
-device ahci,bus=pcie.0,id=ahci \
-drive file=/var/lib/libvirt/images/Windows8.1.img,id=disk,format=raw \
-device ide-hd,bus=ahci.0,drive=disk \
-device vfio-pci,host=00:19.0,bus=pcie.0 


echo "Done"

sudo systemctl stop synergys@trimm

echo -n "Restoring display VGA1.."
xrandr --output VIRTUAL1 --off --output DP1 --off --output HDMI3 --mode 1920x1080 --pos 1920x0 --rotate normal --output HDMI2 --off --output HDMI1 --off --output VGA1 --mode 1920x1080 --pos 0x0 --rotate normal

echo "done"

My setup at the moment is perfect for me, the only (small?) problem is the error code 43 issue.
Any help is greatly appreciated.

are you using my qemu-git and seabios-git packages?


I am afraid not, this is the result while using qemu-git and seabios-git: qemu-system-x86_64: hw/pci/pcie.c:240: pcie_cap_slot_hotplug_common: Assertion `((pci_dev->devfn) & 0x07) == 0' failed.

Oh yeah my bad, i forgot to update it on the first post, try this one qemu-git.tar.gz
Sorry again its this one: qemu-git.tar.gz

Last edited by nbhs (2014-03-10 21:33:17)

Offline

#1317 2014-03-10 21:43:20

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

GNA wrote:

/sys/kernel/iommu_groups is empty.
My system is supporting vt-d and it should be enabled. I dont get it.
Did i miss something obvious? Thanks for help!

perhaps you forgot to boot with intel_iommu=on

Offline

#1318 2014-03-10 21:53:09

trimm
Member
Registered: 2014-03-06
Posts: 31

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

nbhs wrote:
trimm wrote:
nbhs wrote:

are you using my qemu-git and seabios-git packages?


I am afraid not, this is the result while using qemu-git and seabios-git: qemu-system-x86_64: hw/pci/pcie.c:240: pcie_cap_slot_hotplug_common: Assertion `((pci_dev->devfn) & 0x07) == 0' failed.

Oh yeah my bad, i forgot to update it on the first post, try this one qemu-git.tar.gz
Sorry again its this one: qemu-git.tar.gz

Tried with your second qemu-git and get the following:

cp: cannot stat '/home/thor/Downloads/qemu-git/src/qemu-git-2.0.r31488.gb304bf0/.libs/libcacard.so*': No such file or directory
==> ERROR: A failure occurred in package_libcacard-git().
    Aborting...

Edit: I tried starting my virtual machine(after I installed the newest qemu-git and ignoring libcacard-git) but now I got issues with my hard drive. "Booting from Hard Disk: boot failed, could not read the boot disk"

Last edited by trimm (2014-03-10 22:14:25)

Offline

#1319 2014-03-10 22:14:26

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

trimm wrote:
nbhs wrote:
trimm wrote:

I am afraid not, this is the result while using qemu-git and seabios-git: qemu-system-x86_64: hw/pci/pcie.c:240: pcie_cap_slot_hotplug_common: Assertion `((pci_dev->devfn) & 0x07) == 0' failed.

Oh yeah my bad, i forgot to update it on the first post, try this one qemu-git.tar.gz
Sorry again its this one: qemu-git.tar.gz

Tried with your second qemu-git and get the following:

cp: cannot stat '/home/thor/Downloads/qemu-git/src/qemu-git-2.0.r31488.gb304bf0/.libs/libcacard.so*': No such file or directory
==> ERROR: A failure occurred in package_libcacard-git().
    Aborting...

I downloaded the second package i linked and it builds and installs fine ( qemu-git.tar.gz ), and since you also managed to build the first package i posted, perhaps you're working on an unclean folder, try deleting the qemu-git folder, unpack my package and build it again

Offline

#1320 2014-03-10 22:36:08

trimm
Member
Registered: 2014-03-06
Posts: 31

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

nbhs wrote:
trimm wrote:
nbhs wrote:

Oh yeah my bad, i forgot to update it on the first post, try this one qemu-git.tar.gz
Sorry again its this one: qemu-git.tar.gz

Tried with your second qemu-git and get the following:

cp: cannot stat '/home/thor/Downloads/qemu-git/src/qemu-git-2.0.r31488.gb304bf0/.libs/libcacard.so*': No such file or directory
==> ERROR: A failure occurred in package_libcacard-git().
    Aborting...

I downloaded the second package i linked and it builds and installs fine ( qemu-git.tar.gz ), and since you also managed to build the first package i posted, perhaps you're working on an unclean folder, try deleting the qemu-git folder, unpack my package and build it again

Weird, I tried to delete the old folder and build it again but the issue persists.
However, I installed the qemu-git package, rebooted and now my GPU is working in WIndows 8.1VM without any errors. Thank you so much nbhs!

Offline

#1321 2014-03-11 10:12:25

alexis_evo
Member
Registered: 2013-07-04
Posts: 33

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

zoop2 wrote:

From here i am looking to implement the Debug registers patch that was mentioned by @aw a while back to improve performance.  I am wondering what kernel that Patch was for, I am assuming it was for 3.13.x.

The second debug register patchset that @aw posted (the generic one that works on AMD as well) is definitely for a newer kernel than 3.13.x. I used linux-mainline from AUR (3.14rc6 I think) and managed to get it compiling, but you'll need to fix a couple of the patches.

Actually, here... I've uploaded my changes to the PKGBUILD/patches here. https://gist.github.com/anonymous/9482833

You'll need to download linux-mainline from the AUR, extract it, copy all of the .patch files from linux-mainline.tar.gz (the one in OP, not in AUR) into the new folder, replace the PKGBUILD with the one supplied, download all of the patches from that gist, then it should compile fine.

I'm not quite sure what version that patchset was made for. I compared the diffs against the latest git and it still didn't match up. The diff files had lines/changes that didn't exist in the current git. But I don't know much about the kernel release/cvs structure, so maybe there's a newer version than the main git.

Offline

#1322 2014-03-11 11:35:53

pereczes
Member
Registered: 2014-03-08
Posts: 14

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

FruitieX wrote:

To pereczes and zzz3000: I initially had issues with crashing (and refusing to boot again) right after Windows would either automatically install the video drivers or after I'd do so manually (Catalyst). To fix this I:
1. Compiled latest qemu and seabios from git, used these. Had to comment out an assertion otherwise the code wouldn't compile. (probably not a great idea smile)
2. Passed through only the video card, not the HDMI audio interface on it. I'm not sure if this actually helped the cause, I'll do some further testing once I get back home tonight. In the qemu version found in Arch repos this would cause the passed through display to show garbled output but it works in the git version.

@FruitieX: not clear from your post: crashing of host or guest? I assume host.

cloned git repo, built it (version 1.7.50)... BTW would be lovely if qemu people would embedd some extra commit version info into the version string
removed the

-device vfio-pci,host=04:00.1,bus=root.1,addr=0.1

line (HDMI sound)

but no changes... host is freezing once windows is trying to activate the catalyst driver (I assume that is the moment)

would be interesting to know what could be traced at this moment for easier investigation

Offline

#1323 2014-03-11 15:32:04

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

deniv wrote:

I'm trying to get 3.14rc6 work with dirty debug registers patches (http://www.spinics.net/lists/kvm/msg100840.html). A minor annoyance is that the first patch doesn't apply cleanly, I have to do it manually. But the biggest issue is that kernel fails to compile:

arch/x86/kvm/vmx.c: In function ‘vmx_sync_dirty_debug_regs’:
arch/x86/kvm/vmx.c:5155:2: error: implicit declaration of function ‘get_debugreg’ [-Werror=implicit-function-declaration]
  get_debugreg(vcpu->arch.db[0], 0);
  ^

Can somebody help me?

I just uploaded a new kernel package on the front page (3.13.6) that includes this patch

Offline

#1324 2014-03-11 18:15:43

Flyser
Member
Registered: 2013-12-19
Posts: 29

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

nbhs wrote:

I just uploaded a new kernel package on the front page (3.13.6) that includes this patch

Since I am not using arch, I tried to apply fix_reading_of_DR6.patch and debug_registers.patch from your linux-mainline tarball on top of 3.13.6, but if fails with

  CC [M]  arch/x86/kvm/../../../virt/kvm/vfio.o
arch/x86/kvm/vmx.c: In function 'vmx_sync_dirty_debug_regs':
arch/x86/kvm/vmx.c:5124:2: error: implicit declaration of function 'get_debugreg' [-Werror=implicit-function-declaration]
make[3]: `arch/x86/realmode/rm/realmode.bin' is up to date.
  CC [M]  arch/x86/kvm/../../../virt/kvm/assigned-dev.o
cc1: some warnings being treated as errors
make[2]: *** [arch/x86/kvm/vmx.o] Error 1
make[2]: *** Waiting for unfinished jobs....
  CHK     kernel/config_data.h
make[1]: *** [arch/x86/kvm] Error 2
make: *** [arch/x86] Error 2
make: *** Waiting for unfinished jobs....

Anything I am missing?

EDIT: Adding "#include <asm/debugreg.h>" to arch/x86/kvm/vmx.c fixed the error. Maybe you could update the patch?

Last edited by Flyser (2014-03-11 18:27:53)

Offline

#1325 2014-03-11 18:22:38

deniv
Member
Registered: 2013-10-16
Posts: 27

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

nbhs wrote:

I just uploaded a new kernel package on the front page (3.13.6) that includes this patch

B-but, but! 3.13 doesn't support hv-time. sad

Offline

Board footer

Powered by FluxBB