[PATCH] i386: PARAVIRT: add kmap_atomic_pte for mapping highpte pages
Xen and VMI both have special requirements when mapping a highmem pte page into the kernel address space. These can be dealt with by adding a new kmap_atomic_pte() function for mapping highptes, and hooking it into the paravirt_ops infrastructure. Xen specifically wants to map the pte page RO, so this patch exposes a helper function, kmap_atomic_prot, which maps the page with the specified page protections. This also adds a kmap_flush_unused() function to clear out the cached kmap mappings. Xen needs this to clear out any potential stray RW mappings of pages which will become part of a pagetable. [ Zach - vmi.c will need some attention after this patch. It wasn't immediately obvious to me what needs to be done. ] Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Andi Kleen <ak@suse.de> Cc: Zachary Amsden <zach@vmware.com>
This commit is contained in:
committed by
Andi Kleen
parent
a27fe809b8
commit
ce6234b529
@@ -27,6 +27,8 @@ static inline void flush_kernel_dcache_page(struct page *page)
|
||||
unsigned int nr_free_highpages(void);
|
||||
extern unsigned long totalhigh_pages;
|
||||
|
||||
void kmap_flush_unused(void);
|
||||
|
||||
#else /* CONFIG_HIGHMEM */
|
||||
|
||||
static inline unsigned int nr_free_highpages(void) { return 0; }
|
||||
@@ -44,9 +46,13 @@ static inline void *kmap(struct page *page)
|
||||
|
||||
#define kmap_atomic(page, idx) \
|
||||
({ pagefault_disable(); page_address(page); })
|
||||
#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx)
|
||||
|
||||
#define kunmap_atomic(addr, idx) do { pagefault_enable(); } while (0)
|
||||
#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx))
|
||||
#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
|
||||
|
||||
#define kmap_flush_unused() do {} while(0)
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_HIGHMEM */
|
||||
|
||||
Reference in New Issue
Block a user