Jump to content

New to KVM - Need help with Nvidia GPU Passthrough


Recommended Posts

Hi Everyone! First post on the forum :) Am having difficulties trying to passthrough my PNY GTX 660Ti into my Windows8.1 VM. My unraid server has a similar motherboard to the "Workstation 1" of the test components in the wiki site. When I launch my VM I do see the GTX 660Ti but it appears to have a driver issue? Am new to KVM in unraid, any help would be much appreciated.

 

My unraid server:

Motherboard: ECS - Z87H3-M

CPU: Intel i7-4790

Graphics Device: PNY GTX 660Ti

Ram: Team Xtream 2x4GB DDR3 1600

 

Here is my XML info:

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Win8-VM1</name>
  <uuid>9e7b25bb-80b8-cd37-8182-a777617f728e</uuid>
  <metadata>
    <vmtemplate name="Custom" icon="windows.png" os="windows"/>
  </metadata>
  <memory unit='KiB'>3145728</memory>
  <currentMemory unit='KiB'>3145728</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>2</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='1'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-2.3'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='2' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/cache/vdisks/Win8-VM1/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/ISO/Win81-x64.iso'/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/ISO/virtio-win-0.1.102.iso'/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:db:98:6b'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/Win8-VM1.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vmvga' vram='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=2,chassis=1,id=root.1'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=01:00.0,bus=pcie.0,multifunction=on'/>
  </qemu:commandline>
</domain>

System_Info.PNG.54bec6d990944a77d233fd6ddd16d476.PNG

VM-Info.PNG.3509124784326110a4d2c05b41aeb022.PNG

660ti.PNG.6f93bfc48121d4ba15a02a19a3a28509.PNG

Link to comment

Hi Everyone! First post on the forum :) Am having difficulties trying to passthrough my PNY GTX 660Ti into my Windows8.1 VM. My unraid server has a similar motherboard to the "Workstation 1" of the test components in the wiki site. When I launch my VM I do see the GTX 660Ti but it appears to have a driver issue? Am new to KVM in unraid, any help would be much appreciated.

 

My unraid server:

Motherboard: ECS - Z87H3-M

CPU: Intel i7-4790

Graphics Device: PNY GTX 660Ti

Ram: Team Xtream 2x4GB DDR3 1600

 

Here is my XML info:

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Win8-VM1</name>
  <uuid>9e7b25bb-80b8-cd37-8182-a777617f728e</uuid>
  <metadata>
    <vmtemplate name="Custom" icon="windows.png" os="windows"/>
  </metadata>
  <memory unit='KiB'>3145728</memory>
  <currentMemory unit='KiB'>3145728</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>2</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='1'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-2.3'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='2' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/cache/vdisks/Win8-VM1/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/ISO/Win81-x64.iso'/>
      <target dev='hda' bus='sata'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/ISO/virtio-win-0.1.102.iso'/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:db:98:6b'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/Win8-VM1.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' websocket='-1' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vmvga' vram='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=2,chassis=1,id=root.1'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=01:00.0,bus=pcie.0,multifunction=on'/>
  </qemu:commandline>
</domain>

 

Yes, this is a known issue if you are leaving VNC on as the primary graphics.  Remove VNC from the VM and boot with just the NVIDIA GPU assigned.  If you still want to have remote access to Windows, use Microsoft RDP (only if you have Windows Professional edition; home edition doesn't have RDP and you'd have to use something like a VNC server in the VM, TeamViewer, or another solution).

 

Here's the guide on setting up RDP:  http://lime-technology.com/wiki/index.php/UnRAID_6/VM_Guest_Support#Enable_Remote_Desktop_Access

Link to comment

Thanks JonP! I have removed VNC from the VM, and am now using only RDP to connect to the VM. I have installed the Nvidia drivers 342.50, but am still getting an error on the card?

 

Ok, is the display lighting up though (probably in a bad resolution if it is)?  If not, is it just staying black?

 

Check your motherboard BIOS settings.  Look for a section about primary graphics and make sure that is NOT set to PCIe.  Instead, make sure it is set to use integrated graphics (or another GPU on the system than the one you wish to pass through).  Report back if this has any affect.

Link to comment

Thanks JonP! I have removed VNC from the VM, and am now using only RDP to connect to the VM. I have installed the Nvidia drivers 342.50, but am still getting an error on the card?

 

How did you remove the VNC part, manually? If so you also don't need some of the input arguments, etc...

The code 43 is typically because you have hyper-v enabled, however I don't see that in your xml posted prior to editing.

 

One question, and one recommendation.

 

Why Q35 instead of i440fx? (recommend changing to i440fx unless you have a specific reason).

 

I'd recommend re-doing your VM entry completely, however do NOT delete the image when asked.

So VM shutdown, delete VM, no to image.

