lkml.org 
[lkml]   [2010]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: Dynamic nop selection breaks boot on Geode LX
    From: Borislav Petkov <bp@alien8.de>
    Date: Sun, Oct 03, 2010 at 07:50:13AM +0200

    > Maybe on a Geode jmp label should use the 2-byte jmp + 3 1-byte nops
    > unconditionally after adding a synthetic CPUID flag in init_amd_k6(), in
    > the Geode part.

    Maybe something like the following? (only tested in kvm)

    --
    diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
    index 220e2ea..e2ef56c 100644
    --- a/arch/x86/include/asm/cpufeature.h
    +++ b/arch/x86/include/asm/cpufeature.h
    @@ -89,7 +89,7 @@
    #define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* "" Lfence synchronizes RDTSC */
    #define X86_FEATURE_11AP (3*32+19) /* "" Bad local APIC aka 11AP */
    #define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */
    - /* 21 available, was AMD_C1E */
    +#define X86_FEATURE_NO_NOPL (3*32+21) /* "" Missing NOPL (e.g. Geode LX) */
    #define X86_FEATURE_XTOPOLOGY (3*32+22) /* cpu topology enum extensions */
    #define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */
    #define X86_FEATURE_NONSTOP_TSC (3*32+24) /* TSC does not stop in C states */
    diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
    index cb0e6d3..3e1fa13 100644
    --- a/arch/x86/kernel/alternative.c
    +++ b/arch/x86/kernel/alternative.c
    @@ -666,6 +666,9 @@ void __init arch_init_ideal_nop5(void)
    *
    * TODO: check the cpuid to determine the best nop.
    */
    + if (boot_cpu_has(X86_FEATURE_NO_NOPL))
    + goto early_done;
    +
    asm volatile (
    "ftrace_test_jmp:"
    "jmp ftrace_test_p6nop\n"
    @@ -688,6 +691,7 @@ void __init arch_init_ideal_nop5(void)
    _ASM_EXTABLE(ftrace_test_nop5, 3b)
    : "=r"(faulted) : "0" (faulted));

    +early_done:
    switch (faulted) {
    case 0:
    pr_info("converting mcount calls to 0f 1f 44 00 00\n");
    diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
    index 7b875fd..d1e5cf4 100644
    --- a/arch/x86/kernel/cpu/amd.c
    +++ b/arch/x86/kernel/cpu/amd.c
    @@ -139,7 +139,7 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)

    if (c->x86_model == 10) {
    /* AMD Geode LX is model 10 */
    - /* placeholder for any needed mods */
    + set_cpu_cap(c, X86_FEATURE_NO_NOPL);
    return;
    }
    }
    --
    Regards/Gruss,
    Boris.


    \
     
     \ /
      Last update: 2010-10-03 22:25    [W:0.023 / U:93.528 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site