Help needed: Pass audio from guest to host using pulseaudio

beralt

New Member
Oct 24, 2023
2
0
1
Hello everyone,

I have recently started with proxmox running on an Intel NUC8i5 (coffeelake) and love it so far. I really hope for your help.

Problem statement
I have a goal that I was not able to achieve yet:
Running kodi on a linux guest VM and using the hosts HDMI port and/or audio connector to output the audio/video from the guest.

Crazily, getting video passthrough worked like a charm with the available tutorials. HDMI video output is working flawlessly.

However, due to the architecture of the NUC passing the audio adapter through is not possible, since it is in the same IOMMU group as the ethernet adapter.
Code:
┌──────────┬────────┬──────────────┬────────────┬────────┬──────────────────────────────────────────────────────────────────────────────────────
│ class    │ device │ id           │ iommugroup │ vendor │ device_name                                                                        
╞══════════╪════════╪══════════════╪════════════╪════════╪══════════════════════════════════════════════════════════════════════════════════════
│ 0x010601 │ 0x9dd3 │ 0000:00:17.0 │          7 │ 0x8086 │ Cannon Point-LP SATA Controller [AHCI Mode]                                        
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x010802 │ 0xa808 │ 0000:3b:00.0 │         13 │ 0x144d │ NVMe SSD Controller SM981/PM981/PM983                                              
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x020000 │ 0x15be │ 0000:00:1f.6 │         12 │ 0x8086 │ Ethernet Connection (6) I219-V                                                      
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x028000 │ 0x9df0 │ 0000:00:14.3 │          5 │ 0x8086 │ Cannon Point-LP CNVi [Wireless-AC]                                                  
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x030000 │ 0x3ea5 │ 0000:00:02.0 │          0 │ 0x8086 │ CoffeeLake-U GT3e [Iris Plus Graphics 655]                                          
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x040380 │ 0x9dc8 │ 0000:00:1f.3 │         12 │ 0x8086 │ Cannon Point-LP High Definition Audio Controller                                    
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x050000 │ 0x9def │ 0000:00:14.2 │          4 │ 0x8086 │ Cannon Point-LP Shared SRAM                                                        
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x060000 │ 0x3ed0 │ 0000:00:00.0 │          1 │ 0x8086 │ 8th Gen Core Processor Host Bridge/DRAM Registers                                  
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x060100 │ 0x9d84 │ 0000:00:1f.0 │         12 │ 0x8086 │ Cannon Point-LP LPC Controller                                                      
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x060400 │ 0x9db8 │ 0000:00:1c.0 │          8 │ 0x8086 │ Cannon Point-LP PCI Express Root Port #1                                            
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x060400 │ 0x9dbc │ 0000:00:1c.4 │          9 │ 0x8086 │ Cannon Point-LP PCI Express Root Port #5                                            
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x060400 │ 0x9db0 │ 0000:00:1d.0 │         10 │ 0x8086 │ Cannon Point-LP PCI Express Root Port #9                                            
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x060400 │ 0x9db6 │ 0000:00:1d.6 │         11 │ 0x8086 │ Cannon Point-LP PCI Express Root Port #15                                          
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x078000 │ 0x9de0 │ 0000:00:16.0 │          6 │ 0x8086 │ Cannon Point-LP MEI Controller #1                                                  
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x088000 │ 0x1911 │ 0000:00:08.0 │          2 │ 0x8086 │ Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Mod
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x0c0330 │ 0x9ded │ 0000:00:14.0 │          4 │ 0x8086 │ Cannon Point-LP USB 3.1 xHCI Controller                                            
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x0c0500 │ 0x9da3 │ 0000:00:1f.4 │         12 │ 0x8086 │ Cannon Point-LP SMBus Controller                                                    
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x0c8000 │ 0x9da4 │ 0000:00:1f.5 │         12 │ 0x8086 │ Cannon Point-LP SPI Controller                                                      
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0x118000 │ 0x9df9 │ 0000:00:12.0 │          3 │ 0x8086 │ Cannon Point-LP Thermal Controller                                                  
├──────────┼────────┼──────────────┼────────────┼────────┼──────────────────────────────────────────────────────────────────────────────────────
│ 0xff0000 │ 0x522a │ 0000:3c:00.0 │         14 │ 0x10ec │ RTS522A PCI Express Card Reader                                                    
└──────────┴────────┴──────────────┴────────────┴────────┴──────────────────────────────────────────────────────────────────────────────────────

Unfortunately, applying the ACS override patch does not separate the IOMMU groups.
It is basically a similar situation as reported in this thread: https://forum.proxmox.com/threads/audio-is-same-iommu-group-as-ethernet-how-pass-through.128404/
Believe me, on some systems it is simply not possible to separate the IOMMU groups like desired/needed.

Tentative idea, help needed

So accepting defeat there, I need a workaround. Basically there are two possible options, as I see it:

1) Simply installing kodi on the proxmox host itself, not using any pcie passthrough whatsoever or
2) Installing only pulseaudio on the host, setting it up to use the HDMI or headphone jack for output, and somehow exposing it over network to the guest or
3) Adding a virtual audio card via spice to achieve the same.
4) Buying extra USB hardware. Either a soundcard, and passing this through or buying a network card and pass the whole IOMMU group through.

I would rather not need to have to do option 1.

Option 4 requires more hardware, and I buying an extra soundcard for usb might result in some lags and I cannot use the single HDMI connection for video/audio. Also, I don't know what else might break besides Ethernet, if I passthrough the whole IOMMU group, maybe other things won't start working.

I am not sure if this is possible via option 3. if I undertand correctly, having the audio on the physical hardware of the host (not only via RDP/VNC) is not possible. From the docs :
To use the physical audio device of the host use devicepassthrough (see PCI Passthrough andUSB Passthrough).

So I am left with option 2, which I think is technically possible.
In particular, I found these two resources:
1) https://mathiashueber.com/virtual-machine-audio-setup-get-pulse-audio-working/
2) https://wiki.archlinux.org/title/PC...o_from_virtual_machine_to_host_via_PulseAudio

Unfortunately, there host system is not proxmox and I am afraif if I am changing libvirt/qemu configs withour really knowing what to do, I will end up screwing up something badly.

So far I have installed pulseaudio on the proxmox host.
Next thing would have to run the pulseaudio server. What should I put into
Code:
/etc/libvirt/qemu.conf
? Should it be
Code:
user = "root"
Also, the rest of the tutorials basically all rely on the fact that the qemu host is run by a normal user with a home-directory and such.

Has anyone any experience with that and would be willing to help out?

If I get this working I am absolutely willing and eager to write a step-by-step tutorial of how to achieve actual audio/video passthrough on the physical hardware of the host in case IOMMU separation is not possible. This might benefit quite a couple of people.

Thanks already a lot for any help!
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!