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: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
diff --git a/arch/x86/mm/pageattr_32.c b/arch/x86/mm/pageattr_32.c
index 14c923b..ad0868b 100644
--- a/arch/x86/mm/pageattr_32.c
+++ b/arch/x86/mm/pageattr_32.c
@@ -79,8 +79,10 @@
* up for us already:
*/
tmp = lookup_address(address, &level);
- if (tmp != kpte)
+ if (tmp != kpte) {
+ WARN_ON_ONCE(1);
goto out_unlock;
+ }
address = __pa(address);
addr = address & LARGE_PAGE_MASK;
@@ -181,17 +183,19 @@
int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot)
{
int i;
- unsigned long pfn = (addr >> PAGE_SHIFT);
+ unsigned long pfn = (__pa(addr) >> PAGE_SHIFT);
for (i = 0; i < numpages; i++) {
if (!pfn_valid(pfn + i)) {
+ WARN_ON_ONCE(1);
break;
} else {
int 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);
}