Pc-q35-4_0 bios + (pulse or alsa) audio: is it possible?

This weekend my goal was to rebuild my gpu-passthru+looking-glass vm from i440fx to q35 and get audio working. It’s been pretty challenging, although I’m a relative newcomer to linux. After 12 hours of trying over two days, I’m ready to bleat for help.

Starting clean-slate in a new pc-q35-4_0 vm, I got installed on qxl first, added the 1080gtx pcie devices, installed drivers etc and everything looked good. Spice audio was working, the pcie bridge layout looked good and even gpu-z reported x16 gen-3 enabled. Super so far.

However, when I restarted with video model=none, I lost audio. About 10 hours in, I can’t get audio working, period. Some details:

  1. I don’t think this is a general host / qemu issue because other vm’s audio on QXL video still work fine. I’ve tried (and backed out when they failed) many permutations of config file changes listed in various guides & forums.

  2. Bios is actually machine=“pc-q35-eoan” because machine=“pc-q35-4_0” caused the display to become unstable & randomly freeze. -eoan seems to work very well though. My host is Ubuntu 19.10. My client is Windows 10 1909. I’ve got the client nvidia audio-outs disabled and the high-definition audio device selected. I don’t think there are any audio mute issues.

  3. My hardware config might be a little unique: I have the motherboard Intel graphics HDMI port and 1080gtx DP port plugged into a Dell U3415W monitor and use it’s built-in KVM switch / PiP to squeeze two monitor-capability into one. I use monitor DP/HDMI audio. I have the host set to use the HDMI A/V from the motherboard, freeing the 1080gtx for KVM passthrough use. This works great, especially with looking glass, except for the audio issues.

  4. My symptoms are just no audio, like it’s muted. No errors that I can see in syslog or the domain log. In other QXL vms, when the vm generates sound, ‘virt-manager:playback’ appears as an app in PulseAudio Volume Control. That doesn’t happen in the looking glass vm.

  5. I’m looking for some advice: I’d like to use spice to pulse audio or ideally spice to alsa, but at this point I’m ready to compromise to get something working. Is it possible to solve this qemu bios 4.0 audio problem, should I punt to using qemu 3.5, or should I just order a cheap USB audio solution and pass it through?

** By the way, thanks to @gnif for his hard work and to the l1t community. I’ve found most of the best, up-to-date & relevant solutions hereabouts and I’ve learned a lot. I hope to give back in some way in the future.

Here’s some domain log output. I start the vm, adjust the volume (should ding), & shut down:

