Commit 34eff1d7 authored by Ingo Molnar's avatar Ingo Molnar

x86: simplify __change_page_attr()

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent b65e6390
...@@ -67,8 +67,7 @@ split_large_page(unsigned long address, pgprot_t ref_prot) ...@@ -67,8 +67,7 @@ split_large_page(unsigned long address, pgprot_t ref_prot)
} }
static int static int
__change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot, __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot)
pgprot_t ref_prot)
{ {
struct page *kpte_page; struct page *kpte_page;
pte_t *kpte; pte_t *kpte;
...@@ -84,10 +83,8 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot, ...@@ -84,10 +83,8 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot,
oldprot = pte_pgprot(*kpte); oldprot = pte_pgprot(*kpte);
BUG_ON(PageLRU(kpte_page)); BUG_ON(PageLRU(kpte_page));
BUG_ON(PageCompound(kpte_page)); BUG_ON(PageCompound(kpte_page));
ref_prot = canon_pgprot(ref_prot);
prot = canon_pgprot(prot); prot = canon_pgprot(prot);
if (pgprot_val(prot) != pgprot_val(ref_prot)) {
if (level == 4) { if (level == 4) {
set_pte(kpte, pfn_pte(pfn, prot)); set_pte(kpte, pfn_pte(pfn, prot));
} else { } else {
...@@ -105,12 +102,6 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot, ...@@ -105,12 +102,6 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot,
set_pte(kpte, mk_pte(split, ref_prot2)); set_pte(kpte, mk_pte(split, ref_prot2));
goto repeat; goto repeat;
} }
} else {
if (level == 4) {
set_pte(kpte, pfn_pte(pfn, ref_prot));
} else
BUG();
}
return 0; return 0;
} }
...@@ -144,8 +135,7 @@ int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot) ...@@ -144,8 +135,7 @@ int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot)
unsigned long pfn = __pa(address) >> PAGE_SHIFT; unsigned long pfn = __pa(address) >> PAGE_SHIFT;
if (!kernel_map || pte_present(pfn_pte(0, prot))) { if (!kernel_map || pte_present(pfn_pte(0, prot))) {
err = __change_page_attr(address, pfn, prot, err = __change_page_attr(address, pfn, prot);
PAGE_KERNEL);
if (err) if (err)
break; break;
} }
...@@ -158,8 +148,7 @@ int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot) ...@@ -158,8 +148,7 @@ int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot)
addr2 = __START_KERNEL_map + __pa(address); addr2 = __START_KERNEL_map + __pa(address);
/* Make sure the kernel mappings stay executable */ /* Make sure the kernel mappings stay executable */
prot2 = pte_pgprot(pte_mkexec(pfn_pte(0, prot))); prot2 = pte_pgprot(pte_mkexec(pfn_pte(0, prot)));
err = __change_page_attr(addr2, pfn, prot2, err = __change_page_attr(addr2, pfn, prot2);
PAGE_KERNEL_EXEC);
} }
} }
up_write(&init_mm.mmap_sem); up_write(&init_mm.mmap_sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment