1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /******************************************************************************
3  * asm-x86/guest/xen.h
4  *
5  * Copyright (c) 2017 Citrix Systems Ltd.
6  */
7 
8 #ifndef __X86_GUEST_XEN_H__
9 #define __X86_GUEST_XEN_H__
10 
11 #include <xen/types.h>
12 
13 #include <asm/e820.h>
14 #include <asm/fixmap.h>
15 #include <asm/guest/hypervisor.h>
16 
17 #define XEN_shared_info ((struct shared_info *)fix_to_virt(FIX_XEN_SHARED_INFO))
18 
19 #ifdef CONFIG_XEN_GUEST
20 
21 extern bool xen_guest;
22 extern bool pv_console;
23 extern uint32_t xen_cpuid_base;
24 
25 const struct hypervisor_ops *xg_probe(void);
26 int xg_alloc_unused_page(mfn_t *mfn);
27 int xg_free_unused_page(mfn_t mfn);
28 
29 DECLARE_PER_CPU(unsigned int, vcpu_id);
30 DECLARE_PER_CPU(struct vcpu_info *, vcpu_info);
31 
32 #else
33 
34 #define xen_guest 0
35 #define pv_console 0
36 
xg_probe(void)37 static inline const struct hypervisor_ops *xg_probe(void) { return NULL; }
38 
39 #endif /* CONFIG_XEN_GUEST */
40 #endif /* __X86_GUEST_XEN_H__ */
41 
42 /*
43  * Local variables:
44  * mode: C
45  * c-file-style: "BSD"
46  * c-basic-offset: 4
47  * tab-width: 4
48  * indent-tabs-mode: nil
49  * End:
50  */
51