2008-10-27 17:41:46 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008, VMware, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
|
|
|
* NON INFRINGEMENT. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
*/
|
2010-05-07 23:57:28 +00:00
|
|
|
#ifndef _ASM_X86_HYPERVISOR_H
|
|
|
|
#define _ASM_X86_HYPERVISOR_H
|
2008-10-27 17:41:46 +00:00
|
|
|
|
2017-12-04 14:07:31 +00:00
|
|
|
/* x86 hypervisor types */
|
2017-11-09 13:27:36 +00:00
|
|
|
enum x86_hypervisor_type {
|
|
|
|
X86_HYPER_NATIVE = 0,
|
|
|
|
X86_HYPER_VMWARE,
|
|
|
|
X86_HYPER_MS_HYPERV,
|
|
|
|
X86_HYPER_XEN_PV,
|
|
|
|
X86_HYPER_XEN_HVM,
|
|
|
|
X86_HYPER_KVM,
|
2017-11-27 08:11:46 +00:00
|
|
|
X86_HYPER_JAILHOUSE,
|
2017-11-09 13:27:36 +00:00
|
|
|
};
|
|
|
|
|
2017-12-04 14:07:31 +00:00
|
|
|
#ifdef CONFIG_HYPERVISOR_GUEST
|
|
|
|
|
|
|
|
#include <asm/kvm_para.h>
|
|
|
|
#include <asm/x86_init.h>
|
|
|
|
#include <asm/xen/hypervisor.h>
|
|
|
|
|
2010-05-07 23:57:28 +00:00
|
|
|
struct hypervisor_x86 {
|
|
|
|
/* Hypervisor name */
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
/* Detection routine */
|
2013-07-25 08:54:35 +00:00
|
|
|
uint32_t (*detect)(void);
|
2010-05-07 23:57:28 +00:00
|
|
|
|
2017-11-09 13:27:36 +00:00
|
|
|
/* Hypervisor type */
|
|
|
|
enum x86_hypervisor_type type;
|
|
|
|
|
2017-11-09 13:27:35 +00:00
|
|
|
/* init time callbacks */
|
|
|
|
struct x86_hyper_init init;
|
2013-01-17 23:44:42 +00:00
|
|
|
|
2017-11-09 13:27:35 +00:00
|
|
|
/* runtime callbacks */
|
|
|
|
struct x86_hyper_runtime runtime;
|
2010-05-07 23:57:28 +00:00
|
|
|
};
|
|
|
|
|
2017-11-09 13:27:36 +00:00
|
|
|
extern enum x86_hypervisor_type x86_hyper_type;
|
2013-03-04 20:20:21 +00:00
|
|
|
extern void init_hypervisor_platform(void);
|
2017-12-04 14:07:31 +00:00
|
|
|
static inline bool hypervisor_is_type(enum x86_hypervisor_type type)
|
|
|
|
{
|
|
|
|
return x86_hyper_type == type;
|
|
|
|
}
|
2013-03-04 20:20:21 +00:00
|
|
|
#else
|
|
|
|
static inline void init_hypervisor_platform(void) { }
|
2017-12-04 14:07:31 +00:00
|
|
|
static inline bool hypervisor_is_type(enum x86_hypervisor_type type)
|
|
|
|
{
|
|
|
|
return type == X86_HYPER_NATIVE;
|
|
|
|
}
|
2013-03-04 20:20:21 +00:00
|
|
|
#endif /* CONFIG_HYPERVISOR_GUEST */
|
|
|
|
#endif /* _ASM_X86_HYPERVISOR_H */
|