aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/pageattr.c
diff options
context:
space:
mode:
authorvenkatesh.pallipadi@intel.com <venkatesh.pallipadi@intel.com>2008-03-18 20:00:18 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:41:19 -0400
commit1219333dfdd488e85f08cf07881b8bc63cf92f21 (patch)
tree4ada0350f450d84b5ce908fff7d292e4848b5c18 /arch/x86/mm/pageattr.c
parentd7677d4034f040f4ce565713e0b83a31cc26f23e (diff)
x86: PAT use reserve free memtype in set_memory_uc
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>
Diffstat (limited to 'arch/x86/mm/pageattr.c')
-rw-r--r--arch/x86/mm/pageattr.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index f7d5ca170c22..938df5e8402b 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -19,6 +19,7 @@
19#include <asm/uaccess.h> 19#include <asm/uaccess.h>
20#include <asm/pgalloc.h> 20#include <asm/pgalloc.h>
21#include <asm/proto.h> 21#include <asm/proto.h>
22#include <asm/pat.h>
22 23
23/* 24/*
24 * The current flushing context - we pass it instead of 5 arguments: 25 * 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,
770 return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask); 771 return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask);
771} 772}
772 773
773int set_memory_uc(unsigned long addr, int numpages) 774int _set_memory_uc(unsigned long addr, int numpages)
774{ 775{
775 return change_page_attr_set(addr, numpages, 776 return change_page_attr_set(addr, numpages,
776 __pgprot(_PAGE_CACHE_UC)); 777 __pgprot(_PAGE_CACHE_UC));
777} 778}
779
780int set_memory_uc(unsigned long addr, int numpages)
781{
782 if (reserve_memtype(addr, addr + numpages * PAGE_SIZE,
783 _PAGE_CACHE_UC, NULL))
784 return -EINVAL;
785
786 return _set_memory_uc(addr, numpages);
787}
778EXPORT_SYMBOL(set_memory_uc); 788EXPORT_SYMBOL(set_memory_uc);
779 789
780int set_memory_wb(unsigned long addr, int numpages) 790int _set_memory_wb(unsigned long addr, int numpages)
781{ 791{
782 return change_page_attr_clear(addr, numpages, 792 return change_page_attr_clear(addr, numpages,
783 __pgprot(_PAGE_CACHE_MASK)); 793 __pgprot(_PAGE_CACHE_MASK));
784} 794}
795
796int set_memory_wb(unsigned long addr, int numpages)
797{
798 free_memtype(addr, addr + numpages * PAGE_SIZE);
799
800 return _set_memory_wb(addr, numpages);
801}
785EXPORT_SYMBOL(set_memory_wb); 802EXPORT_SYMBOL(set_memory_wb);
786 803
787int set_memory_x(unsigned long addr, int numpages) 804int set_memory_x(unsigned long addr, int numpages)