6

i have an asus n550jv laptop with the following output from lspci -nn | grep "VGA|3D":

00:02.0 VGA compatible controller [0300]: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller [8086:0416] (rev 06)
01:00.0 3D controller [0302]: NVIDIA Corporation GK107M [GeForce GT 750M] [10de:0fe4] (rev ff)

i want to run a windows 8.1 vm with vga-passthrough so i don't have to dualboot. i've read that you need a card with a dedicated output port but i haven't figured out why and there've been some posts on forums indicating that it might work yet.

i'm trying to run the vm with this command:

qemu-system-x86_64 -enable-kvm -M q35 -m 4096 -cpu host \
-smp 4,sockets=1,cores=4,threads=2 \
-bios /usr/share/ovmf/OVMF.fd \
-usb -usbdevice tablet \
-soundhw hda \
-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,x-vga=on \
-drive file=/home/duke/windows.img,id=disk,format=raw -device ide-hd,bus=ide.0,drive=disk \
-drive file=/home/duke/Downloads/windows.iso,id=isocd -device ide-cd,bus=ide.1,drive=isocd \
-vga vmware \
-boot menu=on

i want to use vga-passthrough but i keep getting errors about x-vga:

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

i found on the arch vga-passthrough thread this information:

This means that either a) your kernel does not support CONFIG_VFIO_PCI_VGA or b) the device is not a VGA device. To test a):

$ grep CONFIG_VFIO_PCI_VGA /boot/config-uname -r

To test b):

$ lspci -s 2:00.0 | grep VGA

If you have Intel host graphics, you still need the i915 patch for your kernel. If you Radeon host graphics, you need the other VGA arbiter patch. Both of these have been referenced in the last few pages, IIRC.

i get CONFIG_VFIO_PCI_VGA=y for (a). in my case (b) is lspci -s 1:00.0 | grep VGA and it doesn't output anything since my nvidia card is listed as a "3d controller" so i have questions:

  1. will the i915 patch or ovmf support my nvidia card which is listed as a 3d controller?

    • if not, is there any way to get the nivida card recognized as vga-compatible?
  2. is running ovmf as simple as setting -bios /usr/share/ovmf/OVMF.fd?

  3. why is -vga=none required for vga assignment?

    • if -vga=none really is required then is there any other way to actually see the screen? for example could i redirect the nvidia card to the hdmi port or have the nvidia card completely takeover the laptop screen?

i also get errors for alsa/pulse, a bunch of them get spit out that generally follow

alsa: Could not initialize ADCk
alsa: Failed to open `default':
alsa: Reason: Connection refused
Home directory not accessible: Permission denied
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

i know this is because root doesn't have access to user-level pulse but i don't want to run pulse at system-level, is there a way for pulseaudio to work without having to launch it in system mode? if not, i'm having issues enabling system mode anyway. There's an explanation here and pulseaudio --system works but i can't connect any clients to the pulse server, i keep getting errors like ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Access denied.

3 Answers 3

7

The reason why you need a dedicated video output is that there is no way the host OS can currently access the output framebuffer of the card assigned to the guest OS.

VT-d restricts the host from accessing/memory mapping the graphics memory directly.

Normally, a modified driver (Nvidia Optimus or Bumblebee on Linux) exposes the results of a window running on the Nvidia card as a texture to the Intel graphics, which then blends it onto your desktop environment.

This requires the drivers of both graphics cards to be modified and communicating/sharing memory, something which isn't possible between host and guest OS as far as I've been able to find.

With a dedicated output port, the card assigned to the virtual machine is allowed to be blisfully unaware of this virtualization mumbo-jumbo, and normal drivers can be used which display the output on a physical output port, just like it would when running on bare metal.

A dedicated output port is, as far as I've encountered them in the wild, only available on desktops or Lenovo ThinkPads with dual graphics (the latter of which wire some of the output ports directly to the Nvidia, messing up Bumblebee support on Linux in the process).

3
  • Wouldn't it be relatively easy to create a fake monitor output for the nvidia card so that the VM would run properly, and then forward the video back to the host OS by streaming it with ffmpeg or something similar (something like steam's in-home streaming)
    – Cestarian
    Oct 16, 2015 at 10:48
  • Might be late to the game, I own a ASUS N550JK (that's the successor model to the N550JV, only difference being 750M vs 850M). The nVidia card is indeed wired to a dedicated output port, namely the DisplayPort. The Intel card is wired to the HDMI port and internal LVDS display. (This is also why the DisplayPort does not work on Linux, unless you start a 2nd X server using the nVidia card). Apr 26, 2016 at 14:41
  • @yjwong, I'm able to use the displayport without a second X server so I guess they are wired differently..
    – erp
    Feb 6, 2017 at 20:03
2

I could be mistaken but doesn't KVM currently only work with discrete video cards (the GT 750M is an Optimus card)?

REF: http://www.linux-kvm.org/wiki/images/b/b3/01x09b-VFIOandYou-small.pdf

2
0

One thing that you didn't mention that you need to do is:

Go into your BIOS and enable the VT-d option. VT-d is required to passthrough a PCI device to a virtual machine.

http://kmpic.asus.com/images/2014/12/29/6bd4ef8d-62a3-4b0c-9674-5a2b0fa53c79.jpg

(And even if this doesn't solve the issue, you should still leave it enabled, because it will be part of the solution.)

1
  • thanks, I forgot to mention but I have done this part too.
    – erp
    Apr 29, 2015 at 3:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .