You are not logged in.

#776 2013-11-15 23:21:44

Norcoen
Member
From: Norway
Registered: 2013-11-02
Posts: 23

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

I rebuilt qemu now, qemu-1.7.r29486.g5c5432e
Still the same error with usb passthrough.
Can I increase verbosity or is there some sort of error log to search for more information, why it could not add the usb device?
Without the machine boots up fine.

Offline

#777 2013-11-16 00:53:20

gentoo-nut
Member
Registered: 2013-11-14
Posts: 4

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

aw wrote:

Windows doesn't much like hardware changes, so it's worth a shot to reinstall.  Others have noted success with Radeon cards when they attach the audio device to bus=pcie.0 rather than as function 1 of the GPU behind the root port.

Well ... I did the re-install this time with the ioh3420 root there .. and no dice, same thing

THEN .. I moved the HDMI audio function back over to pci.2 as you suggested, kept the VGA over on the ioh, and BAM.  Great success.  Full 3D accel and I can reboot the thing freely, meanwhile the host is rock solid stable.  AW, thank you x100000000000 for that suggestion.  And even more for all of your hard work, great work mind you, and great idea for the VFIO mechanism.  This is truly great stuff, once it becomes easier we can imagine how popular this type of setup could be!!  (seriously, this is awesome)

And nbhs, thank you again for putting the software recipe together on the first post, as well as for all of the help you have given me over the past couple months.   It's been a long often very stressful journey, but I think I am finally finished.   I'll be doing some stability testing over the next few hours and will report back one final time with some screenshots and a summary of what all I've ran into.  BUT IT WORKS, I am so happy right now.... smile smile

[ actually the hdmi audio shows code 10, can't start, as expected I guess.  But who cares, I really don't even want that in the first place.  smile ]

Last edited by gentoo-nut (2013-11-16 01:17:49)

Offline

#778 2013-11-16 06:04:41

ilya80
Member
Registered: 2013-11-12
Posts: 34

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

Norcoen wrote:

I rebuilt qemu now, qemu-1.7.r29486.g5c5432e
Still the same error with usb passthrough.
Can I increase verbosity or is there some sort of error log to search for more information, why it could not add the usb device?
Without the machine boots up fine.

Hi!

It really looks like you have built QEMU without usb support. If your qemu starts, can you connect to it via VNC and issue "info usb" and "info hostusb" commands?

To build with usb support you need to run ./configure --help and check the options - there are options to enable it. Then you may have to install some libs.

Offline

#779 2013-11-16 06:06:32

ilya80
Member
Registered: 2013-11-12
Posts: 34

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

I installed debian as guest and nouveau doesnt start. Since its all opensource I thought there can be a way to get more diagnostics out of it... any hints?

Thanks,
Ilya.

Offline

#780 2013-11-16 10:49:18

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

gentoo-nut wrote:

...

Nice to see you finally got it working!

Offline

#781 2013-11-16 12:44:25

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

Norcoen wrote:

I rebuilt qemu now, qemu-1.7.r29486.g5c5432e
Still the same error with usb passthrough.
Can I increase verbosity or is there some sort of error log to search for more information, why it could not add the usb device?
Without the machine boots up fine.

Maybe perhaps you're missing some usb dependencies see this post: https://bbs.archlinux.org/viewtopic.php … 5#p1337135

Offline

#782 2013-11-16 13:34:49

kaladis
Member
Registered: 2013-11-16
Posts: 1

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

I have a P15SM Notebook with i7-4800MQ with integrated graphics and Radeon 8970. There are 3 ports for graphics: Display Port, Mini Display Port and HDMI.

I would like to run X on one port (+ Notebook screen) using the IGP and a Windows VM with the discrete GPU on another port.

Is this possible? If so, how do configure which GPU is used for which port?

So far I got the below commands running fine - just without any graphic output:

echo "8086 0c01" > /sys/bus/pci/drivers/vfio-pci/new_id
echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
echo 0000:01:00.0 > /sys/bus/pci/drivers/vfio-pci/bind
sudo qemu-system-x86_64 -M q35 -m 8G -enable-kvm -cpu Haswell -vga none -parallel none -bios /usr/share/qemu/bios.bin -smp 4,sockets=1,cores=4,threads=1 -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 -device ahci,bus=pcie.0,id=ahci -device vfio-pci,host=01:00.0,x-vga=on,addr=0.0,multifunction=on,bus=root.1 -vnc :1

Thanks a lot

Offline

#783 2013-11-16 16:22:07

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

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

kaladis wrote:

I have a P15SM Notebook with i7-4800MQ with integrated graphics and Radeon 8970. There are 3 ports for graphics: Display Port, Mini Display Port and HDMI.

I would like to run X on one port (+ Notebook screen) using the IGP and a Windows VM with the discrete GPU on another port.

Is this possible? If so, how do configure which GPU is used for which port?

So far I got the below commands running fine - just without any graphic output:

echo "8086 0c01" > /sys/bus/pci/drivers/vfio-pci/new_id
echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
echo 0000:01:00.0 > /sys/bus/pci/drivers/vfio-pci/bind
sudo qemu-system-x86_64 -M q35 -m 8G -enable-kvm -cpu Haswell -vga none -parallel none -bios /usr/share/qemu/bios.bin -smp 4,sockets=1,cores=4,threads=1 -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 -device ahci,bus=pcie.0,id=ahci -device vfio-pci,host=01:00.0,x-vga=on,addr=0.0,multifunction=on,bus=root.1 -vnc :1

Thanks a lot

