Intel HD Audio or PCI passthrough (host vs guest device)

Discussions related to using VirtualBox on Windows hosts.
Post Reply
VM2VM
Posts: 19
Joined: 7. Sep 2014, 01:26

Intel HD Audio or PCI passthrough (host vs guest device)

Post by VM2VM »

Hi,
I'm trying to understand the mechanism used by VB to enumerate the hosts physical Audio device(s) on the guest VM.

The problem is that my host is using an "Intel HD Audio" PCI device, but showing a completely different Audio device on my VM OS.
Thus I don't have Audio when using the Guest OS in that mode. This is my setup:

Code: Select all

Hardware:       ASUS N550JK
Motherboard:    Intel HM86 (Lynx Point)
Processor:      Intel Core i7-4710HQ
Memory:         16 GB DDR3 SDRAM
Video-1:        Intel HD Graphics 4600
Audio Adapter:  Intel Lynx Point PCH - High Definition Audio Controller [C2]    Vendor:Device/8086:8C20
Audio Codec:    Realtek High Definition Audio (Realtek ALC668)                  Vendor:Device/10EC:0668
Host OS:        Windows 8.1 (64bit)
Guest OS:       Linux Mint 17 Qiana (64bit)
VirtualBox:     4.3.14r95030
On Windows Host, I get:

Code: Select all

Audio Adapter:                  Intel Lynx Point PCH - High Definition Audio Controller [C2]
Audio Controller Hardware ID:   PCI\VEN_8086&DEV_8C20&SUBSYS_11CD1043&REV_05
Audio Codec Hardware ID:        HDAUDIO\FUNC_01&VEN_10EC&DEV_0668&SUBSYS_00000000
DeviceInstanceId:               HDAUDIO\FUNC_01&VEN_10EC&DEV_0668&SUBSYS_104311CD&REV_1000\4&6BFDCFC&0&0001
Which according to the PCI ID site is a: Realtek ALC668 [10EC:0668]

However, VirtualBox detects this Codec Hardware in the VMs, as the completely different device: SigmaTel STAC9221 HD Audio Codec [8384:7680]

On Linux Mint (Intel HD Audio):

Code: Select all

#lspci -b -nn -v

00:05.0 Audio device [0403]: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) High Definition Audio Controller [8086:2668] (rev 01)
        Subsystem: SigmaTel Device [8384:7680]
        Flags: bus master, fast devsel, latency 64, IRQ 11
        Memory at f0804000 (32-bit, non-prefetchable)
        Capabilities: [50] Power Management version 2
        Kernel driver in use: snd_hda_intel
On Windows-7 (Intel HD Audio):

Code: Select all

Audio Controller Hardware ID:   PCI\VEN_8086&DEV_2668&SUBSYS_76808384&REV_01
Audio Codec Hardware ID:        HDAUDIO\FUNC_04&VEN_0000&DEV_0000&SUBSYS_00000000
After reading another post about video ram and RTFM (Chap. 9-6: PCI-passthrough),
I thought perhaps PCI Audio was just passed through, but apparently not.

