You are not logged in.

#501 2013-09-20 08:05:55

gosheto
Member
Registered: 2013-09-04
Posts: 7

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

Hi,

I`m using latest stable kernel 3.11.1 with your linux-mainline.tar.gz (3.11) - all patches and configured with your config.x86_64
Qemu version 1.6.0 patched with your qemu.tar.gz (1.6)
SeaBIOS v1.7.3 QEMU/KVM image - bios.bin-1.7.3.gz

Offline

#502 2013-09-21 03:52:55

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

gosheto wrote:

Hi,

I`m using latest stable kernel 3.11.1 with your linux-mainline.tar.gz (3.11) - all patches and configured with your config.x86_64
Qemu version 1.6.0 patched with your qemu.tar.gz (1.6)
SeaBIOS v1.7.3 QEMU/KVM image - bios.bin-1.7.3.gz

Have you tried the previous qemu version? im having some problems myself using qemu 1.6 ( system crawls and eventually hangs at windows login prompt)

Offline

#503 2013-09-23 02:19:59

Smasher816
Member
Registered: 2012-03-15
Posts: 32
Website

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

Awesome write  nbhs. Unfortunately I am having some strange issues.

I have an AMD FX processor, a Gigabyte motherboard (with IOMMU support), an Nvidia GTX graphics card (for Linux, primary card in bios, proprietary driver), and an ATI Radeon HD 5770 (for Windows). I successfully got vga passthrough working with Xen in the past, but it made the dom0 graphics acceleration fail. I am now attempting this KVM method which looks promising.

If I do not have the nvidia module built and boot  into the command line I can successfully see the ati card working. However, once I install the nvidia module and boot into X, all I get is a black screen on the second card.

I am attempting to test the passthrough with these commands:

$ sudo vfio-bind 0000:01:00.0 0000:01:00.1
$ sudo qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host \
-smp 6,sockets=1,cores=6,threads=1 \
-bios /usr/share/qemu/bios.bin -vga none -nographic \
-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

Installed packages (patched versions from first post):

linux-mainline 3.11-1
linux-mainline-headers 3.11-1
qemu 1.6.0-9
seabios 1.7.3-1
nvidia-304xx 304.108-5 (rebuilt for linux-mainline kernel)

lspci output:

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Juniper XT [Radeon HD 5770]
	Subsystem: PC Partner Limited Device e132
	Kernel driver in use: vfio-pci
	Kernel modules: radeon
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Juniper HDMI Audio [Radeon HD 5700 Series]
	Subsystem: PC Partner Limited Device aa58
	Kernel driver in use: vfio-pci
	Kernel modules: snd_hda_intel

Edit: Fixed. See this patch http://lists.gnu.org/archive/html/qemu- … 9_I13p.txt

Last edited by Smasher816 (2013-09-23 02:51:42)


(Arch) Linux is user friendly, its just very selective of its friends

Offline

#504 2013-09-23 02:47:08

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

Smasher816 wrote:

Awesome write  nbhs. Unfortunately I am having some strange issues.

I have an AMD FX processor, a Gigabyte motherboard (with IOMMU support), an Nvidia GTX graphics card (for Linux, primary card in bios, proprietary driver), and an ATI Radeon HD 5770 (for Windows). I successfully got vga passthrough working with Xen in the past, but it made the dom0 graphics acceleration fail. I am now attempting this KVM method which looks promising.

If I do not have the nvidia module built and boot  into the command line I can successfully see the ati card working. However, once I install the nvidia module and boot into X, all I get is a black screen on the second card.

I am attempting to test the passthrough with these commands:

$ sudo vfio-bind 0000:01:00.0 0000:01:00.1
$ sudo qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host \
-smp 6,sockets=1,cores=6,threads=1 \
-bios /usr/share/qemu/bios.bin -vga none -nographic \
-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

Installed packages (patched versions from first post):

linux-mainline 3.11-1
linux-mainline-headers 3.11-1
qemu 1.6.0-9
seabios 1.7.3-1
nvidia-304xx 304.108-5 (rebuilt for linux-mainline kernel)

