Pass through PCIe sound card for docker or VM..?


Recommended Posts

Hi all, I wasn't sure if I should post this here or in the KVM section. Sorry for the long and convoluted post, but I've spent the last couple of hours trying to figure this out with no luck. Any suggestions or advice would really be appreciated! Thanks.

 

Here is the situation. I am using an ASRock C2750D4II motherboard with an Intel Avoton (Atom) C2750 CPU (http://www.asrockrack.com/general/productdetail.asp?Model=C2750D4II). I am also running Roon (https://roonlabs.com/) in a modified Ubuntu docker to manage and play my music.

 

I would like to be able to play music directly (via Roon) from my server by sending it out digitally (via TOSLINK optical or coaxial) to my DAC where it will be decoded and transferred as an analog signal to my amplifier. I thought I could accomplish this by installing an ASUS Xonar DX PCIe sound card which has a coax digital output. However my Roon docker doesn't recognize the sound card as a local audio device.

 

When I check my PCI devices in Tools > 'system devices' I see this:

00:00.0 Host bridge: Intel Corporation Atom processor C2000 SoC Transaction Router (rev 02)
00:01.0 PCI bridge: Intel Corporation Atom processor C2000 PCIe Root Port 1 (rev 02)
00:03.0 PCI bridge: Intel Corporation Atom processor C2000 PCIe Root Port 3 (rev 02)
00:04.0 PCI bridge: Intel Corporation Atom processor C2000 PCIe Root Port 4 (rev 02)
00:0e.0 Host bridge: Intel Corporation Atom processor C2000 RAS (rev 02)
00:0f.0 IOMMU: Intel Corporation Atom processor C2000 RCEC (rev 02)
00:13.0 System peripheral: Intel Corporation Atom processor C2000 SMBus 2.0 (rev 02)
00:16.0 USB controller: Intel Corporation Atom processor C2000 USB Enhanced Host Controller (rev 02)
00:17.0 SATA controller: Intel Corporation Atom processor C2000 AHCI SATA2 Controller (rev 02)
00:18.0 SATA controller: Intel Corporation Atom processor C2000 AHCI SATA3 Controller (rev 02)
00:1f.0 ISA bridge: Intel Corporation Atom processor C2000 PCU (rev 02)
00:1f.3 SMBus: Intel Corporation Atom processor C2000 PCU SMBus (rev 02)
01:00.0 PCI bridge: PLX Technology, Inc. PEX8112 x1 Lane PCI Express-to-PCI Bridge (rev aa)
02:04.0 Multimedia audio controller: C-Media Electronics Inc CMI8788 [Oxygen HD Audio]
03:00.0 PCI bridge: PLX Technology, Inc. PEX 8608 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
04:01.0 PCI bridge: PLX Technology, Inc. PEX 8608 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
04:05.0 PCI bridge: PLX Technology, Inc. PEX 8608 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
04:07.0 PCI bridge: PLX Technology, Inc. PEX 8608 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
04:09.0 PCI bridge: PLX Technology, Inc. PEX 8608 8-lane, 8-Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba)
05:00.0 SATA controller: Marvell Technology Group Ltd. 88SE9172 SATA 6Gb/s Controller (rev 11)
06:00.0 PCI bridge: ASPEED Technology, Inc. AST1150 PCI-to-PCI Bridge (rev 02)
07:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 21)
08:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
09:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
0a:00.0 SATA controller: Marvell Technology Group Ltd. 88SE9230 PCIe SATA 6Gb/s Controller (rev 11)

 

The Asus soundcard is not listed, but when I downloaded my config files from Tools > Diagnostics, the lspci.txt file in the system folder lists this entry:

02:04.0 Multimedia audio controller [0401]: C-Media Electronics Inc CMI8788 [Oxygen HD Audio] [13f6:8788]
Subsystem: ASUSTeK Computer Inc. Virtuoso 100 (Xonar DX) [1043:8275]

 

Because the sound card isn't recognized in the Roon docker directly I decided to install a Windows VM and enabled PCIe ACS Override, and then installed Roon Server inside this VM. However when I look at the Windows Device manager I can't see the sound card.

 

Here is my VM XML:

