Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 1 | #ifndef _XEN_XEN_H |
| 2 | #define _XEN_XEN_H |
| 3 | |
| 4 | enum xen_domain_type { |
| 5 | XEN_NATIVE, /* running on bare hardware */ |
| 6 | XEN_PV_DOMAIN, /* running in a PV domain */ |
| 7 | XEN_HVM_DOMAIN, /* running in a Xen hvm domain */ |
| 8 | }; |
| 9 | |
| 10 | #ifdef CONFIG_XEN |
| 11 | extern enum xen_domain_type xen_domain_type; |
| 12 | #else |
| 13 | #define xen_domain_type XEN_NATIVE |
| 14 | #endif |
| 15 | |
Juergen Gross | b4feaeb | 2017-07-27 17:11:58 +0200 | [diff] [blame] | 16 | #ifdef CONFIG_XEN_PVH |
| 17 | extern bool xen_pvh; |
| 18 | #else |
| 19 | #define xen_pvh 0 |
| 20 | #endif |
| 21 | |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 22 | #define xen_domain() (xen_domain_type != XEN_NATIVE) |
Juergen Gross | b4feaeb | 2017-07-27 17:11:58 +0200 | [diff] [blame] | 23 | #define xen_pv_domain() (xen_domain_type == XEN_PV_DOMAIN) |
| 24 | #define xen_hvm_domain() (xen_domain_type == XEN_HVM_DOMAIN) |
| 25 | #define xen_pvh_domain() (xen_pvh) |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 26 | |
| 27 | #ifdef CONFIG_XEN_DOM0 |
| 28 | #include <xen/interface/xen.h> |
| 29 | #include <asm/xen/hypervisor.h> |
| 30 | |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 31 | #define xen_initial_domain() (xen_domain() && \ |
Stefano Stabellini | 4ed5978 | 2012-10-03 18:08:52 +0100 | [diff] [blame] | 32 | xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 33 | #else /* !CONFIG_XEN_DOM0 */ |
| 34 | #define xen_initial_domain() (0) |
| 35 | #endif /* CONFIG_XEN_DOM0 */ |
| 36 | |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 37 | #endif /* _XEN_XEN_H */ |