lspci output:

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Juniper XT [Radeon HD 5770]
	Subsystem: PC Partner Limited Device e132
	Kernel driver in use: vfio-pci
	Kernel modules: radeon
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Juniper HDMI Audio [Radeon HD 5700 Series]
	Subsystem: PC Partner Limited Device aa58
	Kernel driver in use: vfio-pci
	Kernel modules: snd_hda_intel

Its on the guide

nbhs wrote:

Using NVIDIA proprietary drivers on the requires a patch: see http://www.mail-archive.com/qemu-devel@ … 74066.html  patch (posted by andy123):  http://bpaste.net/show/109185/

Good luck!

Last edited by nbhs (2013-09-23 02:48:03)

Offline

#505 2013-09-23 02:56:14

Smasher816
Member
Registered: 2012-03-15
Posts: 32
Website

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

nbhs wrote:
Smasher816 wrote:

<snip>

Its on the guide

nbhs wrote:

Using NVIDIA proprietary drivers on the requires a patch: see http://www.mail-archive.com/qemu-devel@ … 74066.html  patch (posted by andy123):  http://bpaste.net/show/109185/

Good luck!

Thanks for the quick reply. It works now big_smile

I ended up finding a link to the same patch on page 16. I read through the first post once before actually attempting anything. I guess when I skimmed over it a second time I managed to miss that link.


(Arch) Linux is user friendly, its just very selective of its friends

Offline

#506 2013-09-23 03:04:56

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

Smasher816 wrote:
nbhs wrote:
Smasher816 wrote:

<snip>

Its on the guide

nbhs wrote:

Using NVIDIA proprietary drivers on the requires a patch: see http://www.mail-archive.com/qemu-devel@ … 74066.html  patch (posted by andy123):  http://bpaste.net/show/109185/

Good luck!

Thanks for the quick reply. It works now big_smile

I ended up finding a link to the same patch on page 16. I read through the first post once before actually attempting anything. I guess when I skimmed over it a second time I managed to miss that link.

Nice, i just realized there was a typo i forgot the word "host", anyway check out my second post on "performance improvements", specifically disabling npt.

Offline

#507 2013-09-24 01:23:21

Smasher816
Member
Registered: 2012-03-15
Posts: 32
Website

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

Alright. My windows.img (Windows 7, raw file) used with Xen works under KVM too.

I am now attempting to virtualize the physical Windows partition I dual-boot into. My Arch Linux install is on an ssd (sda1), and Windows is on a hard drive (sdb3). lspci only shows one SATA controller, therefore I am passing through my whole second hard drive (which has its own bootloader).

Passing /dev/sdb to Qemu shows the Syslinux bootloader, and then begins booting Windows. Unfortunately it quickly blue screens of death with the error "*** STOP: 0x0000007B (0xFFFFF880009A97E8,0xFFFFFFFFC0000034,0x0000000000000000,0x0000000000000000)". I believe this means that Windows does not like the Qemu disk controller (piix4-ide). When booting in in ahci mode it will error before Windows starts (bios is in IDE mode if I remember correctly). Is it possible to have qemu use a different device Windows 7 will recognize? Perhaps there is a way to boot into Windows and install some drivers before virtualizing it with qemu?

I also have an issue with audio. When using the two lines from your original post any sounds made in the Windows vm will stutter badly. With Xen I passed through my onboard audio controller, and used a dedicated sound card for Linux. I then had the speaker port of one plugged into line in of the other. When trying this with KVM I face issues. When I use vfio-bind on 0000:00:14.2 my sound stops working. Note: alsa is configured to use the CMI8768 card and the onboard should be disabled with "pci-stubs.ids=....".

The two cards are:

00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)
05:06.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10)

Thanks in advance for any help.

Last edited by Smasher816 (2013-09-24 01:36:48)


(Arch) Linux is user friendly, its just very selective of its friends

Offline

#508 2013-09-24 03:16:39

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

Smasher816 wrote:

Alright. My windows.img (Windows 7, raw file) used with Xen works under KVM too.

I am now attempting to virtualize the physical Windows partition I dual-boot into. My Arch Linux install is on an ssd (sda1), and Windows is on a hard drive (sdb3). lspci only shows one SATA controller, therefore I am passing through my whole second hard drive (which has its own bootloader).

