diff options
-rw-r--r-- | sound/pci/intel8x0.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 2d4bb4c9a030..11718b49b2e2 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -2937,20 +2937,41 @@ static unsigned int sis_codec_bits[3] = { | |||
2937 | ICH_PCR, ICH_SCR, ICH_SIS_TCR | 2937 | ICH_PCR, ICH_SCR, ICH_SIS_TCR |
2938 | }; | 2938 | }; |
2939 | 2939 | ||
2940 | static int __devinit snd_intel8x0_inside_vm(void) | 2940 | static int __devinit snd_intel8x0_inside_vm(struct pci_dev *pci) |
2941 | { | 2941 | { |
2942 | int result = inside_vm; | 2942 | int result = inside_vm; |
2943 | char *msg = NULL; | ||
2943 | 2944 | ||
2944 | if (result < 0) { | 2945 | /* check module parameter first (override detection) */ |
2945 | /* detect KVM and Parallels virtual environments */ | 2946 | if (result >= 0) { |
2946 | result = kvm_para_available(); | 2947 | msg = result ? "enable (forced) VM" : "disable (forced) VM"; |
2947 | #if defined(__i386__) || defined(__x86_64__) | 2948 | goto fini; |
2948 | result = result || boot_cpu_has(X86_FEATURE_HYPERVISOR); | 2949 | } |
2950 | |||
2951 | /* detect KVM and Parallels virtual environments */ | ||
2952 | result = kvm_para_available(); | ||
2953 | #ifdef X86_FEATURE_HYPERVISOR | ||
2954 | result = result || boot_cpu_has(X86_FEATURE_HYPERVISOR); | ||
2949 | #endif | 2955 | #endif |
2956 | if (!result) | ||
2957 | goto fini; | ||
2958 | |||
2959 | /* check for known (emulated) devices */ | ||
2960 | if (pci->subsystem_vendor == 0x1af4 && | ||
2961 | pci->subsystem_device == 0x1100) { | ||
2962 | /* KVM emulated sound, PCI SSID: 1af4:1100 */ | ||
2963 | msg = "enable KVM"; | ||
2964 | } else if (pci->subsystem_vendor == 0x1ab8) { | ||
2965 | /* Parallels VM emulated sound, PCI SSID: 1ab8:xxxx */ | ||
2966 | msg = "enable Parallels VM"; | ||
2967 | } else { | ||
2968 | msg = "disable (unknown or VT-d) VM"; | ||
2969 | result = 0; | ||
2950 | } | 2970 | } |
2951 | 2971 | ||
2952 | if (result) | 2972 | fini: |
2953 | printk(KERN_INFO "intel8x0: enable KVM optimization\n"); | 2973 | if (msg != NULL) |
2974 | printk(KERN_INFO "intel8x0: %s optimization\n", msg); | ||
2954 | 2975 | ||
2955 | return result; | 2976 | return result; |
2956 | } | 2977 | } |
@@ -3022,7 +3043,7 @@ static int __devinit snd_intel8x0_create(struct snd_card *card, | |||
3022 | if (xbox) | 3043 | if (xbox) |
3023 | chip->xbox = 1; | 3044 | chip->xbox = 1; |
3024 | 3045 | ||
3025 | chip->inside_vm = snd_intel8x0_inside_vm(); | 3046 | chip->inside_vm = snd_intel8x0_inside_vm(pci); |
3026 | 3047 | ||
3027 | if (pci->vendor == PCI_VENDOR_ID_INTEL && | 3048 | if (pci->vendor == PCI_VENDOR_ID_INTEL && |
3028 | pci->device == PCI_DEVICE_ID_INTEL_440MX) | 3049 | pci->device == PCI_DEVICE_ID_INTEL_440MX) |