aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2008-01-30 07:34:06 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:06 -0500
commit6d238cc4dc8a36a3915c26202fe49f58a0683fb9 (patch)
treef17d1b7d27ab48ba3b5f998a8a286c198b052ce2
parent75cbade8ea3127a84e3da7c2c15808e54f0df7e8 (diff)
x86: convert CPA users to the new set_page_ API
This patch converts various users of change_page_attr() to the new, more intent driven set_page_*/set_memory_* API set. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/efi.c8
-rw-r--r--arch/x86/kernel/pci-gart_64.c3
-rw-r--r--arch/x86/mm/init_32.c20
-rw-r--r--arch/x86/mm/init_64.c10
-rw-r--r--drivers/char/agp/intel-agp.c6
-rw-r--r--drivers/video/vermilion/vermilion.c9
-rw-r--r--include/asm-x86/agp.h4
-rw-r--r--sound/pci/intel8x0.c7
8 files changed, 29 insertions, 38 deletions
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index 57b57778bf60..a70fe77354b8 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -396,10 +396,10 @@ static void __init runtime_code_page_mkexec(void)
396 md = p; 396 md = p;
397 end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT); 397 end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
398 if (md->type == EFI_RUNTIME_SERVICES_CODE && 398 if (md->type == EFI_RUNTIME_SERVICES_CODE &&
399 (end >> PAGE_SHIFT) <= max_pfn_mapped) 399 (end >> PAGE_SHIFT) <= max_pfn_mapped) {
400 change_page_attr_addr(md->virt_addr, 400 set_memory_x(md->virt_addr, md->num_pages);
401 md->num_pages, 401 set_memory_uc(md->virt_addr, md->num_pages);
402 PAGE_KERNEL_EXEC_NOCACHE); 402 }
403 } 403 }
404 __flush_tlb_all(); 404 __flush_tlb_all();
405} 405}
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 04ca5c5221d7..8860c6eba8ab 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -570,8 +570,7 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
570 gatt = (void *)__get_free_pages(GFP_KERNEL, get_order(gatt_size)); 570 gatt = (void *)__get_free_pages(GFP_KERNEL, get_order(gatt_size));
571 if (!gatt) 571 if (!gatt)
572 panic("Cannot allocate GATT table"); 572 panic("Cannot allocate GATT table");
573 if (change_page_attr_addr((unsigned long)gatt, gatt_size >> PAGE_SHIFT, 573 if (set_memory_uc((unsigned long)gatt, gatt_size >> PAGE_SHIFT))
574 PAGE_KERNEL_NOCACHE))
575 panic("Could not set GART PTEs to uncacheable pages"); 574 panic("Could not set GART PTEs to uncacheable pages");
576 global_flush_tlb(); 575 global_flush_tlb();
577 576
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 016c8ccd1d8d..7c9bb3076b8a 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -770,34 +770,30 @@ void mark_rodata_ro(void)
770 if (num_possible_cpus() <= 1) 770 if (num_possible_cpus() <= 1)
771#endif 771#endif
772 { 772 {
773 change_page_attr(virt_to_page(start), 773 set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
774 size >> PAGE_SHIFT, PAGE_KERNEL_RX);
775 printk("Write protecting the kernel text: %luk\n", size >> 10); 774 printk("Write protecting the kernel text: %luk\n", size >> 10);
776 775
777#ifdef CONFIG_CPA_DEBUG 776#ifdef CONFIG_CPA_DEBUG
778 global_flush_tlb(); 777 global_flush_tlb();
779 778
780 printk("Testing CPA: Reverting %lx-%lx\n", start, start+size); 779 printk("Testing CPA: Reverting %lx-%lx\n", start, start+size);
781 change_page_attr(virt_to_page(start), size>>PAGE_SHIFT, 780 set_pages_rw(virt_to_page(start), size>>PAGE_SHIFT);
782 PAGE_KERNEL_EXEC);
783 global_flush_tlb(); 781 global_flush_tlb();
784 782
785 printk("Testing CPA: write protecting again\n"); 783 printk("Testing CPA: write protecting again\n");
786 change_page_attr(virt_to_page(start), size>>PAGE_SHIFT, 784 set_pages_ro(virt_to_page(start), size>>PAGE_SHIFT);
787 PAGE_KERNEL_RX);
788 global_flush_tlb(); 785 global_flush_tlb();
789#endif 786#endif
790 } 787 }
791#endif 788#endif
792 start += size; 789 start += size;
793 size = (unsigned long)__end_rodata - start; 790 size = (unsigned long)__end_rodata - start;
794 change_page_attr(virt_to_page(start), 791 set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
795 size >> PAGE_SHIFT, PAGE_KERNEL_RO);
796 printk("Write protecting the kernel read-only data: %luk\n", 792 printk("Write protecting the kernel read-only data: %luk\n",
797 size >> 10); 793 size >> 10);
798 794
799 /* 795 /*
800 * change_page_attr() requires a global_flush_tlb() call after it. 796 * set_pages_*() requires a global_flush_tlb() call after it.
801 * We do this after the printk so that if something went wrong in the 797 * We do this after the printk so that if something went wrong in the
802 * change, the printk gets out at least to give a better debug hint 798 * change, the printk gets out at least to give a better debug hint
803 * of who is the culprit. 799 * of who is the culprit.
@@ -806,13 +802,11 @@ void mark_rodata_ro(void)
806 802
807#ifdef CONFIG_CPA_DEBUG 803#ifdef CONFIG_CPA_DEBUG
808 printk("Testing CPA: undo %lx-%lx\n", start, start + size); 804 printk("Testing CPA: undo %lx-%lx\n", start, start + size);
809 change_page_attr(virt_to_page(start), size >> PAGE_SHIFT, 805 set_pages_rw(virt_to_page(start), size >> PAGE_SHIFT);
810 PAGE_KERNEL);
811 global_flush_tlb(); 806 global_flush_tlb();
812 807
813 printk("Testing CPA: write protecting again\n"); 808 printk("Testing CPA: write protecting again\n");
814 change_page_attr(virt_to_page(start), size >> PAGE_SHIFT, 809 set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
815 PAGE_KERNEL_RO);
816 global_flush_tlb(); 810 global_flush_tlb();
817#endif 811#endif
818} 812}
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index c250580a9432..05bb12db0b09 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -556,8 +556,6 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
556 init_page_count(virt_to_page(addr)); 556 init_page_count(virt_to_page(addr));
557 memset((void *)(addr & ~(PAGE_SIZE-1)), 557 memset((void *)(addr & ~(PAGE_SIZE-1)),
558 POISON_FREE_INITMEM, PAGE_SIZE); 558 POISON_FREE_INITMEM, PAGE_SIZE);
559 if (addr >= __START_KERNEL_map)
560 change_page_attr_addr(addr, 1, __pgprot(0));
561 free_page(addr); 559 free_page(addr);
562 totalram_pages++; 560 totalram_pages++;
563 } 561 }
@@ -594,13 +592,13 @@ void mark_rodata_ro(void)
594 if (end <= start) 592 if (end <= start)
595 return; 593 return;
596 594
597 change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL_RO); 595 set_memory_ro(start, (end - start) >> PAGE_SHIFT);
598 596
599 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", 597 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
600 (end - start) >> 10); 598 (end - start) >> 10);
601 599
602 /* 600 /*
603 * change_page_attr_addr() requires a global_flush_tlb() call after it. 601 * set_memory_*() requires a global_flush_tlb() call after it.
604 * We do this after the printk so that if something went wrong in the 602 * We do this after the printk so that if something went wrong in the
605 * change, the printk gets out at least to give a better debug hint 603 * change, the printk gets out at least to give a better debug hint
606 * of who is the culprit. 604 * of who is the culprit.
@@ -609,11 +607,11 @@ void mark_rodata_ro(void)
609 607
610#ifdef CONFIG_CPA_DEBUG 608#ifdef CONFIG_CPA_DEBUG
611 printk("Testing CPA: undo %lx-%lx\n", start, end); 609 printk("Testing CPA: undo %lx-%lx\n", start, end);
612 change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL); 610 set_memory_rw(start, (end-start) >> PAGE_SHIFT);
613 global_flush_tlb(); 611 global_flush_tlb();
614 612
615 printk("Testing CPA: again\n"); 613 printk("Testing CPA: again\n");
616 change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL_RO); 614 set_memory_ro(start, (end-start) >> PAGE_SHIFT);
617 global_flush_tlb(); 615 global_flush_tlb();
618#endif 616#endif
619} 617}
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 03eac1eb8e0f..c03a7143928f 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -210,8 +210,8 @@ static void *i8xx_alloc_pages(void)
210 if (page == NULL) 210 if (page == NULL)
211 return NULL; 211 return NULL;
212 212
213 if (change_page_attr(page, 4, PAGE_KERNEL_NOCACHE) < 0) { 213 if (set_pages_uc(page, 4) < 0) {
214 change_page_attr(page, 4, PAGE_KERNEL); 214 set_pages_wb(page, 4);
215 global_flush_tlb(); 215 global_flush_tlb();
216 __free_pages(page, 2); 216 __free_pages(page, 2);
217 return NULL; 217 return NULL;
@@ -230,7 +230,7 @@ static void i8xx_destroy_pages(void *addr)
230 return; 230 return;
231 231
232 page = virt_to_page(addr); 232 page = virt_to_page(addr);
233 change_page_attr(page, 4, PAGE_KERNEL); 233 set_pages_wb(page, 4);
234 global_flush_tlb(); 234 global_flush_tlb();
235 put_page(page); 235 put_page(page);
236 __free_pages(page, 2); 236 __free_pages(page, 2);
diff --git a/drivers/video/vermilion/vermilion.c b/drivers/video/vermilion/vermilion.c
index c31f549ebea0..fb72778dee48 100644
--- a/drivers/video/vermilion/vermilion.c
+++ b/drivers/video/vermilion/vermilion.c
@@ -88,9 +88,7 @@ static int vmlfb_alloc_vram_area(struct vram_area *va, unsigned max_order,
88{ 88{
89 gfp_t flags; 89 gfp_t flags;
90 unsigned long i; 90 unsigned long i;
91 pgprot_t wc_pageprot;
92 91
93 wc_pageprot = PAGE_KERNEL_NOCACHE;
94 max_order++; 92 max_order++;
95 do { 93 do {
96 /* 94 /*
@@ -131,8 +129,7 @@ static int vmlfb_alloc_vram_area(struct vram_area *va, unsigned max_order,
131 */ 129 */
132 130
133 global_flush_tlb(); 131 global_flush_tlb();
134 change_page_attr(virt_to_page(va->logical), va->size >> PAGE_SHIFT, 132 set_pages_uc(virt_to_page(va->logical), va->size >> PAGE_SHIFT);
135 wc_pageprot);
136 global_flush_tlb(); 133 global_flush_tlb();
137 134
138 printk(KERN_DEBUG MODULE_NAME 135 printk(KERN_DEBUG MODULE_NAME
@@ -157,8 +154,8 @@ static void vmlfb_free_vram_area(struct vram_area *va)
157 * Reset the linear kernel map caching policy. 154 * Reset the linear kernel map caching policy.
158 */ 155 */
159 156
160 change_page_attr(virt_to_page(va->logical), 157 set_pages_wb(virt_to_page(va->logical),
161 va->size >> PAGE_SHIFT, PAGE_KERNEL); 158 va->size >> PAGE_SHIFT);
162 global_flush_tlb(); 159 global_flush_tlb();
163 160
164 /* 161 /*
diff --git a/include/asm-x86/agp.h b/include/asm-x86/agp.h
index 62df2a9e7130..f6df72561832 100644
--- a/include/asm-x86/agp.h
+++ b/include/asm-x86/agp.h
@@ -16,8 +16,8 @@
16 * Caller's responsibility to call global_flush_tlb() for performance 16 * Caller's responsibility to call global_flush_tlb() for performance
17 * reasons 17 * reasons
18 */ 18 */
19#define map_page_into_agp(page) change_page_attr(page, 1, PAGE_KERNEL_NOCACHE) 19#define map_page_into_agp(page) set_pages_uc(page, 1)
20#define unmap_page_from_agp(page) change_page_attr(page, 1, PAGE_KERNEL) 20#define unmap_page_from_agp(page) set_pages_wb(page, 1)
21#define flush_agp_mappings() global_flush_tlb() 21#define flush_agp_mappings() global_flush_tlb()
22 22
23/* 23/*
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index b4a38a3d855b..e5650905296e 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -711,11 +711,14 @@ static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ich
711static void fill_nocache(void *buf, int size, int nocache) 711static void fill_nocache(void *buf, int size, int nocache)
712{ 712{
713 size = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 713 size = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
714 change_page_attr(virt_to_page(buf), size, nocache ? PAGE_KERNEL_NOCACHE : PAGE_KERNEL); 714 if (nocache)
715 set_pages_uc(virt_to_page(buf), size);
716 else
717 set_pages_wb(virt_to_page(buf), size);
715 global_flush_tlb(); 718 global_flush_tlb();
716} 719}
717#else 720#else
718#define fill_nocache(buf,size,nocache) 721#define fill_nocache(buf, size, nocache) do { ; } while (0)
719#endif 722#endif
720 723
721/* 724/*