Passing /dev/sdb to Qemu shows the Syslinux bootloader, and then begins booting Windows. Unfortunately it quickly blue screens of death with the error "*** STOP: 0x0000007B (0xFFFFF880009A97E8,0xFFFFFFFFC0000034,0x0000000000000000,0x0000000000000000)". I believe this means that Windows does not like the Qemu disk controller (piix4-ide). When booting in in ahci mode it will error before Windows starts (bios is in IDE mode if I remember correctly). Is it possible to have qemu use a different device Windows 7 will recognize? Perhaps there is a way to boot into Windows and install some drivers before virtualizing it with qemu?

I also have an issue with audio. When using the two lines from your original post any sounds made in the Windows vm will stutter badly. With Xen I passed through my onboard audio controller, and used a dedicated sound card for Linux. I then had the speaker port of one plugged into line in of the other. When trying this with KVM I face issues. When I use vfio-bind on 0000:00:14.2 my sound stops working. Note: alsa is configured to use the CMI8768 card and the onboard should be disabled with "pci-stubs.ids=....".

The two cards are:

00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)
05:06.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10)

Thanks in advance for any help.

you'll need to modfiy the windows registry i believe some people had this problem some pages back, about the sound you could try another driver instead of pulse, like also or oss

Offline

#509 2013-09-25 13:34:10

apoapo
Member
Registered: 2013-05-16
Posts: 15

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

Wow. Many pages in here big_smile.

Have to do some reading and will probably give the vfio a try again the next days.
Unfortunately I didn't found time/motivation to do more testing/using with the pci-assign in the past.

Was there some progress with vfio and Intel IGPs (eg in i5) as primary GPU?

Greetings
apo

Offline

#510 2013-09-25 18:14:27

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

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

I just wanted to start trying this on  my new machine. When building the qemu-git package from the AUR it conflicts with some files by seasbios...
Do i still need seabios or was its functionality merged into qemu itself?

EDIT: I just recognized something in the first post. The output of "dmesg | grep pci-stub" contains one line more than one would expect with the posted kernel parameters. I suppose the next pci device is a USB-Controller you added in your configuration (?).

EDIT2: So i tried to run this on my machine, but it does not seem to work. I installed the linux-mainline (3.11), qemu (1.6) and seabios (1.7.3) from the packagebuilds you posted. IOMMU is enabled, the pci-bind kernel boot parameter is set and i execute the vfio-bind script using your systemctl service.

# dmesg | grep -iE 'iommu|vfio|pci-bind'
[    0.848089] AMD-Vi: Found IOMMU at 0000:00:00.2 cap 0x40
[    0.970713] VFIO - User Level meta-driver version: 0.3
[  229.648012] vfio-pci 0000:06:00.0: enabling device (0000 -> 0003)
[  476.262919] vfio-pci 0000:06:00.1: enabling device (0000 -> 0002)

# lspci
06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Caicos [Radeon HD 6450/7450/8450]
06:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Caicos HDMI Audio [Radeon HD 6400 Series]

# lspci -n
06:00.0 0300: 1002:6779
06:00.1 0403: 1002:aa98

# cat /etc/vfio-pci.cfg 
DEVICES="0000:06:00.1 0000:06:00.1"

