On Wed, Mar 23, 2022 at 5:41 AM Takashi Iwai <tiwai@xxxxxxx> wrote: > > On Tue, 22 Mar 2022 19:57:27 +0100, > Jason Andryuk wrote: > > > > Hi, > > > > I'm running Xen hypervisor and using PCI passthrough to assign an > > Intel HDA audio device (00:1f.3 Audio device: Intel Corporation Cannon > > Point-LP High Definition Audio Controller (rev 30)) to a Xen HVM > > virtual machine. I do this for both Linux 5.4.185 and a different > > Windows 10 VM (only one at a time). The Windows VM seems to work > > every time. The Linux VM has issues after the first VM boot. This is > > one boot of the physical hardware and multiple boots of the virtual > > machines. > > > > For Linux, on first boot, the sound card is detected and works > > properly. After that, things usually don't work. I just ran a reboot > > loop and it was: > > 1st boot - audio detected and working > > 2 & 3 - no audio > > 4th - audio detected and working > > 5 - 20 - no audio > > > > For boots 2, 3, 5-7, dmesg shows: > > [ 0.760401] hdaudio hdaudioC0D0: no AFG or MFG node found > > [ 0.760415] snd_hda_intel 0000:00:06.0: no codecs initialized > > > > For boots 8+, the errors changed to: > > [ 0.783397] hdaudio hdaudioC0D0: cannot read sub nodes for FG 0x10 > > [ 0.783413] snd_hda_intel 0000:00:06.0: no codecs initialized > > > > At this point, I booted a Windows 10 VM and audio works > > > > Trying to boot Linux again gives a new error message > > [ 0.789041] snd_hda_intel 0000:00:06.0: Unknown capability 0 > > [ 1.811205] snd_hda_intel 0000:00:06.0: No response from codec, > > resetting bus: last cmd=0x0eef0004 > > [ 1.811246] hdaudio hdaudioC0D0: cannot read sub nodes for FG 0x10ee > > [ 1.811263] snd_hda_intel 0000:00:06.0: no codecs initialized > > > > Reboot VM and it's back to: > > [ 0.775917] hdaudio hdaudioC0D0: no AFG or MFG node found > > [ 0.775932] snd_hda_intel 0000:00:06.0: no codecs initialized > > > > Reboot VM and again: > > [ 0.789069] hdaudio hdaudioC0D0: cannot read sub nodes for FG 0x10 > > [ 0.789084] snd_hda_intel 0000:00:06.0: no codecs initialized > > > > Reboot physical laptop: > > 1. boot Windows 10 - audio works > > 2. boot Linux - audio works > > 3. reboot Linux - no audio > > [ 0.773111] hdaudio hdaudioC0D0: no AFG or MFG node found > > [ 0.773151] snd_hda_intel 0000:00:06.0: no codecs initialized > > > > This seems to me like Windows does a better job resetting the card to > > get the audio hardware working. Any suggestions on what to > > investigate? Thanks for taking a look, Takashi. > First off, 5.4.x is way too old to debug, please confirm the issue > with the latest kernel. > > And, one test I'd try is to unload snd-hda-intel module before > rebooting. Does the problem persist? For my 5.4.186 VM, the module is built-in. I tried `echo 0000:00:03.0 > /sys/bus/pci/driver/snd_hda_intel/unbind` before rebooting, but that did not work. I switched to Fedora 35 in the VM with kernel 5.16.16. That worked the first time and failed the second. First working: [ 3.094907] snd_hda_intel 0000:00:06.0: DSP detected with PCI class/subclass/prog-if info 0x040380 [ 3.094912] snd_hda_intel 0000:00:06.0: NHLT table not found [ 3.197480] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC3204: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker [ 3.197484] snd_hda_codec_realtek hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) [ 3.197485] snd_hda_codec_realtek hdaudioC0D0: hp_outs=1 (0x21/0x0/0x0/0x0/0x0) [ 3.197486] snd_hda_codec_realtek hdaudioC0D0: mono: mono_out=0x0 [ 3.197487] snd_hda_codec_realtek hdaudioC0D0: inputs: [ 3.197488] snd_hda_codec_realtek hdaudioC0D0: Headset Mic=0x19 [ 3.197489] snd_hda_codec_realtek hdaudioC0D0: Headphone Mic=0x1a [ 3.197489] snd_hda_codec_realtek hdaudioC0D0: Internal Mic=0x12 [ 66.801958] snd_hda_intel 0000:00:06.0: azx_get_response timeout, switching to polling mode: last cmd=0x00170500 Second boot audio still failed after doing `echo 0000:00:06.0 > /sys/bus/pci/driver/snd_hda_intel/unbind` and rmmod-ing lots of snd_* modules. I rmmod-ed the snd_*intel ones, but other snd* modules including snd_hrtimer were in use and could not be removed. [ 2.850918] snd_hda_intel 0000:00:06.0: DSP detected with PCI class/subclass/prog-if info 0x040380 [ 2.850923] snd_hda_intel 0000:00:06.0: NHLT table not found [ 2.873157] hdaudio hdaudioC0D0: no AFG or MFG node found [ 2.873161] snd_hda_intel 0000:00:06.0: no codecs initialized A different second boot where audio failed: [ 2.892183] snd_hda_intel 0000:00:06.0: DSP detected with PCI class/subclass/prog-if info 0x040380 [ 2.892189] snd_hda_intel 0000:00:06.0: NHLT table not found [ 2.961762] hdaudio hdaudioC0D0: cannot read sub nodes for FG 0x0e [ 2.961768] snd_hda_intel 0000:00:06.0: no codecs initialized Thanks, Jason