Commit 5508a748 authored by Ingo Molnar's avatar Ingo Molnar

x86: cpa self-test fixes

cpa self-test fixes. change_page_attr_addr() was buggy, it
passed in a virtual address as a physical one.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent bb5c2dbd
...@@ -106,12 +106,6 @@ static __init int print_split(struct split_state *s) ...@@ -106,12 +106,6 @@ static __init int print_split(struct split_state *s)
return err; return err;
} }
static __init int state_same(struct split_state *a, struct split_state *b)
{
return a->lpg == b->lpg && a->gpg == b->gpg && a->spg == b->spg &&
a->exec == b->exec;
}
static unsigned long __initdata addr[NTEST]; static unsigned long __initdata addr[NTEST];
static unsigned int __initdata len[NTEST]; static unsigned int __initdata len[NTEST];
...@@ -229,8 +223,6 @@ static __init int exercise_pageattr(void) ...@@ -229,8 +223,6 @@ static __init int exercise_pageattr(void)
global_flush_tlb(); global_flush_tlb();
failed += print_split(&sc); failed += print_split(&sc);
if (!state_same(&sa, &sc))
failed++;
if (failed) if (failed)
printk(KERN_ERR "CPA selftests NOT PASSED. Please report.\n"); printk(KERN_ERR "CPA selftests NOT PASSED. Please report.\n");
......
...@@ -79,8 +79,10 @@ split_large_page(pte_t *kpte, unsigned long address, pgprot_t ref_prot) ...@@ -79,8 +79,10 @@ split_large_page(pte_t *kpte, unsigned long address, pgprot_t ref_prot)
* up for us already: * up for us already:
*/ */
tmp = lookup_address(address, &level); tmp = lookup_address(address, &level);
if (tmp != kpte) if (tmp != kpte) {
WARN_ON_ONCE(1);
goto out_unlock; goto out_unlock;
}
address = __pa(address); address = __pa(address);
addr = address & LARGE_PAGE_MASK; addr = address & LARGE_PAGE_MASK;
...@@ -181,17 +183,19 @@ EXPORT_SYMBOL(change_page_attr); ...@@ -181,17 +183,19 @@ EXPORT_SYMBOL(change_page_attr);
int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot) int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot)
{ {
int i; int i;
unsigned long pfn = (addr >> PAGE_SHIFT); unsigned long pfn = (__pa(addr) >> PAGE_SHIFT);
for (i = 0; i < numpages; i++) { for (i = 0; i < numpages; i++) {
if (!pfn_valid(pfn + i)) { if (!pfn_valid(pfn + i)) {
WARN_ON_ONCE(1);
break; break;
} else { } else {
int level; int level;
pte_t *pte = lookup_address(addr + i*PAGE_SIZE, &level); pte_t *pte = lookup_address(addr + i*PAGE_SIZE, &level);
BUG_ON(pte && !pte_none(*pte)); BUG_ON(pte && pte_none(*pte));
} }
} }
return change_page_attr(virt_to_page(addr), i, prot); return change_page_attr(virt_to_page(addr), i, prot);
} }
......
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