the emulated HDA works fine in Windows 7 VM using the above, with proviso that I run VM as root, ie.
/etc/libvirt/qemu.conf includes (in my case, which works)
user = "root"
group = "root"
cgroup_device_acl = [
"/dev/null", "/dev/full", "/dev/zero",
"/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
"/dev/rtc","/dev/hpet", "/dev/vfio/vfio",
"/dev/vfio/1", "/dev/vfio/14", "/dev/vfio/15", "/dev/vfio/16", "/dev/vfio/17",
"/dev/shm", "/root/.config/pulse", "/dev/snd",
]
nographics_allow_host_audio = 1
security_require_confined = 0
hugetlbfs_mount = "/dev/hugepages"
clear_emulator_capabilities = 0
relaxed_acs_check = 1
If using VNC rather than Spice, you may also need
vnc_allow_host_audio = 1
and /etc/apparmor.d/abstractions/libvirt/qemu contains the following additional lines (in my case)
/{dev,run}/shm/pulse-shm* rw,
@{HOME}/.config/puls** rwk,
@{HOME}/** r,
/root/.config/puls** rwk,
/root/.asoundrc r,
/dev/vfio/* rw,
This works nicely with a Windows 7 guest using the following xml (where a graphics card is apssed through at 01:00.0 and a USB card is passed at 02:00.0, note that the inbuilt audio device on the graphics card is NOT passed through i'ts still attached to pci-stub)
!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit ssd-win7
or other application using the libvirt API.
-->
ssd-win792faa169-292a-4086-a398-31df57266eb1629145662914562hvm/mnt/programming_data/virtualisation/bios/bios.binHaswelldestroyrestartdestroy/usr/bin/qemu-system-x86_64
If you'd rather grant access at the VM level you can update the apparmor entries in /etc/apparmor.d/libvirt/libivrt-
What worked best for me was to create a new permissions file based on the "libvirt-.files" entry which was autmatically generated. The new file contains the following
# Added by R E to support use of VFIO.
"/dev/vfio/*" rw,
# Needed for ALSA sound (based on error messages about not having access).
"/dev/shm/pulse-shm*" rwk,
"/run/shm/pulse-shm*" rwk,
"/root/.config/puls**" rwk,
"/root/.asoundrc" r,
# Rather than specifying individual files, allow the whole directory
"/mnt/programming_data/isos/**" r,
# don't audit writes to readonly files
deny "/mnt/programming_data/isos/**" w,
Then add a pointer to that file in the master at "libvirt-" ie. to look like this (see the last entry, the file which i created)
#
# This profile is for the domain whose UUID matches this file.
#
#include
profile libvirt-c1a86cb2-82b4-4db9-89c2-ced5be57b39e {
#include
#include
#include
}
For some reason, when I do the same for a Ubuntu Trusty VM it initially worked but now shows a "device busy" error for some reason, which i'm unable to overcome - even though a Windows VM operating in exactly the same manner works fine. Arcane magic involved - sacrifice may be required
Both the AC97 and the HDA devices work on Windows ie. go into Control Panel / Sound and select one, run a test and it works fine. Neither of them is a PCI pasthrough card. As it happens I have a separate USB soundcard I can use in Windows because it's attached to the USB controller with is passed through via PCI passthrough, but that's a spearate story.
In my situation, the host is Ubuntu Trusty running kvm, qemu, libvirt and virt-manager from the standard repos. The kernel is patched to support VGA passthrough (mostly to deal with Intel graphics poor handling of VGA arbitration)
Have you tried this arrangement ?