diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2012-09-14 09:53:39 -0400 |
---|---|---|
committer | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2012-09-14 09:53:39 -0400 |
commit | 4c071ee5268f7234c3d084b6093bebccc28cdcba (patch) | |
tree | 6eaa7a6848263e9ea566f7b46d2c6667108c618e /arch/arm | |
parent | ecc635f90adfe1b7cd5fd354f49edfbf24aa4e3e (diff) |
arm: initial Xen support
- Basic hypervisor.h and interface.h definitions.
- Skeleton enlighten.c, set xen_start_info to an empty struct.
- Make xen_initial_domain dependent on the SIF_PRIVILIGED_BIT.
The new code only compiles when CONFIG_XEN is set, that is going to be
added to arch/arm/Kconfig in patch #11 "xen/arm: introduce CONFIG_XEN on
ARM".
Changes in v3:
- improve comments.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/hypervisor.h | 6 | ||||
-rw-r--r-- | arch/arm/include/asm/xen/hypervisor.h | 19 | ||||
-rw-r--r-- | arch/arm/include/asm/xen/interface.h | 69 | ||||
-rw-r--r-- | arch/arm/xen/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/xen/enlighten.c | 35 |
6 files changed, 131 insertions, 0 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 | |||
251 | core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ | 251 | core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ |
252 | core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) | 252 | core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) |
253 | core-$(CONFIG_VFP) += arch/arm/vfp/ | 253 | core-$(CONFIG_VFP) += arch/arm/vfp/ |
254 | core-$(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. |
256 | core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ | 257 | core-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 | |||
4 | extern struct shared_info *HYPERVISOR_shared_info; | ||
5 | extern struct start_info *xen_start_info; | ||
6 | |||
7 | /* Lazy mode for batching updates / context switch */ | ||
8 | enum paravirt_lazy_mode { | ||
9 | PARAVIRT_LAZY_NONE, | ||
10 | PARAVIRT_LAZY_MMU, | ||
11 | PARAVIRT_LAZY_CPU, | ||
12 | }; | ||
13 | |||
14 | static 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. */ | ||
30 | typedef 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); | ||
35 | DEFINE_GUEST_HANDLE(char); | ||
36 | DEFINE_GUEST_HANDLE(int); | ||
37 | DEFINE_GUEST_HANDLE(long); | ||
38 | DEFINE_GUEST_HANDLE(void); | ||
39 | DEFINE_GUEST_HANDLE(uint64_t); | ||
40 | DEFINE_GUEST_HANDLE(uint32_t); | ||
41 | DEFINE_GUEST_HANDLE(xen_pfn_t); | ||
42 | |||
43 | /* Maximum number of virtual CPUs in multi-processor guests. */ | ||
44 | #define MAX_VIRT_CPUS 1 | ||
45 | |||
46 | struct arch_vcpu_info { }; | ||
47 | struct arch_shared_info { }; | ||
48 | |||
49 | /* TODO: Move pvclock definitions some place arch independent */ | ||
50 | struct 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 */ | ||
62 | struct 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 | |||
9 | struct start_info _xen_start_info; | ||
10 | struct start_info *xen_start_info = &_xen_start_info; | ||
11 | EXPORT_SYMBOL_GPL(xen_start_info); | ||
12 | |||
13 | enum xen_domain_type xen_domain_type = XEN_NATIVE; | ||
14 | EXPORT_SYMBOL_GPL(xen_domain_type); | ||
15 | |||
16 | struct shared_info xen_dummy_shared_info; | ||
17 | struct shared_info *HYPERVISOR_shared_info = (void *)&xen_dummy_shared_info; | ||
18 | |||
19 | DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); | ||
20 | |||
21 | /* TODO: to be removed */ | ||
22 | __read_mostly int xen_have_vector_callback; | ||
23 | EXPORT_SYMBOL_GPL(xen_have_vector_callback); | ||
24 | |||
25 | int xen_platform_pci_unplug = XEN_UNPLUG_ALL; | ||
26 | EXPORT_SYMBOL_GPL(xen_platform_pci_unplug); | ||
27 | |||
28 | int 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 | } | ||
35 | EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range); | ||