diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-04 12:11:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-04 12:11:16 -0400 |
commit | 1f9c52e16b5f67131440ddd51bd0cff27e45ea10 (patch) | |
tree | d15f176fb64b37af81b2390a6bf835f1f5999725 /arch | |
parent | 9cb87aaf404110822200ca1e508471f8f083d1de (diff) | |
parent | 237d1548543312fcc8c99d302ab68fbf8ef6f97f (diff) |
Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cpu feature fixes from Ingo Molnar:
"Two small cpufeature support updates"
* 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86: Fix override new_cpu_data.x86 with 486
x86, cpufeature: Use new CC_HAVE_ASM_GOTO
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/cpufeature.h | 17 | ||||
-rw-r--r-- | arch/x86/kernel/head_32.S | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 47538a61c91b..d3f5c63078d8 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -366,9 +366,10 @@ extern bool __static_cpu_has_safe(u16 bit); | |||
366 | */ | 366 | */ |
367 | static __always_inline __pure bool __static_cpu_has(u16 bit) | 367 | static __always_inline __pure bool __static_cpu_has(u16 bit) |
368 | { | 368 | { |
369 | #if __GNUC__ > 4 || __GNUC_MINOR__ >= 5 | 369 | #ifdef CC_HAVE_ASM_GOTO |
370 | 370 | ||
371 | #ifdef CONFIG_X86_DEBUG_STATIC_CPU_HAS | 371 | #ifdef CONFIG_X86_DEBUG_STATIC_CPU_HAS |
372 | |||
372 | /* | 373 | /* |
373 | * Catch too early usage of this before alternatives | 374 | * Catch too early usage of this before alternatives |
374 | * have run. | 375 | * have run. |
@@ -384,6 +385,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit) | |||
384 | ".previous\n" | 385 | ".previous\n" |
385 | /* skipping size check since replacement size = 0 */ | 386 | /* skipping size check since replacement size = 0 */ |
386 | : : "i" (X86_FEATURE_ALWAYS) : : t_warn); | 387 | : : "i" (X86_FEATURE_ALWAYS) : : t_warn); |
388 | |||
387 | #endif | 389 | #endif |
388 | 390 | ||
389 | asm goto("1: jmp %l[t_no]\n" | 391 | asm goto("1: jmp %l[t_no]\n" |
@@ -406,7 +408,9 @@ static __always_inline __pure bool __static_cpu_has(u16 bit) | |||
406 | warn_pre_alternatives(); | 408 | warn_pre_alternatives(); |
407 | return false; | 409 | return false; |
408 | #endif | 410 | #endif |
409 | #else /* GCC_VERSION >= 40500 */ | 411 | |
412 | #else /* CC_HAVE_ASM_GOTO */ | ||
413 | |||
410 | u8 flag; | 414 | u8 flag; |
411 | /* Open-coded due to __stringify() in ALTERNATIVE() */ | 415 | /* Open-coded due to __stringify() in ALTERNATIVE() */ |
412 | asm volatile("1: movb $0,%0\n" | 416 | asm volatile("1: movb $0,%0\n" |
@@ -427,7 +431,8 @@ static __always_inline __pure bool __static_cpu_has(u16 bit) | |||
427 | ".previous\n" | 431 | ".previous\n" |
428 | : "=qm" (flag) : "i" (bit)); | 432 | : "=qm" (flag) : "i" (bit)); |
429 | return flag; | 433 | return flag; |
430 | #endif | 434 | |
435 | #endif /* CC_HAVE_ASM_GOTO */ | ||
431 | } | 436 | } |
432 | 437 | ||
433 | #define static_cpu_has(bit) \ | 438 | #define static_cpu_has(bit) \ |
@@ -441,7 +446,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit) | |||
441 | 446 | ||
442 | static __always_inline __pure bool _static_cpu_has_safe(u16 bit) | 447 | static __always_inline __pure bool _static_cpu_has_safe(u16 bit) |
443 | { | 448 | { |
444 | #if __GNUC__ > 4 || __GNUC_MINOR__ >= 5 | 449 | #ifdef CC_HAVE_ASM_GOTO |
445 | /* | 450 | /* |
446 | * We need to spell the jumps to the compiler because, depending on the offset, | 451 | * We need to spell the jumps to the compiler because, depending on the offset, |
447 | * the replacement jump can be bigger than the original jump, and this we cannot | 452 | * the replacement jump can be bigger than the original jump, and this we cannot |
@@ -475,7 +480,7 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit) | |||
475 | return false; | 480 | return false; |
476 | t_dynamic: | 481 | t_dynamic: |
477 | return __static_cpu_has_safe(bit); | 482 | return __static_cpu_has_safe(bit); |
478 | #else /* GCC_VERSION >= 40500 */ | 483 | #else |
479 | u8 flag; | 484 | u8 flag; |
480 | /* Open-coded due to __stringify() in ALTERNATIVE() */ | 485 | /* Open-coded due to __stringify() in ALTERNATIVE() */ |
481 | asm volatile("1: movb $2,%0\n" | 486 | asm volatile("1: movb $2,%0\n" |
@@ -511,7 +516,7 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit) | |||
511 | : "=qm" (flag) | 516 | : "=qm" (flag) |
512 | : "i" (bit), "i" (X86_FEATURE_ALWAYS)); | 517 | : "i" (bit), "i" (X86_FEATURE_ALWAYS)); |
513 | return (flag == 2 ? __static_cpu_has_safe(bit) : flag); | 518 | return (flag == 2 ? __static_cpu_has_safe(bit) : flag); |
514 | #endif | 519 | #endif /* CC_HAVE_ASM_GOTO */ |
515 | } | 520 | } |
516 | 521 | ||
517 | #define static_cpu_has_safe(bit) \ | 522 | #define static_cpu_has_safe(bit) \ |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index 5dd87a89f011..81ba27679f18 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -409,6 +409,7 @@ enable_paging: | |||
409 | /* | 409 | /* |
410 | * Check if it is 486 | 410 | * Check if it is 486 |
411 | */ | 411 | */ |
412 | movb $4,X86 # at least 486 | ||
412 | cmpl $-1,X86_CPUID | 413 | cmpl $-1,X86_CPUID |
413 | je is486 | 414 | je is486 |
414 | 415 | ||
@@ -436,7 +437,6 @@ enable_paging: | |||
436 | movl %edx,X86_CAPABILITY | 437 | movl %edx,X86_CAPABILITY |
437 | 438 | ||
438 | is486: | 439 | is486: |
439 | movb $4,X86 | ||
440 | movl $0x50022,%ecx # set AM, WP, NE and MP | 440 | movl $0x50022,%ecx # set AM, WP, NE and MP |
441 | movl %cr0,%eax | 441 | movl %cr0,%eax |
442 | andl $0x80000011,%eax # Save PG,PE,ET | 442 | andl $0x80000011,%eax # Save PG,PE,ET |