Unless you have the schematic for the laptop we can't really tell you whether it's even possible.  Is there a hardware mux that can switch individual output ports to each graphics device independently?  Who knows.  I don't know about IGD/Radeon laptops, but modern IGD/Nvidia laptops don't attach the Nvidia device to any output, the IGD and Nvidia are meant to work together.  The Nvidia renders into buffers which are displayed by the IGD.  I have an older, pre-optimus Asus UL30VT with discrete Nvidia + IGD.  In this case I've figured out that laptop panel is switchable between graphics using a mux in ACPI.  Even then I can only get standard VGA drivers to work, the accelerated drivers just turn the screen black.

So, for your device, it may be possible to get this to work, it may not.  Either way it's going to take some digging and guesswork on your part to figure out if outputs can be switched and how to do it.  It may be telling if the device works with standard Intel and AMD graphics drivers or whether it requires a custom driver from the laptop vendor.  If it requires a custom driver, I doubt you're going to have much success.  Good luck.


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

#784 2013-11-16 18:24:00

blacky
Member
Registered: 2012-10-26
Posts: 14

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

blacky wrote:
nbhs wrote:

Use the packages i provided instead of the AUR ones

I thought that those were o.k. too since you linked them

nbhs wrote:

qemu-git.tar.gz (includes NoSnoop patch) OR qemu-git from AUR
seabios.tar.gz (1.7.3.2)
linux-mainline.tar.gz (3.12.0 includes acs override patch and i915 fixes) OR  linux-mainline from AUR

But of course I’ll follow your advise, thanks!

… and it was good advise. Although I’m not completely finished just yet I can now tell you that I successfully booted Windows.

Maybe interesting facts:

* migrated existing Windows 7 installation from its own physical machine into a virtual environment
* Using IGP on board graphics from ASRock Z87 Extreme6 for Arch Linux Host works
* Successfully passed through Radeon HD 4850 to Windows

Findings:

* Booting Windows from ssd using a virtualized AHCI controller did not work. Although the Windows repair disk did find the installation nothing I tried to fix it (bootsect, bcdedit, bootrec, etc.) worked. Error messages included but were not limited to “Windows failed to start. A recent hardware or software change might be the cause.”, “An error occurred while attempting to read the boot configuration data” and “An error occurred while attempting to read the boot configuration data”. Then I decided to boot up Windows on the physical host an install all drivers for both the physical machine and virtio. Since I then tried booting (in qemu) using virtio straight away and it worked I don’t know if this or any of the other drivers did the trick.
* It might not have been necessary to decrypt the Windows main drive if I had installed the virtio-drivers before. Also: Don’t decrypt using the rescue CD from TrueCrypt in Qemu. They tell you it will be painfully slow and they mean that. Also it’s single threaded.

Next step:

* Try to pass Creative X-Fi through to Windows. I’m not very optimistic on this one; it looks like it may be sharing it’s IOMMU group with a ton of other stuff
* Set up cpuset
* Fine tuning

Thank you so very, very much, nbhs!

I wanted to try this with Xen back in 2008 but unfortunately my BIOS (yes, only that) did not support VT-d. Now I’m finally there an this is thanks to you and all the other fine people around here. Thank you all!

Offline

#785 2013-11-16 18:41:23

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

blacky wrote:

...
* Try to pass Creative X-Fi through to Windows. I’m not very optimistic on this one; it looks like it may be sharing it’s IOMMU group with a ton of other stuff
...

Try using the acs override workarround

Offline

#786 2013-11-16 23:03:42

Norcoen
Member
From: Norway
Registered: 2013-11-02
Posts: 23

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

ilya80 wrote:

Hi!

It really looks like you have built QEMU without usb support. If your qemu starts, can you connect to it via VNC and issue "info usb" and "info hostusb" commands?

To build with usb support you need to run ./configure --help and check the options - there are options to enable it. Then you may have to install some libs.

nbhs wrote:

Maybe perhaps you're missing some usb dependencies see this post: https://bbs.archlinux.org/viewtopic.php … 5#p1337135

I think I fixed it now. Even tough configure didn't complain anymore, and I did a "yum-builddep qemu" as aw suggested, libusb-devel and some other stuff was still missing.

