1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
205e4d316SH. Peter Anvin #ifndef _ASM_X86_XEN_PAGE_H
305e4d316SH. Peter Anvin #define _ASM_X86_XEN_PAGE_H
4bb898558SAl Viro
5ecbf29cdSJeremy Fitzhardinge #include <linux/kernel.h>
6ecbf29cdSJeremy Fitzhardinge #include <linux/types.h>
7ecbf29cdSJeremy Fitzhardinge #include <linux/spinlock.h>
8bb898558SAl Viro #include <linux/pfn.h>
97e77506aSIan Campbell #include <linux/mm.h>
107fd5cf0bSIngo Molnar #include <linux/device.h>
11bb898558SAl Viro
121457d8cfSJuergen Gross #include <asm/extable.h>
13ecbf29cdSJeremy Fitzhardinge #include <asm/page.h>
14bb898558SAl Viro
15ecbf29cdSJeremy Fitzhardinge #include <xen/interface/xen.h>
16008c320aSJulien Grall #include <xen/interface/grant_table.h>
17bb898558SAl Viro #include <xen/features.h>
18bb898558SAl Viro
19bb898558SAl Viro /* Xen machine address */
20bb898558SAl Viro typedef struct xmaddr {
21bb898558SAl Viro phys_addr_t maddr;
22bb898558SAl Viro } xmaddr_t;
23bb898558SAl Viro
24bb898558SAl Viro /* Xen pseudo-physical address */
25bb898558SAl Viro typedef struct xpaddr {
26bb898558SAl Viro phys_addr_t paddr;
27bb898558SAl Viro } xpaddr_t;
28bb898558SAl Viro
296f0e8bf1SJuergen Gross #ifdef CONFIG_X86_64
306f0e8bf1SJuergen Gross #define XEN_PHYSICAL_MASK __sme_clr((1UL << 52) - 1)
316f0e8bf1SJuergen Gross #else
326f0e8bf1SJuergen Gross #define XEN_PHYSICAL_MASK __PHYSICAL_MASK
336f0e8bf1SJuergen Gross #endif
346f0e8bf1SJuergen Gross
356f0e8bf1SJuergen Gross #define XEN_PTE_MFN_MASK ((pteval_t)(((signed long)PAGE_MASK) & \
366f0e8bf1SJuergen Gross XEN_PHYSICAL_MASK))
376f0e8bf1SJuergen Gross
38bb898558SAl Viro #define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
39bb898558SAl Viro #define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
40bb898558SAl Viro
41bb898558SAl Viro /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
42bb898558SAl Viro #define INVALID_P2M_ENTRY (~0UL)
43f4cec35bSKonrad Rzeszutek Wilk #define FOREIGN_FRAME_BIT (1UL<<(BITS_PER_LONG-1))
44f4cec35bSKonrad Rzeszutek Wilk #define IDENTITY_FRAME_BIT (1UL<<(BITS_PER_LONG-2))
45bb898558SAl Viro #define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT)
46f4cec35bSKonrad Rzeszutek Wilk #define IDENTITY_FRAME(m) ((m) | IDENTITY_FRAME_BIT)
47bb898558SAl Viro
48cb3eb850SJuergen Gross #define P2M_PER_PAGE (PAGE_SIZE / sizeof(unsigned long))
49cb3eb850SJuergen Gross
507e77506aSIan Campbell extern unsigned long *machine_to_phys_mapping;
51ccbcdf7cSJan Beulich extern unsigned long machine_to_phys_nr;
525b8e7d80SJuergen Gross extern unsigned long *xen_p2m_addr;
535b8e7d80SJuergen Gross extern unsigned long xen_p2m_size;
545b8e7d80SJuergen Gross extern unsigned long xen_max_p2m_pfn;
55bb898558SAl Viro
568edfcf88SDavid Vrabel extern int xen_alloc_p2m_entry(unsigned long pfn);
578edfcf88SDavid Vrabel
58bb898558SAl Viro extern unsigned long get_phys_to_machine(unsigned long pfn);
59c3798062SJeremy Fitzhardinge extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn);
606eaa412fSKonrad Rzeszutek Wilk extern bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn);
61cb3eb850SJuergen Gross extern unsigned long __init set_phys_range_identity(unsigned long pfn_s,
62f4cec35bSKonrad Rzeszutek Wilk unsigned long pfn_e);
63bb898558SAl Viro
643d4ebdb2SVitaly Kuznetsov #ifdef CONFIG_XEN_PV
651429d46dSZoltan Kiss extern int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
661429d46dSZoltan Kiss struct gnttab_map_grant_ref *kmap_ops,
671429d46dSZoltan Kiss struct page **pages, unsigned int count);
681429d46dSZoltan Kiss extern int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
69853d0289SDavid Vrabel struct gnttab_unmap_grant_ref *kunmap_ops,
701429d46dSZoltan Kiss struct page **pages, unsigned int count);
713d4ebdb2SVitaly Kuznetsov #else
723d4ebdb2SVitaly Kuznetsov static inline int
set_foreign_p2m_mapping(struct gnttab_map_grant_ref * map_ops,struct gnttab_map_grant_ref * kmap_ops,struct page ** pages,unsigned int count)733d4ebdb2SVitaly Kuznetsov set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
743d4ebdb2SVitaly Kuznetsov struct gnttab_map_grant_ref *kmap_ops,
753d4ebdb2SVitaly Kuznetsov struct page **pages, unsigned int count)
763d4ebdb2SVitaly Kuznetsov {
773d4ebdb2SVitaly Kuznetsov return 0;
783d4ebdb2SVitaly Kuznetsov }
793d4ebdb2SVitaly Kuznetsov
803d4ebdb2SVitaly Kuznetsov static inline int
clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref * unmap_ops,struct gnttab_unmap_grant_ref * kunmap_ops,struct page ** pages,unsigned int count)813d4ebdb2SVitaly Kuznetsov clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
823d4ebdb2SVitaly Kuznetsov struct gnttab_unmap_grant_ref *kunmap_ops,
833d4ebdb2SVitaly Kuznetsov struct page **pages, unsigned int count)
843d4ebdb2SVitaly Kuznetsov {
853d4ebdb2SVitaly Kuznetsov return 0;
863d4ebdb2SVitaly Kuznetsov }
873d4ebdb2SVitaly Kuznetsov #endif
88448f2831SJeremy Fitzhardinge
890aad5689SJuergen Gross /*
9090fff3eaSJuergen Gross * Helper functions to write or read unsigned long values to/from
9190fff3eaSJuergen Gross * memory, when the access may fault.
9290fff3eaSJuergen Gross */
xen_safe_write_ulong(unsigned long * addr,unsigned long val)9390fff3eaSJuergen Gross static inline int xen_safe_write_ulong(unsigned long *addr, unsigned long val)
9490fff3eaSJuergen Gross {
951457d8cfSJuergen Gross int ret = 0;
961457d8cfSJuergen Gross
971457d8cfSJuergen Gross asm volatile("1: mov %[val], %[ptr]\n"
981457d8cfSJuergen Gross "2:\n"
99e2b48e43SPeter Zijlstra _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_EFAULT_REG, %[ret])
1001457d8cfSJuergen Gross : [ret] "+r" (ret), [ptr] "=m" (*addr)
1011457d8cfSJuergen Gross : [val] "r" (val));
1021457d8cfSJuergen Gross
1031457d8cfSJuergen Gross return ret;
10490fff3eaSJuergen Gross }
10590fff3eaSJuergen Gross
xen_safe_read_ulong(const unsigned long * addr,unsigned long * val)1061457d8cfSJuergen Gross static inline int xen_safe_read_ulong(const unsigned long *addr,
1071457d8cfSJuergen Gross unsigned long *val)
10890fff3eaSJuergen Gross {
1091457d8cfSJuergen Gross unsigned long rval = ~0ul;
110e2b48e43SPeter Zijlstra int ret = 0;
1111457d8cfSJuergen Gross
1121457d8cfSJuergen Gross asm volatile("1: mov %[ptr], %[rval]\n"
1131457d8cfSJuergen Gross "2:\n"
114e2b48e43SPeter Zijlstra _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_EFAULT_REG, %[ret])
1151457d8cfSJuergen Gross : [ret] "+r" (ret), [rval] "+r" (rval)
1161457d8cfSJuergen Gross : [ptr] "m" (*addr));
1171457d8cfSJuergen Gross *val = rval;
1181457d8cfSJuergen Gross
1191457d8cfSJuergen Gross return ret;
12090fff3eaSJuergen Gross }
12190fff3eaSJuergen Gross
1223d4ebdb2SVitaly Kuznetsov #ifdef CONFIG_XEN_PV
12390fff3eaSJuergen Gross /*
1240aad5689SJuergen Gross * When to use pfn_to_mfn(), __pfn_to_mfn() or get_phys_to_machine():
1250aad5689SJuergen Gross * - pfn_to_mfn() returns either INVALID_P2M_ENTRY or the mfn. No indicator
1260aad5689SJuergen Gross * bits (identity or foreign) are set.
1270aad5689SJuergen Gross * - __pfn_to_mfn() returns the found entry of the p2m table. A possibly set
1280aad5689SJuergen Gross * identity or foreign indicator will be still set. __pfn_to_mfn() is
129054954ebSJuergen Gross * encapsulating get_phys_to_machine() which is called in special cases only.
130054954ebSJuergen Gross * - get_phys_to_machine() is to be called by __pfn_to_mfn() only in special
131054954ebSJuergen Gross * cases needing an extended handling.
1320aad5689SJuergen Gross */
__pfn_to_mfn(unsigned long pfn)1330aad5689SJuergen Gross static inline unsigned long __pfn_to_mfn(unsigned long pfn)
1340aad5689SJuergen Gross {
135054954ebSJuergen Gross unsigned long mfn;
136054954ebSJuergen Gross
137054954ebSJuergen Gross if (pfn < xen_p2m_size)
138054954ebSJuergen Gross mfn = xen_p2m_addr[pfn];
139054954ebSJuergen Gross else if (unlikely(pfn < xen_max_p2m_pfn))
1400aad5689SJuergen Gross return get_phys_to_machine(pfn);
141054954ebSJuergen Gross else
142054954ebSJuergen Gross return IDENTITY_FRAME(pfn);
143054954ebSJuergen Gross
144054954ebSJuergen Gross if (unlikely(mfn == INVALID_P2M_ENTRY))
145054954ebSJuergen Gross return get_phys_to_machine(pfn);
146054954ebSJuergen Gross
147054954ebSJuergen Gross return mfn;
1480aad5689SJuergen Gross }
1493d4ebdb2SVitaly Kuznetsov #else
__pfn_to_mfn(unsigned long pfn)1503d4ebdb2SVitaly Kuznetsov static inline unsigned long __pfn_to_mfn(unsigned long pfn)
1513d4ebdb2SVitaly Kuznetsov {
1523d4ebdb2SVitaly Kuznetsov return pfn;
1533d4ebdb2SVitaly Kuznetsov }
1543d4ebdb2SVitaly Kuznetsov #endif
1550aad5689SJuergen Gross
pfn_to_mfn(unsigned long pfn)156bb898558SAl Viro static inline unsigned long pfn_to_mfn(unsigned long pfn)
157bb898558SAl Viro {
158cfd8951eSJeremy Fitzhardinge unsigned long mfn;
159cfd8951eSJeremy Fitzhardinge
1600df4f266SJulien Grall /*
1610df4f266SJulien Grall * Some x86 code are still using pfn_to_mfn instead of
1620df4f266SJulien Grall * pfn_to_mfn. This will have to be removed when we figured
1630df4f266SJulien Grall * out which call.
1640df4f266SJulien Grall */
165bb898558SAl Viro if (xen_feature(XENFEAT_auto_translated_physmap))
166bb898558SAl Viro return pfn;
167bb898558SAl Viro
1680aad5689SJuergen Gross mfn = __pfn_to_mfn(pfn);
169cfd8951eSJeremy Fitzhardinge
170cfd8951eSJeremy Fitzhardinge if (mfn != INVALID_P2M_ENTRY)
171f4cec35bSKonrad Rzeszutek Wilk mfn &= ~(FOREIGN_FRAME_BIT | IDENTITY_FRAME_BIT);
172cfd8951eSJeremy Fitzhardinge
173cfd8951eSJeremy Fitzhardinge return mfn;
174bb898558SAl Viro }
175bb898558SAl Viro
phys_to_machine_mapping_valid(unsigned long pfn)176bb898558SAl Viro static inline int phys_to_machine_mapping_valid(unsigned long pfn)
177bb898558SAl Viro {
178bb898558SAl Viro if (xen_feature(XENFEAT_auto_translated_physmap))
179bb898558SAl Viro return 1;
180bb898558SAl Viro
1810aad5689SJuergen Gross return __pfn_to_mfn(pfn) != INVALID_P2M_ENTRY;
182bb898558SAl Viro }
183bb898558SAl Viro
mfn_to_pfn_no_overrides(unsigned long mfn)1840160676bSDavid Vrabel static inline unsigned long mfn_to_pfn_no_overrides(unsigned long mfn)
185bb898558SAl Viro {
186bb898558SAl Viro unsigned long pfn;
1870160676bSDavid Vrabel int ret;
188bb898558SAl Viro
1890160676bSDavid Vrabel if (unlikely(mfn >= machine_to_phys_nr))
1900160676bSDavid Vrabel return ~0;
1910160676bSDavid Vrabel
192bb898558SAl Viro /*
193bb898558SAl Viro * The array access can fail (e.g., device space beyond end of RAM).
194bb898558SAl Viro * In such cases it doesn't matter what we return (we return garbage),
195bb898558SAl Viro * but we must handle the fault without crashing!
196bb898558SAl Viro */
19790fff3eaSJuergen Gross ret = xen_safe_read_ulong(&machine_to_phys_mapping[mfn], &pfn);
198706cc9d2SStefano Stabellini if (ret < 0)
1990160676bSDavid Vrabel return ~0;
2000160676bSDavid Vrabel
2010160676bSDavid Vrabel return pfn;
2020160676bSDavid Vrabel }
2030160676bSDavid Vrabel
mfn_to_pfn(unsigned long mfn)2040160676bSDavid Vrabel static inline unsigned long mfn_to_pfn(unsigned long mfn)
2050160676bSDavid Vrabel {
2060160676bSDavid Vrabel unsigned long pfn;
2070160676bSDavid Vrabel
2080df4f266SJulien Grall /*
2090df4f266SJulien Grall * Some x86 code are still using mfn_to_pfn instead of
2100df4f266SJulien Grall * gfn_to_pfn. This will have to be removed when we figure
2110df4f266SJulien Grall * out which call.
2120df4f266SJulien Grall */
2130160676bSDavid Vrabel if (xen_feature(XENFEAT_auto_translated_physmap))
2140160676bSDavid Vrabel return mfn;
2150160676bSDavid Vrabel
2160160676bSDavid Vrabel pfn = mfn_to_pfn_no_overrides(mfn);
2170bb599fdSDavid Vrabel if (__pfn_to_mfn(pfn) != mfn)
2180bb599fdSDavid Vrabel pfn = ~0;
219706cc9d2SStefano Stabellini
220706cc9d2SStefano Stabellini /*
2210bb599fdSDavid Vrabel * pfn is ~0 if there are no entries in the m2p for mfn or the
2220bb599fdSDavid Vrabel * entry doesn't map back to the mfn.
223706cc9d2SStefano Stabellini */
2240aad5689SJuergen Gross if (pfn == ~0 && __pfn_to_mfn(mfn) == IDENTITY_FRAME(mfn))
225706cc9d2SStefano Stabellini pfn = mfn;
226448f2831SJeremy Fitzhardinge
227bb898558SAl Viro return pfn;
228bb898558SAl Viro }
229bb898558SAl Viro
phys_to_machine(xpaddr_t phys)230bb898558SAl Viro static inline xmaddr_t phys_to_machine(xpaddr_t phys)
231bb898558SAl Viro {
232bb898558SAl Viro unsigned offset = phys.paddr & ~PAGE_MASK;
233bb898558SAl Viro return XMADDR(PFN_PHYS(pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset);
234bb898558SAl Viro }
235bb898558SAl Viro
machine_to_phys(xmaddr_t machine)236bb898558SAl Viro static inline xpaddr_t machine_to_phys(xmaddr_t machine)
237bb898558SAl Viro {
238bb898558SAl Viro unsigned offset = machine.maddr & ~PAGE_MASK;
239bb898558SAl Viro return XPADDR(PFN_PHYS(mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset);
240bb898558SAl Viro }
241bb898558SAl Viro
2420df4f266SJulien Grall /* Pseudo-physical <-> Guest conversion */
pfn_to_gfn(unsigned long pfn)2430df4f266SJulien Grall static inline unsigned long pfn_to_gfn(unsigned long pfn)
2440df4f266SJulien Grall {
2450df4f266SJulien Grall if (xen_feature(XENFEAT_auto_translated_physmap))
2460df4f266SJulien Grall return pfn;
2470df4f266SJulien Grall else
2480df4f266SJulien Grall return pfn_to_mfn(pfn);
2490df4f266SJulien Grall }
2500df4f266SJulien Grall
gfn_to_pfn(unsigned long gfn)2510df4f266SJulien Grall static inline unsigned long gfn_to_pfn(unsigned long gfn)
2520df4f266SJulien Grall {
2530df4f266SJulien Grall if (xen_feature(XENFEAT_auto_translated_physmap))
2540df4f266SJulien Grall return gfn;
2550df4f266SJulien Grall else
2560df4f266SJulien Grall return mfn_to_pfn(gfn);
2570df4f266SJulien Grall }
2580df4f266SJulien Grall
25932e09870SJulien Grall /* Pseudo-physical <-> Bus conversion */
2600df4f266SJulien Grall #define pfn_to_bfn(pfn) pfn_to_gfn(pfn)
2610df4f266SJulien Grall #define bfn_to_pfn(bfn) gfn_to_pfn(bfn)
26232e09870SJulien Grall
263bb898558SAl Viro /*
264bb898558SAl Viro * We detect special mappings in one of two ways:
265bb898558SAl Viro * 1. If the MFN is an I/O page then Xen will set the m2p entry
266bb898558SAl Viro * to be outside our maximum possible pseudophys range.
267bb898558SAl Viro * 2. If the MFN belongs to a different domain then we will certainly
268bb898558SAl Viro * not have MFN in our p2m table. Conversely, if the page is ours,
269bb898558SAl Viro * then we'll have p2m(m2p(MFN))==MFN.
270bb898558SAl Viro * If we detect a special mapping then it doesn't have a 'struct page'.
271bb898558SAl Viro * We force !pfn_valid() by returning an out-of-range pointer.
272bb898558SAl Viro *
273bb898558SAl Viro * NB. These checks require that, for any MFN that is not in our reservation,
274bb898558SAl Viro * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
275bb898558SAl Viro * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
276bb898558SAl Viro * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
277bb898558SAl Viro *
278bb898558SAl Viro * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
279bb898558SAl Viro * use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
280bb898558SAl Viro * require. In all the cases we care about, the FOREIGN_FRAME bit is
281bb898558SAl Viro * masked (e.g., pfn_to_mfn()) so behaviour there is correct.
282bb898558SAl Viro */
bfn_to_local_pfn(unsigned long mfn)28332e09870SJulien Grall static inline unsigned long bfn_to_local_pfn(unsigned long mfn)
284bb898558SAl Viro {
285fc590efeSMukesh Rathor unsigned long pfn;
286fc590efeSMukesh Rathor
287fc590efeSMukesh Rathor if (xen_feature(XENFEAT_auto_translated_physmap))
288fc590efeSMukesh Rathor return mfn;
289fc590efeSMukesh Rathor
290fc590efeSMukesh Rathor pfn = mfn_to_pfn(mfn);
2910aad5689SJuergen Gross if (__pfn_to_mfn(pfn) != mfn)
292c0011dbfSJeremy Fitzhardinge return -1; /* force !pfn_valid() */
293bb898558SAl Viro return pfn;
294bb898558SAl Viro }
295bb898558SAl Viro
296bb898558SAl Viro /* VIRT <-> MACHINE conversion */
297bb898558SAl Viro #define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v))))
virt_to_pfn(const void * v)298*067e4f17SLinus Walleij static inline unsigned long virt_to_pfn(const void *v)
299*067e4f17SLinus Walleij {
300*067e4f17SLinus Walleij return PFN_DOWN(__pa(v));
301*067e4f17SLinus Walleij }
302b40bf53eSAlex Nixon #define virt_to_mfn(v) (pfn_to_mfn(virt_to_pfn(v)))
303bb898558SAl Viro #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
304bb898558SAl Viro
3050df4f266SJulien Grall /* VIRT <-> GUEST conversion */
3060df4f266SJulien Grall #define virt_to_gfn(v) (pfn_to_gfn(virt_to_pfn(v)))
3070df4f266SJulien Grall #define gfn_to_virt(g) (__va(gfn_to_pfn(g) << PAGE_SHIFT))
3080df4f266SJulien Grall
pte_mfn(pte_t pte)309bb898558SAl Viro static inline unsigned long pte_mfn(pte_t pte)
310bb898558SAl Viro {
3116f0e8bf1SJuergen Gross return (pte.pte & XEN_PTE_MFN_MASK) >> PAGE_SHIFT;
312bb898558SAl Viro }
313bb898558SAl Viro
mfn_pte(unsigned long page_nr,pgprot_t pgprot)314bb898558SAl Viro static inline pte_t mfn_pte(unsigned long page_nr, pgprot_t pgprot)
315bb898558SAl Viro {
316bb898558SAl Viro pte_t pte;
317bb898558SAl Viro
318bb898558SAl Viro pte.pte = ((phys_addr_t)page_nr << PAGE_SHIFT) |
319b534816bSJeremy Fitzhardinge massage_pgprot(pgprot);
320bb898558SAl Viro
321bb898558SAl Viro return pte;
322bb898558SAl Viro }
323bb898558SAl Viro
pte_val_ma(pte_t pte)324bb898558SAl Viro static inline pteval_t pte_val_ma(pte_t pte)
325bb898558SAl Viro {
326bb898558SAl Viro return pte.pte;
327bb898558SAl Viro }
328bb898558SAl Viro
__pte_ma(pteval_t x)329bb898558SAl Viro static inline pte_t __pte_ma(pteval_t x)
330bb898558SAl Viro {
331bb898558SAl Viro return (pte_t) { .pte = x };
332bb898558SAl Viro }
333bb898558SAl Viro
334bb898558SAl Viro #define pmd_val_ma(v) ((v).pmd)
335bb898558SAl Viro #ifdef __PAGETABLE_PUD_FOLDED
336f2a6a705SKirill A. Shutemov #define pud_val_ma(v) ((v).p4d.pgd.pgd)
337bb898558SAl Viro #else
338bb898558SAl Viro #define pud_val_ma(v) ((v).pud)
339bb898558SAl Viro #endif
340bb898558SAl Viro #define __pmd_ma(x) ((pmd_t) { (x) } )
341bb898558SAl Viro
342f2a6a705SKirill A. Shutemov #ifdef __PAGETABLE_P4D_FOLDED
343f2a6a705SKirill A. Shutemov #define p4d_val_ma(x) ((x).pgd.pgd)
344f2a6a705SKirill A. Shutemov #else
345f2a6a705SKirill A. Shutemov #define p4d_val_ma(x) ((x).p4d)
346f2a6a705SKirill A. Shutemov #endif
347bb898558SAl Viro
348bb898558SAl Viro xmaddr_t arbitrary_virt_to_machine(void *address);
3499976b39bSJeremy Fitzhardinge unsigned long arbitrary_virt_to_mfn(void *vaddr);
350bb898558SAl Viro void make_lowmem_page_readonly(void *vaddr);
351bb898558SAl Viro void make_lowmem_page_readwrite(void *vaddr);
352bb898558SAl Viro
xen_arch_need_swiotlb(struct device * dev,phys_addr_t phys,dma_addr_t dev_addr)353a4dba130SStefano Stabellini static inline bool xen_arch_need_swiotlb(struct device *dev,
354291be10fSJulien Grall phys_addr_t phys,
355291be10fSJulien Grall dma_addr_t dev_addr)
356a4dba130SStefano Stabellini {
357a4dba130SStefano Stabellini return false;
358a4dba130SStefano Stabellini }
359a4dba130SStefano Stabellini
36005e4d316SH. Peter Anvin #endif /* _ASM_X86_XEN_PAGE_H */
361