1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/types.h>
8 XEN_NATIVE, /* running on bare hardware */
9 XEN_PV_DOMAIN, /* running in a PV domain */
10 XEN_HVM_DOMAIN, /* running in a Xen hvm domain */
14 extern enum xen_domain_type xen_domain_type;
16 #define xen_domain_type XEN_NATIVE
25 #define xen_domain() (xen_domain_type != XEN_NATIVE)
26 #define xen_pv_domain() (xen_domain_type == XEN_PV_DOMAIN)
27 #define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN)
28 #define xen_pvh_domain() (xen_pvh)
30 extern uint32_t xen_start_flags;
33 extern bool xen_pv_pci_possible;
35 #define xen_pv_pci_possible 0
38 #include <xen/interface/hvm/start_info.h>
39 extern struct hvm_start_info pvh_start_info;
40 void xen_prepare_pvh(void);
42 void xen_pv_evtchn_do_upcall(struct pt_regs *regs);
44 #ifdef CONFIG_XEN_DOM0
45 #include <xen/interface/xen.h>
46 #include <asm/xen/hypervisor.h>
48 #define xen_initial_domain() (xen_domain() && \
49 (xen_start_flags & SIF_INITDOMAIN))
50 #else /* !CONFIG_XEN_DOM0 */
51 #define xen_initial_domain() (0)
52 #endif /* CONFIG_XEN_DOM0 */
57 bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
58 const struct page *page);
60 #if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_XEN_BALLOON)
61 extern u64 xen_saved_max_mem_size;
64 #ifdef CONFIG_XEN_UNPOPULATED_ALLOC
65 int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages);
66 void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages);
67 #include <linux/ioport.h>
68 int arch_xen_unpopulated_init(struct resource **res);
70 #include <xen/balloon.h>
71 static inline int xen_alloc_unpopulated_pages(unsigned int nr_pages,
74 return xen_alloc_ballooned_pages(nr_pages, pages);
76 static inline void xen_free_unpopulated_pages(unsigned int nr_pages,
79 xen_free_ballooned_pages(nr_pages, pages);
83 #if defined(CONFIG_XEN_DOM0) && defined(CONFIG_ACPI) && defined(CONFIG_X86)
84 bool __init xen_processor_present(uint32_t acpi_id);
86 #include <linux/bug.h>
87 static inline bool xen_processor_present(uint32_t acpi_id)
94 #endif /* _XEN_XEN_H */