diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2009-10-06 18:11:14 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-11-04 11:47:24 -0500 |
commit | 1ccbf5344c3daef046d2323190cc6807c44f1917 (patch) | |
tree | 0c080e1c478a7cd5b67e5ec0af4d9ca97dbcf348 /include | |
parent | 9a08f7d3506019e3833cd4394ca0d7da0ae3689f (diff) |
xen: move Xen-testing predicates to common header
Move xen_domain and related tests out of asm-x86 to xen/xen.h so they
can be included whenever they are necessary.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/xen/xen.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/xen/xen.h b/include/xen/xen.h new file mode 100644 index 000000000000..a16402418d31 --- /dev/null +++ b/include/xen/xen.h | |||
@@ -0,0 +1,32 @@ | |||
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 | |||
26 | #define xen_initial_domain() (xen_pv_domain() && \ | ||
27 | xen_start_info->flags & SIF_INITDOMAIN) | ||
28 | #else /* !CONFIG_XEN_DOM0 */ | ||
29 | #define xen_initial_domain() (0) | ||
30 | #endif /* CONFIG_XEN_DOM0 */ | ||
31 | |||
32 | #endif /* _XEN_XEN_H */ | ||