aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2009-10-06 18:11:14 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-11-04 11:47:24 -0500
commit1ccbf5344c3daef046d2323190cc6807c44f1917 (patch)
tree0c080e1c478a7cd5b67e5ec0af4d9ca97dbcf348
parent9a08f7d3506019e3833cd4394ca0d7da0ae3689f (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>
-rw-r--r--arch/x86/include/asm/xen/hypervisor.h27
-rw-r--r--arch/x86/xen/enlighten.c1
-rw-r--r--drivers/block/xen-blkfront.c1
-rw-r--r--drivers/char/hvc_xen.c2
-rw-r--r--drivers/input/xen-kbdfront.c3
-rw-r--r--drivers/net/xen-netfront.c1
-rw-r--r--drivers/video/xen-fbfront.c3
-rw-r--r--drivers/xen/balloon.c2
-rw-r--r--drivers/xen/cpu_hotplug.c1
-rw-r--r--drivers/xen/evtchn.c2
-rw-r--r--drivers/xen/grant-table.c1
-rw-r--r--drivers/xen/sys-hypervisor.c1
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c2
-rw-r--r--drivers/xen/xenfs/super.c2
-rw-r--r--include/xen/xen.h32
15 files changed, 54 insertions, 27 deletions
diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h
index d5b7e90c0edf..396ff4cc8ed4 100644
--- a/arch/x86/include/asm/xen/hypervisor.h
+++ b/arch/x86/include/asm/xen/hypervisor.h
@@ -37,31 +37,4 @@
37extern struct shared_info *HYPERVISOR_shared_info; 37extern struct shared_info *HYPERVISOR_shared_info;
38extern struct start_info *xen_start_info; 38extern struct start_info *xen_start_info;
39 39
40enum xen_domain_type {
41 XEN_NATIVE, /* running on bare hardware */
42 XEN_PV_DOMAIN, /* running in a PV domain */
43 XEN_HVM_DOMAIN, /* running in a Xen hvm domain */
44};
45
46#ifdef CONFIG_XEN
47extern enum xen_domain_type xen_domain_type;
48#else
49#define xen_domain_type XEN_NATIVE
50#endif
51
52#define xen_domain() (xen_domain_type != XEN_NATIVE)
53#define xen_pv_domain() (xen_domain() && \
54 xen_domain_type == XEN_PV_DOMAIN)
55#define xen_hvm_domain() (xen_domain() && \
56 xen_domain_type == XEN_HVM_DOMAIN)
57
58#ifdef CONFIG_XEN_DOM0
59#include <xen/interface/xen.h>
60
61#define xen_initial_domain() (xen_pv_domain() && \
62 xen_start_info->flags & SIF_INITDOMAIN)
63#else /* !CONFIG_XEN_DOM0 */
64#define xen_initial_domain() (0)
65#endif /* CONFIG_XEN_DOM0 */
66
67#endif /* _ASM_X86_XEN_HYPERVISOR_H */ 40#endif /* _ASM_X86_XEN_HYPERVISOR_H */
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 23a4d80fb39e..5bccd706232c 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -28,6 +28,7 @@
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29#include <linux/console.h> 29#include <linux/console.h>
30 30
31#include <xen/xen.h>
31#include <xen/interface/xen.h> 32#include <xen/interface/xen.h>
32#include <xen/interface/version.h> 33#include <xen/interface/version.h>
33#include <xen/interface/physdev.h> 34#include <xen/interface/physdev.h>
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index b8578bb3f4c9..05a31e55d278 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -42,6 +42,7 @@
42#include <linux/module.h> 42#include <linux/module.h>
43#include <linux/scatterlist.h> 43#include <linux/scatterlist.h>
44 44
45#include <xen/xen.h>
45#include <xen/xenbus.h> 46#include <xen/xenbus.h>
46#include <xen/grant_table.h> 47#include <xen/grant_table.h>
47#include <xen/events.h> 48#include <xen/events.h>
diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c
index eba999f8598d..93d33816c9d9 100644
--- a/drivers/char/hvc_xen.c
+++ b/drivers/char/hvc_xen.c
@@ -25,6 +25,8 @@
25#include <linux/types.h> 25#include <linux/types.h>
26 26
27#include <asm/xen/hypervisor.h> 27#include <asm/xen/hypervisor.h>
28
29#include <xen/xen.h>
28#include <xen/page.h> 30#include <xen/page.h>
29#include <xen/events.h> 31#include <xen/events.h>
30#include <xen/interface/io/console.h> 32#include <xen/interface/io/console.h>
diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c
index b115726dc088..c721c0a23eb8 100644
--- a/drivers/input/xen-kbdfront.c
+++ b/drivers/input/xen-kbdfront.c
@@ -21,7 +21,10 @@
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/input.h> 23#include <linux/input.h>
24
24#include <asm/xen/hypervisor.h> 25#include <asm/xen/hypervisor.h>
26
27#include <xen/xen.h>
25#include <xen/events.h> 28#include <xen/events.h>
26#include <xen/page.h> 29#include <xen/page.h>
27#include <xen/interface/io/fbif.h> 30#include <xen/interface/io/fbif.h>
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index baa051d5bfbe..a869b45d3d37 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -42,6 +42,7 @@
42#include <linux/mm.h> 42#include <linux/mm.h>
43#include <net/ip.h> 43#include <net/ip.h>
44 44
45#include <xen/xen.h>
45#include <xen/xenbus.h> 46#include <xen/xenbus.h>
46#include <xen/events.h> 47#include <xen/events.h>
47#include <xen/page.h> 48#include <xen/page.h>
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index 54cd91610174..966b226c858c 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -25,7 +25,10 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/mm.h> 27#include <linux/mm.h>
28
28#include <asm/xen/hypervisor.h> 29#include <asm/xen/hypervisor.h>
30
31#include <xen/xen.h>
29#include <xen/events.h> 32#include <xen/events.h>
30#include <xen/page.h> 33#include <xen/page.h>
31#include <xen/interface/io/fbif.h> 34#include <xen/interface/io/fbif.h>
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index d31505b6f7a4..826dda414166 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -52,6 +52,8 @@
52 52
53#include <asm/xen/hypervisor.h> 53#include <asm/xen/hypervisor.h>
54#include <asm/xen/hypercall.h> 54#include <asm/xen/hypercall.h>
55
56#include <xen/xen.h>
55#include <xen/interface/xen.h> 57#include <xen/interface/xen.h>
56#include <xen/interface/memory.h> 58#include <xen/interface/memory.h>
57#include <xen/xenbus.h> 59#include <xen/xenbus.h>
diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c
index bdfd584ad853..6625ffe1a6fd 100644
--- a/drivers/xen/cpu_hotplug.c
+++ b/drivers/xen/cpu_hotplug.c
@@ -1,5 +1,6 @@
1#include <linux/notifier.h> 1#include <linux/notifier.h>
2 2
3#include <xen/xen.h>
3#include <xen/xenbus.h> 4#include <xen/xenbus.h>
4 5
5#include <asm/xen/hypervisor.h> 6#include <asm/xen/hypervisor.h>
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
index 79bedba44fee..f70a4f4698c5 100644
--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -48,6 +48,8 @@
48#include <linux/gfp.h> 48#include <linux/gfp.h>
49#include <linux/mutex.h> 49#include <linux/mutex.h>
50#include <linux/cpu.h> 50#include <linux/cpu.h>
51
52#include <xen/xen.h>
51#include <xen/events.h> 53#include <xen/events.h>
52#include <xen/evtchn.h> 54#include <xen/evtchn.h>
53#include <asm/xen/hypervisor.h> 55#include <asm/xen/hypervisor.h>
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 7d8f531fb8e8..4c6c0bd636a8 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -37,6 +37,7 @@
37#include <linux/vmalloc.h> 37#include <linux/vmalloc.h>
38#include <linux/uaccess.h> 38#include <linux/uaccess.h>
39 39
40#include <xen/xen.h>
40#include <xen/interface/xen.h> 41#include <xen/interface/xen.h>
41#include <xen/page.h> 42#include <xen/page.h>
42#include <xen/grant_table.h> 43#include <xen/grant_table.h>
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index 88a60e03ccf0..ae5cb05a1a1c 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -14,6 +14,7 @@
14#include <asm/xen/hypervisor.h> 14#include <asm/xen/hypervisor.h>
15#include <asm/xen/hypercall.h> 15#include <asm/xen/hypercall.h>
16 16
17#include <xen/xen.h>
17#include <xen/xenbus.h> 18#include <xen/xenbus.h>
18#include <xen/interface/xen.h> 19#include <xen/interface/xen.h>
19#include <xen/interface/version.h> 20#include <xen/interface/version.h>
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index d42e25d5968d..08638adec9fc 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -49,6 +49,8 @@
49#include <asm/page.h> 49#include <asm/page.h>
50#include <asm/pgtable.h> 50#include <asm/pgtable.h>
51#include <asm/xen/hypervisor.h> 51#include <asm/xen/hypervisor.h>
52
53#include <xen/xen.h>
52#include <xen/xenbus.h> 54#include <xen/xenbus.h>
53#include <xen/events.h> 55#include <xen/events.h>
54#include <xen/page.h> 56#include <xen/page.h>
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
index 6559e0c752ce..8924d93136f1 100644
--- a/drivers/xen/xenfs/super.c
+++ b/drivers/xen/xenfs/super.c
@@ -13,6 +13,8 @@
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/magic.h> 14#include <linux/magic.h>
15 15
16#include <xen/xen.h>
17
16#include "xenfs.h" 18#include "xenfs.h"
17 19
18#include <asm/xen/hypervisor.h> 20#include <asm/xen/hypervisor.h>
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
4enum 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
11extern 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 */