Passing through PCI Sound Card


Recommended Posts

I'm sorry in advance for the probable dumb request but I couldn't find much info in the wiki or here.

I just upgraded unRAID to make it VT-d capable and wanted to pass through my NVIDIA GTS 450 and Asus Xonar Sound Card.

 

I struggled a little with the gpu but with the explicit rom file it seems to work now.

As for the sound card I can't selected from the GUI, it's not listed, but I guess I can work some magic through the editing of the XML file, just as I did with the GPU.

 

Here are my PCI devices:

 

00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)
00:02.0 Display controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09)
00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)
00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579V Gigabit Network Connection (rev 04)
00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4)
00:1c.7 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 8 (rev c4)
00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation Z77 Express Chipset LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation GF116 [GeForce GTS 450 Rev. 2] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GF116 High Definition Audio Controller (rev a1)
02:00.0 RAID bus controller: Marvell Technology Group Ltd. MV64460/64461/64462 System Controller, Revision B (rev 01)
03:00.0 PCI bridge: Integrated Technology Express, Inc. Device 8892 (rev 30)
04:02.0 Multimedia audio controller: C-Media Electronics Inc CMI8788 [Oxygen HD Audio]

 

Here the IOMMU groups

 

/sys/kernel/iommu_groups/0/devices/0000:00:00.0
/sys/kernel/iommu_groups/1/devices/0000:00:01.0
/sys/kernel/iommu_groups/1/devices/0000:01:00.0
/sys/kernel/iommu_groups/1/devices/0000:01:00.1
/sys/kernel/iommu_groups/2/devices/0000:00:02.0
/sys/kernel/iommu_groups/3/devices/0000:00:14.0
/sys/kernel/iommu_groups/4/devices/0000:00:16.0
/sys/kernel/iommu_groups/5/devices/0000:00:19.0
/sys/kernel/iommu_groups/6/devices/0000:00:1a.0
/sys/kernel/iommu_groups/7/devices/0000:00:1c.0
/sys/kernel/iommu_groups/8/devices/0000:00:1c.7
/sys/kernel/iommu_groups/9/devices/0000:00:1d.0
/sys/kernel/iommu_groups/10/devices/0000:00:1f.0
/sys/kernel/iommu_groups/10/devices/0000:00:1f.2
/sys/kernel/iommu_groups/10/devices/0000:00:1f.3
/sys/kernel/iommu_groups/11/devices/0000:02:00.0
/sys/kernel/iommu_groups/12/devices/0000:03:00.0
/sys/kernel/iommu_groups/12/devices/0000:04:02.0

 

Can anyone guide me?

Link to comment

I have the exact same sound card, so I feel obliged to help! Add this between <devices> and </devices>, Add it directly after a </hostdev> line, so you dont break any other virtual devices:

 

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

 

Be aware that because this has been added in the XML editor, if you ever change anything on this VM in the GUI editor, this bit will be stripped out and you'll need to add it in again.

 

For future reference, you can do this with other devices too (eg, USB3 card). just change the bus\slot\function to match the device code in your PCI device list. So your sound card is

04:02.0

, so that translates to

bus='0x04' slot='0x02' function='0x0'

in the VM address domain.

Link to comment

Thanks for the tip, and I added what you said to the configuration, but the VM refuses to start now:

 

Here's the log:

2015-12-10T09:10:58.605047Z qemu-system-x86_64: -device vfio-pci,host=04:02.0,id=hostdev2,bus=pci.0,addr=0x8: vfio: Error: Failed to setup INTx fd: Device or resource busy
2015-12-10T09:10:58.605463Z qemu-system-x86_64: -device vfio-pci,host=04:02.0,id=hostdev2,bus=pci.0,addr=0x8: Device initialization failed
2015-12-10T09:10:58.605486Z qemu-system-x86_64: -device vfio-pci,host=04:02.0,id=hostdev2,bus=pci.0,addr=0x8: Device 'vfio-pci' could not be initialized

Link to comment

try and pass through the sound cards PCIe bridge too as thats in the same IOMMU group:

 

<hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
      </source>
    </hostdev>

 

if that doesn't work, take out the PCIe bridge above and look into enabling ACS Overide (Settings>VM Manager>PCIe ACS Override: Enable). Should pass through fine after that.

Link to comment

I think it worked without the PCIe bridge now.

Sorry but I'm quite new to this and my original VM was with SEABIOS so I created a new OVMF config, but same vdisk1, to match your instructions. I followed a guide to convert Windows from MBR to UEFI and tried again.

 

This time I experience some sort of UEFI corruption as I tried to add the hostdev tag after video but before another USB thing... The screen remained black...

 

I removed the sound card setting again and had to go through the reconfiguration of UEFI.. I don't know...

 

