1 #ifndef _ASM_ARM_XEN_PAGE_H
2 #define _ASM_ARM_XEN_PAGE_H
5 #include <asm/pgtable.h>
8 #include <linux/types.h>
9 #include <linux/dma-mapping.h>
12 #include <xen/interface/grant_table.h>
14 #define phys_to_machine_mapping_valid(pfn) (1)
15 #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
17 #define pte_mfn pte_pfn
18 #define mfn_pte pfn_pte
20 /* Xen machine address */
21 typedef struct xmaddr
{
25 /* Xen pseudo-physical address */
26 typedef struct xpaddr
{
30 #define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
31 #define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
33 #define INVALID_P2M_ENTRY (~0UL)
35 unsigned long __pfn_to_mfn(unsigned long pfn
);
36 extern struct rb_root phys_to_mach
;
38 static inline unsigned long pfn_to_mfn(unsigned long pfn
)
42 if (phys_to_mach
.rb_node
!= NULL
) {
43 mfn
= __pfn_to_mfn(pfn
);
44 if (mfn
!= INVALID_P2M_ENTRY
)
51 static inline unsigned long mfn_to_pfn(unsigned long mfn
)
56 #define mfn_to_local_pfn(mfn) mfn_to_pfn(mfn)
58 static inline xmaddr_t
phys_to_machine(xpaddr_t phys
)
60 unsigned offset
= phys
.paddr
& ~PAGE_MASK
;
61 return XMADDR(PFN_PHYS(pfn_to_mfn(PFN_DOWN(phys
.paddr
))) | offset
);
64 static inline xpaddr_t
machine_to_phys(xmaddr_t machine
)
66 unsigned offset
= machine
.maddr
& ~PAGE_MASK
;
67 return XPADDR(PFN_PHYS(mfn_to_pfn(PFN_DOWN(machine
.maddr
))) | offset
);
69 /* VIRT <-> MACHINE conversion */
70 #define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v))))
71 #define virt_to_mfn(v) (pfn_to_mfn(virt_to_pfn(v)))
72 #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
74 static inline xmaddr_t
arbitrary_virt_to_machine(void *vaddr
)
76 /* TODO: assuming it is mapped in the kernel 1:1 */
77 return virt_to_machine(vaddr
);
80 /* TODO: this shouldn't be here but it is because the frontend drivers
81 * are using it (its rolled in headers) even though we won't hit the code path.
82 * So for right now just punt with this.
84 static inline pte_t
*lookup_address(unsigned long address
, unsigned int *level
)
90 extern int set_foreign_p2m_mapping(struct gnttab_map_grant_ref
*map_ops
,
91 struct gnttab_map_grant_ref
*kmap_ops
,
92 struct page
**pages
, unsigned int count
);
94 extern int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref
*unmap_ops
,
95 struct gnttab_unmap_grant_ref
*kunmap_ops
,
96 struct page
**pages
, unsigned int count
);
98 bool __set_phys_to_machine(unsigned long pfn
, unsigned long mfn
);
99 bool __set_phys_to_machine_multi(unsigned long pfn
, unsigned long mfn
,
100 unsigned long nr_pages
);
102 static inline bool set_phys_to_machine(unsigned long pfn
, unsigned long mfn
)
104 return __set_phys_to_machine(pfn
, mfn
);
107 #define xen_remap(cookie, size) ioremap_cache((cookie), (size))
108 #define xen_unmap(cookie) iounmap((cookie))
110 bool xen_arch_need_swiotlb(struct device
*dev
,
114 #endif /* _ASM_ARM_XEN_PAGE_H */
This page took 0.034163 seconds and 6 git commands to generate.