Skip to contentSkip to conversation

snd_intel8x0_inside_vm()

DISCUSSION H. Peter Anvin 2 participants 2 messages Feb 19, 2014

lore
Share & tools
lore
#0 lore raw

I just stumbled upon the function snd_intel8x0_inside_vm(), and quite frankly the code seems bizarre:

        /* detect KVM and Parallels virtual environments */
        result = kvm_para_available();
#ifdef X86_FEATURE_HYPERVISOR
        result = result || boot_cpu_has(X86_FEATURE_HYPERVISOR);
#endif
        if (!result)
                goto fini;

Why don't we simply rely on the PCI SSIDs?

-hpa

#1 lore raw

At Tue, 18 Feb 2014 19:48:11 -0800,

Quoted 12 lines · H. Peter Anvin

I just stumbled upon the function snd_intel8x0_inside_vm(), and quite frankly the code seems bizarre:

        /* detect KVM and Parallels virtual environments */
        result = kvm_para_available();
#ifdef X86_FEATURE_HYPERVISOR
        result = result || boot_cpu_has(X86_FEATURE_HYPERVISOR);
#endif
        if (!result)
                goto fini;
Quoted 1 line

Why don't we simply rely on the PCI SSIDs?

The original code checking kvm_para_available() and boot_cpu_has() was supposed to work for also VirtualBox and VMware. The PCI SSID checks have been introduced later, and looking at the code again, this might have broken VirtualBox and VMware workaround. Hmm.

Besides that, the kvm_para_available() and boot_cpu_has() checks are still left for avoiding unnecessary kernel message (enable/disable VM workaround) on non-VM kernels.

Takashi