]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: PAT use reserve free memtype in set_memory_uc
authorvenkatesh.pallipadi@intel.com <venkatesh.pallipadi@intel.com>
Wed, 19 Mar 2008 00:00:18 +0000 (17:00 -0700)
committerIngo Molnar <mingo@elte.hu>
Thu, 17 Apr 2008 15:41:19 +0000 (17:41 +0200)
Use reserve_memtype and free_memtype interfaces in set_memory_uc/set_memory_wb
interfaces to avoid aliasing.
Usage model of set_memory_uc and set_memory_wb is for RAM memory and users
will first call set_memory_uc and call set_memory_wb after use to reset the
attribute.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/ioremap.c
arch/x86/mm/pageattr.c
include/asm-x86/cacheflush.h

index 20c01f2b2e1130325ed29d8f38ca1c10933c4fba..0cdb7f11ce496102916a4ff21d8f126088a99cd3 100644 (file)
@@ -95,10 +95,10 @@ int ioremap_change_attr(unsigned long vaddr, unsigned long size,
        switch (prot_val) {
        case _PAGE_CACHE_UC:
        default:
-               err = set_memory_uc(vaddr, nrpages);
+               err = _set_memory_uc(vaddr, nrpages);
                break;
        case _PAGE_CACHE_WB:
-               err = set_memory_wb(vaddr, nrpages);
+               err = _set_memory_wb(vaddr, nrpages);
                break;
        }
 
index f7d5ca170c22141db4e3360b15fc57966399177f..938df5e8402b5886770bf3e17f88cf454c3e9045 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/proto.h>
+#include <asm/pat.h>
 
 /*
  * The current flushing context - we pass it instead of 5 arguments:
@@ -770,18 +771,34 @@ static inline int change_page_attr_clear(unsigned long addr, int numpages,
        return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask);
 }
 
-int set_memory_uc(unsigned long addr, int numpages)
+int _set_memory_uc(unsigned long addr, int numpages)
 {
        return change_page_attr_set(addr, numpages,
                                    __pgprot(_PAGE_CACHE_UC));
 }
+
+int set_memory_uc(unsigned long addr, int numpages)
+{
+       if (reserve_memtype(addr, addr + numpages * PAGE_SIZE,
+                           _PAGE_CACHE_UC, NULL))
+               return -EINVAL;
+
+       return _set_memory_uc(addr, numpages);
+}
 EXPORT_SYMBOL(set_memory_uc);
 
-int set_memory_wb(unsigned long addr, int numpages)
+int _set_memory_wb(unsigned long addr, int numpages)
 {
        return change_page_attr_clear(addr, numpages,
                                      __pgprot(_PAGE_CACHE_MASK));
 }
+
+int set_memory_wb(unsigned long addr, int numpages)
+{
+       free_memtype(addr, addr + numpages * PAGE_SIZE);
+
+       return _set_memory_wb(addr, numpages);
+}
 EXPORT_SYMBOL(set_memory_wb);
 
 int set_memory_x(unsigned long addr, int numpages)
index 5396c212d8c09d8af1d8d5d82e9996ba50c2dfb6..5676fba10a097b9b9dfe4a86841acf1c99373cca 100644 (file)
@@ -34,6 +34,8 @@ int set_pages_nx(struct page *page, int numpages);
 int set_pages_ro(struct page *page, int numpages);
 int set_pages_rw(struct page *page, int numpages);
 
+int _set_memory_uc(unsigned long addr, int numpages);
+int _set_memory_wb(unsigned long addr, int numpages);
 int set_memory_uc(unsigned long addr, int numpages);
 int set_memory_wb(unsigned long addr, int numpages);
 int set_memory_x(unsigned long addr, int numpages);