Add VM, point to existing VM image (you also won't need the iso image, or virtio image and can leave that blank), leave defaults (i440fx), assign GPU, sound card, hyperv should automatically go to no, ram, cpu's, etc...

 

I recommend this because it only takes like a minute, and ensures your XML is correctly defined without any editing done by hand and set right for the Nvidia pass-thru.

Link to comment

Thanks JonP! I have removed VNC from the VM, and am now using only RDP to connect to the VM. I have installed the Nvidia drivers 342.50, but am still getting an error on the card?

 

How did you remove the VNC part, manually? If so you also don't need some of the input arguments, etc...

 

You delete the <graphics> and <video> parts of the XML as well as the <input> sections, but you shouldn't need to manually remove them (you can do that from the Edit VM page in unRAID).

 

The code 43 is typically because you have hyper-v enabled, however I don't see that in your xml posted prior to editing.

 

Hyper-v was the first thing I looked for in his XML as well, but yeah, I didn't see that.  I have seen NVIDIA report code 43 with VNC graphics assigned as primary before.  It also may take multiple reboots after removing the VNC graphics to ensure it's cleared completely.

 

One question, and one recommendation.

 

Why Q35 instead of i440fx? (recommend changing to i440fx unless you have a specific reason).

 

I agree.  The only reason I didn't mention it yet was because I wasn't sure if he had already activated his copy of Windows.  If so, changing this to an already activated copy of Windows is akin to installing a completely new motherboard (and Windows activation doesn't like that, so it'll prompt you to reactivate).

 

I'd recommend re-doing your VM entry completely, however do NOT delete the image when asked.

So VM shutdown, delete VM, no to image.

Add VM, point to existing VM image (you also won't need the iso image, or virtio image and can leave that blank), leave defaults (i440fx), assign GPU, sound card, hyperv should automatically go to no, ram, cpu's, etc...

 

I recommend this because it only takes like a minute, and ensures your XML is correctly defined without any editing done by hand and set right for the Nvidia pass-thru.

 

If you already activated Windows, you may want to make a copy of that vdisk before doing this, so you can test the Q35 to i440fx change.  If you don't, switching back may still prompt for reactivation by Windows.

Link to comment

Ok, is the display lighting up though (probably in a bad resolution if it is)?  If not, is it just staying black?

 

Check your motherboard BIOS settings.  Look for a section about primary graphics and make sure that is NOT set to PCIe.  Instead, make sure it is set to use integrated graphics (or another GPU on the system than the one you wish to pass through).  Report back if this has any affect.

 

Any feedback on these suggestions?

Link to comment

Hi JonP, when i connect my monitor to the 660Ti the display stays black, like if nothing is plugged in. The motherboard settings allows me to select Auto, PCIe or PCi, but there is nothing that to select integrated graphics.

 

Try disabling the option for igd multi-monitor support.

Link to comment

Hi JonP, I have disabled the IDG for Muilti-Monitor support but am still getting blank screen when I start my VM. Are there any other options or recommendations for me to try? Thank you for all your help so far.

 

Try setting initiate graphic adapter to PCI (not PCI Express).

 

Another thing to try:  change which PCIe port the GPU is plugged into.

Link to comment

Stupid question, BUT I think we're running out of troubleshooting options..

 

You have the proper power cables 12v to the graphics card (660Ti)?

Have you passed this card through before to anything?

 

Have you attempted from the wiki loading the rom for the card, it's certainly not specific to this but can help with various stupid issues.

http://lime-technology.com/wiki/index.php/UnRAID_Manual_6#Edit_XML_for_VM_to_supply_GPU_ROM_manually

 

To test the card and make sure it works, can you make an Openelec VM and assign this card to it and see if it will start/show video?

OE is easy to setup, so it wouldn't take long to test this, likely need to be SeaBIOS unless that card supports OVMF (didn't look).

Link to comment

Hi JonP, thanks for all your help so far :) I have tried setting it to PCI, but nothing has changed, am still getting the blank screen. I have also moved my graphics card to slot 2. My Motherboard only has 2 PCIe slots. Anything else I should be looking into? 

 

No problem on the assistance.  That's why I lurk around these boards.  This is one area in which folks have some challenges with certain hardware setups, so each experience to work with someone on this is an opportunity to learn more about how various hardware vendors implement virtualization tech.

 

Two quick questions:

 

Do you have on-board graphics on this motherboard or is the only graphics adapter on your system the GPU itself you want to assign?

 

Do you have another GPU you can insert into the system in addition to the 660ti?  Just for testing?

 

Stupid question, BUT I think we're running out of troubleshooting options..

 

You have the proper power cables 12v to the graphics card (660Ti)?

Have you passed this card through before to anything?

 

Have you attempted from the wiki loading the rom for the card, it's certainly not specific to this but can help with various stupid issues.

http://lime-technology.com/wiki/index.php/UnRAID_Manual_6#Edit_XML_for_VM_to_supply_GPU_ROM_manually

 

