Skip to contentSkip to conversation

include/linux/hypervisor.h: Add test for running on Hyper-V

PATCH Superseded Michael Kelley 1 participant 1 message Nov 1, 2018 PARAVIRT_OPS interface

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 include/linux/hypervisor.h: Add test for running on Hyper-V

Add a test for running on Hyper-V on x86/x64.

---
 include/linux/hypervisor.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
include/linux/hypervisor.h +11 -0
index fc08b43..1281f62 100644
@@ -9,6 +9,7 @@
 
 #ifdef CONFIG_X86
 
+#include <asm/hypervisor.h>
 #include <asm/jailhouse_para.h>
 #include <asm/x86_init.h>
 
@@ -17,6 +18,11 @@ static inline void hypervisor_pin_vcpu(int cpu)
 	x86_platform.hyper.pin_vcpu(cpu);
 }
 
+static inline bool hypervisor_is_mshyperv(void)
+{
+	return hypervisor_is_type(X86_HYPER_MS_HYPERV);
+}
+
 #else /* !CONFIG_X86 */
 
 #include <linux/of.h>
@@ -30,6 +36,11 @@ static inline bool jailhouse_paravirt(void)
 	return of_find_compatible_node(NULL, NULL, "jailhouse,cell");
 }
 
+static inline bool hypervisor_is_mshyperv(void)
+{
+	return false;
+}
+
 #endif /* !CONFIG_X86 */
 
 #endif /* __LINUX_HYPEVISOR_H */
Signature · 1 line
1.8.3.1