Sound from guest VM output on host

Hello,

I have a vm runing windows 7 64bit and i would like to output it's sound on the integrated sound card of the host.

Is it possible ?

I have added the following args in the config files :

device intel-hda,id=sound5,bus=pci.0,addr=0x18 -device hda-micro,id=sound5-codec0,bus=sound5.0,cad=0 -device hda-duplex,id=sound5-codec1,bus=sound5.0,cad=1

I now have a sound card that is configured but i still have no sound output.

Thanks for your help
 
not sure if I understand your use case.

e.g. your Proxmox VE host is in the datacenter and you access a Win7 VM via your desktop OS - and you want sound.

if this is the use case, you can:
- juse use ms rdp with sound
- or use SPICE client, see http://pve.proxmox.com/wiki/SPICE#Using_Audio
 
Nope it's a home lab (basically a pc in my livving room)

I want to use it to have multiple vms (one main windows where i will set SARAH a voice control home automation software, this is why i need sound and then some other linux vms for various stuff)

For my main vm i want to plug some speakers on the PC and be able to hear the sound of my windows VM
 
As suggested by spirit i have enabled pci passthrough but now i'm not able to boot my vm

I have added this to the grub file

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"

pci passthrought works as you can see here

root@proxmox:~# dmesg | grep -e DMAR -e IOMMUACPI: DMAR 00000000c966a230 000B8 (v01 INTEL BDW 00000001 INTL 00000001)
dmar: IOMMU 0: reg_base_addr fed90000 ver 1:0 cap c0000020660462 ecap f0101a
dmar: IOMMU 1: reg_base_addr fed91000 ver 1:0 cap d2008c20660462 ecap f010da
root@proxmox:~#

And here is the list of my pci devices

root@proxmox:~# lspci00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06)
00:02.0 Display controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)
00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
00:14.0 USB controller: Intel Corporation 9 Series Chipset Family USB xHCI Controller
00:16.0 Communication controller: Intel Corporation 9 Series Chipset Family ME Interface #1
00:1a.0 USB controller: Intel Corporation 9 Series Chipset Family USB EHCI Controller #2
00:1b.0 Audio device: Intel Corporation 9 Series Chipset Family HD Audio Controller
00:1c.0 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 1 (rev d0)
00:1c.2 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 3 (rev d0)
00:1c.3 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 4 (rev d0)
00:1d.0 USB controller: Intel Corporation 9 Series Chipset Family USB EHCI Controller #1
00:1f.0 ISA bridge: Intel Corporation 9 Series Chipset Family H97 Controller
00:1f.2 SATA controller: Intel Corporation 9 Series Chipset Family SATA Controller [AHCI Mode]
00:1f.3 SMBus: Intel Corporation 9 Series Chipset Family SMBus Controller
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde PRO [Radeon HD 7750 / R7 250E]
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)
04:00.0 USB controller: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller (rev 03)

My sound card seems to be the host 00:03.0, so i add this to my vm conf file

hostpci0: 00:03.0

But when i try to boot my VM i have this error

kvm: -device pci-assign,host=00:03.0,id=hostpci0,bus=pci.0,addr=0x10: No IOMMU found. Unable to assign device "hostpci0"
kvm: -device pci-assign,host=00:03.0,id=hostpci0,bus=pci.0,addr=0x10: Device initialization failed.
kvm: -device pci-assign,host=00:03.0,id=hostpci0,bus=pci.0,addr=0x10: Device 'kvm-pci-assign' could not be initialized
TASK ERROR: start failed: command '/usr/bin/kvm -id 100 -chardev 'socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait' -mon 'chardev=qmp,mode=control' -vnc unix:/var/run/qemu-server/100.vnc,x509,password -pidfile /var/run/qemu-server/100.pid -daemonize -smbios 'type=1,uuid=f1580da4-2ed7-4109-87b6-e9306a6b2986' -name windows7-sarah -smp 'sockets=1,cores=1' -nodefaults -boot 'menu=on' -vga std -no-hpet -cpu 'kvm64,hv_spinlocks=0xffff,hv_relaxed,+lahf_lm,+x2apic,+sep' -k fr -m 2048 -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -readconfig /usr/share/qemu-server/pve-usb.cfg -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'pci-assign,host=00:03.0,id=hostpci0,bus=pci.0,addr=0x10' -device 'usb-host,hostbus=5,hostport=2.3' -device 'usb-host,hostbus=5,hostport=2.2' -device 'usb-host,hostbus=5,hostport=2.1' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:28539a5a855' -drive 'file=/var/lib/vz/template/iso/virtio-win-0.1-81.iso,if=none,id=drive-ide0,media=cdrom,aio=native' -device 'ide-cd,bus=ide.0,unit=0,drive=drive-ide0,id=ide0,bootindex=200' -drive 'file=/var/lib/vz/template/iso/Windows_7_SP1_X64_AIO.iso,if=none,id=drive-ide2,media=cdrom,aio=native' -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=201' -drive 'file=/var/lib/vz/images/100/vm-100-disk-1.qcow2,if=none,id=drive-virtio0,format=qcow2,cache=writeback,aio=native' -device 'virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=100' -netdev 'type=user,id=net0,hostname=windows7-sarah' -device 'e1000,mac=0E:7C:FB:07:13:69,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' -rtc 'driftfix=slew,base=localtime' -global 'kvm-pit.lost_tick_policy=discard'' failed: exit code 1
 
After upgrading the kernel now my Vms don't start

here is the error

Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
TASK ERROR: start failed: command '/usr/bin/kvm -id 100 -chardev 'socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait' -mon 'chardev=qmp,mode=control' -vnc unix:/var/run/qemu-server/100.vnc,x509,password -pidfile /var/run/qemu-server/100.pid -daemonize -smbios 'type=1,uuid=f1580da4-2ed7-4109-87b6-e9306a6b2986' -name windows7-sarah -smp 'sockets=1,cores=1' -nodefaults -boot 'menu=on' -vga std -no-hpet -cpu 'kvm64,hv_spinlocks=0xffff,hv_relaxed,+lahf_lm,+x2apic,+sep' -k fr -m 2048 -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -readconfig /usr/share/qemu-server/pve-usb.cfg -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'pci-assign,host=00:03.0,id=hostpci0,bus=pci.0,addr=0x10' -device 'usb-host,hostbus=5,hostport=2.3' -device 'usb-host,hostbus=5,hostport=2.2' -device 'usb-host,hostbus=5,hostport=2.1' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:28539a5a855' -drive 'file=/var/lib/vz/template/iso/virtio-win-0.1-81.iso,if=none,id=drive-ide0,media=cdrom,aio=native' -device 'ide-cd,bus=ide.0,unit=0,drive=drive-ide0,id=ide0,bootindex=200' -drive 'file=/var/lib/vz/template/iso/Windows_7_SP1_X64_AIO.iso,if=none,id=drive-ide2,media=cdrom,aio=native' -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=201' -drive 'file=/var/lib/vz/images/100/vm-100-disk-1.qcow2,if=none,id=drive-virtio0,format=qcow2,cache=writeback,aio=native' -device 'virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=100' -netdev 'type=user,id=net0,hostname=windows7-sarah' -device 'e1000,mac=0E:7C:FB:07:13:69,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' -rtc 'driftfix=slew,base=localtime' -global 'kvm-pit.lost_tick_policy=discard'' failed: exit code 1