x86: Detect running on a Microsoft HyperV system
[firefly-linux-kernel-4.4.55.git] / arch / x86 / kernel / cpu / hypervisor.c
index 08be922de33ad7b2d14cde498f53ac013817edde..de3f4e0ce8eb32d8865e7c1d3b4438b1eb36acaa 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <asm/processor.h>
 #include <asm/vmware.h>
+#include <asm/mshyperv.h>
 #include <asm/hypervisor.h>
 
 static inline void __cpuinit
@@ -30,6 +31,8 @@ detect_hypervisor_vendor(struct cpuinfo_x86 *c)
 {
        if (vmware_platform())
                c->x86_hyper_vendor = X86_HYPER_VENDOR_VMWARE;
+       else if (ms_hyperv_platform())
+               c->x86_hyper_vendor = X86_HYPER_VENDOR_MSFT;
        else
                c->x86_hyper_vendor = X86_HYPER_VENDOR_NONE;
 }
@@ -37,10 +40,11 @@ detect_hypervisor_vendor(struct cpuinfo_x86 *c)
 static inline void __cpuinit
 hypervisor_set_feature_bits(struct cpuinfo_x86 *c)
 {
-       if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_VMWARE) {
+       if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_VMWARE)
                vmware_set_feature_bits(c);
-               return;
-       }
+       else if (boot_cpu_data.x86_hyper_vendor == X86_HYPER_VENDOR_MSFT)
+               ms_hyperv_set_feature_bits(c);
+       return;
 }
 
 void __cpuinit init_hypervisor(struct cpuinfo_x86 *c)