aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-30 07:33:56 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:56 -0500
commit5508a7489659f1eed108d3ae7c2d36c8794ee330 (patch)
tree518702b4f68c75c83bb2976e275cb53c5138488a
parentbb5c2dbd57d93a36b0386dd783dd95e0cbaaa23f (diff)
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>
-rw-r--r--arch/x86/mm/pageattr-test.c8
-rw-r--r--arch/x86/mm/pageattr_32.c10
2 files changed, 7 insertions, 11 deletions
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index 91e05a26004d..a12dabbd5c33 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -106,12 +106,6 @@ static __init int print_split(struct split_state *s)
106 return err; 106 return err;
107} 107}
108 108
109static __init int state_same(struct split_state *a, struct split_state *b)
110{
111 return a->lpg == b->lpg && a->gpg == b->gpg && a->spg == b->spg &&
112 a->exec == b->exec;
113}
114
115static unsigned long __initdata addr[NTEST]; 109static unsigned long __initdata addr[NTEST];
116static unsigned int __initdata len[NTEST]; 110static unsigned int __initdata len[NTEST];
117 111
@@ -229,8 +223,6 @@ static __init int exercise_pageattr(void)
229 global_flush_tlb(); 223 global_flush_tlb();
230 224
231 failed += print_split(&sc); 225 failed += print_split(&sc);
232 if (!state_same(&sa, &sc))
233 failed++;
234 226
235 if (failed) 227 if (failed)
236 printk(KERN_ERR "CPA selftests NOT PASSED. Please report.\n"); 228 printk(KERN_ERR "CPA selftests NOT PASSED. Please report.\n");
diff --git a/arch/x86/mm/pageattr_32.c b/arch/x86/mm/pageattr_32.c
index 14c923b3b07f..ad0868bfa374 100644
--- a/arch/x86/mm/pageattr_32.c
+++ b/arch/x86/mm/pageattr_32.c
@@ -79,8 +79,10 @@ split_large_page(pte_t *kpte, unsigned long address, pgprot_t ref_prot)
79 * up for us already: 79 * up for us already:
80 */ 80 */
81 tmp = lookup_address(address, &level); 81 tmp = lookup_address(address, &level);
82 if (tmp != kpte) 82 if (tmp != kpte) {
83 WARN_ON_ONCE(1);
83 goto out_unlock; 84 goto out_unlock;
85 }
84 86
85 address = __pa(address); 87 address = __pa(address);
86 addr = address & LARGE_PAGE_MASK; 88 addr = address & LARGE_PAGE_MASK;
@@ -181,17 +183,19 @@ EXPORT_SYMBOL(change_page_attr);
181int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot) 183int change_page_attr_addr(unsigned long addr, int numpages, pgprot_t prot)
182{ 184{
183 int i; 185 int i;
184 unsigned long pfn = (addr >> PAGE_SHIFT); 186 unsigned long pfn = (__pa(addr) >> PAGE_SHIFT);
185 187
186 for (i = 0; i < numpages; i++) { 188 for (i = 0; i < numpages; i++) {
187 if (!pfn_valid(pfn + i)) { 189 if (!pfn_valid(pfn + i)) {
190 WARN_ON_ONCE(1);
188 break; 191 break;
189 } else { 192 } else {
190 int level; 193 int level;
191 pte_t *pte = lookup_address(addr + i*PAGE_SIZE, &level); 194 pte_t *pte = lookup_address(addr + i*PAGE_SIZE, &level);
192 BUG_ON(pte && !pte_none(*pte)); 195 BUG_ON(pte && pte_none(*pte));
193 } 196 }
194 } 197 }
198
195 return change_page_attr(virt_to_page(addr), i, prot); 199 return change_page_attr(virt_to_page(addr), i, prot);
196} 200}
197 201