1 #ifndef __ASM_PMAP_H__
2 #define __ASM_PMAP_H__
3 
4 #include <xen/mm.h>
5 
6 #include <asm/fixmap.h>
7 
arch_pmap_map(unsigned int slot,mfn_t mfn)8 static inline void arch_pmap_map(unsigned int slot, mfn_t mfn)
9 {
10     lpae_t *entry = &xen_fixmap[slot];
11     lpae_t pte;
12 
13     ASSERT(!lpae_is_valid(*entry));
14 
15     pte = mfn_to_xen_entry(mfn, PAGE_HYPERVISOR_RW);
16     pte.pt.table = 1;
17     write_pte(entry, pte);
18     /*
19      * The new entry will be used very soon after arch_pmap_map() returns.
20      * So ensure the DSB in write_pte() has completed before continuing.
21      */
22     isb();
23 }
24 
arch_pmap_unmap(unsigned int slot)25 static inline void arch_pmap_unmap(unsigned int slot)
26 {
27     lpae_t pte = {};
28 
29     write_pte(&xen_fixmap[slot], pte);
30 
31     flush_xen_tlb_range_va_local(FIXMAP_ADDR(slot), PAGE_SIZE);
32 }
33 
34 #endif /* __ASM_PMAP_H__ */
35