This is the script i use to run the VM: (it`s easier to edit the commands in there)

#!/bin/sh

qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -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=06:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
-device vfio-pci,host=06:00.1,bus=root.1,addr=00.1

When i run the vm, my main screen goes black after switching to tty2 and back again its normal again (i suppose its a Gnome or X bug). I have an empty qemu window. After plugging my monitor to the second GPU i get no signal from it.
Some thoughts i had on what could cause the problem:
- maybe the 6450 doesnt support switching? I want to use my 7870 but i cant choose my primary boot device in bios so i need to change the slots (havent done that yet)
- do i need to have the monitor plugged in, when the vm starts?

Any help is greatly appreciated!

Last edited by SpacePirate (2013-09-26 10:18:46)

Offline

#511 2013-09-26 15:54:31

Endrik
Member
Registered: 2013-09-26
Posts: 1

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

apoapo wrote:

Wow. Many pages in here big_smile.

Have to do some reading and will probably give the vfio a try again the next days.
Unfortunately I didn't found time/motivation to do more testing/using with the pci-assign in the past.

Was there some progress with vfio and Intel IGPs (eg in i5) as primary GPU?

Greetings
apo

I don't know if there has been any progress with the IGP - when i try to passtrough my intel Card qemu complains:

qemu-system-x86_64: -device vfio-pci,host=00:02.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: vfio: Device does not support requested feature x-vga
qemu-system-x86_64: -device vfio-pci,host=00:02.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: vfio: failed to get device 0000:00:02.0
qemu-system-x86_64: -device vfio-pci,host=00:02.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: Device initialization failed.
qemu-system-x86_64: -device vfio-pci,host=00:02.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: Device 'vfio-pci' could not be initialized


passing the radeon card works fine - except the "bug" that after a guest reboot only the seabios message is passed, after "grub init" the display stays blank and the guest doesnt boot up hmm

i am currently using qemu/seabios from git and kernel 3.11.0 (debian) with vga-vfio enabled

I have no clue why i can't pass-trough the intel-gpu, the i915 driver ist blacklisted and the radeon is primary GPU. Starting qemu without x-vga=on boots up the guest - but the monitor stays off and the guest kernel complains:
[    3.883569] [drm] Initialized drm 1.1.0 20060810
[    3.893808] [drm] Memory usable by graphics device = 2048M
[    3.895049] i915 0000:01:00.0: setting latency timer to 64
[    3.897831] [drm:hsw_unclaimed_reg_clear] *ERROR* Unknown unclaimed register before writing to 61208
[    3.897834] [drm:hsw_unclaimed_reg_check] *ERROR* Unclaimed write to 61208
[    3.897836] [drm:hsw_unclaimed_reg_check] *ERROR* Unclaimed write to 6120c
[    3.898233] i915 0000:01:00.0: irq 46 for MSI/MSI-X
[    3.981291] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[    3.981301] [drm] Driver supports precise vblank timestamp query.
[    3.981317] i915 0000:01:00.0: BAR 6: can't assign [??? 0x00000000 flags 0x0] (bogus alignment)
[    3.981321] [drm] failed to find VBIOS tables
....

Maybe someone found a workaround?
Greetings

Edit1: When booting the host up with the intel as primary device and running the qemu command to pass-through the intel card with x-vga on: qemu does not complain, but screen turns off (login prompt from the host vanishes and the monitor turns off)

Last edited by Endrik (2013-09-26 16:33:15)

Offline

#512 2013-09-26 20:14:33

Smasher816
Member
Registered: 2012-03-15
Posts: 32
Website

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

nbhs wrote:
Smasher816 wrote:

Alright. My windows.img (Windows 7, raw file) used with Xen works under KVM too.

<snip>

you'll need to modfiy the windows registry i believe some people had this problem some pages back, about the sound you could try another driver instead of pulse, like also or oss

Just a quick update. I got a fresh virtual installation to work well, but could not convert my previous install. Sound works great using alsa and "-soundhw ac97" along with the ac97 drivers in Windows 7. Both virtio disk and network (bridged tap) are working well.

The Windows Experience Index gives me 7.4 for the processor, 7.9 for memory, 7.2 for graphics, and 4.8 for disk (its an old hard drive). Overall the virtual machine runs great big_smile

I am still unable to pass through my physical sata controller and sound card because they are part of a ten device iommu_group. I have already tried using pcie_acs_override=... with downstream, mulitplex, and the vendor ids of various controllers to no avail. As it stands it would be nice to get more manageable iommu groups, but it is not a game breaker. Thanks again for the awesome guide nbhs.

Edit: is it possible to use usb 2.0 with pci passthrough? Windows keeps yelling at me saying "this device can perform better" if it was plugged into a usb 2 port.

Last edited by Smasher816 (2013-09-27 03:29:15)


(Arch) Linux is user friendly, its just very selective of its friends

Offline

#513 2013-09-26 22:56:00

Chetyre
Member
Registered: 2013-03-27
Posts: 34

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

Hey again.

I upgraded qemu, seabios and the kernel with the builds on the first page since things weren't working before anyway, but now when I try to launch the test machine I get this error:

qemu-system-x86_64: -device vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: vfio: Error: Failed to setup INTx fd: Device or resource busy
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

Also, the kvm module isn't loading on boot. I've added it to modules-load.d but it doesn't want to work

dmesg shows this when I try creating the vm:

genirq: Flags mismatch irq 17. 00000080 (vfio-intx(0000:02:00.0)) vs. 00002000 (kvm:0000:07:00.0)

Last edited by Chetyre (2013-09-26 23:12:47)

Offline

#514 2013-09-27 08:58:57

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

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

So i swapped the Cards now, to check if maybe passing the 7870 works and now the qemu process crashes...:
http://ideone.com/5fxU8z
Any ideas on that?

Offline

#515 2013-09-29 12:09:02

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

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

Hey,

My problem is that I keep getting "ls: cannot access /sys/bus/pci/devices/0000:02:00.0/iommu_group/devices: No such file or directory"
I have an nvidia 9800GT as the system's GPU and I want to bind my GTX 660 Ti.
I had nvidia drivers, but I saw in page 3 that they have a bug and that's why I don't have the "iommu_group" directory.
Then I changed to nouveau. The problem remains.
Then I built your linux-mainline (I was on 3.11.1-1). The problem still remains.
I can't bind my 660... :\

`dmesg| grep -i pci-`

[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-linux-mainline root=UUID=e78cde76-376a-4d00-b994-18453659643a quiet add_efi_memmap rw pci-stub.ids=10de:0e0a,10de:1183
[    0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-linux-mainline root=UUID=e78cde76-376a-4d00-b994-18453659643a quiet add_efi_memmap rw pci-stub.ids=10de:0e0a,10de:1183
[    0.792129] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    0.881226] pci-stub: add 10DE:0E0A sub=FFFFFFFF:FFFFFFFF cls=00000000/00000000
[    0.881234] pci-stub 0000:02:00.1: claimed by stub
[    0.881240] pci-stub: add 10DE:1183 sub=FFFFFFFF:FFFFFFFF cls=00000000/00000000
[    0.881244] pci-stub 0000:02:00.0: claimed by stub

My mobo and CPU (Asus P9X79 Deluxe and i7-3820) support interrupt remapping (VT-d) and I've enabled it, so there is no need for the "vfio_iommu_type1.allow_unsafe_interrupts=1" at my kernel line. Right?

Thank you in advance

Offline

#516 2013-09-29 14:27:50

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

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

Just a wild guess, did you load the module / compile it into the kernel?

Last edited by SpacePirate (2013-09-29 14:30:34)

Offline

#517 2013-09-29 14:29:19

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

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

Yes. I use the patched linux-mainline kernel and I double-checked it.

Offline

#518 2013-10-02 13:35:27

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

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

Any help please?
I would be very glad if I could enjoy bf3 without dual-booting...

Offline

#519 2013-10-02 14:09:35

El_Presidente
Member
Registered: 2013-10-02
Posts: 1

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

ttouch wrote:

Any help please?
I would be very glad if I could enjoy bf3 without dual-booting...

i think you have not enabled vt-d within the kernel. i dont see "intel_iommu=on" in your kernel command line.

Offline

#520 2013-10-02 14:36:19

ttouch
Member
From: /dev/null
Registered: 2012-05-27
Posts: 130
Website

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

ooo, thank you very much... it now binds smile
I'll edit if I find any other problem...

EDIT: I get blank screen when I try to run qemu (the patched for mainline one) and in dmesg I get: "vfio-pci 0000:02:00.0: Invalid ROM contents"
Googling proved fruitless and I saw the same problem on the first page and there was no solution...
Also qemu reports: "qemu-system-x86_64: -device vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on: Warning, device 0000:02:00.0 does not support reset"

EDIT 2: Long boot cause found, completely irrelevant

Last edited by ttouch (2013-10-04 19:47:18)

Offline

#521 2013-10-03 19:17:58

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

SpacePirate wrote:

I just wanted to start trying this on  my new machine. When building the qemu-git package from the AUR it conflicts with some files by seasbios...
Do i still need seabios or was its functionality merged into qemu itself?

EDIT: I just recognized something in the first post. The output of "dmesg | grep pci-stub" contains one line more than one would expect with the posted kernel parameters. I suppose the next pci device is a USB-Controller you added in your configuration (?).

EDIT2: So i tried to run this on my machine, but it does not seem to work. I installed the linux-mainline (3.11), qemu (1.6) and seabios (1.7.3) from the packagebuilds you posted. IOMMU is enabled, the pci-bind kernel boot parameter is set and i execute the vfio-bind script using your systemctl service.

# dmesg | grep -iE 'iommu|vfio|pci-bind'
[    0.848089] AMD-Vi: Found IOMMU at 0000:00:00.2 cap 0x40
[    0.970713] VFIO - User Level meta-driver version: 0.3
[  229.648012] vfio-pci 0000:06:00.0: enabling device (0000 -> 0003)
[  476.262919] vfio-pci 0000:06:00.1: enabling device (0000 -> 0002)

# lspci
06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Caicos [Radeon HD 6450/7450/8450]
06:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Caicos HDMI Audio [Radeon HD 6400 Series]

# lspci -n
06:00.0 0300: 1002:6779
06:00.1 0403: 1002:aa98

# cat /etc/vfio-pci.cfg 
DEVICES="0000:06:00.1 0000:06:00.1"

This is the script i use to run the VM: (it`s easier to edit the commands in there)

