diff options
Diffstat (limited to 'arch/x86/mm/pageattr.c')
-rw-r--r-- | arch/x86/mm/pageattr.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 1b734d7a8966..7e600c1962db 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -591,9 +591,12 @@ static int __change_page_attr(struct cpa_data *cpa, int primary) | |||
591 | unsigned int level; | 591 | unsigned int level; |
592 | pte_t *kpte, old_pte; | 592 | pte_t *kpte, old_pte; |
593 | 593 | ||
594 | if (cpa->flags & CPA_PAGES_ARRAY) | 594 | if (cpa->flags & CPA_PAGES_ARRAY) { |
595 | address = (unsigned long)page_address(cpa->pages[cpa->curpage]); | 595 | struct page *page = cpa->pages[cpa->curpage]; |
596 | else if (cpa->flags & CPA_ARRAY) | 596 | if (unlikely(PageHighMem(page))) |
597 | return 0; | ||
598 | address = (unsigned long)page_address(page); | ||
599 | } else if (cpa->flags & CPA_ARRAY) | ||
597 | address = cpa->vaddr[cpa->curpage]; | 600 | address = cpa->vaddr[cpa->curpage]; |
598 | else | 601 | else |
599 | address = *cpa->vaddr; | 602 | address = *cpa->vaddr; |
@@ -697,9 +700,12 @@ static int cpa_process_alias(struct cpa_data *cpa) | |||
697 | * No need to redo, when the primary call touched the direct | 700 | * No need to redo, when the primary call touched the direct |
698 | * mapping already: | 701 | * mapping already: |
699 | */ | 702 | */ |
700 | if (cpa->flags & CPA_PAGES_ARRAY) | 703 | if (cpa->flags & CPA_PAGES_ARRAY) { |
701 | vaddr = (unsigned long)page_address(cpa->pages[cpa->curpage]); | 704 | struct page *page = cpa->pages[cpa->curpage]; |
702 | else if (cpa->flags & CPA_ARRAY) | 705 | if (unlikely(PageHighMem(page))) |
706 | return 0; | ||
707 | vaddr = (unsigned long)page_address(page); | ||
708 | } else if (cpa->flags & CPA_ARRAY) | ||
703 | vaddr = cpa->vaddr[cpa->curpage]; | 709 | vaddr = cpa->vaddr[cpa->curpage]; |
704 | else | 710 | else |
705 | vaddr = *cpa->vaddr; | 711 | vaddr = *cpa->vaddr; |
@@ -997,12 +1003,15 @@ EXPORT_SYMBOL(set_memory_array_uc); | |||
997 | int _set_memory_wc(unsigned long addr, int numpages) | 1003 | int _set_memory_wc(unsigned long addr, int numpages) |
998 | { | 1004 | { |
999 | int ret; | 1005 | int ret; |
1006 | unsigned long addr_copy = addr; | ||
1007 | |||
1000 | ret = change_page_attr_set(&addr, numpages, | 1008 | ret = change_page_attr_set(&addr, numpages, |
1001 | __pgprot(_PAGE_CACHE_UC_MINUS), 0); | 1009 | __pgprot(_PAGE_CACHE_UC_MINUS), 0); |
1002 | |||
1003 | if (!ret) { | 1010 | if (!ret) { |
1004 | ret = change_page_attr_set(&addr, numpages, | 1011 | ret = change_page_attr_set_clr(&addr_copy, numpages, |
1005 | __pgprot(_PAGE_CACHE_WC), 0); | 1012 | __pgprot(_PAGE_CACHE_WC), |
1013 | __pgprot(_PAGE_CACHE_MASK), | ||
1014 | 0, 0, NULL); | ||
1006 | } | 1015 | } |
1007 | return ret; | 1016 | return ret; |
1008 | } | 1017 | } |
@@ -1119,7 +1128,9 @@ int set_pages_array_uc(struct page **pages, int addrinarray) | |||
1119 | int free_idx; | 1128 | int free_idx; |
1120 | 1129 | ||
1121 | for (i = 0; i < addrinarray; i++) { | 1130 | for (i = 0; i < addrinarray; i++) { |
1122 | start = (unsigned long)page_address(pages[i]); | 1131 | if (PageHighMem(pages[i])) |
1132 | continue; | ||
1133 | start = page_to_pfn(pages[i]) << PAGE_SHIFT; | ||
1123 | end = start + PAGE_SIZE; | 1134 | end = start + PAGE_SIZE; |
1124 | if (reserve_memtype(start, end, _PAGE_CACHE_UC_MINUS, NULL)) | 1135 | if (reserve_memtype(start, end, _PAGE_CACHE_UC_MINUS, NULL)) |
1125 | goto err_out; | 1136 | goto err_out; |
@@ -1132,7 +1143,9 @@ int set_pages_array_uc(struct page **pages, int addrinarray) | |||
1132 | err_out: | 1143 | err_out: |
1133 | free_idx = i; | 1144 | free_idx = i; |
1134 | for (i = 0; i < free_idx; i++) { | 1145 | for (i = 0; i < free_idx; i++) { |
1135 | start = (unsigned long)page_address(pages[i]); | 1146 | if (PageHighMem(pages[i])) |
1147 | continue; | ||
1148 | start = page_to_pfn(pages[i]) << PAGE_SHIFT; | ||
1136 | end = start + PAGE_SIZE; | 1149 | end = start + PAGE_SIZE; |
1137 | free_memtype(start, end); | 1150 | free_memtype(start, end); |
1138 | } | 1151 | } |
@@ -1161,7 +1174,9 @@ int set_pages_array_wb(struct page **pages, int addrinarray) | |||
1161 | return retval; | 1174 | return retval; |
1162 | 1175 | ||
1163 | for (i = 0; i < addrinarray; i++) { | 1176 | for (i = 0; i < addrinarray; i++) { |
1164 | start = (unsigned long)page_address(pages[i]); | 1177 | if (PageHighMem(pages[i])) |
1178 | continue; | ||
1179 | start = page_to_pfn(pages[i]) << PAGE_SHIFT; | ||
1165 | end = start + PAGE_SIZE; | 1180 | end = start + PAGE_SIZE; |
1166 | free_memtype(start, end); | 1181 | free_memtype(start, end); |
1167 | } | 1182 | } |