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)
16 #define pte_mfn pte_pfn
17 #define mfn_pte pfn_pte
19 /* Xen machine address */
20 typedef struct xmaddr {
24 /* Xen pseudo-physical address */
25 typedef struct xpaddr {
29 #define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
30 #define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
32 #define INVALID_P2M_ENTRY (~0UL)
34 unsigned long __pfn_to_mfn(unsigned long pfn);
35 extern struct rb_root phys_to_mach;
37 static inline unsigned long pfn_to_mfn(unsigned long pfn)
41 if (phys_to_mach.rb_node != NULL) {
42 mfn = __pfn_to_mfn(pfn);
43 if (mfn != INVALID_P2M_ENTRY)
50 static inline unsigned long mfn_to_pfn(unsigned long mfn)
55 #define mfn_to_local_pfn(mfn) mfn_to_pfn(mfn)
57 /* VIRT <-> MACHINE conversion */
58 #define virt_to_mfn(v) (pfn_to_mfn(virt_to_pfn(v)))
59 #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
61 /* Only used in PV code. But ARM guests are always HVM. */
62 static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr)
67 /* TODO: this shouldn't be here but it is because the frontend drivers
68 * are using it (its rolled in headers) even though we won't hit the code path.
69 * So for right now just punt with this.
71 static inline pte_t *lookup_address(unsigned long address, unsigned int *level)
77 extern int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
78 struct gnttab_map_grant_ref *kmap_ops,
79 struct page **pages, unsigned int count);
81 extern int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
82 struct gnttab_unmap_grant_ref *kunmap_ops,
83 struct page **pages, unsigned int count);
85 bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn);
86 bool __set_phys_to_machine_multi(unsigned long pfn, unsigned long mfn,
87 unsigned long nr_pages);
89 static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
91 return __set_phys_to_machine(pfn, mfn);
94 #define xen_remap(cookie, size) ioremap_cache((cookie), (size))
95 #define xen_unmap(cookie) iounmap((cookie))
97 bool xen_arch_need_swiotlb(struct device *dev,
100 unsigned long xen_get_swiotlb_free_pages(unsigned int order);
102 #endif /* _ASM_ARM_XEN_PAGE_H */