#!/bin/sh

qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -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=06:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
-device vfio-pci,host=06:00.1,bus=root.1,addr=00.1

When i run the vm, my main screen goes black after switching to tty2 and back again its normal again (i suppose its a Gnome or X bug). I have an empty qemu window. After plugging my monitor to the second GPU i get no signal from it.
Some thoughts i had on what could cause the problem:
- maybe the 6450 doesnt support switching? I want to use my 7870 but i cant choose my primary boot device in bios so i need to change the slots (havent done that yet)
- do i need to have the monitor plugged in, when the vm starts?

Any help is greatly appreciated!

Could you post your specs?

Offline

#522 2013-10-03 21:51:01

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

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

nbhs wrote:
SpacePirate wrote:

...

Could you post your specs?

CPU:   AMD FX-8350
MB:     Gigabyte 970A-UD3
GPU1: Gigabyte HD7870 GHz
GPU2: Saphire HD6450

+ 16GiB RAM

Offline

#523 2013-10-03 21:54:39

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

SpacePirate wrote:
nbhs wrote:
SpacePirate wrote:

...

Could you post your specs?

CPU:   AMD FX-8350
MB:     Gigabyte 970A-UD3
GPU1: Gigabyte HD7870 GHz
GPU2: Saphire HD6450

+ 16GiB RAM