$ ./configure --prefix=/home/user/qemu-1.7.r29486.g5c5432e --sysconfdir=/etc --audio-drv-list='pa alsa sdl oss' \
>               --python=/usr/bin/python2 --smbd=/sbin/smbd \
>               --enable-docs --libexecdir=/home/user/qemu-1.7.r29486.g5c5432e/libexec \
>               --disable-gtk --enable-linux-aio --enable-seccomp \
>               --enable-spice --localstatedir=/var
Install prefix    /home/user/qemu-1.7.r29486.g5c5432e
BIOS directory    /home/user/qemu-1.7.r29486.g5c5432e/share/qemu
binary directory  /home/user/qemu-1.7.r29486.g5c5432e/bin
library directory /home/user/qemu-1.7.r29486.g5c5432e/lib
libexec directory /home/user/qemu-1.7.r29486.g5c5432e/libexec
include directory /home/user/qemu-1.7.r29486.g5c5432e/include
config directory  /etc
local state directory   /var
Manual directory  /home/user/qemu-1.7.r29486.g5c5432e/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path       /home/user/qemu-git/test/qemu-1.7.r29486.g5c5432e
C compiler        cc
Host C compiler   cc
C++ compiler      c++
Objective-C compiler cc
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g  -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -I/usr/include/glusterfs    
QEMU_CFLAGS       -Werror -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing  -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all   -I/usr/include/p11-kit-1     -I/usr/include/libpng15     -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/spice-1   -I/usr/include/nss3 -I/usr/include/nspr4   -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -I/usr/include/libusb-1.0     -I/usr/include/pixman-1   
LDFLAGS           -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g 
make              make
install           install
python            /usr/bin/python2
smbd              /sbin/smbd
host CPU          x86_64
host big endian   no
target list        alpha-softmmu arm-softmmu cris-softmmu i386-softmmu lm32-softmmu m68k-softmmu microblazeel-softmmu microblaze-softmmu mips64el-softmmu mips64-softmmu mipsel-softmmu mips-softmmu moxie-softmmu or32-softmmu ppc64-softmmu ppcemb-softmmu ppc-softmmu s390x-softmmu sh4eb-softmmu sh4-softmmu sparc64-softmmu sparc-softmmu unicore32-softmmu x86_64-softmmu xtensaeb-softmmu xtensa-softmmu alpha-linux-user armeb-linux-user arm-linux-user cris-linux-user i386-linux-user m68k-linux-user microblazeel-linux-user microblaze-linux-user mips64el-linux-user mips64-linux-user mipsel-linux-user mips-linux-user mipsn32el-linux-user mipsn32-linux-user or32-linux-user ppc64abi32-linux-user ppc64-linux-user ppc-linux-user s390x-linux-user sh4eb-linux-user sh4-linux-user sparc32plus-linux-user sparc64-linux-user sparc-linux-user unicore32-linux-user x86_64-linux-user
tcg debug enabled no
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
-Werror enabled   yes
pixman            system
SDL support       yes
GTK support       no
curses support    yes
curl support      yes
mingw32 support   no
Audio drivers     pa alsa sdl oss
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    yes
VNC support       yes
VNC TLS support   yes
VNC SASL support  yes
VNC JPEG support  yes
VNC PNG support   yes
VNC WS support    yes
xen support       no
brlapi support    yes
bluez  support    yes
Documentation     yes
GUEST_BASE        yes
PIE               yes
vde support       no
Linux AIO support yes
ATTR/XATTR support yes
Install blobs     yes
KVM support       yes
RDMA support      no
TCG interpreter   no
fdt support       yes
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes
sigev_thread_id   yes
uuid support      yes
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
Trace backend     nop
Trace output file trace-<pid>
spice support     yes (0.12.6/0.12.4)
rbd support       yes
xfsctl support    yes
nss used          yes
libusb            yes
usb net redir     yes
GLX support       yes
libiscsi support  yes
build guest agent yes
QGA VSS support   no
seccomp support   yes
coroutine backend ucontext
coroutine pool    yes
GlusterFS support yes
virtio-blk-data-plane yes
gcov              gcov
gcov enabled      no
TPM support       no
libssh2 support   yes
TPM passthrough   no
QOM debugging     yes
vhdx              yes

So libusb is now saying "yes", are some of the others saying "no" important?

I can now passthrough the usb devices I need and managed to install Win7Ultimate in a 30GB .img-file as shown in the first post. (Just for now, until it works)
My install process looked like this:
1. boot from win7.iso
2. select "disk" and start installation
3. reboot
4. installation process finishes
5. reboot
6. initial setup of win7: chose computer name, select network and password, etc.

BUT

When it's finished, it never boots the actual system, after seabios it just stops with a blinking underline "_" while one of my cpu cores runs at 100% load all the time.
I tried this many times now, with installation on an .img-file, a real /dev/sdj disk and even by passing through the  pcie-controller with a disk attached (unfortunately windows states it cant be installed on this disk, when doing so)

Is this a known problem someone ran into before? My old installation still works fine, my wildest guess is that using emulated q35 chipset with an image of win7 from 2010 is just not working.
Any ideas?

Offline

#787 2013-11-17 00:46:43

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

Norcoen wrote:

...

Dont use my script, use the command line or use this one:

#!/bin/sh

QEMU=/usr/bin/qemu-system-x86_64

VCPUS="6" 
CPU="Opteron_G4"
MEM="8192"
MEM_PATH="/dev/hugepages"
BIOS="/usr/share/qemu/bios.bin"
NET="-netdev bridge,br=br0,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0"
USB_DEVICES=""
PCI_DEVICES="00:11.0 04:00.0 05:00.0 06:00.0"
GPU="07:00.0"
GPU_SND="07:00.1"
SND=true
SND_DRIVER_OPTS="QEMU_ALSA_DAC_BUFFER_SIZE=512 QEMU_ALSA_DAC_PERIOD_SIZE=170 QEMU_AUDIO_DRV=alsa "
VBIOS="/usr/local/share/qemu/vgabios-6950.bin"
CDROM=""
HDD=""
QEMU_ARGS=" -M q35 -enable-kvm -monitor stdio"
EXTRA_ARGS="-boot menu=on"
	
if [ -n "$GPU" ]; then
	EXTRA_ARGS+=" -vga none -nographic"
	DEV+=" -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1"
	if [ -n "$VBIOS" ]; then
		DEV+=" -device vfio-pci,host=$GPU,x-vga=on,addr=0.0,multifunction=on,bus=root.1,romfile=$VBIOS"
	else
		DEV+=" -device vfio-pci,host=$GPU,x-vga=on,addr=0.0,multifunction=on,bus=root.1"
	fi
  
	if [ -n "$GPU_SND" ]; then
		DEV+=" -device vfio-pci,host=$GPU_SND,addr=0.1,bus=root.1"
	fi
fi

if [ -n "$PCI_DEVICES" ]; then
	for d in $PCI_DEVICES; do
		DEV+=" -device vfio-pci,host=$d"
	done
fi 


if [ -n "$HDD" ] || [ -n "$CDROM" ]; then
	DEV+="  -device ahci,bus=pcie.0,id=ahci"
	if [ -n "$HDD" ]; then
		STORAGE+=" -drive file=$HDD,id=disk,format=raw -device ide-hd,bus=ahci.0,drive=disk"
	fi
	if [ -n "$CDROM" ]; then
		STORAGE+=" -drive file=$CDROM,id=isocd -device ide-cd,bus=ahci.1,drive=isocd"
	fi
