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 | |
| 16 | #define xen_domain() (xen_domain_type != XEN_NATIVE) |
| 17 | #define xen_pv_domain() (xen_domain() && \ |
| 18 | xen_domain_type == XEN_PV_DOMAIN) |
| 19 | #define xen_hvm_domain() (xen_domain() && \ |
| 20 | xen_domain_type == XEN_HVM_DOMAIN) |
| 21 | |
| 22 | #ifdef CONFIG_XEN_DOM0 |
| 23 | #include <xen/interface/xen.h> |
| 24 | #include <asm/xen/hypervisor.h> |
| 25 | |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 26 | #define xen_initial_domain() (xen_domain() && \ |
Stefano Stabellini | 4ed5978 | 2012-10-03 18:08:52 +0100 | [diff] [blame] | 27 | xen_start_info && xen_start_info->flags & SIF_INITDOMAIN) |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 28 | #else /* !CONFIG_XEN_DOM0 */ |
| 29 | #define xen_initial_domain() (0) |
| 30 | #endif /* CONFIG_XEN_DOM0 */ |
| 31 | |
Mukesh Rathor | ddc416c | 2013-12-13 12:39:56 -0500 | [diff] [blame] | 32 | #ifdef CONFIG_XEN_PVH |
| 33 | /* This functionality exists only for x86. The XEN_PVHVM support exists |
| 34 | * only in x86 world - hence on ARM it will be always disabled. |
| 35 | * N.B. ARM guests are neither PV nor HVM nor PVHVM. |
| 36 | * It's a bit like PVH but is different also (it's further towards the H |
| 37 | * end of the spectrum than even PVH). |
| 38 | */ |
| 39 | #include <xen/features.h> |
| 40 | #define xen_pvh_domain() (xen_pv_domain() && \ |
Boris Ostrovsky | 5d7ab83 | 2017-04-24 15:04:53 -0400 | [diff] [blame] | 41 | xen_feature(XENFEAT_auto_translated_physmap) && \ |
| 42 | xen_have_vector_callback) |
Mukesh Rathor | ddc416c | 2013-12-13 12:39:56 -0500 | [diff] [blame] | 43 | #else |
| 44 | #define xen_pvh_domain() (0) |
| 45 | #endif |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 46 | #endif /* _XEN_XEN_H */ |