If I want to make spice display the GVT-G output, I have to tell it not to listen to any addresses/ports or I will get errors and the VM won’t run.
If I want to use Looking Glass, I need Spice to listen to localhost.
This is a working GVT-G config for my setup:
libvirt config
<domain xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="kvm">
<name>Windoze_GVT</name>
<uuid>3c5e73bd-fba0-4cf0-b024-a38814cc8d90</uuid>
<title>Windoze GVT</title>
<description>Windoze 10 With GVT-G</description>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://microsoft.com/win/10"/>
</libosinfo:libosinfo>
</metadata>
<memory unit="KiB">16777216</memory>
<currentMemory unit="KiB">16777216</currentMemory>
<vcpu placement="static">8</vcpu>
<os>
<type arch="x86_64" machine="pc-q35-6.1">hvm</type>
<loader readonly="yes" type="pflash">/usr/share/edk2-ovmf/x64/OVMF_CODE.fd</loader>
<nvram>/var/lib/libvirt/qemu/nvram/Windoze_GVT_VARS.fd</nvram>
<boot dev="hd"/>
</os>
<features>
<acpi/>
<apic/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
</hyperv>
<vmport state="off"/>
</features>
<cpu mode="host-model" check="partial"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="raw"/>
<source file="/home/rabcor/Windoze/vm-files/Windoze.img"/>
<target dev="sda" bus="sata"/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15">
<address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
</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="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="1" port="0x10"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
</controller>
<controller type="pci" index="2" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="2" port="0x11"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/>
</controller>
<controller type="pci" index="3" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="3" port="0x12"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/>
</controller>
<controller type="pci" index="4" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="4" port="0x13"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/>
</controller>
<controller type="pci" index="5" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="5" port="0x14"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/>
</controller>
<controller type="pci" index="6" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="6" port="0x15"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/>
</controller>
<controller type="pci" index="7" model="pcie-to-pci-bridge">
<model name="pcie-pci-bridge"/>
<address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
</controller>
<controller type="virtio-serial" index="0">
<address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
</controller>
<interface type="network">
<mac address="52:54:00:cb:a9:1d"/>
<source network="default"/>
<model type="e1000e"/>
<address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>
<serial type="pty">
<target type="isa-serial" port="0">
<model name="isa-serial"/>
</target>
</serial>
<console type="pty">
<target type="serial" port="0"/>
</console>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
<address type="virtio-serial" controller="0" bus="0" port="1"/>
</channel>
<input type="tablet" bus="usb">
<address type="usb" bus="0" port="1"/>
</input>
<input type="mouse" bus="ps2"/>
<input type="keyboard" bus="ps2"/>
<graphics type="spice">
<listen type="none"/>
<image compression="off"/>
<gl enable="yes" rendernode="/dev/dri/by-path/pci-0000:00:02.0-render"/>
</graphics>
<sound model="ich9">
<address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/>
</sound>
<audio id="1" type="spice"/>
<video>
<model type="none"/>
</video>
<hostdev mode="subsystem" type="mdev" managed="no" model="vfio-pci" display="on">
<source>
<address uuid="71abd338-d32e-4a56-8f9a-5830d16a2828"/>
</source>
<address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
</hostdev>
<redirdev bus="usb" type="spicevmc">
<address type="usb" bus="0" port="2"/>
</redirdev>
<redirdev bus="usb" type="spicevmc">
<address type="usb" bus="0" port="3"/>
</redirdev>
<memballoon model="virtio">
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</memballoon>
<shmem name="looking-glass">
<model type="ivshmem-plain"/>
<size unit="M">32</size>
<address type="pci" domain="0x0000" bus="0x07" slot="0x01" function="0x0"/>
</shmem>
</devices>
<qemu:commandline>
<qemu:arg value="-set"/>
<qemu:arg value="device.hostdev0.romfile=/home/rabcor/Windoze/vm-files/vbios_gvt_uefi.rom"/>
<qemu:arg value="-set"/>
<qemu:arg value="device.hostdev0.x-igd-opregion=on"/>
<qemu:arg value="-set"/>
<qemu:arg value="device.hostdev0.ramfb=on"/>
<qemu:arg value="-set"/>
<qemu:arg value="device.hostdev0.driver=vfio-pci-nohotplug"/>
</qemu:commandline>
</domain>
Result is as you can see here: https://cdn.discordapp.com/attachments/799390918205374485/894769144904429588/unknown.png
And perhaps unsurprisingly (given the spice configuration), looking glass client spits out:
$ looking-glass-client
[I] 80329074488 main.c:1064 | main | Looking Glass (B4)
[I] 80329074505 main.c:1065 | main | Locking Method: Atomic
[I] 80329088632 ivshmem.c:127 | ivshmemOpenDev | KVMFR Device : /dev/shm/looking-glass
[E] 80329088719 main.c:727 | lg_run | Failed to connect to spice server
The spice configuration is like this:
<graphics type="spice">
<listen type="none"/>
<image compression="off"/>
<gl enable="yes" rendernode="/dev/dri/by-path/pci-0000:00:02.0-render"/>
</graphics>
As you can see the listen type is none, which would explain why the client has issues.
If I change it to this:
<graphics type="spice" autoport="yes">
<listen type="address"/>
<image compression="off"/>
<gl enable="yes" rendernode="/dev/dri/by-path/pci-0000:00:02.0-render"/>
</graphics>
I get this error:
qemu-system-x86_64: SPICE GL support is local-only for now and incompatible with -spice port/tls-port
If I further change it to this:
<graphics type="spice" autoport="yes">
<listen type="address"/>
<image compression="off"/>
</graphics>
I get this error instead:
qemu-system-x86_64: ... vfio-display-dmabuf: opengl not available
Does anyone know how I should fix the config so that looking glass will work, without breaking the VM?
Partial Solution mentioned by Netboy3 below, is to run looking-glass-client -s
, which provides a display output, but no direct HID & Clipboard support (because of no spice).
Solved Portion (host errors)
(Solution in one of my comments below)
However, the looking glass host fails to run:
Host Logs
Service Log
[2021-10-05 02:31:45] Startup
[2021-10-05 02:31:45] Host application exited with code 0x50
[2021-10-05 02:31:45] Host application failed to start with fatal error; will not restart
[2021-10-05 02:31:45] Finished
Looking Glass Host Log
[I] 217103125 delay.c:41 | delayInit | System timer resolution: 488200 ns
[W] 217104552 platform.c:495 | boostPriority | Failed to set realtime GPU priority.
[I] 217105543 platform.c:496 | boostPriority | This is not a failure, please do not report this as an issue.
[I] 217106745 platform.c:497 | boostPriority | To fix this, install and run the Looking Glass host as a service.
[I] 217108152 platform.c:498 | boostPriority | looking-glass-host.exe InstallService
[I] 217109113 app.c:514 | app_main | Looking Glass Host (B4)
217117428 [E] ivshmem.c:71 | ivshmemInit | Unable to enumerate the device, is it attached?: 0x00000103 (No more data is available.)
[E] 217118332 app.c:519 | app_main | Failed to find the IVSHMEM device
[I] 23332161 delay.c:41 | delayInit | System timer resolution: 488200 ns
[I] 23332730 app.c:514 | app_main | Looking Glass Host (B4)
23337521 [E] ivshmem.c:71 | ivshmemInit | Unable to enumerate the device, is it attached?: 0x00000103 (No more data is available.)
[E] 23337997 app.c:519 | app_main | Failed to find the IVSHMEM device
[I] 37451162 delay.c:41 | delayInit | System timer resolution: 488200 ns
[W] 37465824 platform.c:495 | boostPriority | Failed to set realtime GPU priority.
[I] 37480317 platform.c:496 | boostPriority | This is not a failure, please do not report this as an issue.
[I] 37497493 platform.c:497 | boostPriority | To fix this, install and run the Looking Glass host as a service.
[I] 37520981 platform.c:498 | boostPriority | looking-glass-host.exe InstallService
[I] 37535552 app.c:514 | app_main | Looking Glass Host (B4)
37554417 [E] ivshmem.c:71 | ivshmemInit | Unable to enumerate the device, is it attached?: 0x00000103 (No more data is available.)
[E] 37588184 app.c:519 | app_main | Failed to find the IVSHMEM device
Extra
I had another thread where I used a different libvirt config where the looking glass host failed, but for different reasons (it found the IVSHMEM Device, but was trying to use the QXL card instead of the iGPU)
Looking Glass Host not finding iGPU
Reason I’m not just continuing in that thread is because this has gone over to the territory of being an entirely different issue (now that there would be no GPU for looking glass to find except the iGPU, I imagine if the host wasn’t crashing for a different reason now).