1 /* SPDX-License-Identifier: GPL-2.0 */
6 XEN_NATIVE, /* running on bare hardware */
7 XEN_PV_DOMAIN, /* running in a PV domain */
8 XEN_HVM_DOMAIN, /* running in a Xen hvm domain */
12 extern enum xen_domain_type xen_domain_type;
14 #define xen_domain_type XEN_NATIVE
23 #define xen_domain() (xen_domain_type != XEN_NATIVE)
24 #define xen_pv_domain() (xen_domain_type == XEN_PV_DOMAIN)
25 #define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN)
26 #define xen_pvh_domain() (xen_pvh)
28 #include <linux/types.h>
30 extern uint32_t xen_start_flags;
32 #include <xen/interface/hvm/start_info.h>
33 extern struct hvm_start_info pvh_start_info;
35 #ifdef CONFIG_XEN_DOM0
36 #include <xen/interface/xen.h>
37 #include <asm/xen/hypervisor.h>
39 #define xen_initial_domain() (xen_domain() && \
40 (xen_start_flags & SIF_INITDOMAIN))
41 #else /* !CONFIG_XEN_DOM0 */
42 #define xen_initial_domain() (0)
43 #endif /* CONFIG_XEN_DOM0 */
48 bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
49 const struct page *page);
51 #if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_XEN_BALLOON)
52 extern u64 xen_saved_max_mem_size;
55 #include <linux/platform-feature.h>
57 static inline void xen_set_restricted_virtio_memory_access(void)
59 if (IS_ENABLED(CONFIG_XEN_VIRTIO) && xen_domain())
60 platform_set(PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS);
63 #ifdef CONFIG_XEN_UNPOPULATED_ALLOC
64 int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages);
65 void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages);
66 #include <linux/ioport.h>
67 int arch_xen_unpopulated_init(struct resource **res);
69 #include <xen/balloon.h>
70 static inline int xen_alloc_unpopulated_pages(unsigned int nr_pages,
73 return xen_alloc_ballooned_pages(nr_pages, pages);
75 static inline void xen_free_unpopulated_pages(unsigned int nr_pages,
78 xen_free_ballooned_pages(nr_pages, pages);
82 #endif /* _XEN_XEN_H */