diff options
-rw-r--r-- | arch/x86/mm/ioremap.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/pageattr.c | 21 | ||||
-rw-r--r-- | include/asm-x86/cacheflush.h | 2 |
3 files changed, 23 insertions, 4 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 20c01f2b2e11..0cdb7f11ce49 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -95,10 +95,10 @@ int ioremap_change_attr(unsigned long vaddr, unsigned long size, | |||
95 | switch (prot_val) { | 95 | switch (prot_val) { |
96 | case _PAGE_CACHE_UC: | 96 | case _PAGE_CACHE_UC: |
97 | default: | 97 | default: |
98 | err = set_memory_uc(vaddr, nrpages); | 98 | err = _set_memory_uc(vaddr, nrpages); |
99 | break; | 99 | break; |
100 | case _PAGE_CACHE_WB: | 100 | case _PAGE_CACHE_WB: |
101 | err = set_memory_wb(vaddr, nrpages); | 101 | err = _set_memory_wb(vaddr, nrpages); |
102 | break; | 102 | break; |
103 | } | 103 | } |
104 | 104 | ||
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 | ||
773 | int set_memory_uc(unsigned long addr, int numpages) | 774 | int _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 | |||
780 | int 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 | } | ||
778 | EXPORT_SYMBOL(set_memory_uc); | 788 | EXPORT_SYMBOL(set_memory_uc); |
779 | 789 | ||
780 | int set_memory_wb(unsigned long addr, int numpages) | 790 | int _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 | |||
796 | int 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 | } | ||
785 | EXPORT_SYMBOL(set_memory_wb); | 802 | EXPORT_SYMBOL(set_memory_wb); |
786 | 803 | ||
787 | int set_memory_x(unsigned long addr, int numpages) | 804 | int set_memory_x(unsigned long addr, int numpages) |
diff --git a/include/asm-x86/cacheflush.h b/include/asm-x86/cacheflush.h index 5396c212d8c0..5676fba10a09 100644 --- a/include/asm-x86/cacheflush.h +++ b/include/asm-x86/cacheflush.h | |||
@@ -34,6 +34,8 @@ int set_pages_nx(struct page *page, int numpages); | |||
34 | int set_pages_ro(struct page *page, int numpages); | 34 | int set_pages_ro(struct page *page, int numpages); |
35 | int set_pages_rw(struct page *page, int numpages); | 35 | int set_pages_rw(struct page *page, int numpages); |
36 | 36 | ||
37 | int _set_memory_uc(unsigned long addr, int numpages); | ||
38 | int _set_memory_wb(unsigned long addr, int numpages); | ||
37 | int set_memory_uc(unsigned long addr, int numpages); | 39 | int set_memory_uc(unsigned long addr, int numpages); |
38 | int set_memory_wb(unsigned long addr, int numpages); | 40 | int set_memory_wb(unsigned long addr, int numpages); |
39 | int set_memory_x(unsigned long addr, int numpages); | 41 | int set_memory_x(unsigned long addr, int numpages); |