The Pragmatic Neckbeard 3: VFIO, IOMMU and PCIe

shows soundcard working in vm but i hear nothing in host

Right. Couple initial questions:

Which soundcard was configured in libvirt?

Are you using PulseAudio or ALSA? (If you don't know, ps -aux | grep pulse if it shows other than the grep command, you've got pulse.)

alsa and it's ich6 in virtual-manager

Hmmm... I'm not familiar with using alsa... Usually alsa just works... let me dig around a bit.

What DE and whatnot are you using?


This is what I see on my end. I know you'll see something different because alsa.

xfce

should i change to pulseaudio? I've done it earlier in ubuntu when alsa was broken, but i don't see reasont why shouldnt it work :S

Here's the thing. I have a good idea of how to get it working on PA, but I can't 100% guarantee it will work.

I usually just use pulse for simplicity because I use the gnome stack, but it's your call.

If you do want to switch to pulse, the change should be quite simple. First, find your user id:

echo $UID

Then, virsh edit your vm and add this, replacing the 1000 with your userid:

 <qemu:commandline>
   <qemu:env name='QEMU_AUDIO_DRV' value='pa'/>
   <qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/>
 </qemu:commandline>

hmm this virsh editing seems too odd for me *like vim :S
can i simply add it with any editor normally with root perm? also where to add it in file top bottom or?

you can use EDITOR=vim or EDITOR=emacs or whatever as a prefix to change the editor it uses.

I usually add it on the second to bottom line.

like before the final closing tag.

should i reboot after?

reboot the VM, yes. Also won't hurt to reboot the host so you can be sure all your changes are applied.

switched to pulse and gnoome de
there is similar tab wit "apps" that play/rec sound, no virt manager present, any other app shows up when playing audio

I had best results with this setup:
1. set CPU architecture to 'host-passthrough' (by manually typing it - it might not show up in the drop down)
2. set the number of logical CPUs to the number of cores you want to use, let's say 4 (multiply by two if you have HyperThreading enabled)
3. set sockets = 1, cores = 4, threads = 1 (2 when HyperThreading is enabled)
This should also help with sound interrupts

As for audio I just use PulseAudio with the AC97 virtual soundcard and leave the virt-manager window open. You have to do some voodoo to install the Realtek AC97 driver on Windows 10. I've tried mucking about with PA and ALSA but usually ended up with broken sound on either the guest or the host. AC97 + PA was the simplest and didn't require any additional configuration.

Quoting this SO answer. Drivers are here

Then for the next section you need to disable driver signature enforcement, I recommend watching the video for this part as it makes it a bit easier to see which option to click but it basically is:

Open Settings, go to Update & Security, Choose Recovery in the left pane, Choose Advanced Start-up, Choose Troubleshoot, Advanced Options, Choose Start Up Settings and then press the restart button.

Once restarted you need to choose option 7 which disables driver signature enforcement.

Once Windows comes back go into Device Manager, Right click the multimedia device and choose 'Update Driver Software' click browse on the next page and navigate to the realtek driver you downloaded earlier.

Edit: I also use the 'CPU pinning' and 'static huge pages' described on ArchLinux wiki, raw format for the drives and keep them on ext4 instead of btrfs.

did all as mentioned and drivers are installed, but when i try to play video/audio it doesnt go from 0:00 and nothing gets out of vm

////// important note/////\
few min ago win update updated my radeon drivers and now wow works same as on normal windows #win10 making things happen

Glad to hear you're making progress. I'm kinda lost on the whole audio thing right now. I've always tried to find workarounds to the problem. What I'm going to do this weekend is make an arch partition and try to replicate the issue. Did you install Arch from scratch or did you use Manjaro or Antergos?

scratch, and i think i found what-s the problem but will be hard to solve it :S

What did you find?

my alsa wasnt fully uninstalled and this showed up in logs

Home directory not accessible: Permission denied
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(sndconfig_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(sndconfig_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(sndconfig_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM sysdefault
alsa: Could not initialize ADC
alsa: Failed to open default':
alsa: Reason: No such file or directory
audio: Failed to create voice
ac97.mc'

You do know that Pulse works on top of alsa, right?

Not sure if there are different packages in arch for alsa/pulse and just alsa, but you shouldn't need to uninstall alsa.

ye i know that it works on top of alsa/oss but i think that virt-manager doesnt have permissions to access it anyways. thats why i was thinking removing alsa then reinstall with pulse will actually fix permissions

and ye there are diff packages for alsa and pulse

hmm so strange there is a lot of ppl who had issues with audio but rare answers could be googled :&