fi

if [ -n "$CPU" ]; then
	CPU="-cpu $CPU -smp $VCPUS,sockets=1,cores=$VCPUS,threads=1"
else
	CPU="-smp $VCPUS,sockets=1,cores=$VCPUS,threads=1"
fi

if [ -n "$BIOS" ]; then
	BIOS=" -bios $BIOS"
fi

if $SND ; then
	SND="-device ich9-intel-hda,bus=pcie.0,addr=1b.0,id=sound0 -device hda-duplex,cad=0"
	export $SND_DRIVER_OPTS
else
	SND=""
fi

if [ -n "$MEM" ]; then
	MEMORY+="-m $MEM"
	if [ -n "$MEM_PATH" ]; then
		MEMORY+=" -mem-prealloc -mem-path $MEM_PATH"
	fi
fi

if [ -n "$USB_DEVICES" ]; then
	for u in $USB_DEVICES; do
		USB_DEV+=" -usbdevice $u"
	done
fi

$QEMU $BIOS $CPU $MEMORY $QEMU_ARGS $DEV $USB_DEV $NET $SND $STORAGE  $EXTRA_ARGS 

echo "All Done!!"

Last edited by nbhs (2013-11-17 00:50:28)

Offline

#788 2013-11-17 01:57:46

Norcoen
Member
From: Norway
Registered: 2013-11-02
Posts: 23

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

same problem hmm
This time I didn't even get to configure Win7, it stopped after the installation process rebootet the 2nd time.
I see the line "SeaBIOS (version rel-1.7.3.2-0-[...]" above the blinking cursor.

After this I stopped qemu and started it again so it startet where it left off, finishing the installation.
After configuring win7 I even got to see the desktop for a few seconds until it decided to do a reboot... and now: back to the blinking cursor. Does not boot anymore. Doesn't matter how often I reset qemu.
Only thing I'm wondering about, is the qemu-console showing "QEMU 1.6.90 monitor - type 'help' for more information".
Shouldn't it be 1.7.x?

Last edited by Norcoen (2013-11-17 01:58:32)

Offline

#789 2013-11-17 08:26:25

ilya80
Member
Registered: 2013-11-12
Posts: 34

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

Norcoen wrote:

same problem hmm

If you fail booting / installing win - try various settings for -cpu option for qemu. host, qemu64, your actual CPU type, etc. Thats what helped me.

Offline

#790 2013-11-17 13:12:33

Norcoen
Member
From: Norway
Registered: 2013-11-02
Posts: 23

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

Thanks. You were right with the -cpu options. smile
I just changed CPU="Haswell" in the script to CPU="host" and it is booting fine now, didn't even need to re-install the system.

I'm currently installing drivers to check if everything is working. But I wonder, why the machine has access to the internet... I set NET="" in the script

#!/bin/sh

QEMU=/home/user/qemu-1.7.r29486.g5c5432e/bin/qemu-system-x86_64

VCPUS="8" 
CPU="host"
MEM="8192"
#MEM_PATH="/dev/hugepages"
MEM_PATH=""
BIOS="/home/user/qemu-1.7.r29486.g5c5432e/share/qemu/bios.bin"
#NET="-netdev bridge,br=br0,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0"
NET=""
#USB_DEVICES=""
USB_DEVICES="host:1267:0210"
PCI_DEVICES="04:00.0 08:00.0 09:00.0"
#PCI_DEVICES=""
GPU="01:00.0"
GPU_SND="01:00.1"
SND=false
SND_DRIVER_OPTS="QEMU_ALSA_DAC_BUFFER_SIZE=512 QEMU_ALSA_DAC_PERIOD_SIZE=170 QEMU_AUDIO_DRV=alsa "
VBIOS=""
CDROM="/home/user/Dokumente/KVM/Win7.iso"
HDD="/media/BigStorage/Temp/windowskvm.img"
QEMU_ARGS=" -M q35 -enable-kvm -monitor stdio"
EXTRA_ARGS="-boot menu=on"
	
if [ -n "$GPU" ]; then
	EXTRA_ARGS+=" -vga none -nographic"
	DEV+=" -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1"
	if [ -n "$VBIOS" ]; then
		DEV+=" -device vfio-pci,host=$GPU,x-vga=on,addr=0.0,multifunction=on,bus=root.1,romfile=$VBIOS"
	else
		DEV+=" -device vfio-pci,host=$GPU,x-vga=on,addr=0.0,multifunction=on,bus=root.1"
	fi
  
	if [ -n "$GPU_SND" ]; then
		DEV+=" -device vfio-pci,host=$GPU_SND,addr=0.1,bus=root.1"
	fi
fi

if [ -n "$PCI_DEVICES" ]; then
	for d in $PCI_DEVICES; do
		DEV+=" -device vfio-pci,host=$d"
	done
fi 


if [ -n "$HDD" ] || [ -n "$CDROM" ]; then
	DEV+="  -device ahci,bus=pcie.0,id=ahci"
	if [ -n "$HDD" ]; then
		STORAGE+=" -drive file=$HDD,id=disk,format=raw -device ide-hd,bus=ahci.0,drive=disk"
	fi
	if [ -n "$CDROM" ]; then
		STORAGE+=" -drive file=$CDROM,id=isocd -device ide-cd,bus=ahci.1,drive=isocd"
	fi
fi

if [ -n "$CPU" ]; then
	CPU="-cpu $CPU -smp $VCPUS,sockets=1,cores=$VCPUS,threads=1"
