aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Makefile1
-rw-r--r--arch/arm/include/asm/hypervisor.h6
-rw-r--r--arch/arm/include/asm/xen/hypervisor.h19
-rw-r--r--arch/arm/include/asm/xen/interface.h69
-rw-r--r--arch/arm/xen/Makefile1
-rw-r--r--arch/arm/xen/enlighten.c35
-rw-r--r--include/xen/xen.h2
7 files changed, 132 insertions, 1 deletions
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 30eae87ead6d..f42968a9fca3 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -251,6 +251,7 @@ endif
251core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ 251core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/
252core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) 252core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ)
253core-$(CONFIG_VFP) += arch/arm/vfp/ 253core-$(CONFIG_VFP) += arch/arm/vfp/
254core-$(CONFIG_XEN) += arch/arm/xen/
254 255
255# If we have a machine-specific directory, then include it in the build. 256# If we have a machine-specific directory, then include it in the build.
256core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ 257core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
diff --git a/arch/arm/include/asm/hypervisor.h b/arch/arm/include/asm/hypervisor.h
new file mode 100644
index 000000000000..b90d9e523d6f
--- /dev/null
+++ b/arch/arm/include/asm/hypervisor.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_ARM_HYPERVISOR_H
2#define _ASM_ARM_HYPERVISOR_H
3
4#include <asm/xen/hypervisor.h>
5
6#endif
diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h
new file mode 100644
index 000000000000..d7ab99a0c9eb
--- /dev/null
+++ b/arch/arm/include/asm/xen/hypervisor.h
@@ -0,0 +1,19 @@
1#ifndef _ASM_ARM_XEN_HYPERVISOR_H
2#define _ASM_ARM_XEN_HYPERVISOR_H
3
4extern struct shared_info *HYPERVISOR_shared_info;
5extern struct start_info *xen_start_info;
6
7/* Lazy mode for batching updates / context switch */
8enum paravirt_lazy_mode {
9 PARAVIRT_LAZY_NONE,
10 PARAVIRT_LAZY_MMU,
11 PARAVIRT_LAZY_CPU,
12};
13
14static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
15{
16 return PARAVIRT_LAZY_NONE;
17}
18
19#endif /* _ASM_ARM_XEN_HYPERVISOR_H */
diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h
new file mode 100644
index 000000000000..74c72b5083a6
--- /dev/null
+++ b/arch/arm/include/asm/xen/interface.h
@@ -0,0 +1,69 @@
1/******************************************************************************
2 * Guest OS interface to ARM Xen.
3 *
4 * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
5 */
6
7#ifndef _ASM_ARM_XEN_INTERFACE_H
8#define _ASM_ARM_XEN_INTERFACE_H
9
10#include <linux/types.h>
11
12#define __DEFINE_GUEST_HANDLE(name, type) \
13 typedef type * __guest_handle_ ## name
14
15#define DEFINE_GUEST_HANDLE_STRUCT(name) \
16 __DEFINE_GUEST_HANDLE(name, struct name)
17#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
18#define GUEST_HANDLE(name) __guest_handle_ ## name
19
20#define set_xen_guest_handle(hnd, val) \
21 do { \
22 if (sizeof(hnd) == 8) \
23 *(uint64_t *)&(hnd) = 0; \
24 (hnd) = val; \
25 } while (0)
26
27#ifndef __ASSEMBLY__
28/* Explicitly size integers that represent pfns in the interface with
29 * Xen so that we can have one ABI that works for 32 and 64 bit guests. */
30typedef uint64_t xen_pfn_t;
31/* Guest handles for primitive C types. */
32__DEFINE_GUEST_HANDLE(uchar, unsigned char);
33__DEFINE_GUEST_HANDLE(uint, unsigned int);
34__DEFINE_GUEST_HANDLE(ulong, unsigned long);
35DEFINE_GUEST_HANDLE(char);
36DEFINE_GUEST_HANDLE(int);
37DEFINE_GUEST_HANDLE(long);
38DEFINE_GUEST_HANDLE(void);
39DEFINE_GUEST_HANDLE(uint64_t);
40DEFINE_GUEST_HANDLE(uint32_t);
41DEFINE_GUEST_HANDLE(xen_pfn_t);
42
43/* Maximum number of virtual CPUs in multi-processor guests. */
44#define MAX_VIRT_CPUS 1
45
46struct arch_vcpu_info { };
47struct arch_shared_info { };
48
49/* TODO: Move pvclock definitions some place arch independent */
50struct pvclock_vcpu_time_info {
51 u32 version;
52 u32 pad0;
53 u64 tsc_timestamp;
54 u64 system_time;
55 u32 tsc_to_system_mul;
56 s8 tsc_shift;
57 u8 flags;
58 u8 pad[2];
59} __attribute__((__packed__)); /* 32 bytes */
60
61/* It is OK to have a 12 bytes struct with no padding because it is packed */
62struct pvclock_wall_clock {
63 u32 version;
64 u32 sec;
65 u32 nsec;
66} __attribute__((__packed__));
67#endif
68
69#endif /* _ASM_ARM_XEN_INTERFACE_H */
diff --git a/arch/arm/xen/Makefile b/arch/arm/xen/Makefile
new file mode 100644
index 000000000000..0bad594b1490
--- /dev/null
+++ b/arch/arm/xen/Makefile
@@ -0,0 +1 @@
obj-y := enlighten.o
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
new file mode 100644
index 000000000000..c53554032a60
--- /dev/null
+++ b/arch/arm/xen/enlighten.c
@@ -0,0 +1,35 @@
1#include <xen/xen.h>
2#include <xen/interface/xen.h>
3#include <xen/interface/memory.h>
4#include <xen/platform_pci.h>
5#include <asm/xen/hypervisor.h>
6#include <asm/xen/hypercall.h>
7#include <linux/module.h>
8
9struct start_info _xen_start_info;
10struct start_info *xen_start_info = &_xen_start_info;
11EXPORT_SYMBOL_GPL(xen_start_info);
12
13enum xen_domain_type xen_domain_type = XEN_NATIVE;
14EXPORT_SYMBOL_GPL(xen_domain_type);
15
16struct shared_info xen_dummy_shared_info;
17struct shared_info *HYPERVISOR_shared_info = (void *)&xen_dummy_shared_info;
18
19DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
20
21/* TODO: to be removed */
22__read_mostly int xen_have_vector_callback;
23EXPORT_SYMBOL_GPL(xen_have_vector_callback);
24
25int xen_platform_pci_unplug = XEN_UNPLUG_ALL;
26EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
27
28int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
29 unsigned long addr,
30 unsigned long mfn, int nr,
31 pgprot_t prot, unsigned domid)
32{
33 return -ENOSYS;
34}
35EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range);
diff --git a/include/xen/xen.h b/include/xen/xen.h
index a16402418d31..2c0d3a56c749 100644
--- a/include/xen/xen.h
+++ b/include/xen/xen.h
@@ -23,7 +23,7 @@ extern enum xen_domain_type xen_domain_type;
23#include <xen/interface/xen.h> 23#include <xen/interface/xen.h>
24#include <asm/xen/hypervisor.h> 24#include <asm/xen/hypervisor.h>
25 25
26#define xen_initial_domain() (xen_pv_domain() && \ 26#define xen_initial_domain() (xen_domain() && \
27 xen_start_info->flags & SIF_INITDOMAIN) 27 xen_start_info->flags & SIF_INITDOMAIN)
28#else /* !CONFIG_XEN_DOM0 */ 28#else /* !CONFIG_XEN_DOM0 */
29#define xen_initial_domain() (0) 29#define xen_initial_domain() (0)