Skip to content

Commit 1f9c52e

Browse files
committed
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
2 parents 9cb87aa + 237d154 commit 1f9c52e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

arch/x86/include/asm/cpufeature.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,10 @@ extern bool __static_cpu_has_safe(u16 bit);
366366
*/
367367
static __always_inline __pure bool __static_cpu_has(u16 bit)
368368
{
369-
#if __GNUC__ > 4 || __GNUC_MINOR__ >= 5
369+
#ifdef CC_HAVE_ASM_GOTO
370370

371371
#ifdef CONFIG_X86_DEBUG_STATIC_CPU_HAS
372+
372373
/*
373374
* Catch too early usage of this before alternatives
374375
* have run.
@@ -384,6 +385,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
384385
".previous\n"
385386
/* skipping size check since replacement size = 0 */
386387
: : "i" (X86_FEATURE_ALWAYS) : : t_warn);
388+
387389
#endif
388390

389391
asm goto("1: jmp %l[t_no]\n"
@@ -406,7 +408,9 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
406408
warn_pre_alternatives();
407409
return false;
408410
#endif
409-
#else /* GCC_VERSION >= 40500 */
411+
412+
#else /* CC_HAVE_ASM_GOTO */
413+
410414
u8 flag;
411415
/* Open-coded due to __stringify() in ALTERNATIVE() */
412416
asm volatile("1: movb $0,%0\n"
@@ -427,7 +431,8 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
427431
".previous\n"
428432
: "=qm" (flag) : "i" (bit));
429433
return flag;
430-
#endif
434+
435+
#endif /* CC_HAVE_ASM_GOTO */
431436
}
432437

433438
#define static_cpu_has(bit) \
@@ -441,7 +446,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
441446

442447
static __always_inline __pure bool _static_cpu_has_safe(u16 bit)
443448
{
444-
#if __GNUC__ > 4 || __GNUC_MINOR__ >= 5
449+
#ifdef CC_HAVE_ASM_GOTO
445450
/*
446451
* We need to spell the jumps to the compiler because, depending on the offset,
447452
* 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)
475480
return false;
476481
t_dynamic:
477482
return __static_cpu_has_safe(bit);
478-
#else /* GCC_VERSION >= 40500 */
483+
#else
479484
u8 flag;
480485
/* Open-coded due to __stringify() in ALTERNATIVE() */
481486
asm volatile("1: movb $2,%0\n"
@@ -511,7 +516,7 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit)
511516
: "=qm" (flag)
512517
: "i" (bit), "i" (X86_FEATURE_ALWAYS));
513518
return (flag == 2 ? __static_cpu_has_safe(bit) : flag);
514-
#endif
519+
#endif /* CC_HAVE_ASM_GOTO */
515520
}
516521

517522
#define static_cpu_has_safe(bit) \

arch/x86/kernel/head_32.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ enable_paging:
409409
/*
410410
* Check if it is 486
411411
*/
412+
movb $4,X86 # at least 486
412413
cmpl $-1,X86_CPUID
413414
je is486
414415

@@ -436,7 +437,6 @@ enable_paging:
436437
movl %edx,X86_CAPABILITY
437438

438439
is486:
439-
movb $4,X86
440440
movl $0x50022,%ecx # set AM, WP, NE and MP
441441
movl %cr0,%eax
442442
andl $0x80000011,%eax # Save PG,PE,ET

0 commit comments

Comments
 (0)