To test the card and make sure it works, can you make an Openelec VM and assign this card to it and see if it will start/show video?

OE is easy to setup, so it wouldn't take long to test this, likely need to be SeaBIOS unless that card supports OVMF (didn't look).

 

These are also good thoughts / suggestions.

Link to comment

bungee91, thanks for the suggestions, I have loaded the 660Ti rom into the XML, but am still getting a blank screen and the Error 43 on the driver is still there. The 660Ti uses two 6pin connectors, and I've made sure that they are connected properly. I have also used this card before so I know it works.

 

JonP, my motherboard does have onboard graphics should I be plugging my DVI cable into the onboard? I do have a GTX970, I try to unplug it from my main PC. I will let you know how that goes.

 

Here is section of the xml that I've loaded the rom.

<qemu:arg value='vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on,romfile=/mnt/disk4/iso/rom/PNY.GTX660Ti.2048.120723.rom'/>

 

 

Link to comment

bungee91, thanks for the suggestions, I have loaded the 660Ti rom into the XML, but am still getting a blank screen and the Error 43 on the driver is still there. The 660Ti uses two 6pin connectors, and I've made sure that they are connected properly. I have also used this card before so I know it works.

 

JonP, my motherboard does have onboard graphics should I be plugging my DVI cable into the onboard? I do have a GTX970, I try to unplug it from my main PC. I will let you know how that goes.

 

Here is section of the xml that I've loaded the rom.

<qemu:arg value='vfio-pci,host=02:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on,romfile=/mnt/disk4/iso/rom/PNY.GTX660Ti.2048.120723.rom'/>

Ok, the plot thickens. Plug your monitor into on board graphics with the machine turned off.  Have nothing attached to the pcie GPU. Boot up unRAID. The unRAID console should appear on the monitor attached to motherboard graphics.  Then plug the monitor into the pcie GPU. Try again.

Link to comment

Hi JonP, I have followed your steps. When I plug my dvi cable into the onboard I don't see any picture, but if I plug into my pcie card I do get a picture on my screen.

 

I have plugged in my GTX970, and loaded the rom into the XML but am still getting a blank screen when I start my vm.

What is the setting in the BIOS for the graphics set to right now?  What we are going for is we want the BIOS itself to load up on the monitor using the on board graphics (not the PCIe GPU).  If you can't make that happen, you're probably not going to have success with GPU assignment.

 

What I think may be going on here is your motherboard doesn't have the setting that most others do.  Usually you can choose to force graphics out your on board graphics, even though you have a discrete GPU installed.  Instead, yours has an Auto option which probably means that with no discrete GPU installed, it will default to using on board graphics, and if it is installed, it will use the GPU installed.

 

Maybe try setting that setting to PCI instead of Auto (or the other way around if its set that way already).

 

Have you also looked to see if any BIOS update is available for your motherboard?

Link to comment

Hi JonP, just got back from a long weekend. Right now the integrated graphics is still set to PCI, and I've looked at the ECS site, it looks like I have their latest bios already installed.

 

I appreciate all your help, but I might need to buy another MOBO, hopefully that's the issue and not another Video card or worst scenario, I need a new Graphics card and a new Mobo. Right now, am short on funds so well see in the future. Something that I cannot understand is the error 43, on the video card driver. If am able to get drivers installed on the VM then am all set, that's what I really need.

Link to comment

Hi JonP, just got back from a long weekend. Right now the integrated graphics is still set to PCI, and I've looked at the ECS site, it looks like I have their latest bios already installed.

 

I appreciate all your help, but I might need to buy another MOBO, hopefully that's the issue and not another Video card or worst scenario, I need a new Graphics card and a new Mobo. Right now, am short on funds so well see in the future. Something that I cannot understand is the error 43, on the video card driver. If am able to get drivers installed on the VM then am all set, that's what I really need.

The issue isn't the drivers.  If pass through was working on your motherboard correctly, you would see your monitor light up the second the VM was started. You'd see a virtual BIOS and the windows loading process.  The fact the device shows up in Windows device manager doesn't mean anything. It's showing a code 43 because the device is technically assigned, but thanks to how your mobo BIOS initializes graphics, the card isn't allowing for reinitialization.

 

I've seen folks run into this issue many times with frankly poor mobos. GPUs are rarely the issue nowadays. I have an incredibly old AMD 3xxx series card that works fine for pass through with multiple good motherboards. That isn't to say there aren't still GPU specific issues (the GTX 550 doesn't reset properly as one example), but your cards are modern enough that they should be fine.

 

Start with a new motherboard before buying anything else.

Link to comment

If this is the root of your problem (sounds like it is) I'd attempt the route of buying a real cheap PCI (since you have a slot) graphics card and hoping you can assign it as the primary boot GPU, that would then leave your desired card free to assign.

You should be able to find a PCI graphics card for ~$10.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...