Skip to content

Commit 53c6de5

Browse files
committed
Merge branch 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 and EFI fixes from Peter Anvin: "Half of these are EFI-related: The by far biggest change is the change to hold off the deletion of a sysfs entry while a backend scan is in progress. This is to avoid calling kmemdup() while under a spinlock. The other major change is for each entry in the EFI pstore backend to get a unique identifier, as required by the pstore filesystem proper. The other changes are: A fix to the recent consolidation and optimization of using "asm goto" with read-modify-write operation, which broke the bitops; specifically in such a way that we could end up generating invalid code. A build hack to make sure we compile with -mno-sse. icc, and most likely future versions of gcc, can generate SSE instructions unless we tell it not to. A comment-only patch to a change the was due in part to an unpublished erratum; now when the erratum is published we want to add a comment explaining why" * 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/apic, doc: Justification for disabling IO APIC before Local APIC x86, bitops: Correct the assembly constraints to testing bitops x86-64, build: Always pass in -mno-sse efi-pstore: Make efi-pstore return a unique id x86/efi: Fix earlyprintk off-by-one bug efivars, efi-pstore: Hold off deletion of sysfs entry until the scan is completed
2 parents 8ecffd7 + 2885432 commit 53c6de5

12 files changed

Lines changed: 201 additions & 37 deletions

File tree

arch/x86/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ ifeq ($(CONFIG_X86_32),y)
3131

3232
KBUILD_CFLAGS += -msoft-float -mregparm=3 -freg-struct-return
3333

34+
# Don't autogenerate SSE instructions
35+
KBUILD_CFLAGS += -mno-sse
36+
3437
# Never want PIC in a 32-bit kernel, prevent breakage with GCC built
3538
# with nonstandard options
3639
KBUILD_CFLAGS += -fno-pic
@@ -57,8 +60,11 @@ else
5760
KBUILD_AFLAGS += -m64
5861
KBUILD_CFLAGS += -m64
5962

63+
# Don't autogenerate SSE instructions
64+
KBUILD_CFLAGS += -mno-sse
65+
6066
# Use -mpreferred-stack-boundary=3 if supported.
61-
KBUILD_CFLAGS += $(call cc-option,-mno-sse -mpreferred-stack-boundary=3)
67+
KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3)
6268

6369
# FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu)
6470
cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)

arch/x86/include/asm/atomic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static inline void atomic_sub(int i, atomic_t *v)
7777
*/
7878
static inline int atomic_sub_and_test(int i, atomic_t *v)
7979
{
80-
GEN_BINARY_RMWcc(LOCK_PREFIX "subl", v->counter, i, "%0", "e");
80+
GEN_BINARY_RMWcc(LOCK_PREFIX "subl", v->counter, "er", i, "%0", "e");
8181
}
8282

8383
/**
@@ -141,7 +141,7 @@ static inline int atomic_inc_and_test(atomic_t *v)
141141
*/
142142
static inline int atomic_add_negative(int i, atomic_t *v)
143143
{
144-
GEN_BINARY_RMWcc(LOCK_PREFIX "addl", v->counter, i, "%0", "s");
144+
GEN_BINARY_RMWcc(LOCK_PREFIX "addl", v->counter, "er", i, "%0", "s");
145145
}
146146

147147
/**

arch/x86/include/asm/atomic64_64.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static inline void atomic64_sub(long i, atomic64_t *v)
7272
*/
7373
static inline int atomic64_sub_and_test(long i, atomic64_t *v)
7474
{
75-
GEN_BINARY_RMWcc(LOCK_PREFIX "subq", v->counter, i, "%0", "e");
75+
GEN_BINARY_RMWcc(LOCK_PREFIX "subq", v->counter, "er", i, "%0", "e");
7676
}
7777

7878
/**
@@ -138,7 +138,7 @@ static inline int atomic64_inc_and_test(atomic64_t *v)
138138
*/
139139
static inline int atomic64_add_negative(long i, atomic64_t *v)
140140
{
141-
GEN_BINARY_RMWcc(LOCK_PREFIX "addq", v->counter, i, "%0", "s");
141+
GEN_BINARY_RMWcc(LOCK_PREFIX "addq", v->counter, "er", i, "%0", "s");
142142
}
143143

144144
/**

arch/x86/include/asm/bitops.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static inline void change_bit(long nr, volatile unsigned long *addr)
205205
*/
206206
static inline int test_and_set_bit(long nr, volatile unsigned long *addr)
207207
{
208-
GEN_BINARY_RMWcc(LOCK_PREFIX "bts", *addr, nr, "%0", "c");
208+
GEN_BINARY_RMWcc(LOCK_PREFIX "bts", *addr, "Ir", nr, "%0", "c");
209209
}
210210