Now should be the turn of the video card but I'm worried it won't be easy.

 

Anyway thanks, I was able to install the Xonar drivers and have the SO see the card. Victory!

Link to comment

OK, I did some more tests...

 

Point 1

Any hardware change I make triggers some sort of corruption... the BIOS keeps on rebooting and the log prints this any time it does it:

 

qemuAgentNotifyEvent:1244 : Received unexpected event 3

 

In other words it never gets to start Windows.

I don't know if this is a defect of the procedure I followed and I should start from a clean disk but this is strange... but at the moment I can't make any hardware modification without incurring into the problem.

 

Point 2

The error given when I tried to add the sound card is triggered if there's also the NVIDIA High Definition Audio - that of the gpu - defined. If I remove it then no error and the VM starts. What's with that?

Link to comment

Personally, ive never been able to get OVMF VMs to run properly, so ive stuck with seabios for the time being. no difference in performance as far as im aware.

also depends on if the device being passed through is UEFI friendly, which might not be the case with the sound card.

 

apparently some updates in 6.2 have made ovmf a little more friendly though, so if you can hang fire until then?

 

In the meantime if you want to get things up and running, id suggest creating the VM using seabios, however it will more than likely require an OS reinstall.

 

Link to comment

Sorry for the confusion. I just found out what my problem was...

 

It worked at first but then after more toying around it stopped and I couldn't get it to work anymore.

That was before I tried to add the sound card - physically I mean, by taking down the server and everything... then I thought the problem was the coexistence.

What I didn't realize is that I had reattached my monitor to the PCI-E gpu rather than the mobo gpu.

 

So the server booted up with the mobo setting the PCI-E gpu as primary video card...

What I just discovered is that it's not just a matter of having at least 2 video cards. If I don't take care of forcing the integrated GPU as primary from the BIOS - mine was set to auto, that's why where the monitor cable was attached made the difference - the screen would remain black.

 

I investigated more when I realized there were more things written in the syslog than the vm log. In the syslog I found this line:

 

vfio-pci 0000:01:00.0: Invalid ROM contents

 

That ultimately led me to the source of the problem and solution.

 

I have both SeaBIOS and OMVF (although I didn't test the corruption thing as I wrote previously but as I was suggested I would wait for unRAID 6.2) working now!

Link to comment

Point 2

The error given when I tried to add the sound card is triggered if there's also the NVIDIA High Definition Audio - that of the gpu - defined. If I remove it then no error and the VM starts. What's with that?

 

I also found out about this but I'm not sure if it can be solved...

 

it's a flag mismatch IRQ error.

Basically 2 devices trying to use the same IRQ because they one of them - or both? - is not properly supporting PCI2.3 INTx disable or something like that... http://marc.info/?l=kvm&m=138939395523823&w=2

 

Link to comment
  • 3 weeks later...

PCIe

 

I have the PCI version and I'm experiencing instability issues.

 

Movie playback is far from being flawless: every some random seconds or minutes the video stutters and the soundcard plays garbled audio. Sometimes, it can occur that the whole server freezes - not only the vm - and I am forced to hard reset everything. If I play audio only - Spotify for example - the playback sounds good but I'm still experiencing the entire lockup of the server.

 

I'm really thinking the audio card is to blame at this point. I tried SeaBIOS and OMVF, Windows 8.1 and Windows 10, official driver and unixonar driver, but the result doesn't change.

 

I guess the "Failed to setup INTx fd:" error message, when passing the whole video card - video and hdmi audio, has to do with the PCI being more rigid than the PCIe.

 

I don't really know what to do as I don't want to spend some 200€ for having a PCIe version of the same card and still deal with the same problem.

 

I guess everything is working well with you ::)

Link to comment

sound wise, yes things are working fine... I have other gripes at this point but hopefully things mature in the next version.

Hopefully someone else passing through a pci sound card can point you in the right direction.

 

would the MSI fix not apply in your situation? http://lime-technology.com/wiki/index.php/UnRAID_6/VM_Guest_Support#Enable_MSI_for_Interrupts_to_Fix_HDMI_Audio_Support

Link to comment

I did that but nothing changed. I didn't experience further freeze but it was just one short test, till I noticed that stuttering and garbled audio was there.

 

For the moment I put things on hold: reinstated my old HTPC and moved the sound card back there.

 

Hopefully things might change with the next update. I'd really love to hold my breath.

Link to comment
  • 3 months later...

I just wanted to say that I finally decided to install my first 6.20 beta, that is, beta 21.

I didn't make any hardware changes since my early woes and lo and behold, it's stable now.

So far, no problems whatsoeve. I'm starting feeling very, very, happy.

 

Thanks unRAID staff for your hard work! Looking forward to seeing more magic happening  ;)

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.