@@ -60,7 +60,7 @@ static inline void kmap_flush_tlb(unsigned long addr) { }
#endif
void *kmap_high(struct page *page);
-static inline void *kmap(struct page *page)
+static inline void *__kmap(struct page *page, bool global)
{
void *addr;
@@ -74,20 +74,20 @@ static inline void *kmap(struct page *page)
* Even non-highmem pages may have additional access protections which
* need to be checked and potentially enabled.
*/
- dev_page_enable_access(page, true);
+ dev_page_enable_access(page, global);
return addr;
}
void kunmap_high(struct page *page);
-static inline void kunmap(struct page *page)
+static inline void __kunmap(struct page *page, bool global)
{
might_sleep();
/*
* Even non-highmem pages may have additional access protections which
* need to be checked and potentially disabled.
*/
- dev_page_disable_access(page, true);
+ dev_page_disable_access(page, global);
if (!PageHighMem(page))
return;
kunmap_high(page);
@@ -160,10 +160,10 @@ static inline struct page *kmap_to_page(void *addr)
static inline unsigned long totalhigh_pages(void) { return 0UL; }
-static inline void *kmap(struct page *page)
+static inline void *__kmap(struct page *page, bool global)
{
might_sleep();
- dev_page_enable_access(page, true);
+ dev_page_enable_access(page, global);
return page_address(page);
}
@@ -171,9 +171,9 @@ static inline void kunmap_high(struct page *page)
{
}
-static inline void kunmap(struct page *page)
+static inline void __kunmap(struct page *page, bool global)
{
- dev_page_disable_access(page, true);
+ dev_page_disable_access(page, global);
#ifdef ARCH_HAS_FLUSH_ON_KUNMAP
kunmap_flush_on_unmap(page_address(page));
#endif
@@ -238,6 +238,24 @@ static inline void kmap_atomic_idx_pop(void)
#endif
+static inline void *kmap(struct page *page)
+{
+ return __kmap(page, true);
+}
+static inline void kunmap(struct page *page)
+{
+ __kunmap(page, true);
+}
+
+static inline void *kmap_thread(struct page *page)
+{
+ return __kmap(page, false);
+}
+static inline void kunmap_thread(struct page *page)
+{
+ __kunmap(page, false);
+}
+
/*
* Prevent people trying to call kunmap_atomic() as if it were kunmap()
* kunmap_atomic() should get the return value of kmap_atomic, not the page.