Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86: Fix included-by file reference comments
x86, cpu: Only CPU features determine NX capabilities
x86, cpu: Call verify_cpu during 32bit CPU startup
x86, cpu: Clear XD_DISABLED flag on Intel to regain NX
x86, cpu: Rename verify_cpu_64.S to verify_cpu.S

+50 -11
+1 -1
arch/x86/boot/compressed/head_64.S
··· 182 182 hlt 183 183 jmp 1b 184 184 185 - #include "../../kernel/verify_cpu_64.S" 185 + #include "../../kernel/verify_cpu.S" 186 186 187 187 /* 188 188 * Be careful here startup_64 needs to be at a predictable
+6
arch/x86/kernel/head_32.S
··· 316 316 subl $0x80000001, %eax 317 317 cmpl $(0x8000ffff-0x80000001), %eax 318 318 ja 6f 319 + 320 + /* Clear bogus XD_DISABLE bits */ 321 + call verify_cpu 322 + 319 323 mov $0x80000001, %eax 320 324 cpuid 321 325 /* Execute Disable bit supported? */ ··· 614 610 popl %eax 615 611 #endif 616 612 iret 613 + 614 + #include "verify_cpu.S" 617 615 618 616 __REFDATA 619 617 .align 4
+1 -1
arch/x86/kernel/trampoline_64.S
··· 127 127 no_longmode: 128 128 hlt 129 129 jmp no_longmode 130 - #include "verify_cpu_64.S" 130 + #include "verify_cpu.S" 131 131 132 132 # Careful these need to be in the same 64K segment as the above; 133 133 tidt:
+41 -8
arch/x86/kernel/verify_cpu_64.S arch/x86/kernel/verify_cpu.S
··· 7 7 * Copyright (c) 2007 Andi Kleen (ak@suse.de) 8 8 * Copyright (c) 2007 Eric Biederman (ebiederm@xmission.com) 9 9 * Copyright (c) 2007 Vivek Goyal (vgoyal@in.ibm.com) 10 + * Copyright (c) 2010 Kees Cook (kees.cook@canonical.com) 10 11 * 11 12 * This source code is licensed under the GNU General Public License, 12 13 * Version 2. See the file COPYING for more details. ··· 15 14 * This is a common code for verification whether CPU supports 16 15 * long mode and SSE or not. It is not called directly instead this 17 16 * file is included at various places and compiled in that context. 18 - * Following are the current usage. 17 + * This file is expected to run in 32bit code. Currently: 19 18 * 20 - * This file is included by both 16bit and 32bit code. 19 + * arch/x86/boot/compressed/head_64.S: Boot cpu verification 20 + * arch/x86/kernel/trampoline_64.S: secondary processor verfication 21 + * arch/x86/kernel/head_32.S: processor startup 21 22 * 22 - * arch/x86_64/boot/setup.S : Boot cpu verification (16bit) 23 - * arch/x86_64/boot/compressed/head.S: Boot cpu verification (32bit) 24 - * arch/x86_64/kernel/trampoline.S: secondary processor verfication (16bit) 25 - * arch/x86_64/kernel/acpi/wakeup.S:Verfication at resume (16bit) 26 - * 27 - * verify_cpu, returns the status of cpu check in register %eax. 23 + * verify_cpu, returns the status of longmode and SSE in register %eax. 28 24 * 0: Success 1: Failure 25 + * 26 + * On Intel, the XD_DISABLE flag will be cleared as a side-effect. 29 27 * 30 28 * The caller needs to check for the error code and take the action 31 29 * appropriately. Either display a message or halt. ··· 62 62 cmpl $0x444d4163,%ecx 63 63 jnz verify_cpu_noamd 64 64 mov $1,%di # cpu is from AMD 65 + jmp verify_cpu_check 65 66 66 67 verify_cpu_noamd: 68 + cmpl $0x756e6547,%ebx # GenuineIntel? 69 + jnz verify_cpu_check 70 + cmpl $0x49656e69,%edx 71 + jnz verify_cpu_check 72 + cmpl $0x6c65746e,%ecx 73 + jnz verify_cpu_check 74 + 75 + # only call IA32_MISC_ENABLE when: 76 + # family > 6 || (family == 6 && model >= 0xd) 77 + movl $0x1, %eax # check CPU family and model 78 + cpuid 79 + movl %eax, %ecx 80 + 81 + andl $0x0ff00f00, %eax # mask family and extended family 82 + shrl $8, %eax 83 + cmpl $6, %eax 84 + ja verify_cpu_clear_xd # family > 6, ok 85 + jb verify_cpu_check # family < 6, skip 86 + 87 + andl $0x000f00f0, %ecx # mask model and extended model 88 + shrl $4, %ecx 89 + cmpl $0xd, %ecx 90 + jb verify_cpu_check # family == 6, model < 0xd, skip 91 + 92 + verify_cpu_clear_xd: 93 + movl $MSR_IA32_MISC_ENABLE, %ecx 94 + rdmsr 95 + btrl $2, %edx # clear MSR_IA32_MISC_ENABLE_XD_DISABLE 96 + jnc verify_cpu_check # only write MSR if bit was changed 97 + wrmsr 98 + 99 + verify_cpu_check: 67 100 movl $0x1,%eax # Does the cpu have what it takes 68 101 cpuid 69 102 andl $REQUIRED_MASK0,%edx
+1 -1
arch/x86/mm/setup_nx.c
··· 41 41 { 42 42 if (!cpu_has_nx) { 43 43 printk(KERN_NOTICE "Notice: NX (Execute Disable) protection " 44 - "missing in CPU or disabled in BIOS!\n"); 44 + "missing in CPU!\n"); 45 45 } else { 46 46 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) 47 47 if (disable_nx) {