1*4882a593Smuzhiyun /******************************************************************************
2*4882a593Smuzhiyun * hypervisor.h
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * Linux-specific hypervisor handling.
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Copyright (c) 2002-2004, K A Fraser
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or
9*4882a593Smuzhiyun * modify it under the terms of the GNU General Public License version 2
10*4882a593Smuzhiyun * as published by the Free Software Foundation; or, when distributed
11*4882a593Smuzhiyun * separately from the Linux kernel or incorporated into other
12*4882a593Smuzhiyun * software packages, subject to the following license:
13*4882a593Smuzhiyun *
14*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a copy
15*4882a593Smuzhiyun * of this source file (the "Software"), to deal in the Software without
16*4882a593Smuzhiyun * restriction, including without limitation the rights to use, copy, modify,
17*4882a593Smuzhiyun * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18*4882a593Smuzhiyun * and to permit persons to whom the Software is furnished to do so, subject to
19*4882a593Smuzhiyun * the following conditions:
20*4882a593Smuzhiyun *
21*4882a593Smuzhiyun * The above copyright notice and this permission notice shall be included in
22*4882a593Smuzhiyun * all copies or substantial portions of the Software.
23*4882a593Smuzhiyun *
24*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27*4882a593Smuzhiyun * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28*4882a593Smuzhiyun * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29*4882a593Smuzhiyun * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30*4882a593Smuzhiyun * IN THE SOFTWARE.
31*4882a593Smuzhiyun */
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun #ifndef _ASM_X86_XEN_HYPERVISOR_H
34*4882a593Smuzhiyun #define _ASM_X86_XEN_HYPERVISOR_H
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun extern struct shared_info *HYPERVISOR_shared_info;
37*4882a593Smuzhiyun extern struct start_info *xen_start_info;
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun #include <asm/processor.h>
40*4882a593Smuzhiyun
xen_cpuid_base(void)41*4882a593Smuzhiyun static inline uint32_t xen_cpuid_base(void)
42*4882a593Smuzhiyun {
43*4882a593Smuzhiyun return hypervisor_cpuid_base("XenVMMXenVMM", 2);
44*4882a593Smuzhiyun }
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun #ifdef CONFIG_XEN
47*4882a593Smuzhiyun extern bool __init xen_hvm_need_lapic(void);
48*4882a593Smuzhiyun
xen_x2apic_para_available(void)49*4882a593Smuzhiyun static inline bool __init xen_x2apic_para_available(void)
50*4882a593Smuzhiyun {
51*4882a593Smuzhiyun return xen_hvm_need_lapic();
52*4882a593Smuzhiyun }
53*4882a593Smuzhiyun #else
xen_x2apic_para_available(void)54*4882a593Smuzhiyun static inline bool __init xen_x2apic_para_available(void)
55*4882a593Smuzhiyun {
56*4882a593Smuzhiyun return (xen_cpuid_base() != 0);
57*4882a593Smuzhiyun }
58*4882a593Smuzhiyun #endif
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun #ifdef CONFIG_HOTPLUG_CPU
61*4882a593Smuzhiyun void xen_arch_register_cpu(int num);
62*4882a593Smuzhiyun void xen_arch_unregister_cpu(int num);
63*4882a593Smuzhiyun #endif
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun #endif /* _ASM_X86_XEN_HYPERVISOR_H */
66