Add pgprot_writecombine. pgprot_writecombine will be aliased to
pgprot_noncached when not supported by the architecture.
Signed-off-by: Venkatesh Pallipadi <[email protected]>
Signed-off-by: Suresh Siddha <[email protected]>
---
arch/x86/include/asm/pgtable.h | 3 +++
arch/x86/mm/pat.c | 8 ++++++++
include/asm-generic/pgtable.h | 4 ++++
3 files changed, 15 insertions(+)
Index: linux-2.6/include/asm-generic/pgtable.h
===================================================================
--- linux-2.6.orig/include/asm-generic/pgtable.h 2008-12-17 15:01:51.000000000 -0800
+++ linux-2.6/include/asm-generic/pgtable.h 2008-12-17 17:23:11.000000000 -0800
@@ -129,6 +129,10 @@ static inline void ptep_set_wrprotect(st
#define move_pte(pte, prot, old_addr, new_addr) (pte)
#endif
+#ifndef pgprot_writecombine
+#define pgprot_writecombine pgprot_noncached
+#endif
+
/*
* When walking page tables, get the address of the next boundary,
* or the end address of the range if that comes earlier. Although no
Index: linux-2.6/arch/x86/include/asm/pgtable.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/pgtable.h 2008-12-17 17:23:07.000000000 -0800
+++ linux-2.6/arch/x86/include/asm/pgtable.h 2008-12-17 17:23:11.000000000 -0800
@@ -168,6 +168,9 @@
#ifndef __ASSEMBLY__
+#define pgprot_writecombine pgprot_writecombine
+extern pgprot_t pgprot_writecombine(pgprot_t prot);
+
/*
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
Index: linux-2.6/arch/x86/mm/pat.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/pat.c 2008-12-17 17:22:59.000000000 -0800
+++ linux-2.6/arch/x86/mm/pat.c 2008-12-17 17:23:11.000000000 -0800
@@ -832,6 +832,14 @@ void untrack_pfn_vma(struct vm_area_stru
}
}
+pgprot_t pgprot_writecombine(pgprot_t prot)
+{
+ if (pat_enabled)
+ return __pgprot(pgprot_val(prot) | _PAGE_CACHE_WC);
+ else
+ return pgprot_noncached(prot);
+}
+
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT)
/* get Nth element of the linked list */
--