else
	CPU="-smp $VCPUS,sockets=1,cores=$VCPUS,threads=1"
fi

if [ -n "$BIOS" ]; then
	BIOS=" -bios $BIOS"
fi

if $SND ; then
	SND="-device ich9-intel-hda,bus=pcie.0,addr=1b.0,id=sound0 -device hda-duplex,cad=0"
	export $SND_DRIVER_OPTS
else
	SND=""
fi

if [ -n "$MEM" ]; then
	MEMORY+="-m $MEM"
	if [ -n "$MEM_PATH" ]; then
		MEMORY+=" -mem-prealloc -mem-path $MEM_PATH"
	fi
fi

if [ -n "$USB_DEVICES" ]; then
	for u in $USB_DEVICES; do
		USB_DEV+=" -usbdevice $u"
	done
fi

$QEMU $BIOS $CPU $MEMORY $QEMU_ARGS $DEV $USB_DEV $NET $SND $STORAGE  $EXTRA_ARGS 

echo "All Done!!"

Still Windows7 has "Intel(R) PRO/1000 MT-Networkconnection".
IP-Adress: 10.0.2.15
Subnet: 255.255.255.0
Gateway: 10.0.2.2
DHCP: 10.0.2.2
DNS: 10.0.2.3

Where is this coming from? The adress looks like the one I got from bridged network in virt-manager.

//Edit:
Unfortunately, I'm getting a bluescreen with atikmpag.sys now everytime I try to boot the system hmm

Last edited by Norcoen (2013-11-17 13:26:25)

Offline

#791 2013-11-17 16:40:15

ilya80
Member
Registered: 2013-11-12
Posts: 34

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

Norcoen wrote:

Unfortunately, I'm getting a bluescreen with atikmpag.sys now everytime I try to boot the system hmm

"I get a BSOD 0x00000116  atikmpag.sys if i remove the ati driver, the VM work good but no graphique acceleration.
Edit: I found the problem to slove it juste put clear_emulator_capabilities=0 in qemu.conf"

Is blue screen code the same? You could try this.

Offline

#792 2013-11-17 17:35:59

cmdr
Member
Registered: 2013-08-01
Posts: 8

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

Hi,
after playing around with my guest i still have 2 unsolved problems.
1. When i reboot the guest the screen stays black. I have to reboot the host to get the guest working again.
2. qemu does not show the pa or alsa driver hence sound is not working in the guest. (qemu-git PKGBUILD from first post, libpulse & pulseaudio packages installed)

# qemu-system-x86_64 -audio-help | grep Name
Name: oss
Name: none
Name: wav

Maybe someone can help me fixing this? big_smile

Thanks in advance!

Offline

#793 2013-11-17 19:03:14

Norcoen
Member
From: Norway
Registered: 2013-11-02
Posts: 23

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

ilya80 wrote:

"I get a BSOD 0x00000116  atikmpag.sys if i remove the ati driver, the VM work good but no graphique acceleration.
Edit: I found the problem to slove it juste put clear_emulator_capabilities=0 in qemu.conf"

Is blue screen code the same? You could try this.

Yes, I'm getting this one:
2013-11-17195947jpgeOvpEsU.jpg
Where is qemu.conf lcoated usually? Or do I have to create it manually?

Last edited by Norcoen (2013-11-17 19:03:34)

Offline

#794 2013-11-17 19:15:19

ilya80
Member
Registered: 2013-11-12
Posts: 34

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

Norcoen wrote:
ilya80 wrote:

"I get a BSOD 0x00000116  atikmpag.sys if i remove the ati driver, the VM work good but no graphique acceleration.
Edit: I found the problem to slove it juste put clear_emulator_capabilities=0 in qemu.conf"

Is blue screen code the same? You could try this.

Yes, I'm getting this one:
http://pichoster.adbt2.ath.cx/viewpic/y/2013-11-17195947jpgeOvpEsU.jpg
Where is qemu.conf lcoated usually? Or do I have to create it manually?

Dude use google. Its in /etc/libvirt/qemu.conf usually.

Offline

#795 2013-11-17 20:50:09

Norcoen
Member
From: Norway
Registered: 2013-11-02
Posts: 23

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

Sorry, I was looking in /etc/qemu/, and it wasn't there, I forgot the connection to libvirtd.
I already have "clear_emulator_capabilities=0" in said qemu.conf, because before finding this board, I followed another tutorial and applied the last paragraph of this site:
http://fedoraproject.org/wiki/How_to_de … assignment

So, I have the same bluescreen error, but your solution somehow does not apply for me hmm

//edit:
I found out, the qemu-git I built isn't looking in /etc/libvirt/ but in /etc/qemu, so I copied my qemu.conf to that location, now getting this error:

qemu-system-x86_64:/etc/qemu/qemu.conf:198: no group defined

Line 198 is

user = "root"

So I'm stuck again...

//edit2:
I played around a bit with the config, and the seems to be around the group for the QEMU processes:

# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
group = "root"

If I delete that line, I get a parser error, but if I set it to any group, root, my user, qemu, kvm, I just get the error above, that no group is defined.

Last edited by Norcoen (2013-11-17 21:26:54)

Offline

#796 2013-11-17 21:09:13

mafferri
Member
Registered: 2013-11-11
Posts: 7

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

aw wrote:

I'm not sure how this is going to help your performance though, it's pretty random whether re-loading the host driver is going to resolve anything that the guest driver can't.  For graphics devices, if you're using kernel+qemu that support bus reset, that should provide something nearly as good as a host reboot.

have the kernel 3.12.0-rc7
I do not know exactly what it was anyway because I did set the values of kvm and kvm-amd.
Solved in this way



/proc/cmdline

