[ovirt-users] How to passthrough GPU to windows guest

Martin Polednik mpolednik at redhat.com
Tue Mar 28 08:48:32 UTC 2017


On 28/03/17 16:22 +0800, yimao wrote:
>Thanks for your suggestions, I have tried that but problems still
>exist. Yes, I used Nvidia GTX 750Ti.
>
>I found the qemu's arguments have changed.
>
>    7210 ?        SLl    0:31 /usr/libexec/qemu-kvm -name
>guest=win7_1,debug-threads=on -S -object
>secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-16-win7_1/master-key.aes
>-machine pc-i440fx-rhel7.3.0,accel=kvm,usb=off -cpu
>Broadwell,+rtm,+hle,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff,hv_vendor_id=whatever,kvm=off
>-m size=1048576k,slots=16,maxmem=4194304k -realtime mlock=off -smp
>1,maxcpus=16,sockets=16,cores=1,threads=1 -numa
>node,nodeid=0,cpus=0,mem=1024 -uuid
>1fba3bd6-0659-4463-92ea-8efa43411082 -smbios
>type=1,manufacturer=oVirt,product=oVirt
>Node,version=7-3.1611.el7.centos,serial=031B021C-040D-050E-D806-900700080009,uuid=1fba3bd6-0659-4463-92ea-8efa43411082
>-no-user-config -nodefaults -chardev
>socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-16-win7_1/monitor.sock,server,nowait
>-mon chardev=charmonitor,id=monitor,mode=control -rtc
>base=2017-03-28T08:54:41,driftfix=slew -global
>kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -boot strict=on
>-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device
>virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x8 -device
>virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x4
>-drive if=none,id=drive-ide0-1-0,readonly=on -device
>ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -drive
>file=/rhev/data-center/00000001-0001-0001-0001-000000000311/c053a0c0-45ad-4f7a-b9ce-c1ac90c900d4/images/082d4d4c-3aae-4369-9cbb-e6a7b31c3204/63da97f3-7b1f-406b-905f-b12eeb96d55f,format=raw,if=none,id=drive-scsi0-0-0-0,serial=082d4d4c-3aae-4369-9cbb-e6a7b31c3204,cache=none,werror=stop,rerror=stop,aio=threads
>-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1
>-netdev tap,fd=33,id=hostnet0,vhost=on,vhostfd=35 -device
>virtio-net-pci,netdev=hostnet0,id=net0,mac=00:1a:4a:16:01:51,bus=pci.0,addr=0x3
>-chardev socket,id=charchannel0,path=/var/lib/libvirt/qemu/channels/1fba3bd6-0659-4463-92ea-8efa43411082.com.redhat.rhevm.vdsm,server,nowait
>-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.rhevm.vdsm
>-chardev socket,id=charchannel1,path=/var/lib/libvirt/qemu/channels/1fba3bd6-0659-4463-92ea-8efa43411082.org.qemu.guest_agent.0,server,nowait
>-device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=org.qemu.guest_agent.0
>-device usb-tablet,id=input0,bus=usb.0,port=1 -vnc
>192.168.120.235:0,password -k en-us -device
>qxl-vga,id=video0,ram_size=67108864,vram_size=8388608,vram64_size_mb=0,vgamem_mb=16,bus=pci.0,addr=0x2
>-device vfio-pci,host=01:00.0,id=hostdev0,bus=pci.0,addr=0x6 -device
>vfio-pci,host=01:00.1,id=hostdev1,bus=pci.0,addr=0x7 -device
>virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -object
>rng-random,id=objrng0,filename=/dev/urandom -device
>virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x9 -msg
>timestamp=on
>
>Does ovirt use vga passthrough or gpu passthrough? Should I install EDK2 OVMF?

It uses secondary GPU passthrough; the VGA is still occupied by the
spice QXL. No OVMF necessary at all.

That being said, if you still have the problem, I'd try to maybe work
with the hook to also disable hyperv and whatever you find around the
internet. It looks like everyone's card needs something different. To
be on the safe side, quadro k2200 seem to work fine.

>Thanks in advance.
>
>2017-03-28 15:17 GMT+08:00 Martin Polednik <mpolednik at redhat.com>:
>> On 28/03/17 02:12 +0800, yimao wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to passthrough gpu card to windows 7 guest, but I got the
>>> error code 43.
>>> I use ovirt node: ovirt-node-ng-installer-ovirt-4.1-2017032304.iso and
>>> ovirt-engine-appliance-4.1-20170322.1.el7.centos.noarch.rpm
>>> I have added  options "intel_iommu=on rdblacklist=nouveau
>>> pci-stub.ids=10de:1380,10de:0fbc" to the grub.conf and attached these
>>> devices to the guest. After I have installed the gpu's driver, I got
>>> the error code 43.
>>> Did I miss something? Any pointers or suggestions would be greatly
>>> appreciated.
>>
>>
>> You are most likely using consumer grade GPU that errors out in
>> Windows if it's running under virtualized environment. You could try
>> using the following hook (make sure it's in
>> /usr/libexec/vdsm/hooks/before_vm_start and it's executable bit is set
>> (chmod +x ...)).
>>
>> Just copy paste the following block to a bash and try to start the VM
>> again.
>>
>> cd /usr/libexec/vdsm/hooks/before_vm_start
>> cat << EOF >> 99_mask_kvm
>> #!/usr/bin/python2
>>
>> import hooking
>> domxml = hooking.read_domxml()
>>
>> hyperv = domxml.getElementsByTagName('hyperv')[0]
>> smm = domxml.createElement('vendor_id')
>> smm.setAttribute('state', 'on')
>> smm.setAttribute('value', 'whatever')
>> hyperv.appendChild(smm)
>>
>> features = domxml.getElementsByTagName('features')[0]
>> kvm = domxml.createElement('kvm')
>> hidden = domxml.createElement('hidden')
>> hidden.setAttribute('state', 'on')
>> kvm.appendChild(hidden)
>> features.appendChild(kvm)
>>
>> hooking.write_domxml(domxml)
>> EOF
>> chmod +x 99_mask_kvm
>>
>>
>>
>>> Thanks in advance.
>>> Yiimao Yang.


More information about the Users mailing list