2020-03-23 08:51:01.531+0000: starting up libvirt version: 5.4.0, package: 0ubuntu5.1 (Guilherme G. Piccoli <[email protected]> Thu, 20 Feb 2020 12:35:23 -0300), qemu version: 4.0.0Debian 1:4.0+dfsg-0ubuntu9.4, kernel: 5.3.0-42-generic, hostname: hexy
LC_ALL=C \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin \
HOME=/var/lib/libvirt/qemu/domain-2-gpu-apps \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-2-gpu-apps/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-2-gpu-apps/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-2-gpu-apps/.config \
QEMU_AUDIO_DRV=spice \
/usr/bin/qemu-system-x86_64 \
-name guest=gpu-apps,debug-threads=on \
-S \
-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-2-gpu-apps/master-key.aes \
-machine pc-q35-eoan,accel=kvm,usb=off,vmport=off,dump-guest-core=off \
-cpu Skylake-Client-IBRS,ss=on,vmx=on,hypervisor=on,tsc_adjust=on,clflushopt=on,umip=on,md-clear=on,stibp=on,arch-capabilities=on,ssbd=on,xsaves=on,pdpe1gb=on,skip-l1dfl-vmentry=on,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff,hv_vendor_id=1234567890ab,kvm=off \
-drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on \
-drive file=/var/lib/libvirt/qemu/nvram/gpu-apps_VARS.fd,if=pflash,format=raw,unit=1 \
-m 16384 \
-overcommit mem-lock=off \
-smp 8,sockets=1,cores=4,threads=2 \
-uuid 8-) \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=24,server,nowait \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=localtime,driftfix=slew \
-global kvm-pit.lost_tick_policy=delay \
-no-hpet \
-no-shutdown \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-boot strict=on \
-device pcie-root-port,port=0x10,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2 \
-device pcie-root-port,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 \
-device pcie-root-port,port=0x12,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 \
-device pcie-root-port,port=0x13,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3 \
-device pcie-root-port,port=0x14,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x4 \
-device pcie-root-port,port=0x15,chassis=6,id=pci.6,bus=pcie.0,addr=0x2.0x5 \
-device pcie-root-port,port=0x16,chassis=7,id=pci.7,bus=pcie.0,addr=0x2.0x6 \
-device pcie-root-port,port=0x17,chassis=8,id=pci.8,bus=pcie.0,addr=0x2.0x7 \
-device pcie-root-port,port=0x18,chassis=9,id=pci.9,bus=pcie.0,multifunction=on,addr=0x3 \
-device pcie-root-port,port=0x19,chassis=10,id=pci.10,bus=pcie.0,addr=0x3.0x1 \
-device pcie-pci-bridge,id=pci.11,bus=pci.10,addr=0x0 \
-device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.2,addr=0x0 \
-device virtio-serial-pci,id=virtio-serial0,bus=pci.3,addr=0x0 \
-drive file=/mnt/images/gpu-apps/gpu-apps.img,format=raw,if=none,id=drive-virtio-disk0,cache=none,aio=threads \
-device virtio-blk-pci,scsi=off,bus=pci.5,addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1,write-cache=on \
-netdev tap,fd=26,id=hostnet0,vhost=on,vhostfd=27 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:00:00:03,bus=pci.1,addr=0x0 \
-chardev pty,id=charserial0 \
-device isa-serial,chardev=charserial0,id=serial0 \
-chardev spicevmc,id=charchannel0,name=vdagent \
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 \
-device virtio-keyboard-pci,id=input2,bus=pci.9,addr=0x0 \
-spice port=5903,addr=127.0.0.1,disable-ticketing,image-compression=off,seamless-migration=on \
-device ich9-intel-hda,id=sound0,bus=pcie.0,addr=0x1b \
-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \
-chardev spicevmc,id=charredir0,name=usbredir \
-device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=1 \
-chardev spicevmc,id=charredir1,name=usbredir \
-device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=2 \
-device vfio-pci,host=01:00.0,id=hostdev0,bus=pci.6,addr=0x0 \
-device vfio-pci,host=01:00.1,id=hostdev1,bus=pci.7,addr=0x0 \
-device vfio-pci,host=05:00.0,id=hostdev2,bus=pci.8,addr=0x0 \
-device usb-host,hostbus=1,hostaddr=5,id=hostdev3,bus=usb.0,port=3 \
-device virtio-balloon-pci,id=balloon0,bus=pci.4,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-object memory-backend-file,id=shmmem-shmem0,mem-path=/dev/shm/looking-glass,size=67108864,share=yes \
-device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,bus=pci.11,addr=0x1 \
-msg timestamp=on
char device redirected to /dev/pts/2 (label charserial0)
2020-03-23T08:54:56.231301Z qemu-system-x86_64: terminating on signal 15 from pid 4219 (/usr/sbin/libvirtd)
2020-03-23 08:54:59.351+0000: shutting down, reason=shutdown

Moved to VFIO as this is not a Looking Glass issue.

LG doesn’t support Spice audio, if you had sound it would have been via a virtual audio device or HDMI.

Make sure you’re running the most recent updates to W10 as Microsoft broke the drivers for this device and silently fixed it a few months later.

Sorry about the terminology confusion. I jumped to the conclusion it was spice-related since audio was lost when I changed video from QXL to none.

Thanks for the windows driver suggestion - I’ll check that but I think I’m on the latest bits.

Apologies I haven’t had the patience to read everything and only skimmed through your post.

Have you tried Scream:

I ended up passing thru a cheap USB audio device. It works well enough for now. Thanks for the suggestion though.