root=PARTUUID=F942477B-23BB-4880-A611-17B3CF4040A7 ro ivrs_ioapic[5]=00:14.0 acpi_sleep=s3_bios,s3_mode vfio_iommu_type1.allow_unsafe_interrupts=1 kvm.allow_unsafe_assigned_interrupts=1 kvm.ignore_msrs=1 kvm_amd.npt=1 pci-stub.ids=1002:6738,1002:aa88,1033:0194

dmesg

[ 6289.907200] kvm_get_msr_common: 70 callbacks suppressed
[ 6289.907203] kvm [2383]: vcpu0 ignored rdmsr: 0xe8
[ 6289.907208] kvm [2383]: vcpu0 ignored rdmsr: 0xe7
[ 6289.911413] kvm [2383]: vcpu0 ignored rdmsr: 0xe8
[ 6289.911417] kvm [2383]: vcpu0 ignored rdmsr: 0xe7
[ 6289.969551] kvm [2383]: vcpu1 ignored rdmsr: 0xe8
[ 6289.969557] kvm [2383]: vcpu1 ignored rdmsr: 0xe7
[ 6289.973760] kvm [2383]: vcpu1 ignored rdmsr: 0xe8
[ 6289.973765] kvm [2383]: vcpu1 ignored rdmsr: 0xe7

What could this message be?


here's what starts libvirt

2013-11-17 17:31:32.777+0000: starting up
LC_ALL=C PATH=/bin:/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3 HOME=/root USER=root QEMU_AUDIO_DRV=none /usr/bin/qemu-system-x86_64 -name dcdcdcd,process=qemu:dcdcdcd -S -machine pc-q35-1.6,accel=kvm,usb=off,mem-merge=off -cpu host -m 3993 -realtime mlock=on -smp 2,sockets=1,cores=3,threads=1 -uuid 34bbd363-5c7a-9147-dff1-c04d90d335eb -nographic -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/dcdcdcd.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime -no-shutdown -no-acpi -boot order=dc,menu=on -device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x2 -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 -device piix3-usb-uhci,id=usb,bus=pci.2,addr=0x1 -drive file=/var/lib/libvirt/images/virtio-win-0.1-65.iso,if=none,id=drive-ide0-0-0,readonly=on,format=raw -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive file=/dev/mapper/350014ee00384381d,if=none,id=drive-sata0-0-1,format=raw -device ide-hd,bus=ide.1,drive=drive-sata0-0-1,id=sata0-0-1 -netdev tap,fd=18,id=hostnet0,vhost=on,vhostfd=19 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:58:63:38,bus=pci.2,addr=0x2 -device usb-host,hostbus=3,hostaddr=3,id=hostdev0 -device usb-host,hostbus=5,hostaddr=2,id=hostdev1 -device usb-host,hostbus=5,hostaddr=3,id=hostdev2 -bios /usr/share/seabios/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,rombar=0,romfile=/usr/share/qemu/vbios.rom -device vfio-pci,host=06:00.1,bus=root.1,addr=00.1 -device vfio-pci,host=04:00.0,bus=pcie.0 -device vfio-pci,host=05:00.0,bus=pcie.0 .
Domain id=3 is tainted: high-privileges
Domain id=3 is tainted: custom-argv
Domain id=3 is tainted: host-cpu

I can not pass the usb3 controller, the host interfere but I think the drivers is vfio-pci
what I could try?

04:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04) (prog-if 30 [XHCI])
        Subsystem: Micro-Star International Co., Ltd. Device 7640
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 51
        Region 0: Memory at f7300000 (64-bit, non-prefetchable) [size=8K]
        Capabilities: [50] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
                Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [70] MSI: Enable- Count=1/8 Maskable- 64bit+
                Address: 0000000000000000  Data: 0000
        Capabilities: [90] MSI-X: Enable+ Count=8 Masked-
                Vector table: BAR=0 offset=00001000
                PBA: BAR=0 offset=00001080
        Capabilities: [a0] Express (v2) Endpoint, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
                        ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported-
                        RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
                        MaxPayload 128 bytes, MaxReadReq 512 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
                LnkCap: Port #0, Speed 5GT/s, Width x1, ASPM L0s L1, Latency L0 <4us, L1 unlimited
                        ClockPM+ Surprise- LLActRep- BwNot-
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Not Supported, TimeoutDis+, LTR+, OBFF Not Supported
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
                LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
                         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
        Capabilities: [100 v1] Advanced Error Reporting
                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
                CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
                AERCap: First Error Pointer: 00, GenCap- CGenEn- ChkCap- ChkEn-
        Capabilities: [140 v1] Device Serial Number ff-ff-ff-ff-ff-ff-ff-ff
        Capabilities: [150 v1] Latency Tolerance Reporting
                Max snoop latency: 0ns
                Max no snoop latency: 0ns
        Kernel driver in use: vfio-pci

05:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04) (prog-if 30 [XHCI])
        Subsystem: Micro-Star International Co., Ltd. Device 7640
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 50
        Region 0: Memory at f7200000 (64-bit, non-prefetchable) [size=8K]
        Capabilities: [50] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
                Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [70] MSI: Enable- Count=1/8 Maskable- 64bit+
                Address: 0000000000000000  Data: 0000
        Capabilities: [90] MSI-X: Enable+ Count=8 Masked-
                Vector table: BAR=0 offset=00001000
                PBA: BAR=0 offset=00001080
        Capabilities: [a0] Express (v2) Endpoint, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
                        ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported-
                        RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
                        MaxPayload 128 bytes, MaxReadReq 512 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
                LnkCap: Port #0, Speed 5GT/s, Width x1, ASPM L0s L1, Latency L0 <4us, L1 unlimited
                        ClockPM+ Surprise- LLActRep- BwNot-
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Not Supported, TimeoutDis+, LTR+, OBFF Not Supported
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
                LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
                         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
        Capabilities: [100 v1] Advanced Error Reporting
                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
                CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
                AERCap: First Error Pointer: 00, GenCap- CGenEn- ChkCap- ChkEn-
        Capabilities: [140 v1] Device Serial Number ff-ff-ff-ff-ff-ff-ff-ff
        Capabilities: [150 v1] Latency Tolerance Reporting
                Max snoop latency: 0ns
                Max no snoop latency: 0ns
        Kernel driver in use: vfio-pci

