diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-02-04 10:48:09 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-02-04 10:48:09 -0500 |
commit | beaff6333b4a21e8f3b7f9a7c3c8f8716b2334bc (patch) | |
tree | adf5df4b87d057c7f5eb26f71e9e9bbf1ad65f8d /arch | |
parent | 9df84993cb3d71669894654ab257f01f6e4ed48e (diff) |
x86: cpa, eliminate CPA_ enum
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/mm/pageattr.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 029fb07b3f03..fb2eedba76ad 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -27,11 +27,6 @@ struct cpa_data { | |||
27 | int flushtlb; | 27 | int flushtlb; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | enum { | ||
31 | CPA_NO_SPLIT = 0, | ||
32 | CPA_SPLIT, | ||
33 | }; | ||
34 | |||
35 | static inline int | 30 | static inline int |
36 | within(unsigned long addr, unsigned long start, unsigned long end) | 31 | within(unsigned long addr, unsigned long start, unsigned long end) |
37 | { | 32 | { |
@@ -263,7 +258,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
263 | unsigned long nextpage_addr, numpages, pmask, psize, flags; | 258 | unsigned long nextpage_addr, numpages, pmask, psize, flags; |
264 | pte_t new_pte, old_pte, *tmp; | 259 | pte_t new_pte, old_pte, *tmp; |
265 | pgprot_t old_prot, new_prot; | 260 | pgprot_t old_prot, new_prot; |
266 | int level, res = CPA_SPLIT; | 261 | int level, do_split = 1; |
267 | 262 | ||
268 | /* | 263 | /* |
269 | * An Athlon 64 X2 showed hard hangs if we tried to preserve | 264 | * An Athlon 64 X2 showed hard hangs if we tried to preserve |
@@ -274,7 +269,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
274 | * disable this code until the hang can be debugged: | 269 | * disable this code until the hang can be debugged: |
275 | */ | 270 | */ |
276 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) | 271 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) |
277 | return res; | 272 | return 1; |
278 | 273 | ||
279 | spin_lock_irqsave(&pgd_lock, flags); | 274 | spin_lock_irqsave(&pgd_lock, flags); |
280 | /* | 275 | /* |
@@ -297,7 +292,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
297 | break; | 292 | break; |
298 | #endif | 293 | #endif |
299 | default: | 294 | default: |
300 | res = -EINVAL; | 295 | do_split = -EINVAL; |
301 | goto out_unlock; | 296 | goto out_unlock; |
302 | } | 297 | } |
303 | 298 | ||
@@ -325,7 +320,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
325 | * above: | 320 | * above: |
326 | */ | 321 | */ |
327 | if (pgprot_val(new_prot) == pgprot_val(old_prot)) { | 322 | if (pgprot_val(new_prot) == pgprot_val(old_prot)) { |
328 | res = CPA_NO_SPLIT; | 323 | do_split = 0; |
329 | goto out_unlock; | 324 | goto out_unlock; |
330 | } | 325 | } |
331 | 326 | ||
@@ -345,13 +340,13 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
345 | new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot)); | 340 | new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot)); |
346 | __set_pmd_pte(kpte, address, new_pte); | 341 | __set_pmd_pte(kpte, address, new_pte); |
347 | cpa->flushtlb = 1; | 342 | cpa->flushtlb = 1; |
348 | res = CPA_NO_SPLIT; | 343 | do_split = 0; |
349 | } | 344 | } |
350 | 345 | ||
351 | out_unlock: | 346 | out_unlock: |
352 | spin_unlock_irqrestore(&pgd_lock, flags); | 347 | spin_unlock_irqrestore(&pgd_lock, flags); |
353 | 348 | ||
354 | return res; | 349 | return do_split; |
355 | } | 350 | } |
356 | 351 | ||
357 | static int split_large_page(pte_t *kpte, unsigned long address) | 352 | static int split_large_page(pte_t *kpte, unsigned long address) |
@@ -429,7 +424,7 @@ out_unlock: | |||
429 | static int __change_page_attr(unsigned long address, struct cpa_data *cpa) | 424 | static int __change_page_attr(unsigned long address, struct cpa_data *cpa) |
430 | { | 425 | { |
431 | struct page *kpte_page; | 426 | struct page *kpte_page; |
432 | int level, res; | 427 | int level, do_split; |
433 | pte_t *kpte; | 428 | pte_t *kpte; |
434 | 429 | ||
435 | repeat: | 430 | repeat: |
@@ -480,25 +475,26 @@ repeat: | |||
480 | * Check, whether we can keep the large page intact | 475 | * Check, whether we can keep the large page intact |
481 | * and just change the pte: | 476 | * and just change the pte: |
482 | */ | 477 | */ |
483 | res = try_preserve_large_page(kpte, address, cpa); | 478 | do_split = try_preserve_large_page(kpte, address, cpa); |
484 | if (res < 0) | 479 | if (do_split < 0) |
485 | return res; | 480 | return do_split; |
486 | 481 | ||
487 | /* | 482 | /* |
488 | * When the range fits into the existing large page, | 483 | * When the range fits into the existing large page, |
489 | * return. cp->numpages and cpa->tlbflush have been updated in | 484 | * return. cp->numpages and cpa->tlbflush have been updated in |
490 | * try_large_page: | 485 | * try_large_page: |
491 | */ | 486 | */ |
492 | if (res == CPA_NO_SPLIT) | 487 | if (do_split == 0) |
493 | return 0; | 488 | return 0; |
494 | 489 | ||
495 | /* | 490 | /* |
496 | * We have to split the large page: | 491 | * We have to split the large page: |
497 | */ | 492 | */ |
498 | res = split_large_page(kpte, address); | 493 | do_split = split_large_page(kpte, address); |
499 | if (res) | 494 | if (do_split) |
500 | return res; | 495 | return do_split; |
501 | cpa->flushtlb = 1; | 496 | cpa->flushtlb = 1; |
497 | |||
502 | goto repeat; | 498 | goto repeat; |
503 | } | 499 | } |
504 | 500 | ||