diff options
Diffstat (limited to 'arch/arm/include/asm/xen')
-rw-r--r-- | arch/arm/include/asm/xen/events.h | 18 | ||||
-rw-r--r-- | arch/arm/include/asm/xen/hypercall.h | 69 | ||||
-rw-r--r-- | arch/arm/include/asm/xen/hypervisor.h | 19 | ||||
-rw-r--r-- | arch/arm/include/asm/xen/interface.h | 73 | ||||
-rw-r--r-- | arch/arm/include/asm/xen/page.h | 82 |
5 files changed, 261 insertions, 0 deletions
diff --git a/arch/arm/include/asm/xen/events.h b/arch/arm/include/asm/xen/events.h new file mode 100644 index 000000000000..94b4e9020b02 --- /dev/null +++ b/arch/arm/include/asm/xen/events.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _ASM_ARM_XEN_EVENTS_H | ||
2 | #define _ASM_ARM_XEN_EVENTS_H | ||
3 | |||
4 | #include <asm/ptrace.h> | ||
5 | |||
6 | enum ipi_vector { | ||
7 | XEN_PLACEHOLDER_VECTOR, | ||
8 | |||
9 | /* Xen IPIs go here */ | ||
10 | XEN_NR_IPIS, | ||
11 | }; | ||
12 | |||
13 | static inline int xen_irqs_disabled(struct pt_regs *regs) | ||
14 | { | ||
15 | return raw_irqs_disabled_flags(regs->ARM_cpsr); | ||
16 | } | ||
17 | |||
18 | #endif /* _ASM_ARM_XEN_EVENTS_H */ | ||
diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h new file mode 100644 index 000000000000..8a823253d775 --- /dev/null +++ b/arch/arm/include/asm/xen/hypercall.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /****************************************************************************** | ||
2 | * hypercall.h | ||
3 | * | ||
4 | * Linux-specific hypervisor handling. | ||
5 | * | ||
6 | * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012 | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License version 2 | ||
10 | * as published by the Free Software Foundation; or, when distributed | ||
11 | * separately from the Linux kernel or incorporated into other | ||
12 | * software packages, subject to the following license: | ||
13 | * | ||
14 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
15 | * of this source file (the "Software"), to deal in the Software without | ||
16 | * restriction, including without limitation the rights to use, copy, modify, | ||
17 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
18 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
19 | * the following conditions: | ||
20 | * | ||
21 | * The above copyright notice and this permission notice shall be included in | ||
22 | * all copies or substantial portions of the Software. | ||
23 | * | ||
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
29 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
30 | * IN THE SOFTWARE. | ||
31 | */ | ||
32 | |||
33 | #ifndef _ASM_ARM_XEN_HYPERCALL_H | ||
34 | #define _ASM_ARM_XEN_HYPERCALL_H | ||
35 | |||
36 | #include <xen/interface/xen.h> | ||
37 | |||
38 | long privcmd_call(unsigned call, unsigned long a1, | ||
39 | unsigned long a2, unsigned long a3, | ||
40 | unsigned long a4, unsigned long a5); | ||
41 | int HYPERVISOR_xen_version(int cmd, void *arg); | ||
42 | int HYPERVISOR_console_io(int cmd, int count, char *str); | ||
43 | int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count); | ||
44 | int HYPERVISOR_sched_op(int cmd, void *arg); | ||
45 | int HYPERVISOR_event_channel_op(int cmd, void *arg); | ||
46 | unsigned long HYPERVISOR_hvm_op(int op, void *arg); | ||
47 | int HYPERVISOR_memory_op(unsigned int cmd, void *arg); | ||
48 | int HYPERVISOR_physdev_op(int cmd, void *arg); | ||
49 | |||
50 | static inline void | ||
51 | MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va, | ||
52 | unsigned int new_val, unsigned long flags) | ||
53 | { | ||
54 | BUG(); | ||
55 | } | ||
56 | |||
57 | static inline void | ||
58 | MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req, | ||
59 | int count, int *success_count, domid_t domid) | ||
60 | { | ||
61 | BUG(); | ||
62 | } | ||
63 | |||
64 | static inline int | ||
65 | HYPERVISOR_multicall(void *call_list, int nr_calls) | ||
66 | { | ||
67 | BUG(); | ||
68 | } | ||
69 | #endif /* _ASM_ARM_XEN_HYPERCALL_H */ | ||
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..ae05e56dd17d --- /dev/null +++ b/arch/arm/include/asm/xen/interface.h | |||
@@ -0,0 +1,73 @@ | |||
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 uint64_aligned_t uint64_t __attribute__((aligned(8))) | ||
13 | |||
14 | #define __DEFINE_GUEST_HANDLE(name, type) \ | ||
15 | typedef struct { union { type *p; uint64_aligned_t q; }; } \ | ||
16 | __guest_handle_ ## name | ||
17 | |||
18 | #define DEFINE_GUEST_HANDLE_STRUCT(name) \ | ||
19 | __DEFINE_GUEST_HANDLE(name, struct name) | ||
20 | #define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) | ||
21 | #define GUEST_HANDLE(name) __guest_handle_ ## name | ||
22 | |||
23 | #define set_xen_guest_handle(hnd, val) \ | ||
24 | do { \ | ||
25 | if (sizeof(hnd) == 8) \ | ||
26 | *(uint64_t *)&(hnd) = 0; \ | ||
27 | (hnd).p = val; \ | ||
28 | } while (0) | ||
29 | |||
30 | #ifndef __ASSEMBLY__ | ||
31 | /* Explicitly size integers that represent pfns in the interface with | ||
32 | * Xen so that we can have one ABI that works for 32 and 64 bit guests. */ | ||
33 | typedef uint64_t xen_pfn_t; | ||
34 | typedef uint64_t xen_ulong_t; | ||
35 | /* Guest handles for primitive C types. */ | ||
36 | __DEFINE_GUEST_HANDLE(uchar, unsigned char); | ||
37 | __DEFINE_GUEST_HANDLE(uint, unsigned int); | ||
38 | __DEFINE_GUEST_HANDLE(ulong, unsigned long); | ||
39 | DEFINE_GUEST_HANDLE(char); | ||
40 | DEFINE_GUEST_HANDLE(int); | ||
41 | DEFINE_GUEST_HANDLE(long); | ||
42 | DEFINE_GUEST_HANDLE(void); | ||
43 | DEFINE_GUEST_HANDLE(uint64_t); | ||
44 | DEFINE_GUEST_HANDLE(uint32_t); | ||
45 | DEFINE_GUEST_HANDLE(xen_pfn_t); | ||
46 | |||
47 | /* Maximum number of virtual CPUs in multi-processor guests. */ | ||
48 | #define MAX_VIRT_CPUS 1 | ||
49 | |||
50 | struct arch_vcpu_info { }; | ||
51 | struct arch_shared_info { }; | ||
52 | |||
53 | /* TODO: Move pvclock definitions some place arch independent */ | ||
54 | struct pvclock_vcpu_time_info { | ||
55 | u32 version; | ||
56 | u32 pad0; | ||
57 | u64 tsc_timestamp; | ||
58 | u64 system_time; | ||
59 | u32 tsc_to_system_mul; | ||
60 | s8 tsc_shift; | ||
61 | u8 flags; | ||
62 | u8 pad[2]; | ||
63 | } __attribute__((__packed__)); /* 32 bytes */ | ||
64 | |||
65 | /* It is OK to have a 12 bytes struct with no padding because it is packed */ | ||
66 | struct pvclock_wall_clock { | ||
67 | u32 version; | ||
68 | u32 sec; | ||
69 | u32 nsec; | ||
70 | } __attribute__((__packed__)); | ||
71 | #endif | ||
72 | |||
73 | #endif /* _ASM_ARM_XEN_INTERFACE_H */ | ||
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h new file mode 100644 index 000000000000..174202318dff --- /dev/null +++ b/arch/arm/include/asm/xen/page.h | |||
@@ -0,0 +1,82 @@ | |||
1 | #ifndef _ASM_ARM_XEN_PAGE_H | ||
2 | #define _ASM_ARM_XEN_PAGE_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | #include <asm/pgtable.h> | ||
6 | |||
7 | #include <linux/pfn.h> | ||
8 | #include <linux/types.h> | ||
9 | |||
10 | #include <xen/interface/grant_table.h> | ||
11 | |||
12 | #define pfn_to_mfn(pfn) (pfn) | ||
13 | #define phys_to_machine_mapping_valid (1) | ||
14 | #define mfn_to_pfn(mfn) (mfn) | ||
15 | #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) | ||
16 | |||
17 | #define pte_mfn pte_pfn | ||
18 | #define mfn_pte pfn_pte | ||
19 | |||
20 | /* Xen machine address */ | ||
21 | typedef struct xmaddr { | ||
22 | phys_addr_t maddr; | ||
23 | } xmaddr_t; | ||
24 | |||
25 | /* Xen pseudo-physical address */ | ||
26 | typedef struct xpaddr { | ||
27 | phys_addr_t paddr; | ||
28 | } xpaddr_t; | ||
29 | |||
30 | #define XMADDR(x) ((xmaddr_t) { .maddr = (x) }) | ||
31 | #define XPADDR(x) ((xpaddr_t) { .paddr = (x) }) | ||
32 | |||
33 | static inline xmaddr_t phys_to_machine(xpaddr_t phys) | ||
34 | { | ||
35 | unsigned offset = phys.paddr & ~PAGE_MASK; | ||
36 | return XMADDR(PFN_PHYS(pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset); | ||
37 | } | ||
38 | |||
39 | static inline xpaddr_t machine_to_phys(xmaddr_t machine) | ||
40 | { | ||
41 | unsigned offset = machine.maddr & ~PAGE_MASK; | ||
42 | return XPADDR(PFN_PHYS(mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset); | ||
43 | } | ||
44 | /* VIRT <-> MACHINE conversion */ | ||
45 | #define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v)))) | ||
46 | #define virt_to_pfn(v) (PFN_DOWN(__pa(v))) | ||
47 | #define virt_to_mfn(v) (pfn_to_mfn(virt_to_pfn(v))) | ||
48 | #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) | ||
49 | |||
50 | static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr) | ||
51 | { | ||
52 | /* TODO: assuming it is mapped in the kernel 1:1 */ | ||
53 | return virt_to_machine(vaddr); | ||
54 | } | ||
55 | |||
56 | /* TODO: this shouldn't be here but it is because the frontend drivers | ||
57 | * are using it (its rolled in headers) even though we won't hit the code path. | ||
58 | * So for right now just punt with this. | ||
59 | */ | ||
60 | static inline pte_t *lookup_address(unsigned long address, unsigned int *level) | ||
61 | { | ||
62 | BUG(); | ||
63 | return NULL; | ||
64 | } | ||
65 | |||
66 | static inline int m2p_add_override(unsigned long mfn, struct page *page, | ||
67 | struct gnttab_map_grant_ref *kmap_op) | ||
68 | { | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | static inline int m2p_remove_override(struct page *page, bool clear_pte) | ||
73 | { | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) | ||
78 | { | ||
79 | BUG(); | ||
80 | return false; | ||
81 | } | ||
82 | #endif /* _ASM_ARM_XEN_PAGE_H */ | ||