diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2012-11-28 14:50:28 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2012-11-29 16:23:03 -0500 |
commit | a5c2a893dbd4956a72fb261e8790d19f67b52c99 (patch) | |
tree | 08ec40c9885f90b67fcf9a272ba675ff815d23ff | |
parent | 094ab1db7cb7833cd4c820acd868fc26acf3f08e (diff) |
x86, 386 removal: Remove CONFIG_X86_WP_WORKS_OK
All 486+ CPUs support WP in supervisor mode, so remove the fallback
386 support code.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Link: http://lkml.kernel.org/r/1354132230-21854-7-git-send-email-hpa@linux.intel.com
-rw-r--r-- | arch/x86/Kconfig.cpu | 3 | ||||
-rw-r--r-- | arch/x86/include/asm/uaccess.h | 42 | ||||
-rw-r--r-- | arch/x86/lib/usercopy_32.c | 57 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 5 |
4 files changed, 1 insertions, 106 deletions
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index d3bdc18af1f0..159ee9c824c9 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
@@ -325,9 +325,6 @@ config X86_INVD_BUG | |||
325 | def_bool y | 325 | def_bool y |
326 | depends on M486 | 326 | depends on M486 |
327 | 327 | ||
328 | config X86_WP_WORKS_OK | ||
329 | def_bool y | ||
330 | |||
331 | config X86_POPAD_OK | 328 | config X86_POPAD_OK |
332 | def_bool y | 329 | def_bool y |
333 | depends on X86_32 | 330 | depends on X86_32 |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 7ccf8d131535..1709801d18ec 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -237,8 +237,6 @@ extern void __put_user_2(void); | |||
237 | extern void __put_user_4(void); | 237 | extern void __put_user_4(void); |
238 | extern void __put_user_8(void); | 238 | extern void __put_user_8(void); |
239 | 239 | ||
240 | #ifdef CONFIG_X86_WP_WORKS_OK | ||
241 | |||
242 | /** | 240 | /** |
243 | * put_user: - Write a simple value into user space. | 241 | * put_user: - Write a simple value into user space. |
244 | * @x: Value to copy to user space. | 242 | * @x: Value to copy to user space. |
@@ -326,29 +324,6 @@ do { \ | |||
326 | } \ | 324 | } \ |
327 | } while (0) | 325 | } while (0) |
328 | 326 | ||
329 | #else | ||
330 | |||
331 | #define __put_user_size(x, ptr, size, retval, errret) \ | ||
332 | do { \ | ||
333 | __typeof__(*(ptr))__pus_tmp = x; \ | ||
334 | retval = 0; \ | ||
335 | \ | ||
336 | if (unlikely(__copy_to_user_ll(ptr, &__pus_tmp, size) != 0)) \ | ||
337 | retval = errret; \ | ||
338 | } while (0) | ||
339 | |||
340 | #define put_user(x, ptr) \ | ||
341 | ({ \ | ||
342 | int __ret_pu; \ | ||
343 | __typeof__(*(ptr))__pus_tmp = x; \ | ||
344 | __ret_pu = 0; \ | ||
345 | if (unlikely(__copy_to_user_ll(ptr, &__pus_tmp, \ | ||
346 | sizeof(*(ptr))) != 0)) \ | ||
347 | __ret_pu = -EFAULT; \ | ||
348 | __ret_pu; \ | ||
349 | }) | ||
350 | #endif | ||
351 | |||
352 | #ifdef CONFIG_X86_32 | 327 | #ifdef CONFIG_X86_32 |
353 | #define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad() | 328 | #define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad() |
354 | #define __get_user_asm_ex_u64(x, ptr) (x) = __get_user_bad() | 329 | #define __get_user_asm_ex_u64(x, ptr) (x) = __get_user_bad() |
@@ -543,29 +518,12 @@ struct __large_struct { unsigned long buf[100]; }; | |||
543 | (x) = (__force __typeof__(*(ptr)))__gue_val; \ | 518 | (x) = (__force __typeof__(*(ptr)))__gue_val; \ |
544 | } while (0) | 519 | } while (0) |
545 | 520 | ||
546 | #ifdef CONFIG_X86_WP_WORKS_OK | ||
547 | |||
548 | #define put_user_try uaccess_try | 521 | #define put_user_try uaccess_try |
549 | #define put_user_catch(err) uaccess_catch(err) | 522 | #define put_user_catch(err) uaccess_catch(err) |
550 | 523 | ||
551 | #define put_user_ex(x, ptr) \ | 524 | #define put_user_ex(x, ptr) \ |
552 | __put_user_size_ex((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) | 525 | __put_user_size_ex((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) |
553 | 526 | ||
554 | #else /* !CONFIG_X86_WP_WORKS_OK */ | ||
555 | |||
556 | #define put_user_try do { \ | ||
557 | int __uaccess_err = 0; | ||
558 | |||
559 | #define put_user_catch(err) \ | ||
560 | (err) |= __uaccess_err; \ | ||
561 | } while (0) | ||
562 | |||
563 | #define put_user_ex(x, ptr) do { \ | ||
564 | __uaccess_err |= __put_user(x, ptr); \ | ||
565 | } while (0) | ||
566 | |||
567 | #endif /* CONFIG_X86_WP_WORKS_OK */ | ||
568 | |||
569 | extern unsigned long | 527 | extern unsigned long |
570 | copy_from_user_nmi(void *to, const void __user *from, unsigned long n); | 528 | copy_from_user_nmi(void *to, const void __user *from, unsigned long n); |
571 | extern __must_check long | 529 | extern __must_check long |
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c index 98f6d6b68f5a..f0312d746402 100644 --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c | |||
@@ -570,63 +570,6 @@ do { \ | |||
570 | unsigned long __copy_to_user_ll(void __user *to, const void *from, | 570 | unsigned long __copy_to_user_ll(void __user *to, const void *from, |
571 | unsigned long n) | 571 | unsigned long n) |
572 | { | 572 | { |
573 | #ifndef CONFIG_X86_WP_WORKS_OK | ||
574 | if (unlikely(boot_cpu_data.wp_works_ok == 0) && | ||
575 | ((unsigned long)to) < TASK_SIZE) { | ||
576 | /* | ||
577 | * When we are in an atomic section (see | ||
578 | * mm/filemap.c:file_read_actor), return the full | ||
579 | * length to take the slow path. | ||
580 | */ | ||
581 | if (in_atomic()) | ||
582 | return n; | ||
583 | |||
584 | /* | ||
585 | * CPU does not honor the WP bit when writing | ||
586 | * from supervisory mode, and due to preemption or SMP, | ||
587 | * the page tables can change at any time. | ||
588 | * Do it manually. Manfred <manfred@colorfullife.com> | ||
589 | */ | ||
590 | while (n) { | ||
591 | unsigned long offset = ((unsigned long)to)%PAGE_SIZE; | ||
592 | unsigned long len = PAGE_SIZE - offset; | ||
593 | int retval; | ||
594 | struct page *pg; | ||
595 | void *maddr; | ||
596 | |||
597 | if (len > n) | ||
598 | len = n; | ||
599 | |||
600 | survive: | ||
601 | down_read(¤t->mm->mmap_sem); | ||
602 | retval = get_user_pages(current, current->mm, | ||
603 | (unsigned long)to, 1, 1, 0, &pg, NULL); | ||
604 | |||
605 | if (retval == -ENOMEM && is_global_init(current)) { | ||
606 | up_read(¤t->mm->mmap_sem); | ||
607 | congestion_wait(BLK_RW_ASYNC, HZ/50); | ||
608 | goto survive; | ||
609 | } | ||
610 | |||
611 | if (retval != 1) { | ||
612 | up_read(¤t->mm->mmap_sem); | ||
613 | break; | ||
614 | } | ||
615 | |||
616 | maddr = kmap_atomic(pg); | ||
617 | memcpy(maddr + offset, from, len); | ||
618 | kunmap_atomic(maddr); | ||
619 | set_page_dirty_lock(pg); | ||
620 | put_page(pg); | ||
621 | up_read(¤t->mm->mmap_sem); | ||
622 | |||
623 | from += len; | ||
624 | to += len; | ||
625 | n -= len; | ||
626 | } | ||
627 | return n; | ||
628 | } | ||
629 | #endif | ||
630 | stac(); | 573 | stac(); |
631 | if (movsl_is_ok(to, from, n)) | 574 | if (movsl_is_ok(to, from, n)) |
632 | __copy_user(to, from, n); | 575 | __copy_user(to, from, n); |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 11a58001b4ce..745d66b843c8 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -715,10 +715,7 @@ static void __init test_wp_bit(void) | |||
715 | 715 | ||
716 | if (!boot_cpu_data.wp_works_ok) { | 716 | if (!boot_cpu_data.wp_works_ok) { |
717 | printk(KERN_CONT "No.\n"); | 717 | printk(KERN_CONT "No.\n"); |
718 | #ifdef CONFIG_X86_WP_WORKS_OK | 718 | panic("Linux doesn't support CPUs with broken WP."); |
719 | panic( | ||
720 | "This kernel doesn't support CPU's with broken WP. Recompile it for a 386!"); | ||
721 | #endif | ||
722 | } else { | 719 | } else { |
723 | printk(KERN_CONT "Ok.\n"); | 720 | printk(KERN_CONT "Ok.\n"); |
724 | } | 721 | } |