Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (C) 2008, VMware, Inc.
0003  *
0004  * This program is free software; you can redistribute it and/or modify
0005  * it under the terms of the GNU General Public License as published by
0006  * the Free Software Foundation; either version 2 of the License, or
0007  * (at your option) any later version.
0008  *
0009  * This program is distributed in the hope that it will be useful, but
0010  * WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
0012  * NON INFRINGEMENT.  See the GNU General Public License for more
0013  * details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program; if not, write to the Free Software
0017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0018  *
0019  */
0020 #ifndef _ASM_X86_HYPERVISOR_H
0021 #define _ASM_X86_HYPERVISOR_H
0022 
0023 /* x86 hypervisor types  */
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     /* Hypervisor name */
0043     const char  *name;
0044 
0045     /* Detection routine */
0046     uint32_t    (*detect)(void);
0047 
0048     /* Hypervisor type */
0049     enum x86_hypervisor_type type;
0050 
0051     /* init time callbacks */
0052     struct x86_hyper_init init;
0053 
0054     /* runtime callbacks */
0055     struct x86_hyper_runtime runtime;
0056 
0057     /* ignore nopv parameter */
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 /* CONFIG_HYPERVISOR_GUEST */
0083 #endif /* _ASM_X86_HYPERVISOR_H */