aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-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
4 files changed, 16 insertions, 25 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}