Skip to content

Commit 2654ad4

Browse files
committed
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 arch fixes from Peter Anvin: "Here is a collection of fixes for 3.7-rc7. This is a superset of tglx' earlier pull request." * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86-64: Fix ordering of CFI directives and recent ASM_CLAC additions x86, microcode, AMD: Add support for family 16h processors x86-32: Export kernel_stack_pointer() for modules x86-32: Fix invalid stack address while in softirq x86, efi: Fix processor-specific memcpy() build error x86: remove dummy long from EFI stub x86, mm: Correct vmflag test for checking VM_HUGETLB x86, amd: Disable way access filter on Piledriver CPUs x86/mce: Do not change worker's running cpu in cmci_rediscover(). x86/ce4100: Fix PCI configuration register access for devices without interrupts x86/ce4100: Fix reboot by forcing the reboot method to be KBD x86/ce4100: Fix pm_poweroff MAINTAINERS: Update email address for Robert Richter x86, microcode_amd: Change email addresses, MAINTAINERS entry MAINTAINERS: Change Boris' email address EDAC: Change Boris' email address x86, AMD: Change Boris' email address
2 parents 35f95d2 + ee4eb87 commit 2654ad4

File tree

16 files changed

+131
-49
lines changed

16 files changed

+131
-49
lines changed

MAINTAINERS

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,9 @@ F: drivers/iommu/amd_iommu*.[ch]
534534
F: include/linux/amd-iommu.h
535535

536536
AMD MICROCODE UPDATE SUPPORT
537-
M: Andreas Herrmann <andreas.herrmann3@amd.com>
537+
M: Andreas Herrmann <herrmann.der.user@googlemail.com>
538538
L: amd64-microcode@amd64.org
539-
S: Supported
539+
S: Maintained
540540
F: arch/x86/kernel/microcode_amd.c
541541

542542
AMS (Apple Motion Sensor) DRIVER
@@ -2716,10 +2716,10 @@ F: include/linux/edac.h
27162716

27172717
EDAC-AMD64
27182718
M: Doug Thompson <dougthompson@xmission.com>
2719-
M: Borislav Petkov <borislav.petkov@amd.com>
2719+
M: Borislav Petkov <bp@alien8.de>
27202720
L: linux-edac@vger.kernel.org
27212721
W: bluesmoke.sourceforge.net
2722-
S: Supported
2722+
S: Maintained
27232723
F: drivers/edac/amd64_edac*
27242724

27252725
EDAC-E752X
@@ -3761,7 +3761,7 @@ S: Maintained
37613761
F: drivers/platform/x86/ideapad-laptop.c
37623762

37633763
IDE/ATAPI DRIVERS
3764-
M: Borislav Petkov <petkovbb@gmail.com>
3764+
M: Borislav Petkov <bp@alien8.de>
37653765
L: linux-ide@vger.kernel.org
37663766
S: Maintained
37673767
F: Documentation/cdrom/ide-cd
@@ -5421,7 +5421,7 @@ S: Maintained
54215421
F: sound/drivers/opl4/
54225422

54235423
OPROFILE
5424-
M: Robert Richter <robert.richter@amd.com>
5424+
M: Robert Richter <rric@kernel.org>
54255425
L: oprofile-list@lists.sf.net
54265426
S: Maintained
54275427
F: arch/*/include/asm/oprofile*.h
@@ -8206,7 +8206,7 @@ F: drivers/platform/x86
82068206

82078207
X86 MCE INFRASTRUCTURE
82088208
M: Tony Luck <tony.luck@intel.com>
8209-
M: Borislav Petkov <bp@amd64.org>
8209+
M: Borislav Petkov <bp@alien8.de>
82108210
L: linux-edac@vger.kernel.org
82118211
S: Maintained
82128212
F: arch/x86/kernel/cpu/mcheck/*

arch/x86/boot/compressed/eboot.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <asm/setup.h>
1313
#include <asm/desc.h>
1414

15+
#undef memcpy /* Use memcpy from misc.c */
16+
1517
#include "eboot.h"
1618

1719
static efi_system_table_t *sys_table;

arch/x86/boot/header.S

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,3 @@ die:
476476
setup_corrupt:
477477
.byte 7
478478
.string "No setup signature found...\n"
479-
480-
.data
481-
dummy: .long 0

arch/x86/include/asm/ptrace.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,21 +205,14 @@ static inline bool user_64bit_mode(struct pt_regs *regs)
205205
}
206206
#endif
207207

208-
/*
209-
* X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode
210-
* when it traps. The previous stack will be directly underneath the saved
211-
* registers, and 'sp/ss' won't even have been saved. Thus the '&regs->sp'.
212-
*
213-
* This is valid only for kernel mode traps.
214-
*/
215-
static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
216-
{
217208
#ifdef CONFIG_X86_32
218-
return (unsigned long)(&regs->sp);
209+
extern unsigned long kernel_stack_pointer(struct pt_regs *regs);
219210
#else
211+
static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
212+
{
220213
return regs->sp;
221-
#endif
222214
}
215+
#endif
223216

224217
#define GET_IP(regs) ((regs)->ip)
225218
#define GET_FP(regs) ((regs)->bp)

arch/x86/kernel/cpu/amd.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,20 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
631631
}
632632
}
633633

634+
/*
635+
* The way access filter has a performance penalty on some workloads.
636+
* Disable it on the affected CPUs.
637+
*/
638+
if ((c->x86 == 0x15) &&
639+
(c->x86_model >= 0x02) && (c->x86_model < 0x20)) {
640+
u64 val;
641+
642+
if (!rdmsrl_safe(0xc0011021, &val) && !(val & 0x1E)) {
643+
val |= 0x1E;
644+
wrmsrl_safe(0xc0011021, val);
645+
}
646+
}
647+
634648
cpu_detect_cache_sizes(c);
635649

636650
/* Multi core CPU? */

arch/x86/kernel/cpu/mcheck/mce_amd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Written by Jacob Shin - AMD, Inc.
88
*
9-
* Support: borislav.petkov@amd.com
9+
* Maintained by: Borislav Petkov <bp@alien8.de>
1010
*
1111
* April 2006
1212
* - added support for AMD Family 0x10 processors

arch/x86/kernel/cpu/mcheck/mce_intel.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -285,34 +285,39 @@ void cmci_clear(void)
285285
raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
286286
}
287287

288+
static long cmci_rediscover_work_func(void *arg)
289+
{
290+
int banks;
291+
292+
/* Recheck banks in case CPUs don't all have the same */
293+
if (cmci_supported(&banks))
294+
cmci_discover(banks);
295+
296+
return 0;
297+
}
298+
288299
/*
289300
* After a CPU went down cycle through all the others and rediscover
290301
* Must run in process context.
291302
*/
292303
void cmci_rediscover(int dying)
293304
{
294-
int banks;
295-
int cpu;
296-
cpumask_var_t old;
305+
int cpu, banks;
297306

298307
if (!cmci_supported(&banks))
299308
return;
300-
if (!alloc_cpumask_var(&old, GFP_KERNEL))
301-
return;
302-
cpumask_copy(old, &current->cpus_allowed);
303309

304310
for_each_online_cpu(cpu) {
305311
if (cpu == dying)
306312
continue;
307-
if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))
313+
314+
if (cpu == smp_processor_id()) {
315+
cmci_rediscover_work_func(NULL);
308316
continue;
309-
/* Recheck banks in case CPUs don't all have the same */
310-
if (cmci_supported(&banks))
311-
cmci_discover(banks);
312-
}
317+
}
313318

314-
set_cpus_allowed_ptr(current, old);
315-
free_cpumask_var(old);
319+
work_on_cpu(cpu, cmci_rediscover_work_func, NULL);
320+
}
316321
}
317322

318323
/*

arch/x86/kernel/entry_64.S

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -995,8 +995,8 @@ END(interrupt)
995995
*/
996996
.p2align CONFIG_X86_L1_CACHE_SHIFT
997997
common_interrupt:
998-
ASM_CLAC
999998
XCPT_FRAME
999+
ASM_CLAC
10001000
addq $-0x80,(%rsp) /* Adjust vector to [-256,-1] range */
10011001
interrupt do_IRQ
10021002
/* 0(%rsp): old_rsp-ARGOFFSET */
@@ -1135,8 +1135,8 @@ END(common_interrupt)
11351135
*/
11361136
.macro apicinterrupt num sym do_sym
11371137
ENTRY(\sym)
1138-
ASM_CLAC
11391138
INTR_FRAME
1139+
ASM_CLAC
11401140
pushq_cfi $~(\num)
11411141
.Lcommon_\sym:
11421142
interrupt \do_sym
@@ -1190,8 +1190,8 @@ apicinterrupt IRQ_WORK_VECTOR \
11901190
*/
11911191
.macro zeroentry sym do_sym
11921192
ENTRY(\sym)
1193-
ASM_CLAC
11941193
INTR_FRAME
1194+
ASM_CLAC
11951195
PARAVIRT_ADJUST_EXCEPTION_FRAME
11961196
pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
11971197
subq $ORIG_RAX-R15, %rsp
@@ -1208,8 +1208,8 @@ END(\sym)
12081208

12091209
.macro paranoidzeroentry sym do_sym
12101210
ENTRY(\sym)
1211-
ASM_CLAC
12121211
INTR_FRAME
1212+
ASM_CLAC
12131213
PARAVIRT_ADJUST_EXCEPTION_FRAME
12141214
pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
12151215
subq $ORIG_RAX-R15, %rsp
@@ -1227,8 +1227,8 @@ END(\sym)
12271227
#define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8)
12281228
.macro paranoidzeroentry_ist sym do_sym ist
12291229
ENTRY(\sym)
1230-
ASM_CLAC
12311230
INTR_FRAME
1231+
ASM_CLAC
12321232
PARAVIRT_ADJUST_EXCEPTION_FRAME
12331233
pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */
12341234
subq $ORIG_RAX-R15, %rsp
@@ -1247,8 +1247,8 @@ END(\sym)
12471247

12481248
.macro errorentry sym do_sym
12491249
ENTRY(\sym)
1250-
ASM_CLAC
12511250
XCPT_FRAME
1251+
ASM_CLAC
12521252
PARAVIRT_ADJUST_EXCEPTION_FRAME
12531253
subq $ORIG_RAX-R15, %rsp
12541254
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
@@ -1266,8 +1266,8 @@ END(\sym)
12661266
/* error code is on the stack already */
12671267
.macro paranoiderrorentry sym do_sym
12681268
ENTRY(\sym)
1269-
ASM_CLAC
12701269
XCPT_FRAME
1270+
ASM_CLAC
12711271
PARAVIRT_ADJUST_EXCEPTION_FRAME
12721272
subq $ORIG_RAX-R15, %rsp
12731273
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15

