Commit 43227e09 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull x86 pti fixes from Ingo Molnar:
 "An APM fix, and a BTS hardware-tracing fix related to PTI changes"

* 'x86-pti-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/apm: Don't access __preempt_count with zeroed fs
  x86/events/intel/ds: Fix bts_interrupt_threshold alignment
parents 48b1db7c 6f6060a5
...@@ -408,9 +408,11 @@ static int alloc_bts_buffer(int cpu) ...@@ -408,9 +408,11 @@ static int alloc_bts_buffer(int cpu)
ds->bts_buffer_base = (unsigned long) cea; ds->bts_buffer_base = (unsigned long) cea;
ds_update_cea(cea, buffer, BTS_BUFFER_SIZE, PAGE_KERNEL); ds_update_cea(cea, buffer, BTS_BUFFER_SIZE, PAGE_KERNEL);
ds->bts_index = ds->bts_buffer_base; ds->bts_index = ds->bts_buffer_base;
max = BTS_RECORD_SIZE * (BTS_BUFFER_SIZE / BTS_RECORD_SIZE); max = BTS_BUFFER_SIZE / BTS_RECORD_SIZE;
ds->bts_absolute_maximum = ds->bts_buffer_base + max; ds->bts_absolute_maximum = ds->bts_buffer_base +
ds->bts_interrupt_threshold = ds->bts_absolute_maximum - (max / 16); max * BTS_RECORD_SIZE;
ds->bts_interrupt_threshold = ds->bts_absolute_maximum -
(max / 16) * BTS_RECORD_SIZE;
return 0; return 0;
} }
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#ifndef _ASM_X86_MACH_DEFAULT_APM_H #ifndef _ASM_X86_MACH_DEFAULT_APM_H
#define _ASM_X86_MACH_DEFAULT_APM_H #define _ASM_X86_MACH_DEFAULT_APM_H
#include <asm/nospec-branch.h>
#ifdef APM_ZERO_SEGS #ifdef APM_ZERO_SEGS
# define APM_DO_ZERO_SEGS \ # define APM_DO_ZERO_SEGS \
"pushl %%ds\n\t" \ "pushl %%ds\n\t" \
...@@ -34,7 +32,6 @@ static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in, ...@@ -34,7 +32,6 @@ static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in,
* N.B. We do NOT need a cld after the BIOS call * N.B. We do NOT need a cld after the BIOS call
* because we always save and restore the flags. * because we always save and restore the flags.
*/ */
firmware_restrict_branch_speculation_start();
__asm__ __volatile__(APM_DO_ZERO_SEGS __asm__ __volatile__(APM_DO_ZERO_SEGS
"pushl %%edi\n\t" "pushl %%edi\n\t"
"pushl %%ebp\n\t" "pushl %%ebp\n\t"
...@@ -47,7 +44,6 @@ static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in, ...@@ -47,7 +44,6 @@ static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in,
"=S" (*esi) "=S" (*esi)
: "a" (func), "b" (ebx_in), "c" (ecx_in) : "a" (func), "b" (ebx_in), "c" (ecx_in)
: "memory", "cc"); : "memory", "cc");
firmware_restrict_branch_speculation_end();
} }
static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in, static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in,
...@@ -60,7 +56,6 @@ static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in, ...@@ -60,7 +56,6 @@ static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in,
* N.B. We do NOT need a cld after the BIOS call * N.B. We do NOT need a cld after the BIOS call
* because we always save and restore the flags. * because we always save and restore the flags.
*/ */
firmware_restrict_branch_speculation_start();
__asm__ __volatile__(APM_DO_ZERO_SEGS __asm__ __volatile__(APM_DO_ZERO_SEGS
"pushl %%edi\n\t" "pushl %%edi\n\t"
"pushl %%ebp\n\t" "pushl %%ebp\n\t"
...@@ -73,7 +68,6 @@ static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in, ...@@ -73,7 +68,6 @@ static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in,
"=S" (si) "=S" (si)
: "a" (func), "b" (ebx_in), "c" (ecx_in) : "a" (func), "b" (ebx_in), "c" (ecx_in)
: "memory", "cc"); : "memory", "cc");
firmware_restrict_branch_speculation_end();
return error; return error;
} }
......
...@@ -240,6 +240,7 @@ ...@@ -240,6 +240,7 @@
#include <asm/olpc.h> #include <asm/olpc.h>
#include <asm/paravirt.h> #include <asm/paravirt.h>
#include <asm/reboot.h> #include <asm/reboot.h>
#include <asm/nospec-branch.h>
#if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT) #if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
extern int (*console_blank_hook)(int); extern int (*console_blank_hook)(int);
...@@ -614,11 +615,13 @@ static long __apm_bios_call(void *_call) ...@@ -614,11 +615,13 @@ static long __apm_bios_call(void *_call)
gdt[0x40 / 8] = bad_bios_desc; gdt[0x40 / 8] = bad_bios_desc;
apm_irq_save(flags); apm_irq_save(flags);
firmware_restrict_branch_speculation_start();
APM_DO_SAVE_SEGS; APM_DO_SAVE_SEGS;
apm_bios_call_asm(call->func, call->ebx, call->ecx, apm_bios_call_asm(call->func, call->ebx, call->ecx,
&call->eax, &call->ebx, &call->ecx, &call->edx, &call->eax, &call->ebx, &call->ecx, &call->edx,
&call->esi); &call->esi);
APM_DO_RESTORE_SEGS; APM_DO_RESTORE_SEGS;
firmware_restrict_branch_speculation_end();
apm_irq_restore(flags); apm_irq_restore(flags);
gdt[0x40 / 8] = save_desc_40; gdt[0x40 / 8] = save_desc_40;
put_cpu(); put_cpu();
...@@ -690,10 +693,12 @@ static long __apm_bios_call_simple(void *_call) ...@@ -690,10 +693,12 @@ static long __apm_bios_call_simple(void *_call)
gdt[0x40 / 8] = bad_bios_desc; gdt[0x40 / 8] = bad_bios_desc;
apm_irq_save(flags); apm_irq_save(flags);
firmware_restrict_branch_speculation_start();
APM_DO_SAVE_SEGS; APM_DO_SAVE_SEGS;
error = apm_bios_call_simple_asm(call->func, call->ebx, call->ecx, error = apm_bios_call_simple_asm(call->func, call->ebx, call->ecx,
&call->eax); &call->eax);
APM_DO_RESTORE_SEGS; APM_DO_RESTORE_SEGS;
firmware_restrict_branch_speculation_end();
apm_irq_restore(flags); apm_irq_restore(flags);
gdt[0x40 / 8] = save_desc_40; gdt[0x40 / 8] = save_desc_40;
put_cpu(); put_cpu();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment