xref: /openbmc/linux/include/xen/xen.h (revision 1fe83888a2b776c204cb06629700adfb8e9cc123)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21ccbf534SJeremy Fitzhardinge #ifndef _XEN_XEN_H
31ccbf534SJeremy Fitzhardinge #define _XEN_XEN_H
41ccbf534SJeremy Fitzhardinge 
51ccbf534SJeremy Fitzhardinge enum xen_domain_type {
61ccbf534SJeremy Fitzhardinge 	XEN_NATIVE,		/* running on bare hardware    */
71ccbf534SJeremy Fitzhardinge 	XEN_PV_DOMAIN,		/* running in a PV domain      */
81ccbf534SJeremy Fitzhardinge 	XEN_HVM_DOMAIN,		/* running in a Xen hvm domain */
91ccbf534SJeremy Fitzhardinge };
101ccbf534SJeremy Fitzhardinge 
111ccbf534SJeremy Fitzhardinge #ifdef CONFIG_XEN
121ccbf534SJeremy Fitzhardinge extern enum xen_domain_type xen_domain_type;
131ccbf534SJeremy Fitzhardinge #else
141ccbf534SJeremy Fitzhardinge #define xen_domain_type		XEN_NATIVE
151ccbf534SJeremy Fitzhardinge #endif
161ccbf534SJeremy Fitzhardinge 
17b4feaeb0SJuergen Gross #ifdef CONFIG_XEN_PVH
18b4feaeb0SJuergen Gross extern bool xen_pvh;
19b4feaeb0SJuergen Gross #else
20b4feaeb0SJuergen Gross #define xen_pvh			0
21b4feaeb0SJuergen Gross #endif
22b4feaeb0SJuergen Gross 
231ccbf534SJeremy Fitzhardinge #define xen_domain()		(xen_domain_type != XEN_NATIVE)
24b4feaeb0SJuergen Gross #define xen_pv_domain()		(xen_domain_type == XEN_PV_DOMAIN)
25b4feaeb0SJuergen Gross #define xen_hvm_domain()	(xen_domain_type == XEN_HVM_DOMAIN)
26b4feaeb0SJuergen Gross #define xen_pvh_domain()	(xen_pvh)
271ccbf534SJeremy Fitzhardinge 
28*1fe83888SRoger Pau Monne #include <linux/types.h>
29*1fe83888SRoger Pau Monne 
30*1fe83888SRoger Pau Monne extern uint32_t xen_start_flags;
31*1fe83888SRoger Pau Monne 
321ccbf534SJeremy Fitzhardinge #ifdef CONFIG_XEN_DOM0
331ccbf534SJeremy Fitzhardinge #include <xen/interface/xen.h>
341ccbf534SJeremy Fitzhardinge #include <asm/xen/hypervisor.h>
351ccbf534SJeremy Fitzhardinge 
364c071ee5SStefano Stabellini #define xen_initial_domain()	(xen_domain() && \
37*1fe83888SRoger Pau Monne 				 (xen_start_flags & SIF_INITDOMAIN))
381ccbf534SJeremy Fitzhardinge #else  /* !CONFIG_XEN_DOM0 */
391ccbf534SJeremy Fitzhardinge #define xen_initial_domain()	(0)
401ccbf534SJeremy Fitzhardinge #endif	/* CONFIG_XEN_DOM0 */
411ccbf534SJeremy Fitzhardinge 
421ccbf534SJeremy Fitzhardinge #endif	/* _XEN_XEN_H */
43