arch/x86/kernel/microcode_amd.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
99
*
1010
* Maintainers:
11-
* Andreas Herrmann <andreas.herrmann3@amd.com>
12-
* Borislav Petkov <borislav.petkov@amd.com>
11+
* Andreas Herrmann <herrmann.der.user@googlemail.com>
12+
* Borislav Petkov <bp@alien8.de>
1313
*
1414
* This driver allows to upgrade microcode on F10h AMD
1515
* CPUs and later.
@@ -190,6 +190,7 @@ static unsigned int verify_patch_size(int cpu, u32 patch_size,
190190
#define F1XH_MPB_MAX_SIZE 2048
191191
#define F14H_MPB_MAX_SIZE 1824
192192
#define F15H_MPB_MAX_SIZE 4096
193+
#define F16H_MPB_MAX_SIZE 3458
193194

194195
switch (c->x86) {
195196
case 0x14:
@@ -198,6 +199,9 @@ static unsigned int verify_patch_size(int cpu, u32 patch_size,
198199
case 0x15:
199200
max_size = F15H_MPB_MAX_SIZE;
200201
break;
202+
case 0x16:
203+
max_size = F16H_MPB_MAX_SIZE;
204+
break;
201205
default:
202206
max_size = F1XH_MPB_MAX_SIZE;
203207
break;

arch/x86/kernel/ptrace.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/perf_event.h>
2323
#include <linux/hw_breakpoint.h>
2424
#include <linux/rcupdate.h>
25+
#include <linux/module.h>
2526

2627
#include <asm/uaccess.h>
2728
#include <asm/pgtable.h>
@@ -166,6 +167,35 @@ static inline bool invalid_selector(u16 value)
166167

167168
#define FLAG_MASK FLAG_MASK_32
168169

170+
/*
171+
* X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode
172+
* when it traps. The previous stack will be directly underneath the saved
173+
* registers, and 'sp/ss' won't even have been saved. Thus the '&regs->sp'.
174+
*
175+
* Now, if the stack is empty, '&regs->sp' is out of range. In this
176+
* case we try to take the previous stack. To always return a non-null
177+
* stack pointer we fall back to regs as stack if no previous stack
178+
* exists.
179+
*
180+
* This is valid only for kernel mode traps.
181+
*/
182+
unsigned long kernel_stack_pointer(struct pt_regs *regs)
183+
{
184+
unsigned long context = (unsigned long)regs & ~(THREAD_SIZE - 1);
185+
unsigned long sp = (unsigned long)&regs->sp;
186+
struct thread_info *tinfo;
187+
188+
if (context == (sp & ~(THREAD_SIZE - 1)))
189+
return sp;
190+
191+
tinfo = (struct thread_info *)context;
192+
if (tinfo->previous_esp)
193+
return tinfo->previous_esp;
194+
195+
return (unsigned long)regs;
196+
}
197+
EXPORT_SYMBOL_GPL(kernel_stack_pointer);
198+
169199
static unsigned long *pt_regs_access(struct pt_regs *regs, unsigned long regno)
170200
{
171201
BUILD_BUG_ON(offsetof(struct pt_regs, bx) != 0);

arch/x86/mm/tlb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
197197
}
198198

199199
if (end == TLB_FLUSH_ALL || tlb_flushall_shift == -1
200-
|| vmflag == VM_HUGETLB) {
200+
|| vmflag & VM_HUGETLB) {
201201
local_flush_tlb();
202202
goto flush_all;
203203
}

arch/x86/pci/ce4100.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ static void sata_revid_read(struct sim_dev_reg *reg, u32 *value)
115115
reg_read(reg, value);
116116
}
117117

118+
static void reg_noirq_read(struct sim_dev_reg *reg, u32 *value)
119+
{
120+
unsigned long flags;
121+
122+
raw_spin_lock_irqsave(&pci_config_lock, flags);
123+
/* force interrupt pin value to 0 */
124+
*value = reg->sim_reg.value & 0xfff00ff;
125+
raw_spin_unlock_irqrestore(&pci_config_lock, flags);
126+
}
127+
118128
static struct sim_dev_reg bus1_fixups[] = {
119129
DEFINE_REG(2, 0, 0x10, (16*MB), reg_init, reg_read, reg_write)
120130
DEFINE_REG(2, 0, 0x14, (256), reg_init, reg_read, reg_write)
@@ -144,6 +154,7 @@ static struct sim_dev_reg bus1_fixups[] = {
144154
DEFINE_REG(11, 5, 0x10, (64*KB), reg_init, reg_read, reg_write)
145155
DEFINE_REG(11, 6, 0x10, (256), reg_init, reg_read, reg_write)
146156
DEFINE_REG(11, 7, 0x10, (64*KB), reg_init, reg_read, reg_write)
157+
DEFINE_REG(11, 7, 0x3c, 256, reg_init, reg_noirq_read, reg_write)
147158
DEFINE_REG(12, 0, 0x10, (128*KB), reg_init, reg_read, reg_write)
148159
DEFINE_REG(12, 0, 0x14, (256), reg_init, reg_read, reg_write)
149160
DEFINE_REG(12, 1, 0x10, (1024), reg_init, reg_read, reg_write)
@@ -161,8 +172,10 @@ static struct sim_dev_reg bus1_fixups[] = {
161172
DEFINE_REG(16, 0, 0x10, (64*KB), reg_init, reg_read, reg_write)
162173
DEFINE_REG(16, 0, 0x14, (64*MB), reg_init, reg_read, reg_write)
163174
DEFINE_REG(16, 0, 0x18, (64*MB), reg_init, reg_read, reg_write)
175+
DEFINE_REG(16, 0, 0x3c, 256, reg_init, reg_noirq_read, reg_write)
164176
DEFINE_REG(17, 0, 0x10, (128*KB), reg_init, reg_read, reg_write)
165177
DEFINE_REG(18, 0, 0x10, (1*KB), reg_init, reg_read, reg_write)
178+
DEFINE_REG(18, 0, 0x3c, 256, reg_init, reg_noirq_read, reg_write)
166179
};
167180

168181
static void __init init_sim_regs(void)

0 commit comments

Comments
 (0)