lkml.org 
[lkml]   [2018]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch RFC 1/5] x86/CPU: Sync CPU feature flags late
    From: Borislav Petkov <bp@suse.de>

    This is for the case where we need to set feature flags late, like, for
    example, after late microcode patch has been loaded which has enabled
    new CPUID bits.

    This has no effect on alternatives patching.

    Signed-off-by: Borislav Petkov <bp@suse.de>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: Peter Zijlstra <peterz@infradead.org>

    ---
    arch/x86/kernel/cpu/common.c | 17 +++++++++++++++++
    arch/x86/kernel/cpu/cpu.h | 3 +++
    2 files changed, 20 insertions(+)

    --- a/arch/x86/kernel/cpu/common.c
    +++ b/arch/x86/kernel/cpu/common.c
    @@ -724,6 +724,23 @@ static void apply_forced_caps(struct cpu
    }
    }

    +/*
    + * This late synchronization of CPU caps has no effect on alternatives patching
    + * but updates the visible feature bits per CPU.
    + */
    +void cpu_caps_sync_late(void)
    +{
    + int cpu;
    +
    + lockdep_assert_cpus_held();
    +
    + for_each_online_cpu(cpu) {
    + struct cpuinfo_x86 *c = &cpu_data(cpu);
    +
    + apply_forced_caps(c);
    + }
    +}
    +
    void get_cpu_cap(struct cpuinfo_x86 *c)
    {
    u32 eax, ebx, ecx, edx;
    --- a/arch/x86/kernel/cpu/cpu.h
    +++ b/arch/x86/kernel/cpu/cpu.h
    @@ -46,5 +46,8 @@ extern const struct cpu_dev *const __x86
    *const __x86_cpu_dev_end[];

    extern void get_cpu_cap(struct cpuinfo_x86 *c);
    +
    +extern void cpu_caps_sync_late(void);
    +
    extern void cpu_detect_cache_sizes(struct cpuinfo_x86 *c);
    #endif /* ARCH_X86_CPU_H */

    \
     
     \ /
      Last update: 2018-01-14 23:20    [W:2.550 / U:0.276 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site