00:00.0 Host bridge should be using a driver?

00:00.0 Host bridge: Advanced Micro Devices [AMD] nee ATI RD890 PCI to PCI bridge (external gfx0 port B) (rev 02)
        Subsystem: Micro-Star International Co., Ltd. Device 7640
        Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ >SERR- <PERR- INTx-
        Capabilities: [f0] HyperTransport: MSI Mapping Enable+ Fixed+
        Capabilities: [c4] HyperTransport: Slave or Primary Interface
                Command: BaseUnitID=0 UnitCnt=20 MastHost- DefDir- DUL-
                Link Control 0: CFlE- CST- CFE- <LkFail- Init+ EOC- TXO- <CRCErr=0 IsocEn- LSEn- ExtCTL- 64b+
                Link Config 0: MLWI=16bit DwFcIn- MLWO=16bit DwFcOut- LWI=16bit DwFcInEn- LWO=16bit DwFcOutEn-
                Link Control 1: CFlE- CST- CFE- <LkFail+ Init- EOC+ TXO+ <CRCErr=0 IsocEn- LSEn- ExtCTL- 64b-
                Link Config 1: MLWI=8bit DwFcIn- MLWO=8bit DwFcOut- LWI=8bit DwFcInEn- LWO=8bit DwFcOutEn-
                Revision ID: 3.00
                Link Frequency 0: [c]
                Link Error 0: <Prot- <Ovfl- <EOC- CTLTm-
                Link Frequency Capability 0: 200MHz+ 300MHz- 400MHz+ 500MHz- 600MHz+ 800MHz+ 1.0GHz+ 1.2GHz+ 1.4GHz- 1.6GHz- Vend-
                Feature Capability: IsocFC+ LDTSTOP+ CRCTM- ECTLT- 64bA+ UIDRD-
                Link Frequency 1: 200MHz
                Link Error 1: <Prot- <Ovfl- <EOC- CTLTm-
                Link Frequency Capability 1: 200MHz- 300MHz- 400MHz- 500MHz- 600MHz- 800MHz- 1.0GHz- 1.2GHz- 1.4GHz- 1.6GHz- Vend-
                Error Handling: PFlE- OFlE- PFE- OFE- EOCFE- RFE- CRCFE- SERRFE- CF- RE- PNFE- ONFE- EOCNFE- RNFE- CRCNFE- SERRNFE-
                Prefetchable memory behind bridge Upper: 00-00
                Bus Number: 00
        Capabilities: [40] HyperTransport: Retry Mode
        Capabilities: [54] HyperTransport: UnitID Clumping
        Capabilities: [9c] HyperTransport: #1a
        Capabilities: [70] MSI: Enable- Count=1/4 Maskable- 64bit-
                Address: 00000000  Data: 0000

00:00.2 IOMMU: Advanced Micro Devices [AMD] nee ATI RD990 I/O Memory Management Unit (IOMMU)
        Subsystem: Micro-Star International Co., Ltd. Device 7640
        Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 72
        Capabilities: [40] Secure device <?>
        Capabilities: [54] MSI: Enable+ Count=1/1 Maskable- 64bit+
                Address: 00000000fee0f00c  Data: 41a1
        Capabilities: [64] HyperTransport: MSI Mapping Enable+ Fixed+

00:02.0 PCI bridge: Advanced Micro Devices [AMD] nee ATI RD890 PCI to PCI bridge (PCI express gpp port B) (prog-if 00 [Normal decode])
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        I/O behind bridge: 0000e000-0000efff
        Memory behind bridge: f4000000-f70fffff
        Prefetchable memory behind bridge: 00000000d0000000-00000000dfffffff
        Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
        BridgeCtl: Parity- SERR- NoISA- VGA+ MAbort- >Reset- FastB2B-
                PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
        Capabilities: [50] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [58] Express (v2) Root Port (Slot+), MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
                        ExtTag+ RBE+ FLReset-
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
                        MaxPayload 128 bytes, MaxReadReq 128 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
                LnkCap: Port #0, Speed 5GT/s, Width x16, ASPM L0s L1, Latency L0 <1us, L1 <8us
                        ClockPM- Surprise- LLActRep+ BwNot+
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x16, TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
                SltCap: AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug- Surprise-
                        Slot #2, PowerLimit 75.000W; Interlock- NoCompl+
                SltCtl: Enable: AttnBtn- PwrFlt- MRL- PresDet- CmdCplt- HPIrq- LinkChg-
                        Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
                SltSta: Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
                        Changed: MRL- PresDet- LinkState-
                RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna- CRSVisible-
                RootCap: CRSVisible-
                RootSta: PME ReqID 0000, PMEStatus- PMEPending-
                DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR-, OBFF Not Supported ARIFwd+
                DevCtl2: Completion Timeout: 65ms to 210ms, TimeoutDis-, LTR-, OBFF Disabled ARIFwd-
                LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
                         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
        Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit-
                Address: 00000000  Data: 0000
        Capabilities: [b0] Subsystem: Micro-Star International Co., Ltd. Device 7640
        Capabilities: [b8] HyperTransport: MSI Mapping Enable+ Fixed+
        Capabilities: [100 v1] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Capabilities: [190 v1] Access Control Services
                ACSCap: SrcValid+ TransBlk+ ReqRedir+ CmpltRedir+ UpstreamFwd+ EgressCtrl- DirectTrans+
                ACSCtl: SrcValid+ TransBlk- ReqRedir+ CmpltRedir+ UpstreamFwd+ EgressCtrl- DirectTrans-
        Kernel driver in use: pcieport

