aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/pageattr.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-30 07:34:07 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:07 -0500
commitf62d0f008e889915c93631c04d4c7d871f05bea7 (patch)
tree36eb08ed99de278c77ef58df06b282736ff19b08 /arch/x86/mm/pageattr.c
parentd806e5ee20f62a892b09aa59559f143d465285db (diff)
x86: cpa: set_memory_notpresent()
Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm/pageattr.c')
-rw-r--r--arch/x86/mm/pageattr.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index fcd96125c5ae..e5910ac37e59 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -357,8 +357,6 @@ int change_page_attr_clear(unsigned long addr, int numpages, pgprot_t prot)
357 return change_page_attr_addr(addr, numpages, prot); 357 return change_page_attr_addr(addr, numpages, prot);
358} 358}
359 359
360
361
362int set_memory_uc(unsigned long addr, int numpages) 360int set_memory_uc(unsigned long addr, int numpages)
363{ 361{
364 pgprot_t uncached; 362 pgprot_t uncached;
@@ -402,7 +400,6 @@ int set_memory_ro(unsigned long addr, int numpages)
402 pgprot_val(rw) = _PAGE_RW; 400 pgprot_val(rw) = _PAGE_RW;
403 return change_page_attr_clear(addr, numpages, rw); 401 return change_page_attr_clear(addr, numpages, rw);
404} 402}
405EXPORT_SYMBOL(set_memory_ro);
406 403
407int set_memory_rw(unsigned long addr, int numpages) 404int set_memory_rw(unsigned long addr, int numpages)
408{ 405{
@@ -411,7 +408,14 @@ int set_memory_rw(unsigned long addr, int numpages)
411 pgprot_val(rw) = _PAGE_RW; 408 pgprot_val(rw) = _PAGE_RW;
412 return change_page_attr_set(addr, numpages, rw); 409 return change_page_attr_set(addr, numpages, rw);
413} 410}
414EXPORT_SYMBOL(set_memory_rw); 411
412int set_memory_np(unsigned long addr, int numpages)
413{
414 pgprot_t present;
415
416 pgprot_val(present) = _PAGE_PRESENT;
417 return change_page_attr_clear(addr, numpages, present);
418}
415 419
416int set_pages_uc(struct page *page, int numpages) 420int set_pages_uc(struct page *page, int numpages)
417{ 421{
@@ -461,7 +465,6 @@ int set_pages_ro(struct page *page, int numpages)
461 pgprot_val(rw) = _PAGE_RW; 465 pgprot_val(rw) = _PAGE_RW;
462 return change_page_attr_clear(addr, numpages, rw); 466 return change_page_attr_clear(addr, numpages, rw);
463} 467}
464EXPORT_SYMBOL(set_pages_ro);
465 468
466int set_pages_rw(struct page *page, int numpages) 469int set_pages_rw(struct page *page, int numpages)
467{ 470{
@@ -471,8 +474,6 @@ int set_pages_rw(struct page *page, int numpages)
471 pgprot_val(rw) = _PAGE_RW; 474 pgprot_val(rw) = _PAGE_RW;
472 return change_page_attr_set(addr, numpages, rw); 475 return change_page_attr_set(addr, numpages, rw);
473} 476}
474EXPORT_SYMBOL(set_pages_rw);
475
476 477
477void clflush_cache_range(void *addr, int size) 478void clflush_cache_range(void *addr, int size)
478{ 479{
@@ -503,6 +504,20 @@ void global_flush_tlb(void)
503EXPORT_SYMBOL(global_flush_tlb); 504EXPORT_SYMBOL(global_flush_tlb);
504 505
505#ifdef CONFIG_DEBUG_PAGEALLOC 506#ifdef CONFIG_DEBUG_PAGEALLOC
507
508static int __set_pages_p(struct page *page, int numpages)
509{
510 unsigned long addr = (unsigned long)page_address(page);
511 return change_page_attr_set(addr, numpages,
512 __pgprot(_PAGE_PRESENT | _PAGE_RW));
513}
514
515static int __set_pages_np(struct page *page, int numpages)
516{
517 unsigned long addr = (unsigned long)page_address(page);
518 return change_page_attr_clear(addr, numpages, __pgprot(_PAGE_PRESENT));
519}
520
506void kernel_map_pages(struct page *page, int numpages, int enable) 521void kernel_map_pages(struct page *page, int numpages, int enable)
507{ 522{
508 if (PageHighMem(page)) 523 if (PageHighMem(page))
@@ -522,7 +537,10 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
522 * The return value is ignored - the calls cannot fail, 537 * The return value is ignored - the calls cannot fail,
523 * large pages are disabled at boot time: 538 * large pages are disabled at boot time:
524 */ 539 */
525 change_page_attr(page, numpages, enable ? PAGE_KERNEL : __pgprot(0)); 540 if (enable)
541 __set_pages_p(page, numpages);
542 else
543 __set_pages_np(page, numpages);
526 544
527 /* 545 /*
528 * We should perform an IPI and flush all tlbs, 546 * We should perform an IPI and flush all tlbs,