Are you using the catalyst drivers?, are you using pci-stub to "hide" the card?

Last edited by nbhs (2013-10-03 21:58:13)

Offline

#524 2013-10-04 00:02:51

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

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

nbhs wrote:
SpacePirate wrote:
nbhs wrote:

Could you post your specs?

CPU:   AMD FX-8350
MB:     Gigabyte 970A-UD3
GPU1: Gigabyte HD7870 GHz
GPU2: Saphire HD6450

+ 16GiB RAM

Are you using the catalyst drivers?, are you using pci-stub to "hide" the card?

Yes i use pci-stub, but the open source drivers.

Offline

#525 2013-10-04 20:58:14

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

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

Code status update:

Linux v3.12 includes support for bus reset and the VFIO interfaces to use it, so you can update to the latest rc release and hopefully throw away any kernel patches you've been using.

On the QEMU front, you'll need to get this series to match the above:

http://lists.nongnu.org/archive/html/qe … 00494.html

Apply to latest qemu.git or pull my tag.

In addition to the bus reset, I've reworked how and when we read the device option ROM, so if you previously needed to supply a romfile= to make things work, try without it.

Also, this patch should hopefully solve the Code 43 issues with Nvidia on Intel for many of you:

http://lists.nongnu.org/archive/html/qe … 00597.html

Thanks,
Alex


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