libvirt dom

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>dcdcdcd</name>
  <uuid>34bbd363-5c7a-9147-dff1-c04d90d335eb</uuid>
  <memory unit='KiB'>4088608</memory>
  <currentMemory unit='KiB'>4088608</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>2</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='2'/>
    <vcpupin vcpu='1' cpuset='1'/>
    <emulatorpin cpuset='0-1,2-3'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-1.6'>hvm</type>
    <boot dev='cdrom'/>
    <boot dev='hd'/>
    <bootmenu enable='yes'/>
  </os>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='3' threads='1'/>
  </cpu>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
      <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/virtio-win-0.1-65.iso'/>                                                                                      
      <target dev='vda' bus='ide'/>
      <alias name='virtio-disk0'/>
     <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
      <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/mapper/350014ee00384381d'/>
      <target dev='vdb' bus='sata'/>
      <alias name='virtio-disk1'/>
      </disk>
    <controller type='sata' index='0'>
      <alias name='sata0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
<controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </controller>
<hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x1b1c'/>
        <product id='0x1ab1'/>
      </source>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x04d9'/>
        <product id='0x1702'/>
      </source>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x192f'/>
        <product id='0x0416'/>
      </source>
    </hostdev>
    <interface type='network'>
      <mac address='52:54:00:58:63:38'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
    </interface>
    <controller type='ide' index='0'/>
    <memballoon model='none'>
      <alias name='balloon0'/>
    </memballoon>
  </devices>
  <seclabel type='none'/>
  <qemu:commandline>
    <qemu:arg value='-bios'/>
    <qemu:arg value='/usr/share/seabios/bios.bin'/>
    <qemu:arg value='-vga'/>
    <qemu:arg value='none'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=06:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on,rombar=0,romfile=/usr/share/qemu/vbios.rom'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=06:00.1,bus=root.1,addr=00.1'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=04:00.0,bus=pcie.0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=05:00.0,bus=pcie.0'/>
  </qemu:commandline>
</domain>

another question I try to pass the sound card but does not feel good

Last edited by mafferri (2013-11-18 00:27:23)

Offline

#797 2013-11-18 20:27:58

juhe
Member
Registered: 2013-08-10
Posts: 2

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

Just wanted to let you know I was able to get the thing working on following HW configurations:

AMD Platform:

  • Motherboard: SABERTOOTH 990FX R20 (BIOS rev. 2005)

  • CPU: AMD FX-8350 @4Ghz

  • Primary VGA: Radeon HD 5850

  • Secondary (passed through) VGA: Radeon HD 7870

Intel Platform:

  • Motherboard: P9X79 DELUXE (BIOS rev. 4502)

  • CPU: Intel i7-3930K

  • Primary VGA: Radeon HD 6670

  • Secondary (passed through) VGA: Radeon HD 7850

Both platform have also passed one internal USB HUB for keyboard / mouse and internal Intel HDA audio for sound. Network and disk use virtio interface.

Host OS (on both machines) is Archlinux with recent stock 3.12 kernel, qemu (1.7.r29424.g964668b) and seabios (1.7.3.2) from nbhs' first post.

AMD platform worked basically out of the box, because nbhs has very similar setup (chipset is the same).  Intel, however, was a bit tougher to get working because of Catalyst 13.9 atikmpag.sys' code 116 BSOD which was finally solved thanks to recent posts from aw and gentoo-nut by simply ommiting the HDMI Audio completely (or adding it to pcie.0 bus works as well).

I would like to Thank nbhs, aw and all you guys who share the information about setups, related issues and their solutions on this thread.  I wouldn't be able to get the thing working without you :-).

Offline

#798 2013-11-18 21:20:51

ilya80
Member
Registered: 2013-11-12
Posts: 34

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

juhe wrote:

Just wanted to let you know I was able to get the thing working

Congrats! I envy you smile

juhe wrote:

CPU: Intel i7-3930K

Are you sure that was a K model? Those are not supposed to have VT-d.

Offline

#799 2013-11-18 21:37:00

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

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

ilya80 wrote:
juhe wrote:

CPU: Intel i7-3930K

Are you sure that was a K model? Those are not supposed to have VT-d.

Never assume you've figured out Intel's naming convention:

http://ark.intel.com/products/63697/Int … GHz?q=3930

VT-d: yes


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

#800 2013-11-19 07:24:40

mangobot
Member
Registered: 2013-11-19
Posts: 1

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

Hey guys,

Thanks for the awesome writeup. My basic hardware is:

cpu: amd FX-6300
gpu: amd 7970
mb: ASUS M5A99FX PRO R2.0 (2005 bios)

I previously used this walkthrough to set up fully working passthrough using two graphics cards (using the 7970 as secondary and a really basic ati card as primary), but I just managed to get it working on my primary card alone, using pci_stub. smile I do see boot graphics and console output from the gfx card (I run all my monitors off of it), but when I run qemu it seems to switch over fine.
I hadn't seen much success with this/had heard a lot about primary passthrough not being possible, but since I'm looking at it, I thought I'd throw my experience into the ring. Now I have more space in my box so I can avoid the Realtek ethernet card!

Offline

Board footer

Powered by FluxBB