<domain type='kvm' id='1'>
  <name>Windows 10 x86 VM</name>
  <uuid>91be1eb1-3ce5-58bb-657f-8ab5ca490376</uuid>
  <metadata>
    <vmtemplate name="Custom" icon="windows.png" os="windows"/>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='4'/>
    <vcpupin vcpu='1' cpuset='5'/>
    <vcpupin vcpu='2' cpuset='6'/>
    <vcpupin vcpu='3' cpuset='7'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='4' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/Domains/Windows 10 x86 VM/vdisk1.img'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/ISOs/WIN10.X86.8x1.ENU.May2016.ISO'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='2'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/ISOs/virtio-win-0.1.102.iso'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:fb:83:45'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/Windows 10 x86 VM.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' websocket='5700' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='vmvga' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
</domain>

 

So, I'm not sure what the issue is. When I check Tools > System Devices the IOMMU Groups entry says:

 

Warning: Your system has booted with the PCIe ACS Override setting enabled. The below list doesn't not reflect the way IOMMU would naturally group devices. To see natural IOMMU groups for your hardware, go to the VM Settings page and set the PCIe ACS Override setting to No.

No IOMMU Groups

 

When I check my server info HVM is Enabled, but  IOMMU is disabled. I checked the Intel page, and it says that my CPU is VT-x enabled (http://ark.intel.com/products/77987/Intel-Atom-Processor-C2750-4M-Cache-2_40-GHz), but from what I can tell the ASRock BIOS doesn't have an option to enable IOMMU.

 

I checked this sticky post in the KVM forum: https://lime-technology.com/forum/index.php?topic=38259.0 , and this post in the KVM forum: https://lime-technology.com/forum/index.php?topic=44591.0 which both seem to indicate that I should add this code to my VM XML but I'm not sure if that will solve the problem as I don't have any IOMMU groups listed:

    
<hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x04' slot='0x02' function='0x1'/>
      </source>
    </hostdev>

 

Again, at the end of the day what I want to accomplish is being able to play audio directly from the server through my PCIe sound card, either from a docker like Roon or Plex or from a Windows VM. Any ideas how I can accomplish this with my setup?

Link to comment

Bad news I bring to you. Your CPU doesn't support vt-d which is needed for being able to pass through devices. Vt-x is for being able to run a VM.

 

Passing through the sound card to a docker I'm not sure if it's so easy to do. I think the drivers have to be installed in unraid for this to work, but I'm not sure.

You could try to run the container as privileged and then install the driver in the container.

Link to comment
  • 6 months later...

I'm not sure this is any different than passing the PCI capture cards to my MythTV docker.

 

--device=/dev/dvb/adapter0/demux0:/dev/dvb/adapter0/demux0 \
--device=/dev/dvb/adapter0/dvr0:/dev/dvb/adapter0/dvr0 \
--device=/dev/dvb/adapter0/net0:/dev/dvb/adapter0/net0 \
--device=/dev/dvb/adapter0/frontend0:/dev/dvb/adapter0/frontend0 \
--device=/dev/dvb/adapter1/demux0:/dev/dvb/adapter1/demux0 \
--device=/dev/dvb/adapter1/dvr0:/dev/dvb/adapter1/dvr0 \
--device=/dev/dvb/adapter1/net0:/dev/dvb/adapter1/net0 \
--device=/dev/dvb/adapter1/frontend0:/dev/dvb/adapter1/frontend0 \

Link to comment

I'm not sure this is any different than passing the PCI capture cards to my MythTV docker.

 

--device=/dev/dvb/adapter0/demux0:/dev/dvb/adapter0/demux0 \
--device=/dev/dvb/adapter0/dvr0:/dev/dvb/adapter0/dvr0 \
--device=/dev/dvb/adapter0/net0:/dev/dvb/adapter0/net0 \
--device=/dev/dvb/adapter0/frontend0:/dev/dvb/adapter0/frontend0 \
--device=/dev/dvb/adapter1/demux0:/dev/dvb/adapter1/demux0 \
--device=/dev/dvb/adapter1/dvr0:/dev/dvb/adapter1/dvr0 \
--device=/dev/dvb/adapter1/net0:/dev/dvb/adapter1/net0 \
--device=/dev/dvb/adapter1/frontend0:/dev/dvb/adapter1/frontend0 \

 

It might work if he manage to install the driver in unraid.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.