aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/mm/Makefile_321
-rw-r--r--arch/x86/mm/Makefile_641
-rw-r--r--arch/x86/mm/pageattr.c51
-rw-r--r--include/asm-x86/cacheflush.h1
4 files changed, 14 insertions, 40 deletions
diff --git a/arch/x86/mm/Makefile_32 b/arch/x86/mm/Makefile_32
index af0d39bea6c5..ffa6d46a1e73 100644
--- a/arch/x86/mm/Makefile_32
+++ b/arch/x86/mm/Makefile_32
@@ -4,7 +4,6 @@
4 4
5obj-y := init_32.o pgtable_32.o fault_32.o ioremap.o extable.o pageattr.o mmap.o 5obj-y := init_32.o pgtable_32.o fault_32.o ioremap.o extable.o pageattr.o mmap.o
6 6
7obj-$(CONFIG_CPA_DEBUG) += pageattr-test.o
8obj-$(CONFIG_NUMA) += discontig_32.o 7obj-$(CONFIG_NUMA) += discontig_32.o
9obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 8obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
10obj-$(CONFIG_HIGHMEM) += highmem_32.o 9obj-$(CONFIG_HIGHMEM) += highmem_32.o
diff --git a/arch/x86/mm/Makefile_64 b/arch/x86/mm/Makefile_64
index b564b5a760da..27a090c86e9b 100644
--- a/arch/x86/mm/Makefile_64
+++ b/arch/x86/mm/Makefile_64
@@ -7,4 +7,3 @@ obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
7obj-$(CONFIG_NUMA) += numa_64.o 7obj-$(CONFIG_NUMA) += numa_64.o
8obj-$(CONFIG_K8_NUMA) += k8topology_64.o 8obj-$(CONFIG_K8_NUMA) += k8topology_64.o
9obj-$(CONFIG_ACPI_NUMA) += srat_64.o 9obj-$(CONFIG_ACPI_NUMA) += srat_64.o
10obj-$(CONFIG_CPA_DEBUG) += pageattr-test.o
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index e5910ac37e59..e4d2b6930e61 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -210,7 +210,8 @@ repeat:
210 * Modules and drivers should use the set_memory_* APIs instead. 210 * Modules and drivers should use the set_memory_* APIs instead.
211 */ 211 */
212 212
213int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot) 213static int change_page_attr_addr(unsigned long address, int numpages,
214 pgprot_t prot)
214{ 215{
215 int err = 0, kernel_map = 0, i; 216 int err = 0, kernel_map = 0, i;
216 217
@@ -252,36 +253,6 @@ int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot)
252} 253}
253 254
254/** 255/**
255 * change_page_attr - Change page table attributes in the linear mapping.
256 * @page: First page to change
257 * @numpages: Number of pages to change
258 * @prot: New protection/caching type (PAGE_*)
259 *
260 * Returns 0 on success, otherwise a negated errno.
261 *
262 * This should be used when a page is mapped with a different caching policy
263 * than write-back somewhere - some CPUs do not like it when mappings with
264 * different caching policies exist. This changes the page attributes of the
265 * in kernel linear mapping too.
266 *
267 * Caller must call global_flush_tlb() later to make the changes active.
268 *
269 * The caller needs to ensure that there are no conflicting mappings elsewhere
270 * (e.g. in user space) * This function only deals with the kernel linear map.
271 *
272 * For MMIO areas without mem_map use change_page_attr_addr() instead.
273 *
274 * Modules and drivers should use the set_pages_* APIs instead.
275 */
276int change_page_attr(struct page *page, int numpages, pgprot_t prot)
277{
278 unsigned long addr = (unsigned long)page_address(page);
279
280 return change_page_attr_addr(addr, numpages, prot);
281}
282EXPORT_UNUSED_SYMBOL(change_page_attr); /* to be removed in 2.6.27 */
283
284/**
285 * change_page_attr_set - Change page table attributes in the linear mapping. 256 * change_page_attr_set - Change page table attributes in the linear mapping.
286 * @addr: Virtual address in linear mapping. 257 * @addr: Virtual address in linear mapping.
287 * @numpages: Number of pages to change 258 * @numpages: Number of pages to change
@@ -294,15 +265,14 @@ EXPORT_UNUSED_SYMBOL(change_page_attr); /* to be removed in 2.6.27 */
294 * different caching policies exist. This changes the page attributes of the 265 * different caching policies exist. This changes the page attributes of the
295 * in kernel linear mapping too. 266 * in kernel linear mapping too.
296 * 267 *
297 * Caller must call global_flush_tlb() later to make the changes active.
298 *
299 * The caller needs to ensure that there are no conflicting mappings elsewhere 268 * The caller needs to ensure that there are no conflicting mappings elsewhere
300 * (e.g. in user space) * This function only deals with the kernel linear map. 269 * (e.g. in user space) * This function only deals with the kernel linear map.
301 * 270 *
302 * This function is different from change_page_attr() in that only selected bits 271 * This function is different from change_page_attr() in that only selected bits
303 * are impacted, all other bits remain as is. 272 * are impacted, all other bits remain as is.
304 */ 273 */
305int change_page_attr_set(unsigned long addr, int numpages, pgprot_t prot) 274static int change_page_attr_set(unsigned long addr, int numpages,
275 pgprot_t prot)
306{ 276{
307 pgprot_t current_prot; 277 pgprot_t current_prot;
308 int level; 278 int level;
@@ -332,15 +302,14 @@ int change_page_attr_set(unsigned long addr, int numpages, pgprot_t prot)
332 * different caching policies exist. This changes the page attributes of the 302 * different caching policies exist. This changes the page attributes of the
333 * in kernel linear mapping too. 303 * in kernel linear mapping too.
334 * 304 *
335 * Caller must call global_flush_tlb() later to make the changes active.
336 *
337 * The caller needs to ensure that there are no conflicting mappings elsewhere 305 * The caller needs to ensure that there are no conflicting mappings elsewhere
338 * (e.g. in user space) * This function only deals with the kernel linear map. 306 * (e.g. in user space) * This function only deals with the kernel linear map.
339 * 307 *
340 * This function is different from change_page_attr() in that only selected bits 308 * This function is different from change_page_attr() in that only selected bits
341 * are impacted, all other bits remain as is. 309 * are impacted, all other bits remain as is.
342 */ 310 */
343int change_page_attr_clear(unsigned long addr, int numpages, pgprot_t prot) 311static int change_page_attr_clear(unsigned long addr, int numpages,
312 pgprot_t prot)
344{ 313{
345 pgprot_t current_prot; 314 pgprot_t current_prot;
346 int level; 315 int level;
@@ -549,3 +518,11 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
549 __flush_tlb_all(); 518 __flush_tlb_all();
550} 519}
551#endif 520#endif
521
522/*
523 * The testcases use internal knowledge of the implementation that shouldn't
524 * be exposed to the rest of the kernel. Include these directly here.
525 */
526#ifdef CONFIG_CPA_DEBUG
527#include "pageattr-test.c"
528#endif
diff --git a/include/asm-x86/cacheflush.h b/include/asm-x86/cacheflush.h
index a95afaf1240d..d15ff359d3e3 100644
--- a/include/asm-x86/cacheflush.h
+++ b/include/asm-x86/cacheflush.h
@@ -27,7 +27,6 @@
27void global_flush_tlb(void); 27void global_flush_tlb(void);
28int __deprecated_for_modules change_page_attr(struct page *page, int numpages, 28int __deprecated_for_modules change_page_attr(struct page *page, int numpages,
29 pgprot_t prot); 29 pgprot_t prot);
30int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot);
31 30
32int set_pages_uc(struct page *page, int numpages); 31int set_pages_uc(struct page *page, int numpages);
33int set_pages_wb(struct page *page, int numpages); 32int set_pages_wb(struct page *page, int numpages);