0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef _ASM_X86_HYPERVISOR_H
0021 #define _ASM_X86_HYPERVISOR_H
0022
0023
0024 enum x86_hypervisor_type {
0025 X86_HYPER_NATIVE = 0,
0026 X86_HYPER_VMWARE,
0027 X86_HYPER_MS_HYPERV,
0028 X86_HYPER_XEN_PV,
0029 X86_HYPER_XEN_HVM,
0030 X86_HYPER_KVM,
0031 X86_HYPER_JAILHOUSE,
0032 X86_HYPER_ACRN,
0033 };
0034
0035 #ifdef CONFIG_HYPERVISOR_GUEST
0036
0037 #include <asm/kvm_para.h>
0038 #include <asm/x86_init.h>
0039 #include <asm/xen/hypervisor.h>
0040
0041 struct hypervisor_x86 {
0042
0043 const char *name;
0044
0045
0046 uint32_t (*detect)(void);
0047
0048
0049 enum x86_hypervisor_type type;
0050
0051
0052 struct x86_hyper_init init;
0053
0054
0055 struct x86_hyper_runtime runtime;
0056
0057
0058 bool ignore_nopv;
0059 };
0060
0061 extern const struct hypervisor_x86 x86_hyper_vmware;
0062 extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
0063 extern const struct hypervisor_x86 x86_hyper_xen_pv;
0064 extern const struct hypervisor_x86 x86_hyper_kvm;
0065 extern const struct hypervisor_x86 x86_hyper_jailhouse;
0066 extern const struct hypervisor_x86 x86_hyper_acrn;
0067 extern struct hypervisor_x86 x86_hyper_xen_hvm;
0068
0069 extern bool nopv;
0070 extern enum x86_hypervisor_type x86_hyper_type;
0071 extern void init_hypervisor_platform(void);
0072 static inline bool hypervisor_is_type(enum x86_hypervisor_type type)
0073 {
0074 return x86_hyper_type == type;
0075 }
0076 #else
0077 static inline void init_hypervisor_platform(void) { }
0078 static inline bool hypervisor_is_type(enum x86_hypervisor_type type)
0079 {
0080 return type == X86_HYPER_NATIVE;
0081 }
0082 #endif
0083 #endif