211211
/**
@@ -251,7 +251,7 @@ static inline int __test_and_set_bit(long nr, volatile unsigned long *addr)
251251
*/
252252
static inline int test_and_clear_bit(long nr, volatile unsigned long *addr)
253253
{
254-
GEN_BINARY_RMWcc(LOCK_PREFIX "btr", *addr, nr, "%0", "c");
254+
GEN_BINARY_RMWcc(LOCK_PREFIX "btr", *addr, "Ir", nr, "%0", "c");
255255
}
256256

257257
/**
@@ -304,7 +304,7 @@ static inline int __test_and_change_bit(long nr, volatile unsigned long *addr)
304304
*/
305305
static inline int test_and_change_bit(long nr, volatile unsigned long *addr)
306306
{
307-
GEN_BINARY_RMWcc(LOCK_PREFIX "btc", *addr, nr, "%0", "c");
307+
GEN_BINARY_RMWcc(LOCK_PREFIX "btc", *addr, "Ir", nr, "%0", "c");
308308
}
309309

310310
static __always_inline int constant_test_bit(long nr, const volatile unsigned long *addr)

arch/x86/include/asm/local.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static inline void local_sub(long i, local_t *l)
5252
*/
5353
static inline int local_sub_and_test(long i, local_t *l)
5454
{
55-
GEN_BINARY_RMWcc(_ASM_SUB, l->a.counter, i, "%0", "e");
55+
GEN_BINARY_RMWcc(_ASM_SUB, l->a.counter, "er", i, "%0", "e");
5656
}
5757

5858
/**
@@ -92,7 +92,7 @@ static inline int local_inc_and_test(local_t *l)
9292
*/
9393
static inline int local_add_negative(long i, local_t *l)
9494
{
95-
GEN_BINARY_RMWcc(_ASM_ADD, l->a.counter, i, "%0", "s");
95+
GEN_BINARY_RMWcc(_ASM_ADD, l->a.counter, "er", i, "%0", "s");
9696
}
9797

9898
/**

arch/x86/include/asm/rmwcc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ cc_label: \
1616
#define GEN_UNARY_RMWcc(op, var, arg0, cc) \
1717
__GEN_RMWcc(op " " arg0, var, cc)
1818

19-
#define GEN_BINARY_RMWcc(op, var, val, arg0, cc) \
20-
__GEN_RMWcc(op " %1, " arg0, var, cc, "er" (val))
19+
#define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
20+
__GEN_RMWcc(op " %1, " arg0, var, cc, vcon (val))
2121

2222
#else /* !CC_HAVE_ASM_GOTO */
2323

@@ -33,8 +33,8 @@ do { \
3333
#define GEN_UNARY_RMWcc(op, var, arg0, cc) \
3434
__GEN_RMWcc(op " " arg0, var, cc)
3535

36-
#define GEN_BINARY_RMWcc(op, var, val, arg0, cc) \
37-
__GEN_RMWcc(op " %2, " arg0, var, cc, "er" (val))
36+
#define GEN_BINARY_RMWcc(op, var, vcon, val, arg0, cc) \
37+
__GEN_RMWcc(op " %2, " arg0, var, cc, vcon (val))
3838

3939
#endif /* CC_HAVE_ASM_GOTO */
4040

arch/x86/kernel/reboot.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,17 @@ void native_machine_shutdown(void)
558558
{
559559
/* Stop the cpus and apics */
560560
#ifdef CONFIG_X86_IO_APIC
561+
/*
562+
* Disabling IO APIC before local APIC is a workaround for
563+
* erratum AVR31 in "Intel Atom Processor C2000 Product Family
564+
* Specification Update". In this situation, interrupts that target
565+
* a Logical Processor whose Local APIC is either in the process of
566+
* being hardware disabled or software disabled are neither delivered
567+
* nor discarded. When this erratum occurs, the processor may hang.
568+
*
569+
* Even without the erratum, it still makes sense to quiet IO APIC
570+
* before disabling Local APIC.
571+
*/
561572
disable_IO_APIC();
562573
#endif
563574

arch/x86/platform/efi/early_printk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ early_efi_write(struct console *con, const char *str, unsigned int num)
142142
efi_y += font->height;
143143
}
144144

145-
if (efi_y + font->height >= si->lfb_height) {
145+
if (efi_y + font->height > si->lfb_height) {
146146
u32 i;
147147

148148
efi_y -= font->height;

0 commit comments

Comments
 (0)