Comment 218 for bug 1958019

Revision history for this message
In , cam (cam-linux-kernel-bugs) wrote :

Created attachment 297545
HUGE progress!

I reached out to Connor McAdams, the auth of QemuHDADump, about some issues I was having with QemuHDADump, and he directed me to https://github.com/ryanprescott/realtek-verb-tools

This is a pair of scripts meant to work with the JCS fork of Qemu (which is just qemu patched for more output to stdout including CORB info for Intel HDA). That repo for that is here: https://github.com/jcs/qemu

Last night I had found this repo, and I had simply tried to apply a patch from the JCS repo... It didn't work. The fields in the output were all zeros. Don't do that. Just build from the JCS repo directly.

Running qemu binary from the JCS qemu, I was able to extract verbs from the the JCS Qemu output and apply them to the laptop using the realtek-verb-tools scripts.

Applying these verbs initially didn't seem to work... So I tried playing music while applying them and you will get momentary blips of sound (specifically I heard blips of the track I was playing and not random noise)! What's most likely happening is that we need to extract a subset of these verbs for initialization and that some of the other verbs are stopping the sound (perhaps from when I stopped the YouTube video under windows as well as during shutdown).

Don't forget to reboot your machine with pci passthrough otherwise the application of the verbs won't work because your sound card is setup up for well... passthrough. There appears to be a way to disable passthrough for the device without rebooting, but rebooting is faster for at least me.

To provide some more concrete steps as to what I did:
The configure I used for JCS Qemu:
./configure --prefix=/opt/qemu/jcs --enable-kvm --enable-trace-backends=log --target-list=x86_64-softmmu --disable-werror
make -j$(nproc)
make install

How I ran it:
sudo /opt/qemu/jcs/bin/qemu-system-x86_64 -enable-kvm -hda win10.qcow2 -m 8G -smp 4 -vga std -device vfio-pci,host=00:1f.3,multifunction=on,x-no-mmap=true -trace events=events.txt >output.txt

python3 cleanverbs.py output.txt >verbs.txt
# Rebooted without intel_iommu and without vfio-pci.ids
# While playing sound:
sudo python3 applyverbs.py verbs.txt

With the verbs.txt, its likely that anyone on this thread with a Legion (or possibly a Yoga Slim as well) could apply these verbs and figure out what subset is needed. Which would be great because I don't know how much time I'll have now that it's Monday.

It's worth noting that it's entirely possible that the Slim needs some slightly different initialization.