1) So how does this work?
2) Does it depend on the "VM Settings > General > Basic > Type | Version"?
3) What are the right drivers to use in the Linux and Windows guests? (I can't find any of those drivers on their respective websites.)

PS. Sound actually works in the Windows guest, but I'd like a more optimal experience with the proper and updated driver.
Last edited by VM2VM on 11. Sep 2014, 14:43, edited 2 times in total.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Intel HD Audio PCI passthrough (host vs guest device)

Post by Perryg »

Under normal use the guest does not use nor see the hosts audio directly. VirtualBox uses programming to enable a generic driver and translates the audio between the host and the guest. This allows for both host and guest to use the audio card at the same time.

You might be able to use PCI pass-through but just like using USB it is a one-to-one connection, so only available on one at a time.
VM2VM
Posts: 19
Joined: 7. Sep 2014, 01:26

Re: Intel HD Audio or PCI passthrough (host vs guest device)

Post by VM2VM »

Aha, what about the other questions (2 & 3)?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Intel HD Audio or PCI passthrough (host vs guest device)

Post by Perryg »

2 & 3 are irrelevant. When choosing the guest the proper drivers are selected. There was a time when you had to get a specific driver but that was a long time ago.
VM2VM
Posts: 19
Joined: 7. Sep 2014, 01:26

Re: Intel HD Audio or PCI passthrough (host vs guest device)

Post by VM2VM »

Perryg wrote:2 & 3 are irrelevant. When choosing the guest the proper drivers are selected.
Maybe it's irrelevant to you, but that's what I am asking about.
And what do you mean with "the proper drivers"?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Intel HD Audio or PCI passthrough (host vs guest device)

Post by scottgus1 »

Each operating system usually carries with it basic drivers to allow the OS to communicate with common hardware found in most computers. When the Virtualbox developers decide to support an operating system they take a look at what drivers are built-in-to the operating system and choose an emulated sound card, etc., to present to the guest that will be recognized by the OS in the guest and have drivers installed automatically and start working automatically without your needing to install anything. The VB devs then set the default "recipe" for that OS to include the hardware that best matches the drivers that the OS comes with.

Thus, the guest will see the emulated hardware, not the physical hardware, as Perry said. And only the emulated hardware's capabilities will be usable in the guest, not the physical hardware's capabilities.

So, changing the sound card settings in the Virtualbox guest settings can affect your ability to get what you want out of the sound coming from your guest if your OS doesn't have the best or correct drivers for the chosen sound card. Best to leave the default settings in most cases.

Since all the defaults are driven by what works best in the OS your guest will use, it is important to match the Type and Version settings (#2) for the guest as closely as possible to the OS you plan to install, so the best hardware for the guest will be chosen.

And, regarding #3, the right drivers for the default settings are already present in the guest OS so you shouldn't have to download anything if you haven't changed from the default guest recipe. If you do decide to change the recipe and something stops working in the guest, there may be drivers available, but you'll have to hunt for them.
VM2VM
Posts: 19
Joined: 7. Sep 2014, 01:26

Re: Intel HD Audio or PCI passthrough (host vs guest device)

Post by VM2VM »

scottgus1 wrote:...it is important to match the Type and Version settings (#2) for the guest as closely as possible to the OS you plan to install, so the best hardware for the guest will be chosen.
Thank you very much for taking your time to explain this. This answered my questions, but as with Pandoras box, any answer, bring more questions, which is probably why most forum answers always start out painfully minimalistic. I promise after this question, I will never ask about this topic again.

Is there any way to know in advance, what a particular VB setting under "VM Settings > General > Basic > Type | Version" will use/present as guest HW?
(Perhaps in the VB sources. Where should I look?)
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Intel HD Audio or PCI passthrough (host vs guest device)

Post by socratis »

VM2VM wrote:what a particular VB setting under "VM Settings > General > Basic > Type | Version" will use/present as guest HW? (Perhaps in the VB sources. Where should I look?)
DOS, OS2, Windows up to NT4 -> SoundBlaster 16.
Windows after 2003, plus all Mac -> Intel HD Audio.
All others -> ICH AC97.
Source: https://www.virtualbox.org/browser/vbox ... Global.cpp
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
VM2VM
Posts: 19
Joined: 7. Sep 2014, 01:26

Re: Intel HD Audio or PCI passthrough (host vs guest device)

Post by VM2VM »

Thanks Socratis that info really helped.

After some additional experiments, this time on a Mac on Mavericks (10.9.4) with same on guest, and just in case someone end up in this thread, when running OSX on OSX, it may help to know that in OSX, the guest audio driver should work with original AppleHD.Kext, as the STAC9221 now seem to be a VB Mac legacy driver for Intel HD Audio, as is evident from the SigmaTel ALSA drivers:

From: ..\alsa\alsa-kernel\pci\hda\patch_sigmatel.c:

Code: Select all

/* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
SND_PCI_QUIRK(0x8384, 0x7680, "Mac", STAC_INTEL_MAC_AUTO),
...
/* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */
static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = {
	SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1),
	SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2),
	SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2),
	SND_PCI_QUIRK(0x106b, 0x0e00, "Mac", STAC_INTEL_MAC_V3),
	SND_PCI_QUIRK(0x106b, 0x0f00, "Mac", STAC_INTEL_MAC_V3),
	SND_PCI_QUIRK(0x106b, 0x1600, "Mac", STAC_INTEL_MAC_V3),
	SND_PCI_QUIRK(0x106b, 0x1700, "Mac", STAC_INTEL_MAC_V3),
	SND_PCI_QUIRK(0x106b, 0x0200, "Mac", STAC_INTEL_MAC_V3),
	SND_PCI_QUIRK(0x106b, 0x1e00, "Mac", STAC_INTEL_MAC_V3),
	SND_PCI_QUIRK(0x106b, 0x1a00, "Mac", STAC_INTEL_MAC_V4),
	SND_PCI_QUIRK(0x106b, 0x0a00, "Mac", STAC_INTEL_MAC_V5),
	SND_PCI_QUIRK(0x106b, 0x2200, "Mac", STAC_INTEL_MAC_V5),
	{}
};
...
{ .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
From: https://www.virtualbox.org/browser/vbox ... Global.cpp

Code: Select all

{ "MacOS", "Mac OS X", "MacOS_64",	"Mac OS X (64 bit)",			VBOXOSTYPE_MacOS_x64,	VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0,StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA,ChipsetType_ICH9, AudioControllerType_HDA },
{ "MacOS", "Mac OS X", "MacOS109_64",	"Mac OS X 10.9 Mavericks (64 bit)",	VBOXOSTYPE_MacOS109_x64,VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0,StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA,ChipsetType_ICH9, AudioControllerType_HDA },
[/size]
I actually wanted to add this post to the outdated ICH AC97 one, here, but it was not possible...
Post Reply