summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2008-01-30 13:34:06 +0100
committerIngo Molnar <mingo@elte.hu>2008-01-30 13:34:06 +0100
commit6d238cc4dc8a36a3915c26202fe49f58a0683fb9 (patch)
treef17d1b7d27ab48ba3b5f998a8a286c198b052ce2 /arch
parent75cbade8ea3127a84e3da7c2c15808e54f0df7e8 (diff)
downloadlinux-6d238cc4dc8a36a3915c26202fe49f58a0683fb9.tar.gz
linux-6d238cc4dc8a36a3915c26202fe49f58a0683fb9.tar.bz2
linux-6d238cc4dc8a36a3915c26202fe49f58a0683fb9.zip
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>
Diffstat (limited to 'arch')
-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)
md = p;
end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
if (md->type == EFI_RUNTIME_SERVICES_CODE &&
- (end >> PAGE_SHIFT) <= max_pfn_mapped)
- change_page_attr_addr(md->virt_addr,
- md->num_pages,
- PAGE_KERNEL_EXEC_NOCACHE);
+ (end >> PAGE_SHIFT) <= max_pfn_mapped) {
+ set_memory_x(md->virt_addr, md->num_pages);
+ set_memory_uc(md->virt_addr, md->num_pages);
+ }
}
__flush_tlb_all();
}
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)
gatt = (void *)__get_free_pages(GFP_KERNEL, get_order(gatt_size));
if (!gatt)
panic("Cannot allocate GATT table");
- if (change_page_attr_addr((unsigned long)gatt, gatt_size >> PAGE_SHIFT,
- PAGE_KERNEL_NOCACHE))
+ if (set_memory_uc((unsigned long)gatt, gatt_size >> PAGE_SHIFT))
panic("Could not set GART PTEs to uncacheable pages");
global_flush_tlb();
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)
if (num_possible_cpus() <= 1)
#endif
{
- change_page_attr(virt_to_page(start),
- size >> PAGE_SHIFT, PAGE_KERNEL_RX);
+ set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
printk("Write protecting the kernel text: %luk\n", size >> 10);
#ifdef CONFIG_CPA_DEBUG
global_flush_tlb();
printk("Testing CPA: Reverting %lx-%lx\n", start, start+size);
- change_page_attr(virt_to_page(start), size>>PAGE_SHIFT,
- PAGE_KERNEL_EXEC);
+ set_pages_rw(virt_to_page(start), size>>PAGE_SHIFT);
global_flush_tlb();
printk("Testing CPA: write protecting again\n");
- change_page_attr(virt_to_page(start), size>>PAGE_SHIFT,
- PAGE_KERNEL_RX);
+ set_pages_ro(virt_to_page(start), size>>PAGE_SHIFT);
global_flush_tlb();
#endif
}
#endif
start += size;
size = (unsigned long)__end_rodata - start;
- change_page_attr(virt_to_page(start),
- size >> PAGE_SHIFT, PAGE_KERNEL_RO);
+ set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
printk("Write protecting the kernel read-only data: %luk\n",
size >> 10);
/*
- * change_page_attr() requires a global_flush_tlb() call after it.
+ * set_pages_*() requires a global_flush_tlb() call after it.
* We do this after the printk so that if something went wrong in the
* change, the printk gets out at least to give a better debug hint
* of who is the culprit.
@@ -806,13 +802,11 @@ void mark_rodata_ro(void)
#ifdef CONFIG_CPA_DEBUG
printk("Testing CPA: undo %lx-%lx\n", start, start + size);
- change_page_attr(virt_to_page(start), size >> PAGE_SHIFT,
- PAGE_KERNEL);
+ set_pages_rw(virt_to_page(start), size >> PAGE_SHIFT);
global_flush_tlb();
printk("Testing CPA: write protecting again\n");
- change_page_attr(virt_to_page(start), size >> PAGE_SHIFT,
- PAGE_KERNEL_RO);
+ set_pages_ro(virt_to_page(start), size >> PAGE_SHIFT);
global_flush_tlb();
#endif
}
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)
init_page_count(virt_to_page(addr));
memset((void *)(addr & ~(PAGE_SIZE-1)),
POISON_FREE_INITMEM, PAGE_SIZE);
- if (addr >= __START_KERNEL_map)
- change_page_attr_addr(addr, 1, __pgprot(0));
free_page(addr);
totalram_pages++;
}
@@ -594,13 +592,13 @@ void mark_rodata_ro(void)
if (end <= start)
return;
- change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL_RO);
+ set_memory_ro(start, (end - start) >> PAGE_SHIFT);
printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
(end - start) >> 10);
/*
- * change_page_attr_addr() requires a global_flush_tlb() call after it.
+ * set_memory_*() requires a global_flush_tlb() call after it.
* We do this after the printk so that if something went wrong in the
* change, the printk gets out at least to give a better debug hint
* of who is the culprit.
@@ -609,11 +607,11 @@ void mark_rodata_ro(void)
#ifdef CONFIG_CPA_DEBUG
printk("Testing CPA: undo %lx-%lx\n", start, end);
- change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL);
+ set_memory_rw(start, (end-start) >> PAGE_SHIFT);
global_flush_tlb();
printk("Testing CPA: again\n");
- change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL_RO);
+ set_memory_ro(start, (end-start) >> PAGE_SHIFT);
global_flush_tlb();
#endif
}