aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/xen/page.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/include/asm/xen/page.h')
-rw-r--r--arch/arm/include/asm/xen/page.h82
1 files changed, 82 insertions, 0 deletions
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 */
21typedef struct xmaddr {
22 phys_addr_t maddr;
23} xmaddr_t;
24
25/* Xen pseudo-physical address */
26typedef 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
33static 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
39static 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
50static 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 */
60static inline pte_t *lookup_address(unsigned long address, unsigned int *level)
61{
62 BUG();
63 return NULL;
64}
65
66static 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
72static inline int m2p_remove_override(struct page *page, bool clear_pte)
73{
74 return 0;
75}
76
77static 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 */