4.14.9-stable review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 1/159 x86/asm: Remove unnecessary \n\t in front of CC_SET() from asm templates
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uros Bizjak <[email protected]>
commit 3c52b5c64326d9dcfee4e10611c53ec1b1b20675 upstream.
There is no need for \n\t in front of CC_SET(), as the macro already includes these two.
--- arch/x86/include/asm/archrandom.h | 8 ++++---- arch/x86/include/asm/bitops.h | 10 +++++----- arch/x86/include/asm/percpu.h | 2 +- arch/x86/include/asm/rmwcc.h | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-)
arch/x86/include/asm/archrandom.h +4 -4
@@ -45,7 +45,7 @@ static inline bool rdrand_long(unsignedbool ok;unsigned int retry =RDRAND_RETRY_LOOPS ; do { - asm volatile(RDRAND_LONG "\n\t" + asm volatile(RDRAND_LONG CC_SET(c) : CC_OUT(c) (ok), "=a" (*v)); if (ok)
@@ -59,7 +59,7 @@ static inline bool rdrand_int(unsigned ibool ok;unsigned int retry =RDRAND_RETRY_LOOPS ; do { - asm volatile(RDRAND_INT "\n\t" + asm volatile(RDRAND_INT CC_SET(c) : CC_OUT(c) (ok), "=a" (*v)); if (ok)
@@ -71,7 +71,7 @@ static inline bool rdrand_int(unsigned istatic inline bool rdseed_long (unsigned long *v) {bool ok; - asm volatile(RDSEED_LONG "\n\t" + asmvolatile (RDSEED_LONG CC_SET(c) : CC_OUT(c) (ok), "=a" (*v));return ok;
@@ -80,7 +80,7 @@ static inline bool rdseed_long(unsignedstatic inline bool rdseed_int (unsigned int *v) {bool ok; - asm volatile(RDSEED_INT "\n\t" + asmvolatile (RDSEED_INT CC_SET(c) : CC_OUT(c) (ok), "=a" (*v));return ok;
arch/x86/include/asm/bitops.h +5 -5
@@ -143,7 +143,7 @@ static __always_inline void __clear_bit( static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr) {bool negative; - asm volatile(LOCK_PREFIX "andb %2,%1\n\t" + asm volatile(LOCK_PREFIX "andb %2,%1" CC_SET(s) : CC_OUT(s) (negative), ADDR : "ir" ((char) ~(1 << nr)) : "memory");
@@ -246,7 +246,7 @@ static __always_inline bool __test_and_s {bool oldbit; - asm("bts %2,%1\n\t" + asm("bts %2,%1" CC_SET(c) : CC_OUT(c) (oldbit), ADDR : "Ir" (nr));
@@ -286,7 +286,7 @@ static __always_inline bool __test_and_c {bool oldbit; - asm volatile("btr %2,%1\n\t" + asm volatile("btr %2,%1" CC_SET(c) : CC_OUT(c) (oldbit), ADDR : "Ir" (nr));
@@ -298,7 +298,7 @@ static __always_inline bool __test_and_c {bool oldbit; - asm volatile("btc %2,%1\n\t" + asm volatile("btc %2,%1" CC_SET(c) : CC_OUT(c) (oldbit), ADDR : "Ir" (nr) : "memory");
@@ -329,7 +329,7 @@ static __always_inline bool variable_tes {bool oldbit; - asm volatile("bt %2,%1\n\t" + asm volatile("bt %2,%1" CC_SET(c) : CC_OUT(c) (oldbit) : "m" (*(unsigned long *)addr), "Ir" (nr));
arch/x86/include/asm/percpu.h +1 -1
@@ -526,7 +526,7 @@ static inline bool x86_this_cpu_variable {bool oldbit; - asm volatile("bt "__percpu_arg(2)",%1\n\t" + asm volatile("bt "__percpu_arg(2)",%1" CC_SET(c) : CC_OUT(c) (oldbit) : "m" (*(unsigned long __percpu *)addr), "Ir" (nr));
arch/x86/include/asm/rmwcc.h +1 -1
@@ -29,7 +29,7 @@ cc_label: \#define __GEN_RMWcc (fullop, var, cc, clobbers, ...) \ do { \ bool c; \ - asm volatile (fullop ";" CC_SET(cc) \ + asm volatile (fullop CC_SET(cc) \ : [counter] "+m" (var), CC_OUT(cc) (c) \ : __VA_ARGS__ : clobbers); \ return c; \
Greg Kroah-Hartman
maintainerPATCH 3/159 x86/head: Remove confusing comment
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit 17270717e80de33a884ad328fea5f407d87f6d6a upstream.
This comment is actively wrong and confusing. It refers to the registers' stack offsets after the pt_regs has been constructed on the stack, but this code is *before* that.
At this point the stack just has the standard iret frame, for which no comment should be needed.
--- arch/x86/kernel/head_64.S | 4 ---- 1 file changed, 4 deletions(-)
arch/x86/kernel/head_64.S +0 -4
@@ -271,10 +271,6 @@ bad_address: __INIT ENTRY(early_idt_handler_array) - # 104(%rsp) %rflags - # 96(%rsp) %cs - # 88(%rsp) %rip - # 80(%rsp) error code i = 0 .rept NUM_EXCEPTION_VECTORS .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1
Greg Kroah-Hartman
maintainerPATCH 5/159 x86/head: Fix head ELF function annotations
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit 015a2ea5478680fc5216d56b7ff306f2a74efaf9 upstream.
These functions aren't callable C-type functions, so don't annotate them as such.
--- arch/x86/kernel/head_64.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/head_64.S +3 -3
@@ -235,7 +235,7 @@ ENTRY(secondary_startup_64) pushq %rax # target address in negative space lretq .Lafter_lret: -ENDPROC(secondary_startup_64) +END(secondary_startup_64) #include "verify_cpu.S"
@@ -278,7 +278,7 @@ ENTRY(early_idt_handler_array) i = i + 1 .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc .endr -ENDPROC(early_idt_handler_array) +END(early_idt_handler_array) early_idt_handler_common: /*
@@ -321,7 +321,7 @@ early_idt_handler_common: 20: decl early_recursion_flag(%rip) jmp restore_regs_and_iret -ENDPROC(early_idt_handler_common) +END(early_idt_handler_common) __INITDATA
Greg Kroah-Hartman
maintainerPATCH 6/159 x86/boot: Annotate verify_cpu() as a callable function
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit e93db75a0054b23a874a12c63376753544f3fe9e upstream.
verify_cpu() is a callable function. Annotate it as such.
--- arch/x86/kernel/verify_cpu.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/verify_cpu.S +2 -1
@@ -33,7 +33,7 @@ #include <asm/cpufeatures.h> #include <asm/msr-index.h> -verify_cpu: +ENTRY(verify_cpu) pushf # Save caller passed flags push $0 # Kill any dangerous flags popf
@@ -139,3 +139,4 @@ verify_cpu: popf # Restore caller passed flags xorl %eax, %eax ret +ENDPROC(verify_cpu)
Greg Kroah-Hartman
maintainerPATCH 7/159 x86/xen: Fix xen head ELF annotations
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit 2582d3df95c76d3b686453baf90b64d57e87d1e8 upstream.
Mark the ends of the startup_xen and hypercall_page code sections.
--- arch/x86/xen/xen-head.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/xen/xen-head.S +2 -2
@@ -34,7 +34,7 @@ ENTRY(startup_xen) mov $init_thread_union+THREAD_SIZE, %_ASM_SP jmp xen_start_kernel - +END(startup_xen) __FINIT #endif
@@ -48,7 +48,7 @@ ENTRY(hypercall_page) .type xen_hypercall_##n, @function; .size xen_hypercall_##n, 32 #include <asm/xen-hypercalls.h> #undef HYPERCALL - +END(hypercall_page) .popsection ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux")
Greg Kroah-Hartman
maintainerPATCH 10/159 ACPI / APEI: adjust a local variable type in ghes_ioremap_pfn_irq()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Beulich <[email protected]>
commit 095f613c6b386a1704b73a549e9ba66c1d5381ae upstream.
Match up with what 7edda0886b ("acpi: apei: handle SEA notification type for ARMv8") did for ghes_ioremap_pfn_nmi().
--- drivers/acpi/apei/ghes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/apei/ghes.c +2 -1
@@ -174,7 +174,8 @@ static void __iomem *ghes_ioremap_pfn_nmstatic void __iomem *ghes_ioremap_pfn_irq (u64 pfn) { -unsigned long vaddr, paddr; +unsigned long vaddr; +phys_addr_t paddr;pgprot_t prot; vaddr = (unsigned long )GHES_IOREMAP_IRQ_PAGE (ghes_ioremap_area->addr);
Greg Kroah-Hartman
maintainerPATCH 11/159 x86/unwinder: Make CONFIG_UNWINDER_ORC=y the default in the 64-bit defconfig
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
commit 1e4078f0bba46ad61b69548abe6a6faf63b89380 upstream.
Increase testing coverage by turning on the primary x86 unwinder for the 64-bit defconfig.
--- arch/x86/configs/x86_64_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/x86/configs/x86_64_defconfig +1 -0
@@ -299,6 +299,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y # CONFIG_DEBUG_RODATA_TEST is not set CONFIG_DEBUG_BOOT_PARAMS=y CONFIG_OPTIMIZE_INLINING=y +CONFIG_ORC_UNWINDER=y CONFIG_SECURITY=y CONFIG_SECURITY_NETWORK=y CONFIG_SECURITY_SELINUX=y
Greg Kroah-Hartman
maintainerPATCH 12/159 x86/fpu/debug: Remove unused x86_fpu_state and x86_fpu_deactivate_state tracepoints
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (VMware) <[email protected]>
commit 127a1bea40f7f2a36bc7207ea4d51bb6b4e936fa upstream.
Commit:
d1898b733619 ("x86/fpu: Add tracepoints to dump FPU state at key points")
... added the 'x86_fpu_state' and 'x86_fpu_deactivate_state' trace points, but never used them. Today they are still not used. As they take up and waste memory, remove them.
--- arch/x86/include/asm/trace/fpu.h | 10 ---------- 1 file changed, 10 deletions(-)
arch/x86/include/asm/trace/fpu.h +0 -10
@@ -34,11 +34,6 @@ DECLARE_EVENT_CLASS(x86_fpu, ) ); -DEFINE_EVENT (x86_fpu, x86_fpu_state, - TP_PROTO(struct fpu *fpu), -TP_ARGS (fpu) -); -DEFINE_EVENT (x86_fpu, x86_fpu_before_save, TP_PROTO(struct fpu *fpu), TP_ARGS(fpu)
@@ -73,11 +68,6 @@ DEFINE_EVENT(x86_fpu, x86_fpu_activate_s TP_PROTO(struct fpu *fpu), TP_ARGS(fpu) ); - -DEFINE_EVENT (x86_fpu, x86_fpu_deactivate_state, - TP_PROTO(struct fpu *fpu), -TP_ARGS (fpu) -); DEFINE_EVENT(x86_fpu, x86_fpu_init_state, TP_PROTO(struct fpu *fpu),
Greg Kroah-Hartman
maintainerPATCH 13/159 x86/unwind: Rename unwinder config options to CONFIG_UNWINDER_*
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit 11af847446ed0d131cf24d16a7ef3d5ea7a49554 upstream.
Rename the unwinder config options from:
CONFIG_ORC_UNWINDER
CONFIG_FRAME_POINTER_UNWINDER
CONFIG_GUESS_UNWINDER
to:
CONFIG_UNWINDER_ORC
CONFIG_UNWINDER_FRAME_POINTER
CONFIG_UNWINDER_GUESS
... in order to give them a more logical config namespace.
--- Documentation/x86/orc-unwinder.txt | 2 +- Makefile | 4 ++-- arch/x86/Kconfig | 2 +- arch/x86/Kconfig.debug | 10 +++++----- arch/x86/configs/tiny.config | 4 ++-- arch/x86/configs/x86_64_defconfig | 2 +- arch/x86/include/asm/module.h | 2 +- arch/x86/include/asm/unwind.h | 8 ++++---- arch/x86/kernel/Makefile | 6 +++--- include/asm-generic/vmlinux.lds.h | 2 +- lib/Kconfig.debug | 2 +- scripts/Makefile.build | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-)
Documentation/x86/orc-unwinder.txt +1 -1
@@ -4,7 +4,7 @@ ORC unwinder Overview -------- -The kernel CONFIG_ORC_UNWINDER option enables the ORC unwinder, which is +The kernel CONFIG_UNWINDER_ORC option enables the ORC unwinder, which is similar in concept to a DWARF unwinder. The difference is that the format of the ORC data is much simpler than DWARF, which in turn allows the ORC unwinder to be much simpler and faster.
Makefile +2 -2
@@ -935,8 +935,8 @@ ifdef CONFIG_STACK_VALIDATION ifeq ($(has_libelf),1) objtool_target := tools/objtool FORCE else - ifdef CONFIG_ORC_UNWINDER - $(error "Cannot generate ORC metadata for CONFIG_ORC_UNWINDER=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") + ifdef CONFIG_UNWINDER_ORC + $(error "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") else $(warning "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") endif
arch/x86/Kconfig +1 -1
@@ -171,7 +171,7 @@ config X86 select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE select HAVE_REGS_AND_STACK_ACCESS_API - select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER_UNWINDER && STACK_VALIDATION + select HAVE_RELIABLE_STACKTRACE if X86_64 && UNWINDER_FRAME_POINTER && STACK_VALIDATION select HAVE_STACK_VALIDATION if X86_64 select HAVE_SYSCALL_TRACEPOINTS select HAVE_UNSTABLE_SCHED_CLOCK
arch/x86/Kconfig.debug +5 -5
@@ -359,13 +359,13 @@ config PUNIT_ATOM_DEBUG choice prompt "Choose kernel unwinder" - default FRAME_POINTER_UNWINDER + default UNWINDER_FRAME_POINTER ---help--- This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack, livepatch, lockdep, and more. -config FRAME_POINTER_UNWINDER +config UNWINDER_FRAME_POINTER bool "Frame pointer unwinder" select FRAME_POINTER ---help---
@@ -380,7 +380,7 @@ config FRAME_POINTER_UNWINDER consistency model, as this is currently the only way to get a reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE). -config ORC_UNWINDER +config UNWINDER_ORC bool "ORC unwinder" depends on X86_64 select STACK_VALIDATION
@@ -396,7 +396,7 @@ config ORC_UNWINDER Enabling this option will increase the kernel's runtime memory usage by roughly 2-4MB, depending on your kernel config. -config GUESS_UNWINDER +config UNWINDER_GUESS bool "Guess unwinder" depends on EXPERT ---help---
@@ -411,7 +411,7 @@ config GUESS_UNWINDER endchoice config FRAME_POINTER - depends on !ORC_UNWINDER && !GUESS_UNWINDER + depends on !UNWINDER_ORC && !UNWINDER_GUESS bool endmenu
arch/x86/configs/tiny.config +2 -2
@@ -1,5 +1,5 @@ CONFIG_NOHIGHMEM=y # CONFIG_HIGHMEM4G is not set # CONFIG_HIGHMEM64G is not set -CONFIG_GUESS_UNWINDER=y -# CONFIG_FRAME_POINTER_UNWINDER is not set +CONFIG_UNWINDER_GUESS=y +# CONFIG_UNWINDER_FRAME_POINTER is not set
arch/x86/configs/x86_64_defconfig +1 -1
@@ -299,7 +299,7 @@ CONFIG_DEBUG_STACKOVERFLOW=y # CONFIG_DEBUG_RODATA_TEST is not set CONFIG_DEBUG_BOOT_PARAMS=y CONFIG_OPTIMIZE_INLINING=y -CONFIG_ORC_UNWINDER=y +CONFIG_UNWINDER_ORC=y CONFIG_SECURITY=y CONFIG_SECURITY_NETWORK=y CONFIG_SECURITY_SELINUX=y
arch/x86/include/asm/module.h +1 -1
@@ -6,7 +6,7 @@#include <asm/orc_types.h> struct mod_arch_specific { -#ifdef CONFIG_ORC_UNWINDER +#ifdef CONFIG_UNWINDER_ORC unsigned int num_orcs;int *orc_unwind_ip;struct orc_entry *orc_unwind;
arch/x86/include/asm/unwind.h +4 -4
@@ -13,11 +13,11 @@ struct unwind_state {struct task_struct *task;int graph_idx;bool error; -#if defined(CONFIG_ORC_UNWINDER ) +#if defined(CONFIG_UNWINDER_ORC )bool signal, full_regs;unsigned long sp, bp, ip;struct pt_regs *regs; -#elif defined(CONFIG_FRAME_POINTER_UNWINDER ) +#elif defined(CONFIG_UNWINDER_FRAME_POINTER )bool got_irq;unsigned long *bp, *orig_sp, ip;struct pt_regs *regs;
@@ -51,7 +51,7 @@ void unwind_start(struct unwind_state *s__unwind_start (state, task, regs, first_frame); } -#if defined(CONFIG_ORC_UNWINDER ) || defined(CONFIG_FRAME_POINTER_UNWINDER ) +#if defined(CONFIG_UNWINDER_ORC ) || defined(CONFIG_UNWINDER_FRAME_POINTER )static inline struct pt_regs *unwind_get_entry_regs (struct unwind_state *state) {if (unwind_done (state))
@@ -66,7 +66,7 @@ static inline struct pt_regs *unwind_get }#endif -#ifdef CONFIG_ORC_UNWINDER +#ifdef CONFIG_UNWINDER_ORC void unwind_init (void );void unwind_module_init (struct module *mod,void *orc_ip,size_t orc_ip_size,void *orc,size_t orc_size);
arch/x86/kernel/Makefile +3 -3
@@ -127,9 +127,9 @@ obj-$(CONFIG_PERF_EVENTS) += perf_regs. obj-$(CONFIG_TRACING) += tracepoint.o obj-$(CONFIG_SCHED_MC_PRIO) += itmt.o -obj-$(CONFIG_ORC_UNWINDER) += unwind_orc.o -obj-$(CONFIG_FRAME_POINTER_UNWINDER) += unwind_frame.o -obj-$(CONFIG_GUESS_UNWINDER) += unwind_guess.o +obj-$(CONFIG_UNWINDER_ORC) += unwind_orc.o +obj-$(CONFIG_UNWINDER_FRAME_POINTER) += unwind_frame.o +obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o ### # 64 bit specific files
include/asm-generic/vmlinux.lds.h +1 -1
@@ -688,7 +688,7 @@#define BUG_TABLE #endif -#ifdef CONFIG_ORC_UNWINDER +#ifdef CONFIG_UNWINDER_ORC #define ORC_UNWIND_TABLE \ . = ALIGN(4); \ .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \
lib/Kconfig.debug +1 -1
@@ -376,7 +376,7 @@ config STACK_VALIDATION that runtime stack traces are more reliable. This is also a prerequisite for generation of ORC unwind data, which - is needed for CONFIG_ORC_UNWINDER. + is needed for CONFIG_UNWINDER_ORC. For more information, see tools/objtool/Documentation/stack-validation.txt.
scripts/Makefile.build +1 -1
@@ -259,7 +259,7 @@ ifneq ($(SKIP_STACK_VALIDATION),1) __objtool_obj := $(objtree)/tools/objtool/objtool -objtool_args = $(if $(CONFIG_ORC_UNWINDER),orc generate,check) +objtool_args = $(if $(CONFIG_UNWINDER_ORC),orc generate,check) ifndef CONFIG_FRAME_POINTER objtool_args += --no-fp
Greg Kroah-Hartman
maintainerPATCH 14/159 x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in kconfig for 64-bit
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit fc72ae40e30327aa24eb88a24b9c7058f938bd36 upstream.
The ORC unwinder has been stable in testing so far. Give it much wider testing by making it the default in kconfig for x86_64. It's not yet supported for 32-bit, so leave frame pointers as the default there.
--- arch/x86/Kconfig.debug | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)
arch/x86/Kconfig.debug +17 -16
@@ -359,27 +359,13 @@ config PUNIT_ATOM_DEBUG choice prompt "Choose kernel unwinder" - default UNWINDER_FRAME_POINTER + default UNWINDER_ORC if X86_64 + default UNWINDER_FRAME_POINTER if X86_32 ---help--- This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc/<pid>/stack, livepatch, lockdep, and more. -config UNWINDER_FRAME_POINTER - bool "Frame pointer unwinder" - select FRAME_POINTER - ---help--- - This option enables the frame pointer unwinder for unwinding kernel - stack traces. - - The unwinder itself is fast and it uses less RAM than the ORC - unwinder, but the kernel text size will grow by ~3% and the kernel's - overall performance will degrade by roughly 5-10%. - - This option is recommended if you want to use the livepatch - consistency model, as this is currently the only way to get a - reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE). - config UNWINDER_ORC bool "ORC unwinder" depends on X86_64
@@ -396,6 +382,21 @@ config UNWINDER_ORC Enabling this option will increase the kernel's runtime memory usage by roughly 2-4MB, depending on your kernel config. +config UNWINDER_FRAME_POINTER + bool "Frame pointer unwinder" + select FRAME_POINTER + ---help--- + This option enables the frame pointer unwinder for unwinding kernel + stack traces. + + The unwinder itself is fast and it uses less RAM than the ORC + unwinder, but the kernel text size will grow by ~3% and the kernel's + overall performance will degrade by roughly 5-10%. + + This option is recommended if you want to use the livepatch + consistency model, as this is currently the only way to get a + reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE). + config UNWINDER_GUESS bool "Guess unwinder" depends on EXPERT
Greg Kroah-Hartman
maintainerPATCH 15/159 bitops: Add clear/set_bit32() to linux/bitops.h
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andi Kleen <[email protected]>
commit cbe96375025e14fc76f9ed42ee5225120d7210f8 upstream.
Add two simple wrappers around set_bit/clear_bit() that accept the common case of an u32 array. This avoids writing casts in all callers.
--- include/linux/bitops.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
include/linux/bitops.h +26 -0
@@ -228,6 +228,32 @@ static inline unsigned long __ffs64(u64return __ffs ((unsigned long )word); } +/* +* clear_bit32 - Clear a bit in memory for u32 array +* @nr: Bit to clear +* @addr: u32 * address of bitmap +* +* Same as clear_bit, but avoids needing casts for u32 arrays. +*/ + +static __always_inline void clear_bit32(long nr, volatile u32 *addr) +{ +clear_bit (nr, (volatile unsigned long *)addr); +} + +/* +* set_bit32 - Set a bit in memory for u32 array +* @nr: Bit to clear +* @addr: u32 * address of bitmap +* +* Same as set_bit, but avoids needing casts for u32 arrays. +*/ + +static __always_inline void set_bit32(long nr, volatile u32 *addr) +{ +set_bit (nr, (volatile unsigned long *)addr); +} +#ifdef __KERNEL__#ifndef set_mask_bits
Greg Kroah-Hartman
maintainerPATCH 18/159 x86/fpu: Make XSAVE check the base CPUID features before enabling
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andi Kleen <[email protected]>
commit ccb18db2ab9d923df07e7495123fe5fb02329713 upstream.
Before enabling XSAVE, not only check the XSAVE specific CPUID bits, but also the base CPUID features of the respective XSAVE feature. This allows to disable individual XSAVE states using the existing clearcpuid= option, which can be useful for performance testing and debugging, and also in general avoids inconsistencies.
--- arch/x86/kernel/fpu/xstate.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
arch/x86/kernel/fpu/xstate.c +23 -0
@@ -15,6 +15,7 @@#include <asm/fpu/xstate.h> #include <asm/tlbflush.h> +#include <asm/cpufeature.h> /* * Although we spell it out in here, the Processor Trace
@@ -36,6 +37,19 @@ static const char *xfeature_names[] = "unknown xstate feature" , }; +static short xsave_cpuid_features[]__initdata = { +X86_FEATURE_FPU , +X86_FEATURE_XMM , +X86_FEATURE_AVX , +X86_FEATURE_MPX , +X86_FEATURE_MPX , +X86_FEATURE_AVX512F , +X86_FEATURE_AVX512F , +X86_FEATURE_AVX512F , +X86_FEATURE_INTEL_PT , +X86_FEATURE_PKU , +}; +/* * Mask of xstate features supported by the CPU and the kernel: */
@@ -726,6 +740,7 @@ void __init fpu__init_system_xstate(voidunsigned int eax, ebx, ecx, edx;static int on_boot_cpu__initdata =1 ;int err; +int i;WARN_ON_FPU (!on_boot_cpu); on_boot_cpu =0 ;
@@ -759,6 +774,14 @@ void __init fpu__init_system_xstate(void goto out_disable; } +/* +* Clear XSAVE features that are disabled in the normal CPUID. +*/ +for (i =0 ; i <ARRAY_SIZE (xsave_cpuid_features); i++) { +if (!boot_cpu_has (xsave_cpuid_features[i])) + xfeatures_mask &= ~BIT (i); + } + xfeatures_mask &=fpu__get_supported_xfeatures_mask ();/* Enable xstate instructions to be able to continue with initialization: */
Greg Kroah-Hartman
maintainerPATCH 19/159 x86/fpu: Remove the explicit clearing of XSAVE dependent features
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andi Kleen <[email protected]>
commit 73e3a7d2a7c3be29a5a22b85026f6cfa5664267f upstream.
Clearing a CPU feature with setup_clear_cpu_cap() clears all features which depend on it. Expressing feature dependencies in one place is easier to maintain than keeping functions like fpu__xstate_clear_all_cpu_caps() up to date.
The features which depend on XSAVE have their dependency expressed in the dependency table, so its sufficient to clear X86_FEATURE_XSAVE.
Remove the explicit clearing of XSAVE dependent features.
--- arch/x86/kernel/fpu/xstate.c | 20 -------------------- 1 file changed, 20 deletions(-)
arch/x86/kernel/fpu/xstate.c +0 -20
@@ -73,26 +73,6 @@ unsigned int fpu_user_xstate_size;void fpu__xstate_clear_all_cpu_caps (void ) {setup_clear_cpu_cap (X86_FEATURE_XSAVE ); -setup_clear_cpu_cap (X86_FEATURE_XSAVEOPT ); -setup_clear_cpu_cap (X86_FEATURE_XSAVEC ); -setup_clear_cpu_cap (X86_FEATURE_XSAVES ); -setup_clear_cpu_cap (X86_FEATURE_AVX ); -setup_clear_cpu_cap (X86_FEATURE_AVX2 ); -setup_clear_cpu_cap (X86_FEATURE_AVX512F ); -setup_clear_cpu_cap (X86_FEATURE_AVX512IFMA ); -setup_clear_cpu_cap (X86_FEATURE_AVX512PF ); -setup_clear_cpu_cap (X86_FEATURE_AVX512ER ); -setup_clear_cpu_cap (X86_FEATURE_AVX512CD ); -setup_clear_cpu_cap (X86_FEATURE_AVX512DQ ); -setup_clear_cpu_cap (X86_FEATURE_AVX512BW ); -setup_clear_cpu_cap (X86_FEATURE_AVX512VL ); -setup_clear_cpu_cap (X86_FEATURE_MPX ); -setup_clear_cpu_cap (X86_FEATURE_XGETBV1 ); -setup_clear_cpu_cap (X86_FEATURE_AVX512VBMI ); -setup_clear_cpu_cap (X86_FEATURE_PKU ); -setup_clear_cpu_cap (X86_FEATURE_AVX512_4VNNIW ); -setup_clear_cpu_cap (X86_FEATURE_AVX512_4FMAPS ); -setup_clear_cpu_cap (X86_FEATURE_AVX512_VPOPCNTDQ ); }/*
Greg Kroah-Hartman
maintainerPATCH 22/159 x86/cpuid: Prevent out of bound access in do_clear_cpu_cap()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 57b8b1a1856adaa849d02d547411a553a531022b upstream.
do_clear_cpu_cap() allocates a bitmap to keep track of disabled feature dependencies. That bitmap is sized NCAPINTS * BITS_PER_INIT. The possible 'features' which can be handed in are larger than this, because after the capabilities the bug 'feature' bits occupy another 32bit. Not really obvious...
So clearing any of the misfeature bits, as 32bit does for the F00F bug, accesses that bitmap out of bounds thereby corrupting the stack.
Size the bitmap proper and add a sanity check to catch accidental out of bound access.
--- arch/x86/kernel/cpu/cpuid-deps.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/cpuid-deps.c +8 -2
@@ -75,11 +75,17 @@ static inline void clear_feature(struct__clear_cpu_cap (c, feature); } +/* Take the capabilities and the BUG bits into account */ +#define MAX_FEATURE_BITS ((NCAPINTS + NBUGINTS) * sizeof(u32) * 8) +static void do_clear_cpu_cap (struct cpuinfo_x86 *c,unsigned int feature) { -bool changed; -DECLARE_BITMAP (disable,NCAPINTS *sizeof (u32) *8 ); +DECLARE_BITMAP (disable,MAX_FEATURE_BITS );const struct cpuid_dep *d; +bool changed; + +if (WARN_ON (feature >=MAX_FEATURE_BITS )) +return ;clear_feature (c, feature);
Greg Kroah-Hartman
maintainerPATCH 23/159 mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill A. Shutemov <[email protected]>
commit 83e3c48729d9ebb7af5a31a504f3fd6aff0348c4 upstream.
Size of the mem_section[] array depends on the size of the physical address space.
In preparation for boot-time switching between paging modes on x86-64 we need to make the allocation of mem_section[] dynamic, because otherwise we waste a lot of RAM: with CONFIG_NODE_SHIFT=10, mem_section[] size is 32kB for 4-level paging and 2MB for 5-level paging mode.
The patch allocates the array on the first call to sparse_memory_present_with_active_regions().
--- include/linux/mmzone.h | 6 +++++- mm/page_alloc.c | 10 ++++++++++ mm/sparse.c | 17 +++++++++++------ 3 files changed, 26 insertions(+), 7 deletions(-)
include/linux/mmzone.h +5 -1
@@ -1152,13 +1152,17 @@ struct mem_section {#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1)#ifdef CONFIG_SPARSEMEM_EXTREME -extern struct mem_section *mem_section[NR_SECTION_ROOTS ]; +extern struct mem_section **mem_section;#else extern struct mem_section mem_section[NR_SECTION_ROOTS ][SECTIONS_PER_ROOT ];#endif static inline struct mem_section *__nr_to_section (unsigned long nr) { +#ifdef CONFIG_SPARSEMEM_EXTREME +if (!mem_section) +return NULL ; +#endif if (!mem_section[SECTION_NR_TO_ROOT (nr)])return NULL ;return &mem_section[SECTION_NR_TO_ROOT (nr)][nr &SECTION_ROOT_MASK ];
mm/page_alloc.c +10 -0
@@ -5651,6 +5651,16 @@ void __init sparse_memory_present_with_aunsigned long start_pfn, end_pfn;int i, this_nid; +#ifdef CONFIG_SPARSEMEM_EXTREME +if (!mem_section) { +unsigned long size, align; + + size =sizeof (struct mem_section ) *NR_SECTION_ROOTS ; + align =1 << (INTERNODE_CACHE_SHIFT ); + mem_section =memblock_virt_alloc (size, align); + } +#endif +for_each_mem_pfn_range (i, nid, &start_pfn, &end_pfn, &this_nid)memory_present (this_nid, start_pfn, end_pfn); }
mm/sparse.c +11 -6
@@ -23,8 +23,7 @@* 1) mem_section - memory sections, mem_map's for valid memory */ #ifdef CONFIG_SPARSEMEM_EXTREME -struct mem_section *mem_section[NR_SECTION_ROOTS ] -____cacheline_internodealigned_in_smp ; +struct mem_section **mem_section;#else struct mem_section mem_section[NR_SECTION_ROOTS ][SECTIONS_PER_ROOT ]____cacheline_internodealigned_in_smp ;
@@ -101,7 +100,7 @@ static inline int sparse_index_init(unsiint __section_nr (struct mem_section * ms) {unsigned long root_nr; -struct mem_section * root; +struct mem_section *root =NULL ;for (root_nr =0 ; root_nr <NR_SECTION_ROOTS ; root_nr++) { root =__nr_to_section (root_nr *SECTIONS_PER_ROOT );
@@ -112,7 +111,7 @@ int __section_nr(struct mem_section* ms)break ; } -VM_BUG_ON (root_nr ==NR_SECTION_ROOTS ); +VM_BUG_ON (!root);return (root_nr *SECTIONS_PER_ROOT ) + (ms - root); }
@@ -330,11 +329,17 @@ again:static void __init check_usemap_section_nr (int nid,unsigned long *usemap) {unsigned long usemap_snr, pgdat_snr; -static unsigned long old_usemap_snr =NR_MEM_SECTIONS ; -static unsigned long old_pgdat_snr =NR_MEM_SECTIONS ; +static unsigned long old_usemap_snr; +static unsigned long old_pgdat_snr;struct pglist_data *pgdat =NODE_DATA (nid);int usemap_nid; +/* First call */ +if (!old_usemap_snr) { + old_usemap_snr =NR_MEM_SECTIONS ; + old_pgdat_snr =NR_MEM_SECTIONS ; + } + usemap_snr =pfn_to_section_nr (__pa (usemap) >>PAGE_SHIFT ); pgdat_snr =pfn_to_section_nr (__pa (pgdat) >>PAGE_SHIFT );if (usemap_snr == pgdat_snr)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerPATCH 24/159 x86/kasan: Use the same shadow offset for 4- and 5-level paging
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Ryabinin <[email protected]>
commit 12a8cc7fcf54a8575f094be1e99032ec38aa045c upstream.
We are going to support boot-time switching between 4- and 5-level paging. For KASAN it means we cannot have different KASAN_SHADOW_OFFSET for different paging modes: the constant is passed to gcc to generate code and cannot be changed at runtime.
This patch changes KASAN code to use 0xdffffc0000000000 as shadow offset for both 4- and 5-level paging.
For 5-level paging it means that shadow memory region is not aligned to PGD boundary anymore and we have to handle unaligned parts of the region properly.
In addition, we have to exclude paravirt code from KASAN instrumentation as we now use set_pgd() before KASAN is fully ready.
--- Documentation/x86/x86_64/mm.txt | 2 arch/x86/Kconfig | 1 arch/x86/kernel/Makefile | 3 - arch/x86/mm/kasan_init_64.c | 101 +++++++++++++++++++++++++++++++--------- 4 files changed, 83 insertions(+), 24 deletions(-)
Documentation/x86/x86_64/mm.txt +1 -1
@@ -34,7 +34,7 @@ ff92000000000000 - ffd1ffffffffffff (=54 ffd2000000000000 - ffd3ffffffffffff (=49 bits) hole ffd4000000000000 - ffd5ffffffffffff (=49 bits) virtual memory map (512TB) ... unused hole ... -ffd8000000000000 - fff7ffffffffffff (=53 bits) kasan shadow memory (8PB) +ffdf000000000000 - fffffc0000000000 (=53 bits) kasan shadow memory (8PB) ... unused hole ... ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks ... unused hole ...
arch/x86/Kconfig +0 -1
@@ -303,7 +303,6 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC config KASAN_SHADOW_OFFSET hex depends on KASAN - default 0xdff8000000000000 if X86_5LEVEL default 0xdffffc0000000000 config HAVE_INTEL_TXT
arch/x86/kernel/Makefile +2 -1
@@ -25,7 +25,8 @@ endif KASAN_SANITIZE_head$(BITS).o := n KASAN_SANITIZE_dumpstack.o := n KASAN_SANITIZE_dumpstack_$(BITS).o := n -KASAN_SANITIZE_stacktrace.o := n +KASAN_SANITIZE_stacktrace.o := n +KASAN_SANITIZE_paravirt.o := n OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o := y OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o := y
arch/x86/mm/kasan_init_64.c +80 -21
142 lines not on this page · raw message
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerPATCH 25/159 x86/xen: Provide pre-built page tables only for CONFIG_XEN_PV=y and CONFIG_XEN_PVH=y
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill A. Shutemov <[email protected]>
commit 4375c29985f155d7eb2346615d84e62d1b673682 upstream.
Looks like we only need pre-built page tables in the CONFIG_XEN_PV=y and CONFIG_XEN_PVH=y cases.
Let's not provide them for other configurations.
--- arch/x86/kernel/head_64.S | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
arch/x86/kernel/head_64.S +6 -5
@@ -38,11 +38,12 @@ * */ -#define p4d_index(x) (((x) >> P4D_SHIFT) & (PTRS_PER_P4D-1)) #define pud_index(x) (((x) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) +#if defined(CONFIG_XEN_PV) || defined(CONFIG_XEN_PVH) PGD_PAGE_OFFSET = pgd_index(__PAGE_OFFSET_BASE) PGD_START_KERNEL = pgd_index(__START_KERNEL_map) +#endif L3_START_KERNEL = pud_index(__START_KERNEL_map) .text
@@ -365,10 +366,7 @@ NEXT_PAGE(early_dynamic_pgts) .data -#ifndef CONFIG_XEN -NEXT_PAGE(init_top_pgt) - .fill 512,8,0 -#else +#if defined(CONFIG_XEN_PV) || defined(CONFIG_XEN_PVH) NEXT_PAGE(init_top_pgt) .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE_NOENC .org init_top_pgt + PGD_PAGE_OFFSET*8, 0
@@ -385,6 +383,9 @@ NEXT_PAGE(level2_ident_pgt) * Don't set NX because code runs from these pages. */ PMDS(0, __PAGE_KERNEL_IDENT_LARGE_EXEC, PTRS_PER_PMD) +#else +NEXT_PAGE(init_top_pgt) + .fill 512,8,0 #endif #ifdef CONFIG_X86_5LEVEL
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerPATCH 26/159 x86/xen: Drop 5-level paging support code from the XEN_PV code
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill A. Shutemov <[email protected]>
commit 773dd2fca581b0a80e5a33332cc8ee67e5a79cba upstream.
It was decided 5-level paging is not going to be supported in XEN_PV.
Let's drop the dead code from the XEN_PV code.
--- arch/x86/xen/mmu_pv.c | 159 ++++++++++++++++++-------------------------------- 1 file changed, 60 insertions(+), 99 deletions(-)
arch/x86/xen/mmu_pv.c +60 -99
@@ -449,7 +449,7 @@ __visible pmd_t xen_make_pmd(pmdval_t pm }PV_CALLEE_SAVE_REGS_THUNK (xen_make_pmd); -#if CONFIG_PGTABLE_LEVELS ==4 +#ifdef CONFIG_X86_64 __visible pudval_t xen_pud_val(pud_t pud) {return pte_mfn_to_pfn (pud.pud);
@@ -538,7 +538,7 @@ static void xen_set_p4d(p4d_t *ptr, p4d_xen_mc_issue (PARAVIRT_LAZY_MMU ); } -#endif /* CONFIG_PGTABLE_LEVELS == 4 */ +#endif /* CONFIG_X86_64 */ static int xen_pmd_walk(struct mm_struct *mm, pmd_t *pmd, int (*func)(struct mm_struct *mm, struct page *, enum pt_level),
@@ -580,21 +580,17 @@ static int xen_p4d_walk(struct mm_structint (*func)(struct mm_struct *mm,struct page *,enum pt_level ), bool last, unsigned long limit) { - int i, nr, flush = 0; + int flush = 0; +pud_t *pud; - nr = last ?p4d_index (limit) +1 :PTRS_PER_P4D ; -for (i =0 ; i < nr; i++) { -pud_t *pud; -if (p4d_none (p4d[i])) -continue ; +if (p4d_none (*p4d)) +return flush; - pud =pud_offset (&p4d[i],0 ); -if (PTRS_PER_PUD >1 ) - flush |= (*func)(mm,virt_to_page (pud),PT_PUD ); - flush |=xen_pud_walk (mm, pud, func, - last && i == nr -1 , limit); - } + pud =pud_offset (p4d,0 ); +if (PTRS_PER_PUD >1 ) + flush |= (*func)(mm,virt_to_page (pud),PT_PUD ); + flush |=xen_pud_walk (mm, pud, func, last, limit);return flush; }
@@ -644,8 +640,6 @@ static int __xen_pgd_walk(struct mm_strucontinue ; p4d =p4d_offset (&pgd[i],0 ); -if (PTRS_PER_P4D >1 ) - flush |= (*func)(mm,virt_to_page (p4d),PT_P4D ); flush |=xen_p4d_walk (mm, p4d, func, i == nr -1 , limit); }
@@ -1176,22 +1170,14 @@ static void __init xen_cleanmfnmap(unsig {pgd_t *pgd;p4d_t *p4d; -unsigned int i;bool unpin; unpin = (vaddr ==2 *PGDIR_SIZE ); vaddr &=PMD_MASK ; pgd =pgd_offset_k (vaddr); p4d =p4d_offset (pgd,0 ); -for (i =0 ; i <PTRS_PER_P4D ; i++) { -if (p4d_none (p4d[i])) -continue ; -xen_cleanmfnmap_p4d (p4d + i, unpin); - } -if (IS_ENABLED (CONFIG_X86_5LEVEL )) { -set_pgd (pgd,__pgd (0 )); -xen_cleanmfnmap_free_pgtbl (p4d, unpin); - } +if (!p4d_none (*p4d)) +xen_cleanmfnmap_p4d (p4d, unpin); }static void __init xen_pagetable_p2m_free (void )
@@ -1692,7 +1678,7 @@ static void xen_release_pmd(unsigned lonxen_release_ptpage (pfn,PT_PMD ); } -#if CONFIG_PGTABLE_LEVELS >=4 +#ifdef CONFIG_X86_64 static void xen_alloc_pud (struct mm_struct *mm,unsigned long pfn) {xen_alloc_ptpage (mm, pfn,PT_PUD );
@@ -2029,13 +2015,12 @@ static phys_addr_t __init xen_early_virt*/ void __init xen_relocate_p2m (void ) { -phys_addr_t size, new_area, pt_phys, pmd_phys, pud_phys, p4d_phys; +phys_addr_t size, new_area, pt_phys, pmd_phys, pud_phys;unsigned long p2m_pfn, p2m_pfn_end, n_frames, pfn, pfn_end; -int n_pte, n_pt, n_pmd, n_pud, n_p4d, idx_pte, idx_pt, idx_pmd, idx_pud, idx_p4d; +int n_pte, n_pt, n_pmd, n_pud, idx_pte, idx_pt, idx_pmd, idx_pud;pte_t *pt;pmd_t *pmd;pud_t *pud; -p4d_t *p4d =NULL ;pgd_t *pgd;unsigned long *new_p2m;int save_pud;
@@ -2045,11 +2030,7 @@ void __init xen_relocate_p2m(void) n_pt =roundup (size,PMD_SIZE ) >>PMD_SHIFT ; n_pmd =roundup (size,PUD_SIZE ) >>PUD_SHIFT ; n_pud =roundup (size,P4D_SIZE ) >>P4D_SHIFT ; -if (PTRS_PER_P4D >1 ) - n_p4d =roundup (size,PGDIR_SIZE ) >>PGDIR_SHIFT ; -else - n_p4d =0 ; - n_frames = n_pte + n_pt + n_pmd + n_pud + n_p4d; + n_frames = n_pte + n_pt + n_pmd + n_pud; new_area =xen_find_free_area (PFN_PHYS (n_frames));if (!new_area) {
@@ -2065,76 +2046,56 @@ void __init xen_relocate_p2m(void)* To avoid any possible virtual address collision, just use * 2 * PUD_SIZE for the new area. */ - p4d_phys = new_area; - pud_phys = p4d_phys +PFN_PHYS (n_p4d); + pud_phys = new_area; pmd_phys = pud_phys +PFN_PHYS (n_pud); pt_phys = pmd_phys +PFN_PHYS (n_pmd); p2m_pfn =PFN_DOWN (pt_phys) + n_pt; pgd =__va (read_cr3_pa ()); new_p2m = (unsigned long *)(2 *PGDIR_SIZE ); - idx_p4d =0 ; save_pud = n_pud; -do { -if (n_p4d >0 ) { - p4d =early_memremap (p4d_phys,PAGE_SIZE ); -clear_page (p4d); - n_pud =min (save_pud,PTRS_PER_P4D ); - } -for (idx_pud =0 ; idx_pud < n_pud; idx_pud++) { - pud =early_memremap (pud_phys,PAGE_SIZE ); -clear_page (pud); -for (idx_pmd =0 ; idx_pmd <min (n_pmd,PTRS_PER_PUD ); - idx_pmd++) { - pmd =early_memremap (pmd_phys,PAGE_SIZE ); -clear_page (pmd); -for (idx_pt =0 ; idx_pt <min (n_pt,PTRS_PER_PMD ); - idx_pt++) { - pt =early_memremap (pt_phys,PAGE_SIZE ); -clear_page (pt); -for (idx_pte =0 ; - idx_pte <min (n_pte,PTRS_PER_PTE ); - idx_pte++) { -set_pte (pt + idx_pte, -pfn_pte (p2m_pfn,PAGE_KERNEL )); - p2m_pfn++; - } - n_pte -=PTRS_PER_PTE ; -early_memunmap (pt,PAGE_SIZE ); -make_lowmem_page_readonly (__va (pt_phys)); -pin_pagetable_pfn (MMUEXT_PIN_L1_TABLE , -PFN_DOWN (pt_phys)); -set_pmd (pmd + idx_pt, -__pmd (_PAGE_TABLE | pt_phys)); - pt_phys +=PAGE_SIZE ; +for (idx_pud =0 ; idx_pud < n_pud; idx_pud++) { + pud =early_memremap (pud_phys,PAGE_SIZE ); +clear_page (pud); +for (idx_pmd =0 ; idx_pmd <min (n_pmd,PTRS_PER_PUD ); + idx_pmd++) { + pmd =early_memremap (pmd_phys,PAGE_SIZE ); +clear_page (pmd); +for (idx_pt =0 ; idx_pt <min (n_pt,PTRS_PER_PMD ); + idx_pt++) { + pt =early_memremap (pt_phys,PAGE_SIZE ); +clear_page (pt); +for (idx_pte =0 ; + idx_pte <min (n_pte,PTRS_PER_PTE ); + idx_pte++) { +set_pte (pt + idx_pte, +pfn_pte (p2m_pfn,PAGE_KERNEL )); + p2m_pfn++; } - n_pt -=PTRS_PER_PMD ; -early_memunmap (pmd,PAGE_SIZE ); -make_lowmem_page_readonly (__va (pmd_phys)); -pin_pagetable_pfn (MMUEXT_PIN_L2_TABLE , -PFN_DOWN (pmd_phys)); -set_pud (pud + idx_pmd,__pud (_PAGE_TABLE | pmd_phys)); - pmd_phys +=PAGE_SIZE ; + n_pte -=PTRS_PER_PTE ; +early_memunmap (pt,PAGE_SIZE ); +make_lowmem_page_readonly (__va (pt_phys)); +pin_pagetable_pfn (MMUEXT_PIN_L1_TABLE , +PFN_DOWN (pt_phys)); +set_pmd (pmd + idx_pt, +__pmd (_PAGE_TABLE | pt_phys)); + pt_phys +=PAGE_SIZE ; } - n_pmd -=PTRS_PER_PUD ; -early_memunmap (pud,PAGE_SIZE ); -make_lowmem_page_readonly (__va (pud_phys)); -pin_pagetable_pfn (MMUEXT_PIN_L3_TABLE ,PFN_DOWN (pud_phys)); -if (n_p4d >0 ) -set_p4d (p4d + idx_pud,__p4d (_PAGE_TABLE | pud_phys)); -else -set_pgd (pgd +2 + idx_pud,__pgd (_PAGE_TABLE | pud_phys)); - pud_phys +=PAGE_SIZE ; - } -if (n_p4d >0 ) { - save_pud -=PTRS_PER_P4D ; -early_memunmap (p4d,PAGE_SIZE ); -make_lowmem_page_readonly (__va (p4d_phys)); -pin_pagetable_pfn (MMUEXT_PIN_L4_TABLE ,PFN_DOWN (p4d_phys)); -set_pgd (pgd +2 + idx_p4d,__pgd (_PAGE_TABLE | p4d_phys)); - p4d_phys +=PAGE_SIZE ; + n_pt -=PTRS_PER_PMD ; +early_memunmap (pmd,PAGE_SIZE ); +make_lowmem_page_readonly (__va (pmd_phys)); +pin_pagetable_pfn (MMUEXT_PIN_L2_TABLE , +PFN_DOWN (pmd_phys)); +set_pud (pud + idx_pmd,__pud (_PAGE_TABLE | pmd_phys)); + pmd_phys +=PAGE_SIZE ; } - }while (++idx_p4d < n_p4d); + n_pmd -=PTRS_PER_PUD ; +early_memunmap (pud,PAGE_SIZE ); +make_lowmem_page_readonly (__va (pud_phys)); +pin_pagetable_pfn (MMUEXT_PIN_L3_TABLE ,PFN_DOWN (pud_phys)); +set_pgd (pgd +2 + idx_pud,__pgd (_PAGE_TABLE | pud_phys)); + pud_phys +=PAGE_SIZE ; + }/* Now copy the old p2m info to the new area. */ memcpy (new_p2m, xen_p2m_addr, size);
@@ -2361,7 +2322,7 @@ static void __init xen_post_allocator_in pv_mmu_ops.set_pte = xen_set_pte; pv_mmu_ops.set_pmd = xen_set_pmd; pv_mmu_ops.set_pud = xen_set_pud; -#if CONFIG_PGTABLE_LEVELS >=4 +#ifdef CONFIG_X86_64 pv_mmu_ops.set_p4d = xen_set_p4d;#endif
@@ -2371,7 +2332,7 @@ static void __init xen_post_allocator_in pv_mmu_ops.alloc_pmd = xen_alloc_pmd; pv_mmu_ops.release_pte = xen_release_pte; pv_mmu_ops.release_pmd = xen_release_pmd; -#if CONFIG_PGTABLE_LEVELS >=4 +#ifdef CONFIG_X86_64 pv_mmu_ops.alloc_pud = xen_alloc_pud; pv_mmu_ops.release_pud = xen_release_pud;#endif
@@ -2435,14 +2396,14 @@ static const struct pv_mmu_ops xen_mmu_o .make_pmd = PV_CALLEE_SAVE(xen_make_pmd), .pmd_val =PV_CALLEE_SAVE (xen_pmd_val), -#if CONFIG_PGTABLE_LEVELS >=4 +#ifdef CONFIG_X86_64 .pud_val =PV_CALLEE_SAVE (xen_pud_val), .make_pud = PV_CALLEE_SAVE(xen_make_pud), .set_p4d = xen_set_p4d_hyper, .alloc_pud = xen_alloc_pmd_init, .release_pud = xen_release_pmd_init, -#endif /* CONFIG_PGTABLE_LEVELS == 4 */ +#endif /* CONFIG_X86_64 */ .activate_mm = xen_activate_mm, .dup_mmap = xen_dup_mmap,
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerPATCH 27/159 ACPI / APEI: remove the unused dead-code for SEA/NMI notification type
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dongjiu Geng <[email protected]>
commit c49870e89f4d2c21c76ebe90568246bb0f3572b7 upstream.
For the SEA notification, the two functions ghes_sea_add() and ghes_sea_remove() are only called when CONFIG_ACPI_APEI_SEA is defined. If not, it will return errors in the ghes_probe() and not continue. If the probe is failed, the ghes_sea_remove() also has no chance to be called. Hence, remove the unnecessary handling when CONFIG_ACPI_APEI_SEA is not defined.
For the NMI notification, it has the same issue as SEA notification, so also remove the unused dead-code for it.
--- drivers/acpi/apei/ghes.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-)
drivers/acpi/apei/ghes.c +5 -28
@@ -852,17 +852,8 @@ static void ghes_sea_remove(struct ghes synchronize_rcu(); }#else /* CONFIG_ACPI_APEI_SEA */ -static inline void ghes_sea_add (struct ghes *ghes) -{ -pr_err (GHES_PFX "ID: %d, trying to add SEA notification which is not supported\n" , - ghes->generic->header.source_id); -} - -static inline void ghes_sea_remove (struct ghes *ghes) -{ -pr_err (GHES_PFX "ID: %d, trying to remove SEA notification which is not supported\n" , - ghes->generic->header.source_id); -} +static inline void ghes_sea_add (struct ghes *ghes) { } +static inline void ghes_sea_remove (struct ghes *ghes) { }#endif /* CONFIG_ACPI_APEI_SEA */ #ifdef CONFIG_HAVE_ACPI_APEI_NMI
@@ -1064,23 +1055,9 @@ static void ghes_nmi_init_cxt(void) init_irq_work(&ghes_proc_irq_work, ghes_proc_in_irq); }#else /* CONFIG_HAVE_ACPI_APEI_NMI */ -static inline void ghes_nmi_add (struct ghes *ghes) -{ -pr_err (GHES_PFX "ID: %d, trying to add NMI notification which is not supported!\n" , - ghes->generic->header.source_id); -BUG (); -} - -static inline void ghes_nmi_remove (struct ghes *ghes) -{ -pr_err (GHES_PFX "ID: %d, trying to remove NMI notification which is not supported!\n" , - ghes->generic->header.source_id); -BUG (); -} - -static inline void ghes_nmi_init_cxt (void ) -{ -} +static inline void ghes_nmi_add (struct ghes *ghes) { } +static inline void ghes_nmi_remove (struct ghes *ghes) { } +static inline void ghes_nmi_init_cxt (void ) { }#endif /* CONFIG_HAVE_ACPI_APEI_NMI */ static int ghes_probe (struct platform_device *ghes_dev)
Greg Kroah-Hartman
maintainerPATCH 28/159 x86/asm: Dont use the confusing .ifeq directive
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit 82c62fa0c49aa305104013cee4468772799bb391 upstream.
I find the '.ifeq <expression>' directive to be confusing. Reading it quickly seems to suggest its opposite meaning, or that it's missing an argument.
Improve readability by replacing all of its x86 uses with '.if <expression> == 0'.
--- arch/x86/entry/entry_64.S | 2 +- arch/x86/kernel/head_32.S | 2 +- arch/x86/kernel/head_64.S | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/entry/entry_64.S +1 -1
@@ -818,7 +818,7 @@ ENTRY(\sym) ASM_CLAC - .ifeq \has_error_code + .if \has_error_code == 0 pushq $-1 /* ORIG_RAX: no syscall to restart */ .endif
arch/x86/kernel/head_32.S +1 -1
@@ -402,7 +402,7 @@ ENTRY(early_idt_handler_array) # 24(%rsp) error code i = 0 .rept NUM_EXCEPTION_VECTORS - .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1 + .if ((EXCEPTION_ERRCODE_MASK >> i) & 1) == 0 pushl $0 # Dummy error code, to make stack frame uniform .endif pushl $i # 20(%esp) Vector number
arch/x86/kernel/head_64.S +1 -1
@@ -275,7 +275,7 @@ ENDPROC(start_cpu0) ENTRY(early_idt_handler_array) i = 0 .rept NUM_EXCEPTION_VECTORS - .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1 + .if ((EXCEPTION_ERRCODE_MASK >> i) & 1) == 0 UNWIND_HINT_IRET_REGS pushq $0 # Dummy error code, to make stack frame uniform .else
Greg Kroah-Hartman
maintainerPATCH 30/159 x86/mm/64: Rename the register_page_bootmem_memmap() size parameter to nr_pages
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baoquan He <[email protected]>
commit 15670bfe19905b1dcbb63137f40d718b59d84479 upstream.
register_page_bootmem_memmap()'s 3rd 'size' parameter is named in a somewhat misleading fashion - rename it to 'nr_pages' which makes the units of it much clearer.
Meanwhile rename the existing local variable 'nr_pages' to 'nr_pmd_pages', a more expressive name, to avoid conflict with new function parameter 'nr_pages'.
(Also clean up the unnecessary parentheses in which get_order() is called.)
--- arch/x86/mm/init_64.c | 10 +++++----- include/linux/mm.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
arch/x86/mm/init_64.c +5 -5
@@ -1426,16 +1426,16 @@ int __meminit vmemmap_populate(unsigned#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE ) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE )void register_page_bootmem_memmap (unsigned long section_nr, -struct page *start_page,unsigned long size) +struct page *start_page,unsigned long nr_pages) {unsigned long addr = (unsigned long )start_page; -unsigned long end = (unsigned long )(start_page + size); +unsigned long end = (unsigned long )(start_page + nr_pages);unsigned long next;pgd_t *pgd;p4d_t *p4d;pud_t *pud;pmd_t *pmd; -unsigned int nr_pages; +unsigned int nr_pmd_pages;struct page *page;for (; addr < end; addr = next) {
@@ -1482,9 +1482,9 @@ void register_page_bootmem_memmap(unsignif (pmd_none (*pmd))continue ; - nr_pages =1 << (get_order (PMD_SIZE )); + nr_pmd_pages =1 <<get_order (PMD_SIZE ); page =pmd_page (*pmd); -while (nr_pages--) +while (nr_pmd_pages--)get_page_bootmem (section_nr, page++,SECTION_INFO ); }
include/linux/mm.h +1 -1
@@ -2510,7 +2510,7 @@ void vmemmap_populate_print_last(void);void vmemmap_free (unsigned long start,unsigned long end);#endif void register_page_bootmem_memmap (unsigned long section_nr,struct page *map, -unsigned long size); +unsigned long nr_pages);enum mf_flags {MF_COUNT_INCREASED =1 <<0 ,
Greg Kroah-Hartman
maintainerPATCH 32/159 x86/mm: Relocate page fault error codes to traps.h
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Neri <[email protected]>
commit 1067f030994c69ca1fba8c607437c8895dcf8509 upstream.
Up to this point, only fault.c used the definitions of the page fault error codes. Thus, it made sense to keep them within such file. Other portions of code might be interested in those definitions too. For instance, the User- Mode Instruction Prevention emulation code will use such definitions to emulate a page fault when it is unable to successfully copy the results of the emulated instructions to user space.
While relocating the error code enumeration, the prefix X86_ is used to make it consistent with the rest of the definitions in traps.h. Of course, code using the enumeration had to be updated as well. No functional changes were performed.
--- arch/x86/include/asm/traps.h | 18 ++++++++ arch/x86/mm/fault.c | 88 ++++++++++++++++--------------------------- 2 files changed, 52 insertions(+), 54 deletions(-)
arch/x86/include/asm/traps.h +18 -0
@@ -145,4 +145,22 @@ enum { X86_TRAP_IRET = 32, /* 32, IRET Exception */ }; +/* +* Page fault error code bits: +* +* bit 0 == 0: no page found 1: protection fault +* bit 1 == 0: read access 1: write access +* bit 2 == 0: kernel-mode access 1: user-mode access +* bit 3 == 1: use of reserved bit detected +* bit 4 == 1: fault was an instruction fetch +* bit 5 == 1: protection keys block access +*/ +enum x86_pf_error_code { +X86_PF_PROT =1 <<0 , +X86_PF_WRITE =1 <<1 , +X86_PF_USER =1 <<2 , +X86_PF_RSVD =1 <<3 , +X86_PF_INSTR =1 <<4 , +X86_PF_PK =1 <<5 , +};#endif /* _ASM_X86_TRAPS_H */
arch/x86/mm/fault.c +34 -54
249 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 33/159 x86/boot: Relocate definition of the initial state of CR0
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Neri <[email protected]>
commit b0ce5b8c95c83a7b98c679b117e3d6ae6f97154b upstream.
Both head_32.S and head_64.S utilize the same value to initialize the control register CR0. Also, other parts of the kernel might want to access this initial definition (e.g., emulation code for User-Mode Instruction Prevention uses this state to provide a sane dummy value for CR0 when emulating the smsw instruction). Thus, relocate this definition to a header file from which it can be conveniently accessed.
--- arch/x86/include/uapi/asm/processor-flags.h | 3 +++ arch/x86/kernel/head_32.S | 3 --- arch/x86/kernel/head_64.S | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-)
arch/x86/include/uapi/asm/processor-flags.h +3 -0
@@ -152,5 +152,8 @@#define CX86_ARR_BASE 0xc4#define CX86_RCR_BASE 0xdc +#define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \ + X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \ + X86_CR0_PG)#endif /* _UAPI_ASM_X86_PROCESSOR_FLAGS_H */
arch/x86/kernel/head_32.S +0 -3
@@ -212,9 +212,6 @@ ENTRY(startup_32_smp) #endif .Ldefault_entry: -#define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \ - X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \ - X86_CR0_PG) movl $(CR0_STATE & ~X86_CR0_PG),%eax movl %eax,%cr0
arch/x86/kernel/head_64.S +0 -3
@@ -154,9 +154,6 @@ ENTRY(secondary_startup_64) 1: wrmsr /* Make changes effective */ /* Setup cr0 */ -#define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \ - X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \ - X86_CR0_PG) movl $CR0_STATE, %eax /* Make changes effective */ movq %rax, %cr0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerPATCH 34/159 ptrace,x86: Make user_64bit_mode() available to 32-bit builds
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Neri <[email protected]>
commit e27c310af5c05cf876d9cad006928076c27f54d4 upstream.
In its current form, user_64bit_mode() can only be used when CONFIG_X86_64 is selected. This implies that code built with CONFIG_X86_64=n cannot use it. If a piece of code needs to be built for both CONFIG_X86_64=y and CONFIG_X86_64=n and wants to use this function, it needs to wrap it in an #ifdef/#endif; potentially, in multiple places.
This can be easily avoided with a single #ifdef/#endif pair within user_64bit_mode() itself.
--- arch/x86/include/asm/ptrace.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/include/asm/ptrace.h +5 -1
@@ -136,9 +136,9 @@ static inline int v8086_mode(struct pt_r#endif } -#ifdef CONFIG_X86_64 static inline bool user_64bit_mode (struct pt_regs *regs) { +#ifdef CONFIG_X86_64 #ifndef CONFIG_PARAVIRT /* * On non-paravirt systems, this is the only long mode CPL 3
@@ -149,8 +149,12 @@ static inline bool user_64bit_mode(struc/* Headers are too twisted for this to go in paravirt.h. */ return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs;#endif +#else /* !CONFIG_X86_64 */ +return false; +#endif } +#ifdef CONFIG_X86_64 #define current_user_stack_pointer () current_pt_regs()->sp#define compat_user_stack_pointer () current_pt_regs()->sp#endif
Greg Kroah-Hartman
maintainerPATCH 35/159 x86/entry/64: Remove the restore_c_regs_and_iret label
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 9da78ba6b47b46428cfdfc0851511ab29c869798 upstream.
The only user was the 64-bit opportunistic SYSRET failure path, and that path didn't really need it. This change makes the opportunistic SYSRET code a bit more straightforward and gets rid of the label.
--- arch/x86/entry/entry_64.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/entry/entry_64.S +2 -3
@@ -246,7 +246,6 @@ entry_SYSCALL64_slow_path: call do_syscall_64 /* returns with IRQs disabled */ return_from_SYSCALL_64: - RESTORE_EXTRA_REGS TRACE_IRQS_IRETQ /* we're about to change IF */ /*
@@ -315,6 +314,7 @@ return_from_SYSCALL_64: */ syscall_return_via_sysret: /* rcx and r11 are already restored (see code above) */ + RESTORE_EXTRA_REGS RESTORE_C_REGS_EXCEPT_RCX_R11 movq RSP(%rsp), %rsp UNWIND_HINT_EMPTY
@@ -322,7 +322,7 @@ syscall_return_via_sysret: opportunistic_sysret_failed: SWAPGS - jmp restore_c_regs_and_iret + jmp restore_regs_and_iret END(entry_SYSCALL_64) ENTRY(stub_ptregs_64)
@@ -639,7 +639,6 @@ retint_kernel: */ GLOBAL(restore_regs_and_iret) RESTORE_EXTRA_REGS -restore_c_regs_and_iret: RESTORE_C_REGS REMOVE_PT_GPREGS_FROM_STACK 8 INTERRUPT_RETURN
Greg Kroah-Hartman
maintainerPATCH 37/159 x86/entry/64: Move SWAPGS into the common IRET-to-usermode path
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 8a055d7f411d41755ce30db5bb65b154777c4b78 upstream.
All of the code paths that ended up doing IRET to usermode did SWAPGS immediately beforehand. Move the SWAPGS into the common code.
--- arch/x86/entry/entry_64.S | 32 ++++++++++++++------------------ arch/x86/entry/entry_64_compat.S | 3 +-- 2 files changed, 15 insertions(+), 20 deletions(-)
arch/x86/entry/entry_64.S +14 -18
@@ -250,12 +250,14 @@ return_from_SYSCALL_64: /* * Try to use SYSRET instead of IRET if we're returning to - * a completely clean 64-bit userspace context. + * a completely clean 64-bit userspace context. If we're not, + * go to the slow exit path. */ movq RCX(%rsp), %rcx movq RIP(%rsp), %r11 - cmpq %rcx, %r11 /* RCX == RIP */ - jne opportunistic_sysret_failed + + cmpq %rcx, %r11 /* SYSRET requires RCX == RIP */ + jne swapgs_restore_regs_and_return_to_usermode /* * On Intel CPUs, SYSRET with non-canonical RCX/RIP will #GP
@@ -273,14 +275,14 @@ return_from_SYSCALL_64: /* If this changed %rcx, it was not canonical */ cmpq %rcx, %r11 - jne opportunistic_sysret_failed + jne swapgs_restore_regs_and_return_to_usermode cmpq $__USER_CS, CS(%rsp) /* CS must match SYSRET */ - jne opportunistic_sysret_failed + jne swapgs_restore_regs_and_return_to_usermode movq R11(%rsp), %r11 cmpq %r11, EFLAGS(%rsp) /* R11 == RFLAGS */ - jne opportunistic_sysret_failed + jne swapgs_restore_regs_and_return_to_usermode /* * SYSCALL clears RF when it saves RFLAGS in R11 and SYSRET cannot
@@ -301,12 +303,12 @@ return_from_SYSCALL_64: * would never get past 'stuck_here'. */ testq $(X86_EFLAGS_RF|X86_EFLAGS_TF), %r11 - jnz opportunistic_sysret_failed + jnz swapgs_restore_regs_and_return_to_usermode /* nothing to check for RSP */ cmpq $__USER_DS, SS(%rsp) /* SS must match SYSRET */ - jne opportunistic_sysret_failed + jne swapgs_restore_regs_and_return_to_usermode /* * We win! This label is here just for ease of understanding
@@ -319,10 +321,6 @@ syscall_return_via_sysret: movq RSP(%rsp), %rsp UNWIND_HINT_EMPTY USERGS_SYSRET64 - -opportunistic_sysret_failed: - SWAPGS - jmp restore_regs_and_return_to_usermode END(entry_SYSCALL_64) ENTRY(stub_ptregs_64)
@@ -423,8 +421,7 @@ ENTRY(ret_from_fork) movq %rsp, %rdi call syscall_return_slowpath /* returns with IRQs disabled */ TRACE_IRQS_ON /* user mode is traced as IRQS on */ - SWAPGS - jmp restore_regs_and_return_to_usermode + jmp swapgs_restore_regs_and_return_to_usermode 1: /* kernel thread */
@@ -612,9 +609,8 @@ GLOBAL(retint_user) mov %rsp,%rdi call prepare_exit_to_usermode TRACE_IRQS_IRETQ - SWAPGS -GLOBAL(restore_regs_and_return_to_usermode) +GLOBAL(swapgs_restore_regs_and_return_to_usermode) #ifdef CONFIG_DEBUG_ENTRY /* Assert that pt_regs indicates user mode. */ testl $3, CS(%rsp)
@@ -622,6 +618,7 @@ GLOBAL(restore_regs_and_return_to_usermo ud2 1: #endif + SWAPGS RESTORE_EXTRA_REGS RESTORE_C_REGS REMOVE_PT_GPREGS_FROM_STACK 8
@@ -1343,8 +1340,7 @@ ENTRY(nmi) * Return back to user mode. We must *not* do the normal exit * work, because we don't want to enable interrupts. */ - SWAPGS - jmp restore_regs_and_return_to_usermode + jmp swapgs_restore_regs_and_return_to_usermode .Lnmi_from_kernel: /*
arch/x86/entry/entry_64_compat.S +1 -2
@@ -337,8 +337,7 @@ ENTRY(entry_INT80_compat) /* Go back to user mode. */ TRACE_IRQS_ON - SWAPGS - jmp restore_regs_and_return_to_usermode + jmp swapgs_restore_regs_and_return_to_usermode END(entry_INT80_compat) ENTRY(stub32_clone)
Greg Kroah-Hartman
maintainerPATCH 40/159 x86/entry/64: Use pop instead of movq in syscall_return_via_sysret
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 4fbb39108f972437c44e5ffa781b56635d496826 upstream.
Saves 64 bytes.
--- arch/x86/entry/entry_64.S | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
arch/x86/entry/entry_64.S +11 -3
@@ -316,10 +316,18 @@ return_from_SYSCALL_64: */ syscall_return_via_sysret: /* rcx and r11 are already restored (see code above) */ - RESTORE_EXTRA_REGS - RESTORE_C_REGS_EXCEPT_RCX_R11 - movq RSP(%rsp), %rsp UNWIND_HINT_EMPTY + POP_EXTRA_REGS + popq %rsi /* skip r11 */ + popq %r10 + popq %r9 + popq %r8 + popq %rax + popq %rsi /* skip rcx */ + popq %rdx + popq %rsi + popq %rdi + movq RSP-ORIG_RAX(%rsp), %rsp USERGS_SYSRET64 END(entry_SYSCALL_64)
Greg Kroah-Hartman
maintainerPATCH 41/159 x86/entry/64: Merge the fast and slow SYSRET paths
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit a512210643da8082cb44181dba8b18e752bd68f0 upstream.
They did almost the same thing. Remove a bunch of pointless instructions (mostly hidden in macros) and reduce cognitive load by merging them.
--- arch/x86/entry/entry_64.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/entry/entry_64.S +3 -3
@@ -221,10 +221,9 @@ entry_SYSCALL_64_fastpath: TRACE_IRQS_ON /* user mode is traced as IRQs on */ movq RIP(%rsp), %rcx movq EFLAGS(%rsp), %r11 - RESTORE_C_REGS_EXCEPT_RCX_R11 - movq RSP(%rsp), %rsp + addq $6*8, %rsp /* skip extra regs -- they were preserved */ UNWIND_HINT_EMPTY - USERGS_SYSRET64 + jmp .Lpop_c_regs_except_rcx_r11_and_sysret 1: /*
@@ -318,6 +317,7 @@ syscall_return_via_sysret: /* rcx and r11 are already restored (see code above) */ UNWIND_HINT_EMPTY POP_EXTRA_REGS +.Lpop_c_regs_except_rcx_r11_and_sysret: popq %rsi /* skip r11 */ popq %r10 popq %r9
Greg Kroah-Hartman
maintainerPATCH 43/159 x86/entry/64: Remove the RESTORE_..._REGS infrastructure
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit c39858de696f0cc160a544455e8403d663d577e9 upstream.
All users of RESTORE_EXTRA_REGS, RESTORE_C_REGS and such, and REMOVE_PT_GPREGS_FROM_STACK are gone. Delete the macros.
--- arch/x86/entry/calling.h | 52 ----------------------------------------------- 1 file changed, 52 deletions(-)
arch/x86/entry/calling.h +0 -52
@@ -142,16 +142,6 @@ For 32-bit we have the following convent UNWIND_HINT_REGS offset=\offset .endm - .macro RESTORE_EXTRA_REGS offset=0 - movq 0*8+\offset(%rsp), %r15 - movq 1*8+\offset(%rsp), %r14 - movq 2*8+\offset(%rsp), %r13 - movq 3*8+\offset(%rsp), %r12 - movq 4*8+\offset(%rsp), %rbp - movq 5*8+\offset(%rsp), %rbx - UNWIND_HINT_REGS offset=\offset extra=0 - .endm - .macro POP_EXTRA_REGS popq %r15 popq %r14
@@ -173,48 +163,6 @@ For 32-bit we have the following convent popq %rdi .endm - .macro RESTORE_C_REGS_HELPER rstor_rax=1, rstor_rcx=1, rstor_r11=1, rstor_r8910=1, rstor_rdx=1 - .if \rstor_r11 - movq 6*8(%rsp), %r11 - .endif - .if \rstor_r8910 - movq 7*8(%rsp), %r10 - movq 8*8(%rsp), %r9 - movq 9*8(%rsp), %r8 - .endif - .if \rstor_rax - movq 10*8(%rsp), %rax - .endif - .if \rstor_rcx - movq 11*8(%rsp), %rcx - .endif - .if \rstor_rdx - movq 12*8(%rsp), %rdx - .endif - movq 13*8(%rsp), %rsi - movq 14*8(%rsp), %rdi - UNWIND_HINT_IRET_REGS offset=16*8 - .endm - .macro RESTORE_C_REGS - RESTORE_C_REGS_HELPER 1,1,1,1,1 - .endm - .macro RESTORE_C_REGS_EXCEPT_RAX - RESTORE_C_REGS_HELPER 0,1,1,1,1 - .endm - .macro RESTORE_C_REGS_EXCEPT_RCX - RESTORE_C_REGS_HELPER 1,0,1,1,1 - .endm - .macro RESTORE_C_REGS_EXCEPT_R11 - RESTORE_C_REGS_HELPER 1,1,0,1,1 - .endm - .macro RESTORE_C_REGS_EXCEPT_RCX_R11 - RESTORE_C_REGS_HELPER 1,0,0,1,1 - .endm - - .macro REMOVE_PT_GPREGS_FROM_STACK addskip=0 - subq $-(15*8+\addskip), %rsp - .endm - .macro icebp .byte 0xf1 .endm
Greg Kroah-Hartman
maintainerPATCH 47/159 x86/entry/64: Pass SP0 directly to load_sp0()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit da51da189a24bb9b7e2d5a123be096e51a4695a5 upstream.
load_sp0() had an odd signature:
void load_sp0(struct tss_struct *tss, struct thread_struct *thread);
Simplify it to:
void load_sp0(unsigned long sp0);
Also simplify a few get_cpu()/put_cpu() sequences to preempt_disable()/preempt_enable().
--- arch/x86/include/asm/paravirt.h | 5 ++--- arch/x86/include/asm/paravirt_types.h | 2 +- arch/x86/include/asm/processor.h | 9 ++++----- arch/x86/kernel/cpu/common.c | 4 ++-- arch/x86/kernel/process_32.c | 2 +- arch/x86/kernel/process_64.c | 2 +- arch/x86/kernel/vm86_32.c | 14 ++++++-------- arch/x86/xen/enlighten_pv.c | 7 +++---- 8 files changed, 20 insertions(+), 25 deletions(-)
arch/x86/include/asm/paravirt.h +2 -3
@@ -16,10 +16,9 @@#include <linux/cpumask.h> #include <asm/frame.h> -static inline void load_sp0 (struct tss_struct *tss, -struct thread_struct *thread) +static inline void load_sp0 (unsigned long sp0) { -PVOP_VCALL2 (pv_cpu_ops.load_sp0, tss, thread); +PVOP_VCALL1 (pv_cpu_ops.load_sp0, sp0); }/* The paravirtualized CPUID instruction. */
arch/x86/include/asm/paravirt_types.h +1 -1
@@ -134,7 +134,7 @@ struct pv_cpu_ops {void (*alloc_ldt)(struct desc_struct *ldt,unsigned entries);void (*free_ldt)(struct desc_struct *ldt,unsigned entries); -void (*load_sp0)(struct tss_struct *tss,struct thread_struct *t); +void (*load_sp0)(unsigned long sp0);void (*set_iopl_mask)(unsigned mask);
arch/x86/include/asm/processor.h +4 -5
@@ -518,9 +518,9 @@ static inline void native_set_iopl_mask( }static inline void -native_load_sp0 (struct tss_struct *tss,struct thread_struct *thread) +native_load_sp0 (unsigned long sp0) { - tss->x86_tss.sp0 = thread->sp0; +this_cpu_write (cpu_tss.x86_tss.sp0, sp0); }static inline void native_swapgs (void )
@@ -545,10 +545,9 @@ static inline unsigned long current_top_#else #define __cpuid native_cpuid -static inline void load_sp0 (struct tss_struct *tss, -struct thread_struct *thread) +static inline void load_sp0 (unsigned long sp0) { -native_load_sp0 (tss, thread); +native_load_sp0 (sp0); }#define set_iopl_mask native_set_iopl_mask
arch/x86/kernel/cpu/common.c +2 -2
@@ -1570,7 +1570,7 @@ void cpu_init(void)initialize_tlbstate_and_flush ();enter_lazy_tlb (&init_mm, me); -load_sp0 (t, ¤t->thread); +load_sp0 (current->thread.sp0);set_tss_desc (cpu, t);load_TR_desc ();load_mm_ldt (&init_mm);
@@ -1625,7 +1625,7 @@ void cpu_init(void)initialize_tlbstate_and_flush ();enter_lazy_tlb (&init_mm, curr); -load_sp0 (t, thread); +load_sp0 (thread->sp0);set_tss_desc (cpu, t);load_TR_desc ();load_mm_ldt (&init_mm);
arch/x86/kernel/process_32.c +1 -1
@@ -287,7 +287,7 @@ __switch_to(struct task_struct *prev_p,* current_thread_info(). Refresh the SYSENTER configuration in * case prev or next is vm86. */ -load_sp0 (tss, next); +load_sp0 (next->sp0);refresh_sysenter_cs (next); this_cpu_write(cpu_current_top_of_stack, (unsigned long)task_stack_page(next_p) +
arch/x86/kernel/process_64.c +1 -1
@@ -465,7 +465,7 @@ __switch_to(struct task_struct *prev_p,this_cpu_write (current_task, next_p);/* Reload sp0. */ -load_sp0 (tss, next); +load_sp0 (next->sp0);/* * Now maybe reload the debug registers and handle I/O bitmaps
arch/x86/kernel/vm86_32.c +6 -8
@@ -95,7 +95,6 @@void save_v86_state (struct kernel_vm86_regs *regs,int retval) { -struct tss_struct *tss;struct task_struct *tsk = current;struct vm86plus_struct __user *user;struct vm86 *vm86 = current->thread.vm86;
@@ -147,13 +146,13 @@ void save_v86_state(struct kernel_vm86_rdo_exit (SIGSEGV ); } - tss = &per_cpu (cpu_tss,get_cpu ()); +preempt_disable (); tsk->thread.sp0 = vm86->saved_sp0; tsk->thread.sysenter_cs = __KERNEL_CS; -load_sp0 (tss, &tsk->thread); +load_sp0 (tsk->thread.sp0);refresh_sysenter_cs (&tsk->thread); vm86->saved_sp0 =0 ; -put_cpu (); +preempt_enable ();memcpy (®s->pt, &vm86->regs32,sizeof (struct pt_regs ));
@@ -239,7 +238,6 @@ SYSCALL_DEFINE2(vm86, unsigned long, cmdstatic long do_sys_vm86 (struct vm86plus_struct __user *user_vm86,bool plus) { -struct tss_struct *tss;struct task_struct *tsk = current;struct vm86 *vm86 = tsk->thread.vm86;struct kernel_vm86_regs vm86regs;
@@ -367,8 +365,8 @@ static long do_sys_vm86(struct vm86plus_ vm86->saved_sp0 = tsk->thread.sp0;lazy_save_gs (vm86->regs32.gs); - tss = &per_cpu (cpu_tss,get_cpu ());/* make room for real-mode segments */ +preempt_disable (); tsk->thread.sp0 +=16 ;if (static_cpu_has (X86_FEATURE_SEP )) {
@@ -376,8 +374,8 @@ static long do_sys_vm86(struct vm86plus_refresh_sysenter_cs (&tsk->thread); } -load_sp0 (tss, &tsk->thread); -put_cpu (); +load_sp0 (tsk->thread.sp0); +preempt_enable ();if (vm86->flags &VM86_SCREEN_BITMAP )mark_screen_rdonly (tsk->mm);
arch/x86/xen/enlighten_pv.c +3 -4
@@ -811,15 +811,14 @@ static void __init xen_write_gdt_entry_b } } -static void xen_load_sp0 (struct tss_struct *tss, -struct thread_struct *thread) +static void xen_load_sp0 (unsigned long sp0) {struct multicall_space mcs; mcs =xen_mc_entry (0 ); -MULTI_stack_switch (mcs.mc, __KERNEL_DS, thread->sp0); +MULTI_stack_switch (mcs.mc, __KERNEL_DS, sp0);xen_mc_issue (PARAVIRT_LAZY_CPU ); - tss->x86_tss.sp0 = thread->sp0; +this_cpu_write (cpu_tss.x86_tss.sp0, sp0); }void xen_set_iopl_mask (unsigned mask)
Greg Kroah-Hartman
maintainerPATCH 48/159 x86/entry: Add task_top_of_stack() to find the top of a tasks stack
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 3500130b84a3cdc5b6796eba1daf178944935efe upstream.
This will let us get rid of a few places that hardcode accesses to thread.sp0.
--- arch/x86/include/asm/processor.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/include/asm/processor.h +2 -0
@@ -796,6 +796,8 @@ static inline void spin_lock_prefetch(co#define TOP_OF_INIT_STACK ((unsigned long)&init_stack + sizeof(init_stack) - \ TOP_OF_KERNEL_STACK_PADDING) +#define task_top_of_stack (task) ((unsigned long)(task_pt_regs(task) + 1)) +#ifdef CONFIG_X86_32 /* * User space process size: 3GB (default).
Greg Kroah-Hartman
maintainerPATCH 50/159 x86/entry/64: Stop initializing TSS.sp0 at boot
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 20bb83443ea79087b5e5f8dab4e9d80bb9bf7acb upstream.
In my quest to get rid of thread_struct::sp0, I want to clean up or remove all of its readers. Two of them are in cpu_init() (32-bit and 64-bit), and they aren't needed. This is because we never enter userspace at all on the threads that CPUs are initialized in.
Poison the initial TSS.sp0 and stop initializing it on CPU init.
The comment text mostly comes from Dave Hansen. Thanks!
--- arch/x86/kernel/cpu/common.c | 13 ++++++++++--- arch/x86/kernel/process.c | 8 +++++++- 2 files changed, 17 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/common.c +10 -3
@@ -1570,9 +1570,13 @@ void cpu_init(void)initialize_tlbstate_and_flush ();enter_lazy_tlb (&init_mm, me); -load_sp0 (current->thread.sp0); +/* +* Initialize the TSS. Don't bother initializing sp0, as the initial +* task never enters user mode. +*/ set_tss_desc (cpu, t);load_TR_desc (); +load_mm_ldt (&init_mm);clear_all_debug_regs ();
@@ -1594,7 +1598,6 @@ void cpu_init(void)int cpu =smp_processor_id ();struct task_struct *curr = current;struct tss_struct *t = &per_cpu (cpu_tss, cpu); -struct thread_struct *thread = &curr->thread;wait_for_master_cpu (cpu);
@@ -1625,9 +1628,13 @@ void cpu_init(void)initialize_tlbstate_and_flush ();enter_lazy_tlb (&init_mm, curr); -load_sp0 (thread->sp0); +/* +* Initialize the TSS. Don't bother initializing sp0, as the initial +* task never enters user mode. +*/ set_tss_desc (cpu, t);load_TR_desc (); +load_mm_ldt (&init_mm); t->x86_tss.io_bitmap_base = offsetof(struct tss_struct , io_bitmap);
arch/x86/kernel/process.c +7 -1
@@ -49,7 +49,13 @@*/ __visible DEFINE_PER_CPU_SHARED_ALIGNED (struct tss_struct ,cpu_tss ) = { .x86_tss = { - .sp0 =TOP_OF_INIT_STACK , +/* +* .sp0 is only used when entering ring 0 from a lower +* privilege level. Since the init task never runs anything +* but ring 0 code, there is no need for a valid value here. +* Poison it. +*/ + .sp0 = (1UL << (BITS_PER_LONG -1 )) +1 , #ifdef CONFIG_X86_32 .ss0 = __KERNEL_DS, .ss1 = __KERNEL_CS,
Greg Kroah-Hartman
maintainerPATCH 52/159 x86/entry/32: Fix cpu_current_top_of_stack initialization at boot
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit cd493a6deb8b78eca280d05f7fa73fd69403ae29 upstream.
cpu_current_top_of_stack's initialization forgot about TOP_OF_KERNEL_STACK_PADDING. This bug didn't matter because the idle threads never enter user mode.
--- arch/x86/kernel/smpboot.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/smpboot.c +1 -2
@@ -962,8 +962,7 @@ void common_cpu_up(unsigned int cpu, str#ifdef CONFIG_X86_32 /* Stack for startup_32 can be just as for start_secondary onwards */ irq_ctx_init (cpu); -per_cpu (cpu_current_top_of_stack, cpu) = - (unsigned long )task_stack_page (idle) +THREAD_SIZE ; +per_cpu (cpu_current_top_of_stack, cpu) =task_top_of_stack (idle);#else initial_gs =per_cpu_offset (cpu);#endif
Greg Kroah-Hartman
maintainerPATCH 53/159 x86/entry/64: Remove thread_struct::sp0
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit d375cf1530595e33961a8844192cddab913650e3 upstream.
On x86_64, we can easily calculate sp0 when needed instead of storing it in thread_struct.
On x86_32, a similar cleanup would be possible, but it would require cleaning up the vm86 code first, and that can wait for a later cleanup series.
--- arch/x86/include/asm/compat.h | 1 + arch/x86/include/asm/processor.h | 28 +++++++++------------------- arch/x86/include/asm/switch_to.h | 6 ++++++ arch/x86/kernel/process_64.c | 1 - 4 files changed, 16 insertions(+), 20 deletions(-)
arch/x86/include/asm/compat.h +1 -0
@@ -7,6 +7,7 @@*/ #include <linux/types.h> #include <linux/sched.h> +#include <linux/sched/task_stack.h> #include <asm/processor.h> #include <asm/user32.h> #include <asm/unistd.h>
arch/x86/include/asm/processor.h +9 -19
@@ -431,7 +431,9 @@ typedef struct {struct thread_struct {/* Cached TLS descriptors: */ struct desc_struct tls_array[GDT_ENTRY_TLS_ENTRIES ]; +#ifdef CONFIG_X86_32 unsigned long sp0; +#endif unsigned long sp;#ifdef CONFIG_X86_32 unsigned long sysenter_cs;
@@ -798,6 +800,13 @@ static inline void spin_lock_prefetch(co#define task_top_of_stack (task) ((unsigned long)(task_pt_regs(task) + 1)) +#define task_pt_regs (task) \ +({ \ + unsigned long __ptr = (unsigned long)task_stack_page(task); \ + __ptr += THREAD_SIZE - TOP_OF_KERNEL_STACK_PADDING; \ + ((struct pt_regs *)__ptr) - 1; \ +}) +#ifdef CONFIG_X86_32 /* * User space process size: 3GB (default).
@@ -817,23 +826,6 @@ static inline void spin_lock_prefetch(co .addr_limit = KERNEL_DS, \ } -/* -* TOP_OF_KERNEL_STACK_PADDING reserves 8 bytes on top of the ring0 stack. -* This is necessary to guarantee that the entire "struct pt_regs" -* is accessible even if the CPU haven't stored the SS/ESP registers -* on the stack (interrupt gate does not save these registers -* when switching to the same priv ring). -* Therefore beware: accessing the ss/esp fields of the -* "struct pt_regs" is possible, but they may contain the -* completely wrong values. -*/ -#define task_pt_regs (task) \ -({ \ - unsigned long __ptr = (unsigned long)task_stack_page(task); \ - __ptr += THREAD_SIZE - TOP_OF_KERNEL_STACK_PADDING; \ - ((struct pt_regs *)__ptr) - 1; \ -}) -#define KSTK_ESP (task) (task_pt_regs(task)->sp)#else
@@ -867,11 +859,9 @@ static inline void spin_lock_prefetch(co#define STACK_TOP_MAX TASK_SIZE_MAX#define INIT_THREAD { \ - .sp0 = TOP_OF_INIT_STACK, \ .addr_limit = KERNEL_DS, \ } -#define task_pt_regs (tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1)extern unsigned long KSTK_ESP (struct task_struct *task);#endif /* CONFIG_X86_64 */
arch/x86/include/asm/switch_to.h +6 -0
@@ -2,6 +2,8 @@#ifndef _ASM_X86_SWITCH_TO_H#define _ASM_X86_SWITCH_TO_H +#include <linux/sched/task_stack.h> +struct task_struct ;/* one of the stranger aspects of C forward declarations */ struct task_struct *__switch_to_asm(struct task_struct *prev,
@@ -88,7 +90,11 @@ static inline void refresh_sysenter_cs(s/* This is used when switching tasks or entering/exiting vm86 mode. */ static inline void update_sp0 (struct task_struct *task) { +#ifdef CONFIG_X86_32 load_sp0 (task->thread.sp0); +#else +load_sp0 (task_top_of_stack (task)); +#endif }#endif /* _ASM_X86_SWITCH_TO_H */
arch/x86/kernel/process_64.c +0 -1
@@ -274,7 +274,6 @@ int copy_thread_tls(unsigned long clone_struct inactive_task_frame *frame;struct task_struct *me = current; - p->thread.sp0 = (unsigned long )task_stack_page (p) +THREAD_SIZE ; childregs =task_pt_regs (p); fork_frame = container_of(childregs, struct fork_frame, regs); frame = &fork_frame->frame;
Greg Kroah-Hartman
maintainerPATCH 54/159 x86/traps: Use a new on_thread_stack() helper to clean up an assertion
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 3383642c2f9d4f5b4fa37436db4a109a1a10018c upstream.
Let's keep the stack-related logic together rather than open-coding a comparison in an assertion in the traps code.
--- arch/x86/include/asm/processor.h | 6 ++++++ arch/x86/kernel/traps.c | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-)
arch/x86/include/asm/processor.h +6 -0
@@ -542,6 +542,12 @@ static inline unsigned long current_top_#endif } +static inline bool on_thread_stack (void ) +{ +return (unsigned long )(current_top_of_stack () - + current_stack_pointer) <THREAD_SIZE ; +} +#ifdef CONFIG_PARAVIRT #include <asm/paravirt.h> #else
arch/x86/kernel/traps.c +1 -2
@@ -141,8 +141,7 @@ void ist_begin_non_atomic(struct pt_regs* will catch asm bugs and any attempt to use ist_preempt_enable * from double_fault. */ -BUG_ON ((unsigned long )(current_top_of_stack () - - current_stack_pointer) >=THREAD_SIZE ); +BUG_ON (!on_thread_stack ());preempt_enable_no_resched (); }
Greg Kroah-Hartman
maintainerPATCH 55/159 x86/entry/64: Shorten TEST instructions
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit 1e4c4f610f774df6088d7c065b2dd4d22adba698 upstream.
Convert TESTL to TESTB and save 3 bytes per callsite.
No functionality change.
--- arch/x86/entry/entry_64.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/entry_64.S +2 -2
@@ -621,7 +621,7 @@ GLOBAL(retint_user) GLOBAL(swapgs_restore_regs_and_return_to_usermode) #ifdef CONFIG_DEBUG_ENTRY /* Assert that pt_regs indicates user mode. */ - testl $3, CS(%rsp) + testb $3, CS(%rsp) jnz 1f ud2 1:
@@ -654,7 +654,7 @@ retint_kernel: GLOBAL(restore_regs_and_return_to_kernel) #ifdef CONFIG_DEBUG_ENTRY /* Assert that pt_regs indicates kernel mode. */ - testl $3, CS(%rsp) + testb $3, CS(%rsp) jz 1f ud2 1:
Greg Kroah-Hartman
maintainerPATCH 56/159 x86/cpuid: Replace set/clear_bit32()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 06dd688ddda5819025e014b79aea9af6ab475fa2 upstream.
Peter pointed out that the set/clear_bit32() variants are broken in various aspects.
Replace them with open coded set/clear_bit() and type cast cpu_info::x86_capability as it's done in all other places throughout x86.
--- arch/x86/kernel/cpu/cpuid-deps.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
arch/x86/kernel/cpu/cpuid-deps.c +11 -15
@@ -62,23 +62,19 @@ const static struct cpuid_dep cpuid_deps {} }; -static inline void __clear_cpu_cap (struct cpuinfo_x86 *c,unsigned int bit) -{ -clear_bit32 (bit, c->x86_capability); -} - -static inline void __setup_clear_cpu_cap (unsigned int bit) -{ -clear_cpu_cap (&boot_cpu_data, bit); -set_bit32 (bit, cpu_caps_cleared); -} -static inline void clear_feature (struct cpuinfo_x86 *c,unsigned int feature) { -if (!c) -__setup_clear_cpu_cap (feature); -else -__clear_cpu_cap (c, feature); +/* +* Note: This could use the non atomic __*_bit() variants, but the +* rest of the cpufeature code uses atomics as well, so keep it for +* consistency. Cleanup all of it separately. +*/ +if (!c) { +clear_cpu_cap (&boot_cpu_data, feature); +set_bit (feature, (unsigned long *)cpu_caps_cleared); + }else { +clear_bit (feature, (unsigned long *)c->x86_capability); + } }/* Take the capabilities and the BUG bits into account */
Greg Kroah-Hartman
maintainerPATCH 57/159 bitops: Revert cbe96375025e ("bitops: Add clear/set_bit32() to linux/bitops.h")
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 1943dc07b45e347c52c1bfdd4a37e04a86e399aa upstream.
These ops are not endian safe and may break on architectures which have aligment requirements.
Reverts: cbe96375025e ("bitops: Add clear/set_bit32() to linux/bitops.h")
--- include/linux/bitops.h | 26 -------------------------- 1 file changed, 26 deletions(-)
include/linux/bitops.h +0 -26
@@ -228,32 +228,6 @@ static inline unsigned long __ffs64(u64return __ffs ((unsigned long )word); } -/* -* clear_bit32 - Clear a bit in memory for u32 array -* @nr: Bit to clear -* @addr: u32 * address of bitmap -* -* Same as clear_bit, but avoids needing casts for u32 arrays. -*/ - -static __always_inline void clear_bit32(long nr, volatile u32 *addr) -{ -clear_bit (nr, (volatile unsigned long *)addr); -} - -/* -* set_bit32 - Set a bit in memory for u32 array -* @nr: Bit to clear -* @addr: u32 * address of bitmap -* -* Same as set_bit, but avoids needing casts for u32 arrays. -*/ - -static __always_inline void set_bit32(long nr, volatile u32 *addr) -{ -set_bit (nr, (volatile unsigned long *)addr); -} -#ifdef __KERNEL__#ifndef set_mask_bits
Greg Kroah-Hartman
maintainerPATCH 58/159 x86/mm: Define _PAGE_TABLE using _KERNPG_TABLE
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit c7da092a1f243bfd1bfb4124f538e69e941882da upstream.
... so that the difference is obvious.
No functionality change.
--- arch/x86/include/asm/pgtable_types.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/include/asm/pgtable_types.h +1 -2
@@ -200,10 +200,9 @@ enum page_cache_mode {#define _PAGE_ENC (_AT(pteval_t, sme_me_mask)) -#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \ - _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_ENC)#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | \ _PAGE_DIRTY | _PAGE_ENC) +#define _PAGE_TABLE (_KERNPG_TABLE | _PAGE_USER)#define __PAGE_KERNEL_ENC (__PAGE_KERNEL | _PAGE_ENC)#define __PAGE_KERNEL_ENC_WP (__PAGE_KERNEL_WP | _PAGE_ENC)
Greg Kroah-Hartman
maintainerPATCH 59/159 x86/cpufeatures: Re-tabulate the X86_FEATURE definitions
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
commit acbc845ffefd9fb70466182cd8555a26189462b2 upstream.
Over the years asm/cpufeatures.h has become somewhat of a mess: the original tabulation style was too narrow, while x86 feature names also kept growing in length, creating frequent field width overflows.
Re-tabulate it to make it wider and easier to read/modify. Also harmonize the tabulation of the other defines in this file to match it.
--- arch/x86/include/asm/cpufeatures.h | 512 ++++++++++++++++++------------------- 1 file changed, 256 insertions(+), 256 deletions(-)
arch/x86/include/asm/cpufeatures.h +256 -256
@@ -13,8 +13,8 @@/* * Defines x86 CPU feature bits */ -#define NCAPINTS 18/* N 32-bit words worth of info */ -#define NBUGINTS 1/* N 32-bit bug flags */ +#define NCAPINTS 18/* N 32-bit words worth of info */ +#define NBUGINTS 1/* N 32-bit bug flags */ /* * Note: If the comment begins with a quoted string, that string is used
@@ -28,163 +28,163 @@*/ /* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */ -#define X86_FEATURE_FPU ( 0*32+ 0)/* Onboard FPU */ -#define X86_FEATURE_VME ( 0*32+ 1)/* Virtual Mode Extensions */ -#define X86_FEATURE_DE ( 0*32+ 2)/* Debugging Extensions */ -#define X86_FEATURE_PSE ( 0*32+ 3)/* Page Size Extensions */ -#define X86_FEATURE_TSC ( 0*32+ 4)/* Time Stamp Counter */ -#define X86_FEATURE_MSR ( 0*32+ 5)/* Model-Specific Registers */ -#define X86_FEATURE_PAE ( 0*32+ 6)/* Physical Address Extensions */ -#define X86_FEATURE_MCE ( 0*32+ 7)/* Machine Check Exception */ -#define X86_FEATURE_CX8 ( 0*32+ 8)/* CMPXCHG8 instruction */ -#define X86_FEATURE_APIC ( 0*32+ 9)/* Onboard APIC */ -#define X86_FEATURE_SEP ( 0*32+11)/* SYSENTER/SYSEXIT */ -#define X86_FEATURE_MTRR ( 0*32+12)/* Memory Type Range Registers */ -#define X86_FEATURE_PGE ( 0*32+13)/* Page Global Enable */ -#define X86_FEATURE_MCA ( 0*32+14)/* Machine Check Architecture */ -#define X86_FEATURE_CMOV ( 0*32+15)/* CMOV instructions */ +#define X86_FEATURE_FPU ( 0*32+ 0)/* Onboard FPU */ +#define X86_FEATURE_VME ( 0*32+ 1)/* Virtual Mode Extensions */ +#define X86_FEATURE_DE ( 0*32+ 2)/* Debugging Extensions */ +#define X86_FEATURE_PSE ( 0*32+ 3)/* Page Size Extensions */ +#define X86_FEATURE_TSC ( 0*32+ 4)/* Time Stamp Counter */ +#define X86_FEATURE_MSR ( 0*32+ 5)/* Model-Specific Registers */ +#define X86_FEATURE_PAE ( 0*32+ 6)/* Physical Address Extensions */ +#define X86_FEATURE_MCE ( 0*32+ 7)/* Machine Check Exception */ +#define X86_FEATURE_CX8 ( 0*32+ 8)/* CMPXCHG8 instruction */ +#define X86_FEATURE_APIC ( 0*32+ 9)/* Onboard APIC */ +#define X86_FEATURE_SEP ( 0*32+11)/* SYSENTER/SYSEXIT */ +#define X86_FEATURE_MTRR ( 0*32+12)/* Memory Type Range Registers */ +#define X86_FEATURE_PGE ( 0*32+13)/* Page Global Enable */ +#define X86_FEATURE_MCA ( 0*32+14)/* Machine Check Architecture */ +#define X86_FEATURE_CMOV ( 0*32+15)/* CMOV instructions */ /* (plus FCMOVcc, FCOMI with FPU) */ -#define X86_FEATURE_PAT ( 0*32+16)/* Page Attribute Table */ -#define X86_FEATURE_PSE36 ( 0*32+17)/* 36-bit PSEs */ -#define X86_FEATURE_PN ( 0*32+18)/* Processor serial number */ -#define X86_FEATURE_CLFLUSH ( 0*32+19)/* CLFLUSH instruction */ -#define X86_FEATURE_DS ( 0*32+21)/* "dts" Debug Store */ -#define X86_FEATURE_ACPI ( 0*32+22)/* ACPI via MSR */ -#define X86_FEATURE_MMX ( 0*32+23)/* Multimedia Extensions */ -#define X86_FEATURE_FXSR ( 0*32+24)/* FXSAVE/FXRSTOR, CR4.OSFXSR */ -#define X86_FEATURE_XMM ( 0*32+25)/* "sse" */ -#define X86_FEATURE_XMM2 ( 0*32+26)/* "sse2" */ -#define X86_FEATURE_SELFSNOOP ( 0*32+27)/* "ss" CPU self snoop */ -#define X86_FEATURE_HT ( 0*32+28)/* Hyper-Threading */ -#define X86_FEATURE_ACC ( 0*32+29)/* "tm" Automatic clock control */ -#define X86_FEATURE_IA64 ( 0*32+30)/* IA-64 processor */ -#define X86_FEATURE_PBE ( 0*32+31)/* Pending Break Enable */ +#define X86_FEATURE_PAT ( 0*32+16)/* Page Attribute Table */ +#define X86_FEATURE_PSE36 ( 0*32+17)/* 36-bit PSEs */ +#define X86_FEATURE_PN ( 0*32+18)/* Processor serial number */ +#define X86_FEATURE_CLFLUSH ( 0*32+19)/* CLFLUSH instruction */ +#define X86_FEATURE_DS ( 0*32+21)/* "dts" Debug Store */ +#define X86_FEATURE_ACPI ( 0*32+22)/* ACPI via MSR */ +#define X86_FEATURE_MMX ( 0*32+23)/* Multimedia Extensions */ +#define X86_FEATURE_FXSR ( 0*32+24)/* FXSAVE/FXRSTOR, CR4.OSFXSR */ +#define X86_FEATURE_XMM ( 0*32+25)/* "sse" */ +#define X86_FEATURE_XMM2 ( 0*32+26)/* "sse2" */ +#define X86_FEATURE_SELFSNOOP ( 0*32+27)/* "ss" CPU self snoop */ +#define X86_FEATURE_HT ( 0*32+28)/* Hyper-Threading */ +#define X86_FEATURE_ACC ( 0*32+29)/* "tm" Automatic clock control */ +#define X86_FEATURE_IA64 ( 0*32+30)/* IA-64 processor */ +#define X86_FEATURE_PBE ( 0*32+31)/* Pending Break Enable */ /* AMD-defined CPU features, CPUID level 0x80000001, word 1 */ /* Don't duplicate feature flags which are redundant with Intel! */ -#define X86_FEATURE_SYSCALL ( 1*32+11)/* SYSCALL/SYSRET */ -#define X86_FEATURE_MP ( 1*32+19)/* MP Capable. */ -#define X86_FEATURE_NX ( 1*32+20)/* Execute Disable */ -#define X86_FEATURE_MMXEXT ( 1*32+22)/* AMD MMX extensions */ -#define X86_FEATURE_FXSR_OPT ( 1*32+25)/* FXSAVE/FXRSTOR optimizations */ -#define X86_FEATURE_GBPAGES ( 1*32+26)/* "pdpe1gb" GB pages */ -#define X86_FEATURE_RDTSCP ( 1*32+27)/* RDTSCP */ -#define X86_FEATURE_LM ( 1*32+29)/* Long Mode (x86-64) */ -#define X86_FEATURE_3DNOWEXT ( 1*32+30)/* AMD 3DNow! extensions */ -#define X86_FEATURE_3DNOW ( 1*32+31)/* 3DNow! */ +#define X86_FEATURE_SYSCALL ( 1*32+11)/* SYSCALL/SYSRET */ +#define X86_FEATURE_MP ( 1*32+19)/* MP Capable. */ +#define X86_FEATURE_NX ( 1*32+20)/* Execute Disable */ +#define X86_FEATURE_MMXEXT ( 1*32+22)/* AMD MMX extensions */ +#define X86_FEATURE_FXSR_OPT ( 1*32+25)/* FXSAVE/FXRSTOR optimizations */ +#define X86_FEATURE_GBPAGES ( 1*32+26)/* "pdpe1gb" GB pages */ +#define X86_FEATURE_RDTSCP ( 1*32+27)/* RDTSCP */ +#define X86_FEATURE_LM ( 1*32+29)/* Long Mode (x86-64) */ +#define X86_FEATURE_3DNOWEXT ( 1*32+30)/* AMD 3DNow! extensions */ +#define X86_FEATURE_3DNOW ( 1*32+31)/* 3DNow! */ /* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */ -#define X86_FEATURE_RECOVERY ( 2*32+ 0)/* CPU in recovery mode */ -#define X86_FEATURE_LONGRUN ( 2*32+ 1)/* Longrun power control */ -#define X86_FEATURE_LRTI ( 2*32+ 3)/* LongRun table interface */ +#define X86_FEATURE_RECOVERY ( 2*32+ 0)/* CPU in recovery mode */ +#define X86_FEATURE_LONGRUN ( 2*32+ 1)/* Longrun power control */ +#define X86_FEATURE_LRTI ( 2*32+ 3)/* LongRun table interface */ /* Other features, Linux-defined mapping, word 3 */ /* This range is used for feature bits which conflict or are synthesized */ -#define X86_FEATURE_CXMMX ( 3*32+ 0)/* Cyrix MMX extensions */ -#define X86_FEATURE_K6_MTRR ( 3*32+ 1)/* AMD K6 nonstandard MTRRs */ -#define X86_FEATURE_CYRIX_ARR ( 3*32+ 2)/* Cyrix ARRs (= MTRRs) */ -#define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3)/* Centaur MCRs (= MTRRs) */ +#define X86_FEATURE_CXMMX ( 3*32+ 0)/* Cyrix MMX extensions */ +#define X86_FEATURE_K6_MTRR ( 3*32+ 1)/* AMD K6 nonstandard MTRRs */ +#define X86_FEATURE_CYRIX_ARR ( 3*32+ 2)/* Cyrix ARRs (= MTRRs) */ +#define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3)/* Centaur MCRs (= MTRRs) */ /* cpu types for specific tunings: */ -#define X86_FEATURE_K8 ( 3*32+ 4)/* "" Opteron, Athlon64 */ -#define X86_FEATURE_K7 ( 3*32+ 5)/* "" Athlon */ -#define X86_FEATURE_P3 ( 3*32+ 6)/* "" P3 */ -#define X86_FEATURE_P4 ( 3*32+ 7)/* "" P4 */ -#define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8)/* TSC ticks at a constant rate */ -#define X86_FEATURE_UP ( 3*32+ 9)/* smp kernel running on up */ -#define X86_FEATURE_ART ( 3*32+10)/* Platform has always running timer (ART) */ -#define X86_FEATURE_ARCH_PERFMON ( 3*32+11)/* Intel Architectural PerfMon */ -#define X86_FEATURE_PEBS ( 3*32+12)/* Precise-Event Based Sampling */ -#define X86_FEATURE_BTS ( 3*32+13)/* Branch Trace Store */ -#define X86_FEATURE_SYSCALL32 ( 3*32+14)/* "" syscall in ia32 userspace */ -#define X86_FEATURE_SYSENTER32 ( 3*32+15)/* "" sysenter in ia32 userspace */ -#define X86_FEATURE_REP_GOOD ( 3*32+16)/* rep microcode works well */ -#define X86_FEATURE_MFENCE_RDTSC ( 3*32+17)/* "" Mfence synchronizes RDTSC */ -#define X86_FEATURE_LFENCE_RDTSC ( 3*32+18)/* "" Lfence synchronizes RDTSC */ -#define X86_FEATURE_ACC_POWER ( 3*32+19)/* AMD Accumulated Power Mechanism */ -#define X86_FEATURE_NOPL ( 3*32+20)/* The NOPL (0F 1F) instructions */ -#define X86_FEATURE_ALWAYS ( 3*32+21)/* "" Always-present feature */ -#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 */ -#define X86_FEATURE_CPUID ( 3*32+25)/* CPU has CPUID instruction itself */ -#define X86_FEATURE_EXTD_APICID ( 3*32+26)/* has extended APICID (8 bits) */ -#define X86_FEATURE_AMD_DCM ( 3*32+27)/* multi-node processor */ -#define X86_FEATURE_APERFMPERF ( 3*32+28)/* APERFMPERF */ -#define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30)/* TSC doesn't stop in S3 state */ -#define X86_FEATURE_TSC_KNOWN_FREQ ( 3*32+31)/* TSC has known frequency */ +#define X86_FEATURE_K8 ( 3*32+ 4)/* "" Opteron, Athlon64 */ +#define X86_FEATURE_K7 ( 3*32+ 5)/* "" Athlon */ +#define X86_FEATURE_P3 ( 3*32+ 6)/* "" P3 */ +#define X86_FEATURE_P4 ( 3*32+ 7)/* "" P4 */ +#define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8)/* TSC ticks at a constant rate */ +#define X86_FEATURE_UP ( 3*32+ 9)/* smp kernel running on up */ +#define X86_FEATURE_ART ( 3*32+10)/* Platform has always running timer (ART) */ +#define X86_FEATURE_ARCH_PERFMON ( 3*32+11)/* Intel Architectural PerfMon */ +#define X86_FEATURE_PEBS ( 3*32+12)/* Precise-Event Based Sampling */ +#define X86_FEATURE_BTS ( 3*32+13)/* Branch Trace Store */ +#define X86_FEATURE_SYSCALL32 ( 3*32+14)/* "" syscall in ia32 userspace */ +#define X86_FEATURE_SYSENTER32 ( 3*32+15)/* "" sysenter in ia32 userspace */ +#define X86_FEATURE_REP_GOOD ( 3*32+16)/* rep microcode works well */ +#define X86_FEATURE_MFENCE_RDTSC ( 3*32+17)/* "" Mfence synchronizes RDTSC */ +#define X86_FEATURE_LFENCE_RDTSC ( 3*32+18)/* "" Lfence synchronizes RDTSC */ +#define X86_FEATURE_ACC_POWER ( 3*32+19)/* AMD Accumulated Power Mechanism */ +#define X86_FEATURE_NOPL ( 3*32+20)/* The NOPL (0F 1F) instructions */ +#define X86_FEATURE_ALWAYS ( 3*32+21)/* "" Always-present feature */ +#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 */ +#define X86_FEATURE_CPUID ( 3*32+25)/* CPU has CPUID instruction itself */ +#define X86_FEATURE_EXTD_APICID ( 3*32+26)/* has extended APICID (8 bits) */ +#define X86_FEATURE_AMD_DCM ( 3*32+27)/* multi-node processor */ +#define X86_FEATURE_APERFMPERF ( 3*32+28)/* APERFMPERF */ +#define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30)/* TSC doesn't stop in S3 state */ +#define X86_FEATURE_TSC_KNOWN_FREQ ( 3*32+31)/* TSC has known frequency */ /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ -#define X86_FEATURE_XMM3 ( 4*32+ 0)/* "pni" SSE-3 */ -#define X86_FEATURE_PCLMULQDQ ( 4*32+ 1)/* PCLMULQDQ instruction */ -#define X86_FEATURE_DTES64 ( 4*32+ 2)/* 64-bit Debug Store */ -#define X86_FEATURE_MWAIT ( 4*32+ 3)/* "monitor" Monitor/Mwait support */ -#define X86_FEATURE_DSCPL ( 4*32+ 4)/* "ds_cpl" CPL Qual. Debug Store */ -#define X86_FEATURE_VMX ( 4*32+ 5)/* Hardware virtualization */ -#define X86_FEATURE_SMX ( 4*32+ 6)/* Safer mode */ -#define X86_FEATURE_EST ( 4*32+ 7)/* Enhanced SpeedStep */ -#define X86_FEATURE_TM2 ( 4*32+ 8)/* Thermal Monitor 2 */ -#define X86_FEATURE_SSSE3 ( 4*32+ 9)/* Supplemental SSE-3 */ -#define X86_FEATURE_CID ( 4*32+10)/* Context ID */ -#define X86_FEATURE_SDBG ( 4*32+11)/* Silicon Debug */ -#define X86_FEATURE_FMA ( 4*32+12)/* Fused multiply-add */ -#define X86_FEATURE_CX16 ( 4*32+13)/* CMPXCHG16B */ -#define X86_FEATURE_XTPR ( 4*32+14)/* Send Task Priority Messages */ -#define X86_FEATURE_PDCM ( 4*32+15)/* Performance Capabilities */ -#define X86_FEATURE_PCID ( 4*32+17)/* Process Context Identifiers */ -#define X86_FEATURE_DCA ( 4*32+18)/* Direct Cache Access */ -#define X86_FEATURE_XMM4_1 ( 4*32+19)/* "sse4_1" SSE-4.1 */ -#define X86_FEATURE_XMM4_2 ( 4*32+20)/* "sse4_2" SSE-4.2 */ -#define X86_FEATURE_X2APIC ( 4*32+21)/* x2APIC */ -#define X86_FEATURE_MOVBE ( 4*32+22)/* MOVBE instruction */ -#define X86_FEATURE_POPCNT ( 4*32+23)/* POPCNT instruction */ +#define X86_FEATURE_XMM3 ( 4*32+ 0)/* "pni" SSE-3 */ +#define X86_FEATURE_PCLMULQDQ ( 4*32+ 1)/* PCLMULQDQ instruction */ +#define X86_FEATURE_DTES64 ( 4*32+ 2)/* 64-bit Debug Store */ +#define X86_FEATURE_MWAIT ( 4*32+ 3)/* "monitor" Monitor/Mwait support */ +#define X86_FEATURE_DSCPL ( 4*32+ 4)/* "ds_cpl" CPL Qual. Debug Store */ +#define X86_FEATURE_VMX ( 4*32+ 5)/* Hardware virtualization */ +#define X86_FEATURE_SMX ( 4*32+ 6)/* Safer mode */ +#define X86_FEATURE_EST ( 4*32+ 7)/* Enhanced SpeedStep */ +#define X86_FEATURE_TM2 ( 4*32+ 8)/* Thermal Monitor 2 */ +#define X86_FEATURE_SSSE3 ( 4*32+ 9)/* Supplemental SSE-3 */ +#define X86_FEATURE_CID ( 4*32+10)/* Context ID */ +#define X86_FEATURE_SDBG ( 4*32+11)/* Silicon Debug */ +#define X86_FEATURE_FMA ( 4*32+12)/* Fused multiply-add */ +#define X86_FEATURE_CX16 ( 4*32+13)/* CMPXCHG16B */ +#define X86_FEATURE_XTPR ( 4*32+14)/* Send Task Priority Messages */ +#define X86_FEATURE_PDCM ( 4*32+15)/* Performance Capabilities */ +#define X86_FEATURE_PCID ( 4*32+17)/* Process Context Identifiers */ +#define X86_FEATURE_DCA ( 4*32+18)/* Direct Cache Access */ +#define X86_FEATURE_XMM4_1 ( 4*32+19)/* "sse4_1" SSE-4.1 */ +#define X86_FEATURE_XMM4_2 ( 4*32+20)/* "sse4_2" SSE-4.2 */ +#define X86_FEATURE_X2APIC ( 4*32+21)/* x2APIC */ +#define X86_FEATURE_MOVBE ( 4*32+22)/* MOVBE instruction */ +#define X86_FEATURE_POPCNT ( 4*32+23)/* POPCNT instruction */ #define X86_FEATURE_TSC_DEADLINE_TIMER ( 4*32+24)/* Tsc deadline timer */ -#define X86_FEATURE_AES ( 4*32+25)/* AES instructions */ -#define X86_FEATURE_XSAVE ( 4*32+26)/* XSAVE/XRSTOR/XSETBV/XGETBV */ -#define X86_FEATURE_OSXSAVE ( 4*32+27)/* "" XSAVE enabled in the OS */ -#define X86_FEATURE_AVX ( 4*32+28)/* Advanced Vector Extensions */ -#define X86_FEATURE_F16C ( 4*32+29)/* 16-bit fp conversions */ -#define X86_FEATURE_RDRAND ( 4*32+30)/* The RDRAND instruction */ -#define X86_FEATURE_HYPERVISOR ( 4*32+31)/* Running on a hypervisor */ +#define X86_FEATURE_AES ( 4*32+25)/* AES instructions */ +#define X86_FEATURE_XSAVE ( 4*32+26)/* XSAVE/XRSTOR/XSETBV/XGETBV */ +#define X86_FEATURE_OSXSAVE ( 4*32+27)/* "" XSAVE enabled in the OS */ +#define X86_FEATURE_AVX ( 4*32+28)/* Advanced Vector Extensions */ +#define X86_FEATURE_F16C ( 4*32+29)/* 16-bit fp conversions */ +#define X86_FEATURE_RDRAND ( 4*32+30)/* The RDRAND instruction */ +#define X86_FEATURE_HYPERVISOR ( 4*32+31)/* Running on a hypervisor */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ -#define X86_FEATURE_XSTORE ( 5*32+ 2)/* "rng" RNG present (xstore) */ -#define X86_FEATURE_XSTORE_EN ( 5*32+ 3)/* "rng_en" RNG enabled */ -#define X86_FEATURE_XCRYPT ( 5*32+ 6)/* "ace" on-CPU crypto (xcrypt) */ -#define X86_FEATURE_XCRYPT_EN ( 5*32+ 7)/* "ace_en" on-CPU crypto enabled */ -#define X86_FEATURE_ACE2 ( 5*32+ 8)/* Advanced Cryptography Engine v2 */ -#define X86_FEATURE_ACE2_EN ( 5*32+ 9)/* ACE v2 enabled */ -#define X86_FEATURE_PHE ( 5*32+10)/* PadLock Hash Engine */ -#define X86_FEATURE_PHE_EN ( 5*32+11)/* PHE enabled */ -#define X86_FEATURE_PMM ( 5*32+12)/* PadLock Montgomery Multiplier */ -#define X86_FEATURE_PMM_EN ( 5*32+13)/* PMM enabled */ +#define X86_FEATURE_XSTORE ( 5*32+ 2)/* "rng" RNG present (xstore) */ +#define X86_FEATURE_XSTORE_EN ( 5*32+ 3)/* "rng_en" RNG enabled */ +#define X86_FEATURE_XCRYPT ( 5*32+ 6)/* "ace" on-CPU crypto (xcrypt) */ +#define X86_FEATURE_XCRYPT_EN ( 5*32+ 7)/* "ace_en" on-CPU crypto enabled */ +#define X86_FEATURE_ACE2 ( 5*32+ 8)/* Advanced Cryptography Engine v2 */ +#define X86_FEATURE_ACE2_EN ( 5*32+ 9)/* ACE v2 enabled */ +#define X86_FEATURE_PHE ( 5*32+10)/* PadLock Hash Engine */ +#define X86_FEATURE_PHE_EN ( 5*32+11)/* PHE enabled */ +#define X86_FEATURE_PMM ( 5*32+12)/* PadLock Montgomery Multiplier */ +#define X86_FEATURE_PMM_EN ( 5*32+13)/* PMM enabled */ /* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */ -#define X86_FEATURE_LAHF_LM ( 6*32+ 0)/* LAHF/SAHF in long mode */ -#define X86_FEATURE_CMP_LEGACY ( 6*32+ 1)/* If yes HyperThreading not valid */ -#define X86_FEATURE_SVM ( 6*32+ 2)/* Secure virtual machine */ -#define X86_FEATURE_EXTAPIC ( 6*32+ 3)/* Extended APIC space */ -#define X86_FEATURE_CR8_LEGACY ( 6*32+ 4)/* CR8 in 32-bit mode */ -#define X86_FEATURE_ABM ( 6*32+ 5)/* Advanced bit manipulation */ -#define X86_FEATURE_SSE4A ( 6*32+ 6)/* SSE-4A */ -#define X86_FEATURE_MISALIGNSSE ( 6*32+ 7)/* Misaligned SSE mode */ -#define X86_FEATURE_3DNOWPREFETCH ( 6*32+ 8)/* 3DNow prefetch instructions */ -#define X86_FEATURE_OSVW ( 6*32+ 9)/* OS Visible Workaround */ -#define X86_FEATURE_IBS ( 6*32+10)/* Instruction Based Sampling */ -#define X86_FEATURE_XOP ( 6*32+11)/* extended AVX instructions */ -#define X86_FEATURE_SKINIT ( 6*32+12)/* SKINIT/STGI instructions */ -#define X86_FEATURE_WDT ( 6*32+13)/* Watchdog timer */ -#define X86_FEATURE_LWP ( 6*32+15)/* Light Weight Profiling */ -#define X86_FEATURE_FMA4 ( 6*32+16)/* 4 operands MAC instructions */ -#define X86_FEATURE_TCE ( 6*32+17)/* translation cache extension */ -#define X86_FEATURE_NODEID_MSR ( 6*32+19)/* NodeId MSR */ -#define X86_FEATURE_TBM ( 6*32+21)/* trailing bit manipulations */ -#define X86_FEATURE_TOPOEXT ( 6*32+22)/* topology extensions CPUID leafs */ -#define X86_FEATURE_PERFCTR_CORE ( 6*32+23)/* core performance counter extensions */ -#define X86_FEATURE_PERFCTR_NB ( 6*32+24)/* NB performance counter extensions */ -#define X86_FEATURE_BPEXT (6*32+26)/* data breakpoint extension */ -#define X86_FEATURE_PTSC ( 6*32+27)/* performance time-stamp counter */ -#define X86_FEATURE_PERFCTR_LLC ( 6*32+28)/* Last Level Cache performance counter extensions */ -#define X86_FEATURE_MWAITX ( 6*32+29)/* MWAIT extension (MONITORX/MWAITX) */ +#define X86_FEATURE_LAHF_LM ( 6*32+ 0)/* LAHF/SAHF in long mode */ +#define X86_FEATURE_CMP_LEGACY ( 6*32+ 1)/* If yes HyperThreading not valid */ +#define X86_FEATURE_SVM ( 6*32+ 2)/* Secure virtual machine */ +#define X86_FEATURE_EXTAPIC ( 6*32+ 3)/* Extended APIC space */ +#define X86_FEATURE_CR8_LEGACY ( 6*32+ 4)/* CR8 in 32-bit mode */ +#define X86_FEATURE_ABM ( 6*32+ 5)/* Advanced bit manipulation */ +#define X86_FEATURE_SSE4A ( 6*32+ 6)/* SSE-4A */ +#define X86_FEATURE_MISALIGNSSE ( 6*32+ 7)/* Misaligned SSE mode */ +#define X86_FEATURE_3DNOWPREFETCH ( 6*32+ 8)/* 3DNow prefetch instructions */ +#define X86_FEATURE_OSVW ( 6*32+ 9)/* OS Visible Workaround */ +#define X86_FEATURE_IBS ( 6*32+10)/* Instruction Based Sampling */ +#define X86_FEATURE_XOP ( 6*32+11)/* extended AVX instructions */ +#define X86_FEATURE_SKINIT ( 6*32+12)/* SKINIT/STGI instructions */ +#define X86_FEATURE_WDT ( 6*32+13)/* Watchdog timer */ +#define X86_FEATURE_LWP ( 6*32+15)/* Light Weight Profiling */ +#define X86_FEATURE_FMA4 ( 6*32+16)/* 4 operands MAC instructions */ +#define X86_FEATURE_TCE ( 6*32+17)/* translation cache extension */ +#define X86_FEATURE_NODEID_MSR ( 6*32+19)/* NodeId MSR */ +#define X86_FEATURE_TBM ( 6*32+21)/* trailing bit manipulations */ +#define X86_FEATURE_TOPOEXT ( 6*32+22)/* topology extensions CPUID leafs */ +#define X86_FEATURE_PERFCTR_CORE ( 6*32+23)/* core performance counter extensions */ +#define X86_FEATURE_PERFCTR_NB ( 6*32+24)/* NB performance counter extensions */ +#define X86_FEATURE_BPEXT (6*32+26)/* data breakpoint extension */ +#define X86_FEATURE_PTSC ( 6*32+27)/* performance time-stamp counter */ +#define X86_FEATURE_PERFCTR_LLC ( 6*32+28)/* Last Level Cache performance counter extensions */ +#define X86_FEATURE_MWAITX ( 6*32+29)/* MWAIT extension (MONITORX/MWAITX) */ /* * Auxiliary flags: Linux defined - For features scattered in various
@@ -192,152 +192,152 @@* * Reuse free bits when adding new feature flags! */ -#define X86_FEATURE_RING3MWAIT ( 7*32+ 0)/* Ring 3 MONITOR/MWAIT */ -#define X86_FEATURE_CPUID_FAULT ( 7*32+ 1)/* Intel CPUID faulting */ -#define X86_FEATURE_CPB ( 7*32+ 2)/* AMD Core Performance Boost */ -#define X86_FEATURE_EPB ( 7*32+ 3)/* IA32_ENERGY_PERF_BIAS support */ -#define X86_FEATURE_CAT_L3 ( 7*32+ 4)/* Cache Allocation Technology L3 */ -#define X86_FEATURE_CAT_L2 ( 7*32+ 5)/* Cache Allocation Technology L2 */ -#define X86_FEATURE_CDP_L3 ( 7*32+ 6)/* Code and Data Prioritization L3 */ - -#define X86_FEATURE_HW_PSTATE ( 7*32+ 8)/* AMD HW-PState */ -#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9)/* AMD ProcFeedbackInterface */ -#define X86_FEATURE_SME ( 7*32+10)/* AMD Secure Memory Encryption */ - -#define X86_FEATURE_INTEL_PPIN ( 7*32+14)/* Intel Processor Inventory Number */ -#define X86_FEATURE_INTEL_PT ( 7*32+15)/* Intel Processor Trace */ -#define X86_FEATURE_AVX512_4VNNIW (7*32+16)/* AVX-512 Neural Network Instructions */ -#define X86_FEATURE_AVX512_4FMAPS (7*32+17)/* AVX-512 Multiply Accumulation Single precision */ +#define X86_FEATURE_RING3MWAIT ( 7*32+ 0)/* Ring 3 MONITOR/MWAIT */ +#define X86_FEATURE_CPUID_FAULT ( 7*32+ 1)/* Intel CPUID faulting */ +#define X86_FEATURE_CPB ( 7*32+ 2)/* AMD Core Performance Boost */ +#define X86_FEATURE_EPB ( 7*32+ 3)/* IA32_ENERGY_PERF_BIAS support */ +#define X86_FEATURE_CAT_L3 ( 7*32+ 4)/* Cache Allocation Technology L3 */ +#define X86_FEATURE_CAT_L2 ( 7*32+ 5)/* Cache Allocation Technology L2 */ +#define X86_FEATURE_CDP_L3 ( 7*32+ 6)/* Code and Data Prioritization L3 */ + +#define X86_FEATURE_HW_PSTATE ( 7*32+ 8)/* AMD HW-PState */ +#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9)/* AMD ProcFeedbackInterface */ +#define X86_FEATURE_SME ( 7*32+10)/* AMD Secure Memory Encryption */ + +#define X86_FEATURE_INTEL_PPIN ( 7*32+14)/* Intel Processor Inventory Number */ +#define X86_FEATURE_INTEL_PT ( 7*32+15)/* Intel Processor Trace */ +#define X86_FEATURE_AVX512_4VNNIW (7*32+16)/* AVX-512 Neural Network Instructions */ +#define X86_FEATURE_AVX512_4FMAPS (7*32+17)/* AVX-512 Multiply Accumulation Single precision */ -#define X86_FEATURE_MBA ( 7*32+18)/* Memory Bandwidth Allocation */ +#define X86_FEATURE_MBA ( 7*32+18)/* Memory Bandwidth Allocation */ /* Virtualization flags: Linux defined, word 8 */ -#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0)/* Intel TPR Shadow */ -#define X86_FEATURE_VNMI ( 8*32+ 1)/* Intel Virtual NMI */ -#define X86_FEATURE_FLEXPRIORITY ( 8*32+ 2)/* Intel FlexPriority */ -#define X86_FEATURE_EPT ( 8*32+ 3)/* Intel Extended Page Table */ -#define X86_FEATURE_VPID ( 8*32+ 4)/* Intel Virtual Processor ID */ +#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0)/* Intel TPR Shadow */ +#define X86_FEATURE_VNMI ( 8*32+ 1)/* Intel Virtual NMI */ +#define X86_FEATURE_FLEXPRIORITY ( 8*32+ 2)/* Intel FlexPriority */ +#define X86_FEATURE_EPT ( 8*32+ 3)/* Intel Extended Page Table */ +#define X86_FEATURE_VPID ( 8*32+ 4)/* Intel Virtual Processor ID */ -#define X86_FEATURE_VMMCALL ( 8*32+15)/* Prefer vmmcall to vmcall */ -#define X86_FEATURE_XENPV ( 8*32+16)/* "" Xen paravirtual guest */ +#define X86_FEATURE_VMMCALL ( 8*32+15)/* Prefer vmmcall to vmcall */ +#define X86_FEATURE_XENPV ( 8*32+16)/* "" Xen paravirtual guest */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */ -#define X86_FEATURE_FSGSBASE ( 9*32+ 0)/* {RD/WR}{FS/GS}BASE instructions*/ -#define X86_FEATURE_TSC_ADJUST ( 9*32+ 1)/* TSC adjustment MSR 0x3b */ -#define X86_FEATURE_BMI1 ( 9*32+ 3)/* 1st group bit manipulation extensions */ -#define X86_FEATURE_HLE ( 9*32+ 4)/* Hardware Lock Elision */ -#define X86_FEATURE_AVX2 ( 9*32+ 5)/* AVX2 instructions */ -#define X86_FEATURE_SMEP ( 9*32+ 7)/* Supervisor Mode Execution Protection */ -#define X86_FEATURE_BMI2 ( 9*32+ 8)/* 2nd group bit manipulation extensions */ -#define X86_FEATURE_ERMS ( 9*32+ 9)/* Enhanced REP MOVSB/STOSB */ -#define X86_FEATURE_INVPCID ( 9*32+10)/* Invalidate Processor Context ID */ -#define X86_FEATURE_RTM ( 9*32+11)/* Restricted Transactional Memory */ -#define X86_FEATURE_CQM ( 9*32+12)/* Cache QoS Monitoring */ -#define X86_FEATURE_MPX ( 9*32+14)/* Memory Protection Extension */ -#define X86_FEATURE_RDT_A ( 9*32+15)/* Resource Director Technology Allocation */ -#define X86_FEATURE_AVX512F ( 9*32+16)/* AVX-512 Foundation */ -#define X86_FEATURE_AVX512DQ ( 9*32+17)/* AVX-512 DQ (Double/Quad granular) Instructions */ -#define X86_FEATURE_RDSEED ( 9*32+18)/* The RDSEED instruction */ -#define X86_FEATURE_ADX ( 9*32+19)/* The ADCX and ADOX instructions */ -#define X86_FEATURE_SMAP ( 9*32+20)/* Supervisor Mode Access Prevention */ -#define X86_FEATURE_AVX512IFMA ( 9*32+21)/* AVX-512 Integer Fused Multiply-Add instructions */ -#define X86_FEATURE_CLFLUSHOPT ( 9*32+23)/* CLFLUSHOPT instruction */ -#define X86_FEATURE_CLWB ( 9*32+24)/* CLWB instruction */ -#define X86_FEATURE_AVX512PF ( 9*32+26)/* AVX-512 Prefetch */ -#define X86_FEATURE_AVX512ER ( 9*32+27)/* AVX-512 Exponential and Reciprocal */ -#define X86_FEATURE_AVX512CD ( 9*32+28)/* AVX-512 Conflict Detection */ -#define X86_FEATURE_SHA_NI ( 9*32+29)/* SHA1/SHA256 Instruction Extensions */ -#define X86_FEATURE_AVX512BW ( 9*32+30)/* AVX-512 BW (Byte/Word granular) Instructions */ -#define X86_FEATURE_AVX512VL ( 9*32+31)/* AVX-512 VL (128/256 Vector Length) Extensions */ +#define X86_FEATURE_FSGSBASE ( 9*32+ 0)/* {RD/WR}{FS/GS}BASE instructions*/ +#define X86_FEATURE_TSC_ADJUST ( 9*32+ 1)/* TSC adjustment MSR 0x3b */ +#define X86_FEATURE_BMI1 ( 9*32+ 3)/* 1st group bit manipulation extensions */ +#define X86_FEATURE_HLE ( 9*32+ 4)/* Hardware Lock Elision */ +#define X86_FEATURE_AVX2 ( 9*32+ 5)/* AVX2 instructions */ +#define X86_FEATURE_SMEP ( 9*32+ 7)/* Supervisor Mode Execution Protection */ +#define X86_FEATURE_BMI2 ( 9*32+ 8)/* 2nd group bit manipulation extensions */ +#define X86_FEATURE_ERMS ( 9*32+ 9)/* Enhanced REP MOVSB/STOSB */ +#define X86_FEATURE_INVPCID ( 9*32+10)/* Invalidate Processor Context ID */ +#define X86_FEATURE_RTM ( 9*32+11)/* Restricted Transactional Memory */ +#define X86_FEATURE_CQM ( 9*32+12)/* Cache QoS Monitoring */ +#define X86_FEATURE_MPX ( 9*32+14)/* Memory Protection Extension */ +#define X86_FEATURE_RDT_A ( 9*32+15)/* Resource Director Technology Allocation */ +#define X86_FEATURE_AVX512F ( 9*32+16)/* AVX-512 Foundation */ +#define X86_FEATURE_AVX512DQ ( 9*32+17)/* AVX-512 DQ (Double/Quad granular) Instructions */ +#define X86_FEATURE_RDSEED ( 9*32+18)/* The RDSEED instruction */ +#define X86_FEATURE_ADX ( 9*32+19)/* The ADCX and ADOX instructions */ +#define X86_FEATURE_SMAP ( 9*32+20)/* Supervisor Mode Access Prevention */ +#define X86_FEATURE_AVX512IFMA ( 9*32+21)/* AVX-512 Integer Fused Multiply-Add instructions */ +#define X86_FEATURE_CLFLUSHOPT ( 9*32+23)/* CLFLUSHOPT instruction */ +#define X86_FEATURE_CLWB ( 9*32+24)/* CLWB instruction */ +#define X86_FEATURE_AVX512PF ( 9*32+26)/* AVX-512 Prefetch */ +#define X86_FEATURE_AVX512ER ( 9*32+27)/* AVX-512 Exponential and Reciprocal */ +#define X86_FEATURE_AVX512CD ( 9*32+28)/* AVX-512 Conflict Detection */ +#define X86_FEATURE_SHA_NI ( 9*32+29)/* SHA1/SHA256 Instruction Extensions */ +#define X86_FEATURE_AVX512BW ( 9*32+30)/* AVX-512 BW (Byte/Word granular) Instructions */ +#define X86_FEATURE_AVX512VL ( 9*32+31)/* AVX-512 VL (128/256 Vector Length) Extensions */ /* Extended state features, CPUID level 0x0000000d:1 (eax), word 10 */ -#define X86_FEATURE_XSAVEOPT (10*32+ 0)/* XSAVEOPT */ -#define X86_FEATURE_XSAVEC (10*32+ 1)/* XSAVEC */ -#define X86_FEATURE_XGETBV1 (10*32+ 2)/* XGETBV with ECX = 1 */ -#define X86_FEATURE_XSAVES (10*32+ 3)/* XSAVES/XRSTORS */ +#define X86_FEATURE_XSAVEOPT (10*32+ 0)/* XSAVEOPT */ +#define X86_FEATURE_XSAVEC (10*32+ 1)/* XSAVEC */ +#define X86_FEATURE_XGETBV1 (10*32+ 2)/* XGETBV with ECX = 1 */ +#define X86_FEATURE_XSAVES (10*32+ 3)/* XSAVES/XRSTORS */ /* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:0 (edx), word 11 */ -#define X86_FEATURE_CQM_LLC (11*32+ 1)/* LLC QoS if 1 */ +#define X86_FEATURE_CQM_LLC (11*32+ 1)/* LLC QoS if 1 */ /* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:1 (edx), word 12 */ -#define X86_FEATURE_CQM_OCCUP_LLC (12*32+ 0)/* LLC occupancy monitoring if 1 */ -#define X86_FEATURE_CQM_MBM_TOTAL (12*32+ 1)/* LLC Total MBM monitoring */ -#define X86_FEATURE_CQM_MBM_LOCAL (12*32+ 2)/* LLC Local MBM monitoring */ +#define X86_FEATURE_CQM_OCCUP_LLC (12*32+ 0)/* LLC occupancy monitoring if 1 */ +#define X86_FEATURE_CQM_MBM_TOTAL (12*32+ 1)/* LLC Total MBM monitoring */ +#define X86_FEATURE_CQM_MBM_LOCAL (12*32+ 2)/* LLC Local MBM monitoring */ /* AMD-defined CPU features, CPUID level 0x80000008 (ebx), word 13 */ -#define X86_FEATURE_CLZERO (13*32+0)/* CLZERO instruction */ -#define X86_FEATURE_IRPERF (13*32+1)/* Instructions Retired Count */ +#define X86_FEATURE_CLZERO (13*32+0)/* CLZERO instruction */ +#define X86_FEATURE_IRPERF (13*32+1)/* Instructions Retired Count */ /* Thermal and Power Management Leaf, CPUID level 0x00000006 (eax), word 14 */ -#define X86_FEATURE_DTHERM (14*32+ 0)/* Digital Thermal Sensor */ -#define X86_FEATURE_IDA (14*32+ 1)/* Intel Dynamic Acceleration */ -#define X86_FEATURE_ARAT (14*32+ 2)/* Always Running APIC Timer */ -#define X86_FEATURE_PLN (14*32+ 4)/* Intel Power Limit Notification */ -#define X86_FEATURE_PTS (14*32+ 6)/* Intel Package Thermal Status */ -#define X86_FEATURE_HWP (14*32+ 7)/* Intel Hardware P-states */ -#define X86_FEATURE_HWP_NOTIFY (14*32+ 8)/* HWP Notification */ -#define X86_FEATURE_HWP_ACT_WINDOW (14*32+ 9)/* HWP Activity Window */ -#define X86_FEATURE_HWP_EPP (14*32+10)/* HWP Energy Perf. Preference */ -#define X86_FEATURE_HWP_PKG_REQ (14*32+11)/* HWP Package Level Request */ +#define X86_FEATURE_DTHERM (14*32+ 0)/* Digital Thermal Sensor */ +#define X86_FEATURE_IDA (14*32+ 1)/* Intel Dynamic Acceleration */ +#define X86_FEATURE_ARAT (14*32+ 2)/* Always Running APIC Timer */ +#define X86_FEATURE_PLN (14*32+ 4)/* Intel Power Limit Notification */ +#define X86_FEATURE_PTS (14*32+ 6)/* Intel Package Thermal Status */ +#define X86_FEATURE_HWP (14*32+ 7)/* Intel Hardware P-states */ +#define X86_FEATURE_HWP_NOTIFY (14*32+ 8)/* HWP Notification */ +#define X86_FEATURE_HWP_ACT_WINDOW (14*32+ 9)/* HWP Activity Window */ +#define X86_FEATURE_HWP_EPP (14*32+10)/* HWP Energy Perf. Preference */ +#define X86_FEATURE_HWP_PKG_REQ (14*32+11)/* HWP Package Level Request */ /* AMD SVM Feature Identification, CPUID level 0x8000000a (edx), word 15 */ -#define X86_FEATURE_NPT (15*32+ 0)/* Nested Page Table support */ -#define X86_FEATURE_LBRV (15*32+ 1)/* LBR Virtualization support */ -#define X86_FEATURE_SVML (15*32+ 2)/* "svm_lock" SVM locking MSR */ -#define X86_FEATURE_NRIPS (15*32+ 3)/* "nrip_save" SVM next_rip save */ -#define X86_FEATURE_TSCRATEMSR (15*32+ 4)/* "tsc_scale" TSC scaling support */ -#define X86_FEATURE_VMCBCLEAN (15*32+ 5)/* "vmcb_clean" VMCB clean bits support */ -#define X86_FEATURE_FLUSHBYASID (15*32+ 6)/* flush-by-ASID support */ -#define X86_FEATURE_DECODEASSISTS (15*32+ 7)/* Decode Assists support */ -#define X86_FEATURE_PAUSEFILTER (15*32+10)/* filtered pause intercept */ -#define X86_FEATURE_PFTHRESHOLD (15*32+12)/* pause filter threshold */ -#define X86_FEATURE_AVIC (15*32+13)/* Virtual Interrupt Controller */ -#define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15)/* Virtual VMSAVE VMLOAD */ -#define X86_FEATURE_VGIF (15*32+16)/* Virtual GIF */ +#define X86_FEATURE_NPT (15*32+ 0)/* Nested Page Table support */ +#define X86_FEATURE_LBRV (15*32+ 1)/* LBR Virtualization support */ +#define X86_FEATURE_SVML (15*32+ 2)/* "svm_lock" SVM locking MSR */ +#define X86_FEATURE_NRIPS (15*32+ 3)/* "nrip_save" SVM next_rip save */ +#define X86_FEATURE_TSCRATEMSR (15*32+ 4)/* "tsc_scale" TSC scaling support */ +#define X86_FEATURE_VMCBCLEAN (15*32+ 5)/* "vmcb_clean" VMCB clean bits support */ +#define X86_FEATURE_FLUSHBYASID (15*32+ 6)/* flush-by-ASID support */ +#define X86_FEATURE_DECODEASSISTS (15*32+ 7)/* Decode Assists support */ +#define X86_FEATURE_PAUSEFILTER (15*32+10)/* filtered pause intercept */ +#define X86_FEATURE_PFTHRESHOLD (15*32+12)/* pause filter threshold */ +#define X86_FEATURE_AVIC (15*32+13)/* Virtual Interrupt Controller */ +#define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15)/* Virtual VMSAVE VMLOAD */ +#define X86_FEATURE_VGIF (15*32+16)/* Virtual GIF */ /* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */ -#define X86_FEATURE_AVX512VBMI (16*32+ 1)/* AVX512 Vector Bit Manipulation instructions*/ -#define X86_FEATURE_PKU (16*32+ 3)/* Protection Keys for Userspace */ -#define X86_FEATURE_OSPKE (16*32+ 4)/* OS Protection Keys Enable */ -#define X86_FEATURE_AVX512_VBMI2 (16*32+ 6)/* Additional AVX512 Vector Bit Manipulation Instructions */ -#define X86_FEATURE_GFNI (16*32+ 8)/* Galois Field New Instructions */ -#define X86_FEATURE_VAES (16*32+ 9)/* Vector AES */ -#define X86_FEATURE_VPCLMULQDQ (16*32+ 10)/* Carry-Less Multiplication Double Quadword */ -#define X86_FEATURE_AVX512_VNNI (16*32+ 11)/* Vector Neural Network Instructions */ -#define X86_FEATURE_AVX512_BITALG (16*32+12)/* Support for VPOPCNT[B,W] and VPSHUF-BITQMB */ -#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14)/* POPCNT for vectors of DW/QW */ -#define X86_FEATURE_LA57 (16*32+16)/* 5-level page tables */ -#define X86_FEATURE_RDPID (16*32+22)/* RDPID instruction */ +#define X86_FEATURE_AVX512VBMI (16*32+ 1)/* AVX512 Vector Bit Manipulation instructions*/ +#define X86_FEATURE_PKU (16*32+ 3)/* Protection Keys for Userspace */ +#define X86_FEATURE_OSPKE (16*32+ 4)/* OS Protection Keys Enable */ +#define X86_FEATURE_AVX512_VBMI2 (16*32+ 6)/* Additional AVX512 Vector Bit Manipulation Instructions */ +#define X86_FEATURE_GFNI (16*32+ 8)/* Galois Field New Instructions */ +#define X86_FEATURE_VAES (16*32+ 9)/* Vector AES */ +#define X86_FEATURE_VPCLMULQDQ (16*32+ 10)/* Carry-Less Multiplication Double Quadword */ +#define X86_FEATURE_AVX512_VNNI (16*32+ 11)/* Vector Neural Network Instructions */ +#define X86_FEATURE_AVX512_BITALG (16*32+12)/* Support for VPOPCNT[B,W] and VPSHUF-BITQMB */ +#define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14)/* POPCNT for vectors of DW/QW */ +#define X86_FEATURE_LA57 (16*32+16)/* 5-level page tables */ +#define X86_FEATURE_RDPID (16*32+22)/* RDPID instruction */ /* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */ -#define X86_FEATURE_OVERFLOW_RECOV (17*32+0)/* MCA overflow recovery support */ -#define X86_FEATURE_SUCCOR (17*32+1)/* Uncorrectable error containment and recovery */ -#define X86_FEATURE_SMCA (17*32+3)/* Scalable MCA */ +#define X86_FEATURE_OVERFLOW_RECOV (17*32+0)/* MCA overflow recovery support */ +#define X86_FEATURE_SUCCOR (17*32+1)/* Uncorrectable error containment and recovery */ +#define X86_FEATURE_SMCA (17*32+3)/* Scalable MCA */ /* * BUG word(s) */ -#define X86_BUG (x) (NCAPINTS*32 + (x)) +#define X86_BUG (x) (NCAPINTS*32 + (x)) -#define X86_BUG_F00F X86_BUG(0)/* Intel F00F */ -#define X86_BUG_FDIV X86_BUG(1)/* FPU FDIV */ -#define X86_BUG_COMA X86_BUG(2)/* Cyrix 6x86 coma */ -#define X86_BUG_AMD_TLB_MMATCH X86_BUG(3)/* "tlb_mmatch" AMD Erratum 383 */ -#define X86_BUG_AMD_APIC_C1E X86_BUG(4)/* "apic_c1e" AMD Erratum 400 */ -#define X86_BUG_11AP X86_BUG(5)/* Bad local APIC aka 11AP */ -#define X86_BUG_FXSAVE_LEAK X86_BUG(6)/* FXSAVE leaks FOP/FIP/FOP */ -#define X86_BUG_CLFLUSH_MONITOR X86_BUG(7)/* AAI65, CLFLUSH required before MONITOR */ -#define X86_BUG_SYSRET_SS_ATTRS X86_BUG(8)/* SYSRET doesn't fix up SS attrs */ +#define X86_BUG_F00F X86_BUG(0)/* Intel F00F */ +#define X86_BUG_FDIV X86_BUG(1)/* FPU FDIV */ +#define X86_BUG_COMA X86_BUG(2)/* Cyrix 6x86 coma */ +#define X86_BUG_AMD_TLB_MMATCH X86_BUG(3)/* "tlb_mmatch" AMD Erratum 383 */ +#define X86_BUG_AMD_APIC_C1E X86_BUG(4)/* "apic_c1e" AMD Erratum 400 */ +#define X86_BUG_11AP X86_BUG(5)/* Bad local APIC aka 11AP */ +#define X86_BUG_FXSAVE_LEAK X86_BUG(6)/* FXSAVE leaks FOP/FIP/FOP */ +#define X86_BUG_CLFLUSH_MONITOR X86_BUG(7)/* AAI65, CLFLUSH required before MONITOR */ +#define X86_BUG_SYSRET_SS_ATTRS X86_BUG(8)/* SYSRET doesn't fix up SS attrs */ #ifdef CONFIG_X86_32 /* * 64-bit kernels don't use X86_BUG_ESPFIX. Make the define conditional * to avoid confusion. */ -#define X86_BUG_ESPFIX X86_BUG(9)/* "" IRET to 16-bit SS corrupts ESP/RSP high bits */ +#define X86_BUG_ESPFIX X86_BUG(9)/* "" IRET to 16-bit SS corrupts ESP/RSP high bits */ #endif -#define X86_BUG_NULL_SEG X86_BUG(10)/* Nulling a selector preserves the base */ -#define X86_BUG_SWAPGS_FENCE X86_BUG(11)/* SWAPGS without input dep on GS */ -#define X86_BUG_MONITOR X86_BUG(12)/* IPI required to wake up remote CPU */ -#define X86_BUG_AMD_E400 X86_BUG(13)/* CPU is among the affected by Erratum 400 */ +#define X86_BUG_NULL_SEG X86_BUG(10)/* Nulling a selector preserves the base */ +#define X86_BUG_SWAPGS_FENCE X86_BUG(11)/* SWAPGS without input dep on GS */ +#define X86_BUG_MONITOR X86_BUG(12)/* IPI required to wake up remote CPU */ +#define X86_BUG_AMD_E400 X86_BUG(13)/* CPU is among the affected by Erratum 400 */ #endif /* _ASM_X86_CPUFEATURES_H */
Greg Kroah-Hartman
maintainerPATCH 60/159 x86/cpufeatures: Fix various details in the feature definitions
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
commit f3a624e901c633593156f7b00ca743a6204a29bc upstream.
Kept this commit separate from the re-tabulation changes, to make the changes easier to review:
- add better explanation for entries with no explanation
- fix/enhance the text of some of the entries
- fix the vertical alignment of some of the feature number definitions
- fix inconsistent capitalization
- ... and lots of other small details
i.e. make it all more of a coherent unit, instead of a patchwork of years of additions.
--- arch/x86/include/asm/cpufeatures.h | 149 ++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 75 deletions(-)
arch/x86/include/asm/cpufeatures.h +74 -75
@@ -20,14 +20,12 @@* Note: If the comment begins with a quoted string, that string is used * in /proc/cpuinfo instead of the macro name. If the string is "", * this feature bit is not displayed in /proc/cpuinfo at all. -*/ - -/* +* * When adding new features here that depend on other features, -* please update the table in kernel/cpu/cpuid-deps.c +* please update the table in kernel/cpu/cpuid-deps.c as well. */ -/* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */ +/* Intel-defined CPU features, CPUID level 0x00000001 (EDX), word 0 */ #define X86_FEATURE_FPU ( 0*32+ 0)/* Onboard FPU */ #define X86_FEATURE_VME ( 0*32+ 1)/* Virtual Mode Extensions */ #define X86_FEATURE_DE ( 0*32+ 2)/* Debugging Extensions */
@@ -42,8 +40,7 @@#define X86_FEATURE_MTRR ( 0*32+12)/* Memory Type Range Registers */ #define X86_FEATURE_PGE ( 0*32+13)/* Page Global Enable */ #define X86_FEATURE_MCA ( 0*32+14)/* Machine Check Architecture */ -#define X86_FEATURE_CMOV ( 0*32+15)/* CMOV instructions */ -/* (plus FCMOVcc, FCOMI with FPU) */ +#define X86_FEATURE_CMOV ( 0*32+15)/* CMOV instructions (plus FCMOVcc, FCOMI with FPU) */ #define X86_FEATURE_PAT ( 0*32+16)/* Page Attribute Table */ #define X86_FEATURE_PSE36 ( 0*32+17)/* 36-bit PSEs */ #define X86_FEATURE_PN ( 0*32+18)/* Processor serial number */
@@ -63,15 +60,15 @@/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */ /* Don't duplicate feature flags which are redundant with Intel! */ #define X86_FEATURE_SYSCALL ( 1*32+11)/* SYSCALL/SYSRET */ -#define X86_FEATURE_MP ( 1*32+19)/* MP Capable. */ +#define X86_FEATURE_MP ( 1*32+19)/* MP Capable */ #define X86_FEATURE_NX ( 1*32+20)/* Execute Disable */ #define X86_FEATURE_MMXEXT ( 1*32+22)/* AMD MMX extensions */ #define X86_FEATURE_FXSR_OPT ( 1*32+25)/* FXSAVE/FXRSTOR optimizations */ #define X86_FEATURE_GBPAGES ( 1*32+26)/* "pdpe1gb" GB pages */ #define X86_FEATURE_RDTSCP ( 1*32+27)/* RDTSCP */ -#define X86_FEATURE_LM ( 1*32+29)/* Long Mode (x86-64) */ -#define X86_FEATURE_3DNOWEXT ( 1*32+30)/* AMD 3DNow! extensions */ -#define X86_FEATURE_3DNOW ( 1*32+31)/* 3DNow! */ +#define X86_FEATURE_LM ( 1*32+29)/* Long Mode (x86-64, 64-bit support) */ +#define X86_FEATURE_3DNOWEXT ( 1*32+30)/* AMD 3DNow extensions */ +#define X86_FEATURE_3DNOW ( 1*32+31)/* 3DNow */ /* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */ #define X86_FEATURE_RECOVERY ( 2*32+ 0)/* CPU in recovery mode */
@@ -84,66 +81,67 @@#define X86_FEATURE_K6_MTRR ( 3*32+ 1)/* AMD K6 nonstandard MTRRs */ #define X86_FEATURE_CYRIX_ARR ( 3*32+ 2)/* Cyrix ARRs (= MTRRs) */ #define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3)/* Centaur MCRs (= MTRRs) */ -/* cpu types for specific tunings: */ + +/* CPU types for specific tunings: */ #define X86_FEATURE_K8 ( 3*32+ 4)/* "" Opteron, Athlon64 */ #define X86_FEATURE_K7 ( 3*32+ 5)/* "" Athlon */ #define X86_FEATURE_P3 ( 3*32+ 6)/* "" P3 */ #define X86_FEATURE_P4 ( 3*32+ 7)/* "" P4 */ #define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8)/* TSC ticks at a constant rate */ -#define X86_FEATURE_UP ( 3*32+ 9)/* smp kernel running on up */ -#define X86_FEATURE_ART ( 3*32+10)/* Platform has always running timer (ART) */ +#define X86_FEATURE_UP ( 3*32+ 9)/* SMP kernel running on UP */ +#define X86_FEATURE_ART ( 3*32+10)/* Always running timer (ART) */ #define X86_FEATURE_ARCH_PERFMON ( 3*32+11)/* Intel Architectural PerfMon */ #define X86_FEATURE_PEBS ( 3*32+12)/* Precise-Event Based Sampling */ #define X86_FEATURE_BTS ( 3*32+13)/* Branch Trace Store */ -#define X86_FEATURE_SYSCALL32 ( 3*32+14)/* "" syscall in ia32 userspace */ -#define X86_FEATURE_SYSENTER32 ( 3*32+15)/* "" sysenter in ia32 userspace */ -#define X86_FEATURE_REP_GOOD ( 3*32+16)/* rep microcode works well */ -#define X86_FEATURE_MFENCE_RDTSC ( 3*32+17)/* "" Mfence synchronizes RDTSC */ -#define X86_FEATURE_LFENCE_RDTSC ( 3*32+18)/* "" Lfence synchronizes RDTSC */ +#define X86_FEATURE_SYSCALL32 ( 3*32+14)/* "" syscall in IA32 userspace */ +#define X86_FEATURE_SYSENTER32 ( 3*32+15)/* "" sysenter in IA32 userspace */ +#define X86_FEATURE_REP_GOOD ( 3*32+16)/* REP microcode works well */ +#define X86_FEATURE_MFENCE_RDTSC ( 3*32+17)/* "" MFENCE synchronizes RDTSC */ +#define X86_FEATURE_LFENCE_RDTSC ( 3*32+18)/* "" LFENCE synchronizes RDTSC */ #define X86_FEATURE_ACC_POWER ( 3*32+19)/* AMD Accumulated Power Mechanism */ #define X86_FEATURE_NOPL ( 3*32+20)/* The NOPL (0F 1F) instructions */ #define X86_FEATURE_ALWAYS ( 3*32+21)/* "" Always-present feature */ -#define X86_FEATURE_XTOPOLOGY ( 3*32+22)/* cpu topology enum extensions */ +#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 */ #define X86_FEATURE_CPUID ( 3*32+25)/* CPU has CPUID instruction itself */ -#define X86_FEATURE_EXTD_APICID ( 3*32+26)/* has extended APICID (8 bits) */ -#define X86_FEATURE_AMD_DCM ( 3*32+27)/* multi-node processor */ -#define X86_FEATURE_APERFMPERF ( 3*32+28)/* APERFMPERF */ +#define X86_FEATURE_EXTD_APICID ( 3*32+26)/* Extended APICID (8 bits) */ +#define X86_FEATURE_AMD_DCM ( 3*32+27)/* AMD multi-node processor */ +#define X86_FEATURE_APERFMPERF ( 3*32+28)/* P-State hardware coordination feedback capability (APERF/MPERF MSRs) */ #define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30)/* TSC doesn't stop in S3 state */ #define X86_FEATURE_TSC_KNOWN_FREQ ( 3*32+31)/* TSC has known frequency */ -/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ +/* Intel-defined CPU features, CPUID level 0x00000001 (ECX), word 4 */ #define X86_FEATURE_XMM3 ( 4*32+ 0)/* "pni" SSE-3 */ #define X86_FEATURE_PCLMULQDQ ( 4*32+ 1)/* PCLMULQDQ instruction */ #define X86_FEATURE_DTES64 ( 4*32+ 2)/* 64-bit Debug Store */ -#define X86_FEATURE_MWAIT ( 4*32+ 3)/* "monitor" Monitor/Mwait support */ -#define X86_FEATURE_DSCPL ( 4*32+ 4)/* "ds_cpl" CPL Qual. Debug Store */ +#define X86_FEATURE_MWAIT ( 4*32+ 3)/* "monitor" MONITOR/MWAIT support */ +#define X86_FEATURE_DSCPL ( 4*32+ 4)/* "ds_cpl" CPL-qualified (filtered) Debug Store */ #define X86_FEATURE_VMX ( 4*32+ 5)/* Hardware virtualization */ -#define X86_FEATURE_SMX ( 4*32+ 6)/* Safer mode */ +#define X86_FEATURE_SMX ( 4*32+ 6)/* Safer Mode eXtensions */ #define X86_FEATURE_EST ( 4*32+ 7)/* Enhanced SpeedStep */ #define X86_FEATURE_TM2 ( 4*32+ 8)/* Thermal Monitor 2 */ #define X86_FEATURE_SSSE3 ( 4*32+ 9)/* Supplemental SSE-3 */ #define X86_FEATURE_CID ( 4*32+10)/* Context ID */ #define X86_FEATURE_SDBG ( 4*32+11)/* Silicon Debug */ #define X86_FEATURE_FMA ( 4*32+12)/* Fused multiply-add */ -#define X86_FEATURE_CX16 ( 4*32+13)/* CMPXCHG16B */ +#define X86_FEATURE_CX16 ( 4*32+13)/* CMPXCHG16B instruction */ #define X86_FEATURE_XTPR ( 4*32+14)/* Send Task Priority Messages */ -#define X86_FEATURE_PDCM ( 4*32+15)/* Performance Capabilities */ +#define X86_FEATURE_PDCM ( 4*32+15)/* Perf/Debug Capabilities MSR */ #define X86_FEATURE_PCID ( 4*32+17)/* Process Context Identifiers */ #define X86_FEATURE_DCA ( 4*32+18)/* Direct Cache Access */ #define X86_FEATURE_XMM4_1 ( 4*32+19)/* "sse4_1" SSE-4.1 */ #define X86_FEATURE_XMM4_2 ( 4*32+20)/* "sse4_2" SSE-4.2 */ -#define X86_FEATURE_X2APIC ( 4*32+21)/* x2APIC */ +#define X86_FEATURE_X2APIC ( 4*32+21)/* X2APIC */ #define X86_FEATURE_MOVBE ( 4*32+22)/* MOVBE instruction */ #define X86_FEATURE_POPCNT ( 4*32+23)/* POPCNT instruction */ -#define X86_FEATURE_TSC_DEADLINE_TIMER ( 4*32+24)/* Tsc deadline timer */ +#define X86_FEATURE_TSC_DEADLINE_TIMER ( 4*32+24)/* TSC deadline timer */ #define X86_FEATURE_AES ( 4*32+25)/* AES instructions */ -#define X86_FEATURE_XSAVE ( 4*32+26)/* XSAVE/XRSTOR/XSETBV/XGETBV */ -#define X86_FEATURE_OSXSAVE ( 4*32+27)/* "" XSAVE enabled in the OS */ +#define X86_FEATURE_XSAVE ( 4*32+26)/* XSAVE/XRSTOR/XSETBV/XGETBV instructions */ +#define X86_FEATURE_OSXSAVE ( 4*32+27)/* "" XSAVE instruction enabled in the OS */ #define X86_FEATURE_AVX ( 4*32+28)/* Advanced Vector Extensions */ -#define X86_FEATURE_F16C ( 4*32+29)/* 16-bit fp conversions */ -#define X86_FEATURE_RDRAND ( 4*32+30)/* The RDRAND instruction */ +#define X86_FEATURE_F16C ( 4*32+29)/* 16-bit FP conversions */ +#define X86_FEATURE_RDRAND ( 4*32+30)/* RDRAND instruction */ #define X86_FEATURE_HYPERVISOR ( 4*32+31)/* Running on a hypervisor */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
@@ -158,10 +156,10 @@#define X86_FEATURE_PMM ( 5*32+12)/* PadLock Montgomery Multiplier */ #define X86_FEATURE_PMM_EN ( 5*32+13)/* PMM enabled */ -/* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */ +/* More extended AMD flags: CPUID level 0x80000001, ECX, word 6 */ #define X86_FEATURE_LAHF_LM ( 6*32+ 0)/* LAHF/SAHF in long mode */ #define X86_FEATURE_CMP_LEGACY ( 6*32+ 1)/* If yes HyperThreading not valid */ -#define X86_FEATURE_SVM ( 6*32+ 2)/* Secure virtual machine */ +#define X86_FEATURE_SVM ( 6*32+ 2)/* Secure Virtual Machine */ #define X86_FEATURE_EXTAPIC ( 6*32+ 3)/* Extended APIC space */ #define X86_FEATURE_CR8_LEGACY ( 6*32+ 4)/* CR8 in 32-bit mode */ #define X86_FEATURE_ABM ( 6*32+ 5)/* Advanced bit manipulation */
@@ -175,16 +173,16 @@#define X86_FEATURE_WDT ( 6*32+13)/* Watchdog timer */ #define X86_FEATURE_LWP ( 6*32+15)/* Light Weight Profiling */ #define X86_FEATURE_FMA4 ( 6*32+16)/* 4 operands MAC instructions */ -#define X86_FEATURE_TCE ( 6*32+17)/* translation cache extension */ +#define X86_FEATURE_TCE ( 6*32+17)/* Translation Cache Extension */ #define X86_FEATURE_NODEID_MSR ( 6*32+19)/* NodeId MSR */ -#define X86_FEATURE_TBM ( 6*32+21)/* trailing bit manipulations */ -#define X86_FEATURE_TOPOEXT ( 6*32+22)/* topology extensions CPUID leafs */ -#define X86_FEATURE_PERFCTR_CORE ( 6*32+23)/* core performance counter extensions */ +#define X86_FEATURE_TBM ( 6*32+21)/* Trailing Bit Manipulations */ +#define X86_FEATURE_TOPOEXT ( 6*32+22)/* Topology extensions CPUID leafs */ +#define X86_FEATURE_PERFCTR_CORE ( 6*32+23)/* Core performance counter extensions */ #define X86_FEATURE_PERFCTR_NB ( 6*32+24)/* NB performance counter extensions */ -#define X86_FEATURE_BPEXT (6*32+26)/* data breakpoint extension */ -#define X86_FEATURE_PTSC ( 6*32+27)/* performance time-stamp counter */ +#define X86_FEATURE_BPEXT ( 6*32+26)/* Data breakpoint extension */ +#define X86_FEATURE_PTSC ( 6*32+27)/* Performance time-stamp counter */ #define X86_FEATURE_PERFCTR_LLC ( 6*32+28)/* Last Level Cache performance counter extensions */ -#define X86_FEATURE_MWAITX ( 6*32+29)/* MWAIT extension (MONITORX/MWAITX) */ +#define X86_FEATURE_MWAITX ( 6*32+29)/* MWAIT extension (MONITORX/MWAITX instructions) */ /* * Auxiliary flags: Linux defined - For features scattered in various
@@ -192,7 +190,7 @@* * Reuse free bits when adding new feature flags! */ -#define X86_FEATURE_RING3MWAIT ( 7*32+ 0)/* Ring 3 MONITOR/MWAIT */ +#define X86_FEATURE_RING3MWAIT ( 7*32+ 0)/* Ring 3 MONITOR/MWAIT instructions */ #define X86_FEATURE_CPUID_FAULT ( 7*32+ 1)/* Intel CPUID faulting */ #define X86_FEATURE_CPB ( 7*32+ 2)/* AMD Core Performance Boost */ #define X86_FEATURE_EPB ( 7*32+ 3)/* IA32_ENERGY_PERF_BIAS support */
@@ -206,8 +204,8 @@#define X86_FEATURE_INTEL_PPIN ( 7*32+14)/* Intel Processor Inventory Number */ #define X86_FEATURE_INTEL_PT ( 7*32+15)/* Intel Processor Trace */ -#define X86_FEATURE_AVX512_4VNNIW (7*32+16)/* AVX-512 Neural Network Instructions */ -#define X86_FEATURE_AVX512_4FMAPS (7*32+17)/* AVX-512 Multiply Accumulation Single precision */ +#define X86_FEATURE_AVX512_4VNNIW ( 7*32+16)/* AVX-512 Neural Network Instructions */ +#define X86_FEATURE_AVX512_4FMAPS ( 7*32+17)/* AVX-512 Multiply Accumulation Single precision */ #define X86_FEATURE_MBA ( 7*32+18)/* Memory Bandwidth Allocation */
@@ -218,19 +216,19 @@#define X86_FEATURE_EPT ( 8*32+ 3)/* Intel Extended Page Table */ #define X86_FEATURE_VPID ( 8*32+ 4)/* Intel Virtual Processor ID */ -#define X86_FEATURE_VMMCALL ( 8*32+15)/* Prefer vmmcall to vmcall */ +#define X86_FEATURE_VMMCALL ( 8*32+15)/* Prefer VMMCALL to VMCALL */ #define X86_FEATURE_XENPV ( 8*32+16)/* "" Xen paravirtual guest */ -/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */ -#define X86_FEATURE_FSGSBASE ( 9*32+ 0)/* {RD/WR}{FS/GS}BASE instructions*/ -#define X86_FEATURE_TSC_ADJUST ( 9*32+ 1)/* TSC adjustment MSR 0x3b */ +/* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */ +#define X86_FEATURE_FSGSBASE ( 9*32+ 0)/* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/ +#define X86_FEATURE_TSC_ADJUST ( 9*32+ 1)/* TSC adjustment MSR 0x3B */ #define X86_FEATURE_BMI1 ( 9*32+ 3)/* 1st group bit manipulation extensions */ #define X86_FEATURE_HLE ( 9*32+ 4)/* Hardware Lock Elision */ #define X86_FEATURE_AVX2 ( 9*32+ 5)/* AVX2 instructions */ #define X86_FEATURE_SMEP ( 9*32+ 7)/* Supervisor Mode Execution Protection */ #define X86_FEATURE_BMI2 ( 9*32+ 8)/* 2nd group bit manipulation extensions */ -#define X86_FEATURE_ERMS ( 9*32+ 9)/* Enhanced REP MOVSB/STOSB */ +#define X86_FEATURE_ERMS ( 9*32+ 9)/* Enhanced REP MOVSB/STOSB instructions */ #define X86_FEATURE_INVPCID ( 9*32+10)/* Invalidate Processor Context ID */ #define X86_FEATURE_RTM ( 9*32+11)/* Restricted Transactional Memory */ #define X86_FEATURE_CQM ( 9*32+12)/* Cache QoS Monitoring */
@@ -238,8 +236,8 @@#define X86_FEATURE_RDT_A ( 9*32+15)/* Resource Director Technology Allocation */ #define X86_FEATURE_AVX512F ( 9*32+16)/* AVX-512 Foundation */ #define X86_FEATURE_AVX512DQ ( 9*32+17)/* AVX-512 DQ (Double/Quad granular) Instructions */ -#define X86_FEATURE_RDSEED ( 9*32+18)/* The RDSEED instruction */ -#define X86_FEATURE_ADX ( 9*32+19)/* The ADCX and ADOX instructions */ +#define X86_FEATURE_RDSEED ( 9*32+18)/* RDSEED instruction */ +#define X86_FEATURE_ADX ( 9*32+19)/* ADCX and ADOX instructions */ #define X86_FEATURE_SMAP ( 9*32+20)/* Supervisor Mode Access Prevention */ #define X86_FEATURE_AVX512IFMA ( 9*32+21)/* AVX-512 Integer Fused Multiply-Add instructions */ #define X86_FEATURE_CLFLUSHOPT ( 9*32+23)/* CLFLUSHOPT instruction */
@@ -251,25 +249,25 @@#define X86_FEATURE_AVX512BW ( 9*32+30)/* AVX-512 BW (Byte/Word granular) Instructions */ #define X86_FEATURE_AVX512VL ( 9*32+31)/* AVX-512 VL (128/256 Vector Length) Extensions */ -/* Extended state features, CPUID level 0x0000000d:1 (eax), word 10 */ -#define X86_FEATURE_XSAVEOPT (10*32+ 0)/* XSAVEOPT */ -#define X86_FEATURE_XSAVEC (10*32+ 1)/* XSAVEC */ -#define X86_FEATURE_XGETBV1 (10*32+ 2)/* XGETBV with ECX = 1 */ -#define X86_FEATURE_XSAVES (10*32+ 3)/* XSAVES/XRSTORS */ +/* Extended state features, CPUID level 0x0000000d:1 (EAX), word 10 */ +#define X86_FEATURE_XSAVEOPT (10*32+ 0)/* XSAVEOPT instruction */ +#define X86_FEATURE_XSAVEC (10*32+ 1)/* XSAVEC instruction */ +#define X86_FEATURE_XGETBV1 (10*32+ 2)/* XGETBV with ECX = 1 instruction */ +#define X86_FEATURE_XSAVES (10*32+ 3)/* XSAVES/XRSTORS instructions */ -/* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:0 (edx), word 11 */ +/* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:0 (EDX), word 11 */ #define X86_FEATURE_CQM_LLC (11*32+ 1)/* LLC QoS if 1 */ -/* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:1 (edx), word 12 */ -#define X86_FEATURE_CQM_OCCUP_LLC (12*32+ 0)/* LLC occupancy monitoring if 1 */ +/* Intel-defined CPU QoS Sub-leaf, CPUID level 0x0000000F:1 (EDX), word 12 */ +#define X86_FEATURE_CQM_OCCUP_LLC (12*32+ 0)/* LLC occupancy monitoring */ #define X86_FEATURE_CQM_MBM_TOTAL (12*32+ 1)/* LLC Total MBM monitoring */ #define X86_FEATURE_CQM_MBM_LOCAL (12*32+ 2)/* LLC Local MBM monitoring */ -/* AMD-defined CPU features, CPUID level 0x80000008 (ebx), word 13 */ -#define X86_FEATURE_CLZERO (13*32+0)/* CLZERO instruction */ -#define X86_FEATURE_IRPERF (13*32+1)/* Instructions Retired Count */ +/* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */ +#define X86_FEATURE_CLZERO (13*32+ 0)/* CLZERO instruction */ +#define X86_FEATURE_IRPERF (13*32+ 1)/* Instructions Retired Count */ -/* Thermal and Power Management Leaf, CPUID level 0x00000006 (eax), word 14 */ +/* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */ #define X86_FEATURE_DTHERM (14*32+ 0)/* Digital Thermal Sensor */ #define X86_FEATURE_IDA (14*32+ 1)/* Intel Dynamic Acceleration */ #define X86_FEATURE_ARAT (14*32+ 2)/* Always Running APIC Timer */
@@ -281,7 +279,7 @@#define X86_FEATURE_HWP_EPP (14*32+10)/* HWP Energy Perf. Preference */ #define X86_FEATURE_HWP_PKG_REQ (14*32+11)/* HWP Package Level Request */ -/* AMD SVM Feature Identification, CPUID level 0x8000000a (edx), word 15 */ +/* AMD SVM Feature Identification, CPUID level 0x8000000a (EDX), word 15 */ #define X86_FEATURE_NPT (15*32+ 0)/* Nested Page Table support */ #define X86_FEATURE_LBRV (15*32+ 1)/* LBR Virtualization support */ #define X86_FEATURE_SVML (15*32+ 2)/* "svm_lock" SVM locking MSR */
@@ -296,24 +294,24 @@#define X86_FEATURE_V_VMSAVE_VMLOAD (15*32+15)/* Virtual VMSAVE VMLOAD */ #define X86_FEATURE_VGIF (15*32+16)/* Virtual GIF */ -/* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx), word 16 */ +/* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16 */ #define X86_FEATURE_AVX512VBMI (16*32+ 1)/* AVX512 Vector Bit Manipulation instructions*/ #define X86_FEATURE_PKU (16*32+ 3)/* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4)/* OS Protection Keys Enable */ #define X86_FEATURE_AVX512_VBMI2 (16*32+ 6)/* Additional AVX512 Vector Bit Manipulation Instructions */ #define X86_FEATURE_GFNI (16*32+ 8)/* Galois Field New Instructions */ #define X86_FEATURE_VAES (16*32+ 9)/* Vector AES */ -#define X86_FEATURE_VPCLMULQDQ (16*32+ 10)/* Carry-Less Multiplication Double Quadword */ -#define X86_FEATURE_AVX512_VNNI (16*32+ 11)/* Vector Neural Network Instructions */ -#define X86_FEATURE_AVX512_BITALG (16*32+12)/* Support for VPOPCNT[B,W] and VPSHUF-BITQMB */ +#define X86_FEATURE_VPCLMULQDQ (16*32+10)/* Carry-Less Multiplication Double Quadword */ +#define X86_FEATURE_AVX512_VNNI (16*32+11)/* Vector Neural Network Instructions */ +#define X86_FEATURE_AVX512_BITALG (16*32+12)/* Support for VPOPCNT[B,W] and VPSHUF-BITQMB instructions */ #define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14)/* POPCNT for vectors of DW/QW */ #define X86_FEATURE_LA57 (16*32+16)/* 5-level page tables */ #define X86_FEATURE_RDPID (16*32+22)/* RDPID instruction */ -/* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */ -#define X86_FEATURE_OVERFLOW_RECOV (17*32+0)/* MCA overflow recovery support */ -#define X86_FEATURE_SUCCOR (17*32+1)/* Uncorrectable error containment and recovery */ -#define X86_FEATURE_SMCA (17*32+3)/* Scalable MCA */ +/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ +#define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0)/* MCA overflow recovery support */ +#define X86_FEATURE_SUCCOR (17*32+ 1)/* Uncorrectable error containment and recovery */ +#define X86_FEATURE_SMCA (17*32+ 3)/* Scalable MCA */ /* * BUG word(s)
@@ -340,4 +338,5 @@#define X86_BUG_SWAPGS_FENCE X86_BUG(11)/* SWAPGS without input dep on GS */ #define X86_BUG_MONITOR X86_BUG(12)/* IPI required to wake up remote CPU */ #define X86_BUG_AMD_E400 X86_BUG(13)/* CPU is among the affected by Erratum 400 */ +#endif /* _ASM_X86_CPUFEATURES_H */
Greg Kroah-Hartman
maintainerPATCH 61/159 selftests/x86/ldt_gdt: Add infrastructure to test set_thread_area()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit d744dcad39094c9187075e274d1cdef79c57c8b5 upstream.
Much of the test design could apply to set_thread_area() (i.e. GDT), not just modify_ldt(). Add set_thread_area() to the install_valid_mode() helper.
--- tools/testing/selftests/x86/ldt_gdt.c | 53 +++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 16 deletions(-)
tools/testing/selftests/x86/ldt_gdt.c +37 -16
@@ -137,30 +137,51 @@ static void check_valid_segment(uint16_t } } -static bool install_valid_mode (const struct user_desc *desc,uint32_t ar, -bool oldmode) +static bool install_valid_mode (const struct user_desc *d,uint32_t ar, +bool oldmode,bool ldt) { -int ret =syscall (SYS_modify_ldt, oldmode ?1 :0x11 , - desc,sizeof (*desc)); -if (ret <-1 ) - errno = -ret; +struct user_desc desc = *d; +int ret; + +if (!ldt) { +#ifndef __i386__ +/* No point testing set_thread_area in a 64-bit build */ +return false; +#endif +if (!gdt_entry_num) +return false; + desc.entry_number = gdt_entry_num; + + ret =syscall (SYS_set_thread_area, &desc); + }else { + ret =syscall (SYS_modify_ldt, oldmode ?1 :0x11 , + &desc,sizeof (desc)); + +if (ret <-1 ) + errno = -ret; + +if (ret !=0 && errno ==ENOSYS ) { +printf ("[OK]\tmodify_ldt returned -ENOSYS\n" ); +return false; + } + } +if (ret ==0 ) { -uint32_t limit = desc->limit; -if (desc->limit_in_pages) +uint32_t limit = desc.limit; +if (desc.limit_in_pages) limit = (limit <<12 ) +4095 ; -check_valid_segment (desc->entry_number,1 , ar, limit, true); +check_valid_segment (desc.entry_number, ldt, ar, limit, true);return true; - }else if (errno ==ENOSYS ) { -printf ("[OK]\tmodify_ldt returned -ENOSYS\n" ); -return false; }else { -if (desc->seg_32bit) { -printf ("[FAIL]\tUnexpected modify_ldt failure %d\n" , +if (desc.seg_32bit) { +printf ("[FAIL]\tUnexpected %s failure %d\n" , + ldt ?"modify_ldt" :"set_thread_area" , errno); nerrs++;return false; }else { -printf ("[OK]\tmodify_ldt rejected 16 bit segment\n" ); +printf ("[OK]\t%s rejected 16 bit segment\n" , + ldt ?"modify_ldt" :"set_thread_area" );return false; } }
@@ -168,7 +189,7 @@ static bool install_valid_mode(const strstatic bool install_valid (const struct user_desc *desc,uint32_t ar) { -return install_valid_mode (desc, ar, false); +return install_valid_mode (desc, ar, false, true); }static void install_invalid (const struct user_desc *desc,bool oldmode)
Greg Kroah-Hartman
maintainerPATCH 64/159 x86/virt, x86/platform: Merge struct x86_hyper into struct x86_platform and struct x86_init
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit f72e38e8ec8869ac0ba5a75d7d2f897d98a1454e upstream.
Instead of x86_hyper being either NULL on bare metal or a pointer to a struct hypervisor_x86 in case of the kernel running as a guest merge the struct into x86_platform and x86_init.
This will remove the need for wrappers making it hard to find out what is being called. With dummy functions added for all callbacks testing for a NULL function pointer can be removed, too.
--- arch/x86/include/asm/hypervisor.h | 25 +++------------- arch/x86/include/asm/x86_init.h | 24 ++++++++++++++++ arch/x86/kernel/apic/apic.c | 2 - arch/x86/kernel/cpu/hypervisor.c | 56 ++++++++++++++++++-------------------- arch/x86/kernel/cpu/mshyperv.c | 2 - arch/x86/kernel/cpu/vmware.c | 4 +- arch/x86/kernel/kvm.c | 2 - arch/x86/kernel/x86_init.c | 9 ++++++ arch/x86/mm/init.c | 2 - arch/x86/xen/enlighten_hvm.c | 8 ++--- arch/x86/xen/enlighten_pv.c | 2 - include/linux/hypervisor.h | 8 ++++- 12 files changed, 82 insertions(+), 62 deletions(-)
arch/x86/include/asm/hypervisor.h +5 -20
@@ -23,6 +23,7 @@#ifdef CONFIG_HYPERVISOR_GUEST #include <asm/kvm_para.h> +#include <asm/x86_init.h> #include <asm/xen/hypervisor.h> /*
@@ -35,17 +36,11 @@ struct hypervisor_x86 {/* Detection routine */ uint32_t (*detect)(void ); -/* Platform setup (run once per boot) */ -void (*init_platform)(void ); +/* init time callbacks */ +struct x86_hyper_init init; -/* X2APIC detection (run once per boot) */ -bool (*x2apic_available)(void ); - -/* pin current vcpu to specified physical cpu (run rarely) */ -void (*pin_vcpu)(int ); - -/* called during init_mem_mapping() to setup early mappings. */ -void (*init_mem_mapping)(void ); +/* runtime callbacks */ +struct x86_hyper_runtime runtime; };extern const struct hypervisor_x86 *x86_hyper;
@@ -58,17 +53,7 @@ extern const struct hypervisor_x86 x86_hextern const struct hypervisor_x86 x86_hyper_kvm;extern void init_hypervisor_platform (void ); -extern bool hypervisor_x2apic_available (void ); -extern void hypervisor_pin_vcpu (int cpu); - -static inline void hypervisor_init_mem_mapping (void ) -{ -if (x86_hyper && x86_hyper->init_mem_mapping) - x86_hyper->init_mem_mapping (); -}#else static inline void init_hypervisor_platform (void ) { } -static inline bool hypervisor_x2apic_available (void ) {return false; } -static inline void hypervisor_init_mem_mapping (void ) { }#endif /* CONFIG_HYPERVISOR_GUEST */ #endif /* _ASM_X86_HYPERVISOR_H */
arch/x86/include/asm/x86_init.h +24 -0
@@ -115,6 +115,18 @@ struct x86_init_pci { };/** +* struct x86_hyper_init - x86 hypervisor init functions +* @init_platform: platform setup +* @x2apic_available: X2APIC detection +* @init_mem_mapping: setup early mappings during init_mem_mapping() +*/ +struct x86_hyper_init { +void (*init_platform)(void ); +bool (*x2apic_available)(void ); +void (*init_mem_mapping)(void ); +}; + +/** * struct x86_init_ops - functions for platform specific setup * */
@@ -127,6 +139,7 @@ struct x86_init_ops {struct x86_init_timers timers;struct x86_init_iommu iommu;struct x86_init_pci pci; +struct x86_hyper_init hyper; };/**
@@ -200,6 +213,15 @@ struct x86_legacy_features { };/** +* struct x86_hyper_runtime - x86 hypervisor specific runtime callbacks +* +* @pin_vcpu: pin current vcpu to specified physical cpu (run rarely) +*/ +struct x86_hyper_runtime { +void (*pin_vcpu)(int cpu); +}; + +/** * struct x86_platform_ops - platform specific runtime functions * @calibrate_cpu: calibrate CPU * @calibrate_tsc: calibrate TSC, if different from CPU
@@ -218,6 +240,7 @@ struct x86_legacy_features {* possible in x86_early_init_platform_quirks() by * only using the current x86_hardware_subarch * semantics. +* @hyper: x86 hypervisor specific runtime callbacks */ struct x86_platform_ops {unsigned long (*calibrate_cpu)(void );
@@ -233,6 +256,7 @@ struct x86_platform_ops {void (*apic_post_init)(void );struct x86_legacy_features legacy;void (*set_legacy_features)(void ); +struct x86_hyper_runtime hyper; };struct pci_dev ;
arch/x86/kernel/apic/apic.c +1 -1
@@ -1645,7 +1645,7 @@ static __init void try_to_enable_x2apic(* under KVM */ if (max_physical_apicid >255 || - !hypervisor_x2apic_available ()) { + !x86_init.hyper.x2apic_available ()) {pr_info ("x2apic: IRQ remapping doesn't support X2APIC mode\n" );x2apic_disable ();return ;
arch/x86/kernel/cpu/hypervisor.c +27 -29
78 lines not on this page · raw message
arch/x86/kernel/cpu/mshyperv.c +1 -1
@@ -257,6 +257,6 @@ static void __init ms_hyperv_init_platfoconst __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { .name ="Microsoft Hyper-V" , .detect = ms_hyperv_platform, - .init_platform = ms_hyperv_init_platform, + .init.init_platform = ms_hyperv_init_platform, };EXPORT_SYMBOL (x86_hyper_ms_hyperv);
arch/x86/kernel/cpu/vmware.c +2 -2
@@ -208,7 +208,7 @@ static bool __init vmware_legacy_x2apic_const __refconst struct hypervisor_x86 x86_hyper_vmware = { .name ="VMware" , .detect = vmware_platform, - .init_platform = vmware_platform_setup, - .x2apic_available = vmware_legacy_x2apic_available, + .init.init_platform = vmware_platform_setup, + .init.x2apic_available = vmware_legacy_x2apic_available, };EXPORT_SYMBOL (x86_hyper_vmware);
arch/x86/kernel/kvm.c +1 -1
@@ -547,7 +547,7 @@ static uint32_t __init kvm_detect(void)const struct hypervisor_x86 x86_hyper_kvm__refconst = { .name ="KVM" , .detect = kvm_detect, - .x2apic_available = kvm_para_available, + .init.x2apic_available = kvm_para_available, };EXPORT_SYMBOL_GPL (x86_hyper_kvm);
arch/x86/kernel/x86_init.c +9 -0
@@ -28,6 +28,8 @@ void x86_init_noop(void) { }void __init x86_init_uint_noop (unsigned int unused) { }int __init iommu_init_noop (void ) {return 0 ; }void iommu_shutdown_noop (void ) { } +bool __init bool_x86_init_noop (void ) {return false; } +void x86_op_int_noop (int cpu) { }/* * The platform setup functions are preset with the default functions
@@ -81,6 +83,12 @@ struct x86_init_ops x86_init __initdata .init_irq = x86_default_pci_init_irq, .fixup_irqs = x86_default_pci_fixup_irqs, }, + + .hyper = { + .init_platform = x86_init_noop, + .x2apic_available = bool_x86_init_noop, + .init_mem_mapping = x86_init_noop, + }, };struct x86_cpuinit_ops x86_cpuinit = {
@@ -101,6 +109,7 @@ struct x86_platform_ops x86_platform __r .get_nmi_reason = default_get_nmi_reason, .save_sched_clock_state = tsc_save_sched_clock_state, .restore_sched_clock_state = tsc_restore_sched_clock_state, + .hyper.pin_vcpu = x86_op_int_noop, };EXPORT_SYMBOL_GPL (x86_platform);
arch/x86/mm/init.c +1 -1
@@ -671,7 +671,7 @@ void __init init_mem_mapping(void)load_cr3 (swapper_pg_dir);__flush_tlb_all (); -hypervisor_init_mem_mapping (); + x86_init.hyper.init_mem_mapping ();early_memtest (0 , max_pfn_mapped <<PAGE_SHIFT ); }
arch/x86/xen/enlighten_hvm.c +4 -4
@@ -229,9 +229,9 @@ static uint32_t __init xen_platform_hvm(const struct hypervisor_x86 x86_hyper_xen_hvm = { .name ="Xen HVM" , .detect = xen_platform_hvm, - .init_platform = xen_hvm_guest_init, - .pin_vcpu = xen_pin_vcpu, - .x2apic_available = xen_x2apic_para_available, - .init_mem_mapping = xen_hvm_init_mem_mapping, + .init.init_platform = xen_hvm_guest_init, + .init.x2apic_available = xen_x2apic_para_available, + .init.init_mem_mapping = xen_hvm_init_mem_mapping, + .runtime.pin_vcpu = xen_pin_vcpu, };EXPORT_SYMBOL (x86_hyper_xen_hvm);
arch/x86/xen/enlighten_pv.c +1 -1
@@ -1462,6 +1462,6 @@ static uint32_t __init xen_platform_pv(vconst struct hypervisor_x86 x86_hyper_xen_pv = { .name ="Xen PV" , .detect = xen_platform_pv, - .pin_vcpu = xen_pin_vcpu, + .runtime.pin_vcpu = xen_pin_vcpu, };EXPORT_SYMBOL (x86_hyper_xen_pv);
include/linux/hypervisor.h +6 -2
@@ -7,8 +7,12 @@* Juergen Gross <[email protected]> */ -#ifdef CONFIG_HYPERVISOR_GUEST -#include <asm/hypervisor.h> +#ifdef CONFIG_X86 +#include <asm/x86_init.h> +static inline void hypervisor_pin_vcpu (int cpu) +{ + x86_platform.hyper.pin_vcpu (cpu); +}#else static inline void hypervisor_pin_vcpu (int cpu) {
Greg Kroah-Hartman
maintainerPATCH 65/159 x86/virt: Add enum for hypervisors to replace x86_hyper
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit 03b2a320b19f1424e9ac9c21696be9c60b6d0d93 upstream.
The x86_hyper pointer is only used for checking whether a virtual device is supporting the hypervisor the system is running on.
Use an enum for that purpose instead and drop the x86_hyper pointer.
--- arch/x86/hyperv/hv_init.c | 2 +- arch/x86/include/asm/hypervisor.h | 23 ++++++++++++++--------- arch/x86/kernel/cpu/hypervisor.c | 12 +++++++++--- arch/x86/kernel/cpu/mshyperv.c | 4 ++-- arch/x86/kernel/cpu/vmware.c | 4 ++-- arch/x86/kernel/kvm.c | 4 ++-- arch/x86/xen/enlighten_hvm.c | 4 ++-- arch/x86/xen/enlighten_pv.c | 4 ++-- drivers/hv/vmbus_drv.c | 2 +- drivers/input/mouse/vmmouse.c | 10 ++++------ drivers/misc/vmw_balloon.c | 2 +- 11 files changed, 40 insertions(+), 31 deletions(-)
arch/x86/hyperv/hv_init.c +1 -1
@@ -113,7 +113,7 @@ void hyperv_init(void)u64 guest_id;union hv_x64_msr_hypercall_contents hypercall_msr; -if (x86_hyper != &x86_hyper_ms_hyperv) +if (x86_hyper_type !=X86_HYPER_MS_HYPERV )return ;/* Allocate percpu VP index */
arch/x86/include/asm/hypervisor.h +14 -9
@@ -29,6 +29,16 @@/* * x86 hypervisor information */ + +enum x86_hypervisor_type { +X86_HYPER_NATIVE =0 , +X86_HYPER_VMWARE , +X86_HYPER_MS_HYPERV , +X86_HYPER_XEN_PV , +X86_HYPER_XEN_HVM , +X86_HYPER_KVM , +}; +struct hypervisor_x86 {/* Hypervisor name */ const char *name;
@@ -36,6 +46,9 @@ struct hypervisor_x86 {/* Detection routine */ uint32_t (*detect)(void ); +/* Hypervisor type */ +enum x86_hypervisor_type type; +/* init time callbacks */ struct x86_hyper_init init;
@@ -43,15 +56,7 @@ struct hypervisor_x86 { struct x86_hyper_runtime runtime; }; -extern const struct hypervisor_x86 *x86_hyper; - -/* Recognized hypervisors */ -extern const struct hypervisor_x86 x86_hyper_vmware; -extern const struct hypervisor_x86 x86_hyper_ms_hyperv; -extern const struct hypervisor_x86 x86_hyper_xen_pv; -extern const struct hypervisor_x86 x86_hyper_xen_hvm; -extern const struct hypervisor_x86 x86_hyper_kvm; - +extern enum x86_hypervisor_type x86_hyper_type;extern void init_hypervisor_platform (void );#else static inline void init_hypervisor_platform (void ) { }
arch/x86/kernel/cpu/hypervisor.c +9 -3
@@ -26,6 +26,12 @@#include <asm/processor.h> #include <asm/hypervisor.h> +extern const struct hypervisor_x86 x86_hyper_vmware; +extern const struct hypervisor_x86 x86_hyper_ms_hyperv; +extern const struct hypervisor_x86 x86_hyper_xen_pv; +extern const struct hypervisor_x86 x86_hyper_xen_hvm; +extern const struct hypervisor_x86 x86_hyper_kvm; +static const __initconst struct hypervisor_x86 *const hypervisors[] = { #ifdef CONFIG_XEN_PV
@@ -41,8 +47,8 @@ static const __initconst struct hypervis#endif }; -const struct hypervisor_x86 *x86_hyper; -EXPORT_SYMBOL (x86_hyper); +enum x86_hypervisor_type x86_hyper_type; +EXPORT_SYMBOL (x86_hyper_type);static inline const struct hypervisor_x86 *__init detect_hypervisor_vendor (void )
@@ -87,6 +93,6 @@ void __init init_hypervisor_platform(voicopy_array (&h->init, &x86_init.hyper,sizeof (h->init));copy_array (&h->runtime, &x86_platform.hyper,sizeof (h->runtime)); - x86_hyper = h; + x86_hyper_type = h->type; x86_init.hyper.init_platform (); }
arch/x86/kernel/cpu/mshyperv.c +2 -2
@@ -254,9 +254,9 @@ static void __init ms_hyperv_init_platfo#endif } -const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { +const __initconst struct hypervisor_x86 x86_hyper_ms_hyperv = { .name ="Microsoft Hyper-V" , .detect = ms_hyperv_platform, + .type =X86_HYPER_MS_HYPERV , .init.init_platform = ms_hyperv_init_platform, }; -EXPORT_SYMBOL (x86_hyper_ms_hyperv);
arch/x86/kernel/cpu/vmware.c +2 -2
@@ -205,10 +205,10 @@ static bool __init vmware_legacy_x2apic_ (eax & (1 <<VMWARE_PORT_CMD_LEGACY_X2APIC )) !=0 ; } -const __refconst struct hypervisor_x86 x86_hyper_vmware = { +const __initconst struct hypervisor_x86 x86_hyper_vmware = { .name ="VMware" , .detect = vmware_platform, + .type =X86_HYPER_VMWARE , .init.init_platform = vmware_platform_setup, .init.x2apic_available = vmware_legacy_x2apic_available, }; -EXPORT_SYMBOL (x86_hyper_vmware);
arch/x86/kernel/kvm.c +2 -2
@@ -544,12 +544,12 @@ static uint32_t __init kvm_detect(void)return kvm_cpuid_base (); } -const struct hypervisor_x86 x86_hyper_kvm__refconst = { +const __initconst struct hypervisor_x86 x86_hyper_kvm = { .name ="KVM" , .detect = kvm_detect, + .type =X86_HYPER_KVM , .init.x2apic_available = kvm_para_available, }; -EXPORT_SYMBOL_GPL (x86_hyper_kvm);static __init int activate_jump_labels (void ) {
arch/x86/xen/enlighten_hvm.c +2 -2
@@ -226,12 +226,12 @@ static uint32_t __init xen_platform_hvm(return xen_cpuid_base (); } -const struct hypervisor_x86 x86_hyper_xen_hvm = { +const __initconst struct hypervisor_x86 x86_hyper_xen_hvm = { .name ="Xen HVM" , .detect = xen_platform_hvm, + .type =X86_HYPER_XEN_HVM , .init.init_platform = xen_hvm_guest_init, .init.x2apic_available = xen_x2apic_para_available, .init.init_mem_mapping = xen_hvm_init_mem_mapping, .runtime.pin_vcpu = xen_pin_vcpu, }; -EXPORT_SYMBOL (x86_hyper_xen_hvm);
arch/x86/xen/enlighten_pv.c +2 -2
@@ -1459,9 +1459,9 @@ static uint32_t __init xen_platform_pv(vreturn 0 ; } -const struct hypervisor_x86 x86_hyper_xen_pv = { +const __initconst struct hypervisor_x86 x86_hyper_xen_pv = { .name ="Xen PV" , .detect = xen_platform_pv, + .type =X86_HYPER_XEN_PV , .runtime.pin_vcpu = xen_pin_vcpu, }; -EXPORT_SYMBOL (x86_hyper_xen_pv);
drivers/hv/vmbus_drv.c +1 -1
@@ -1534,7 +1534,7 @@ static int __init hv_acpi_init(void) {int ret, t; -if (x86_hyper != &x86_hyper_ms_hyperv) +if (x86_hyper_type !=X86_HYPER_MS_HYPERV )return -ENODEV ;init_completion (&probe_event);
drivers/input/mouse/vmmouse.c +4 -6
@@ -316,11 +316,9 @@ static int vmmouse_enable(struct psmouse/* * Array of supported hypervisors. */ -static const struct hypervisor_x86 *vmmouse_supported_hypervisors[] = { - &x86_hyper_vmware, -#ifdef CONFIG_KVM_GUEST - &x86_hyper_kvm, -#endif +static enum x86_hypervisor_type vmmouse_supported_hypervisors[] = { +X86_HYPER_VMWARE , +X86_HYPER_KVM , };/**
@@ -331,7 +329,7 @@ static bool vmmouse_check_hypervisor(voiint i;for (i =0 ; i <ARRAY_SIZE (vmmouse_supported_hypervisors); i++) -if (vmmouse_supported_hypervisors[i] == x86_hyper) +if (vmmouse_supported_hypervisors[i] == x86_hyper_type)return true;return false;
drivers/misc/vmw_balloon.c +1 -1
@@ -1271,7 +1271,7 @@ static int __init vmballoon_init(void)* Check if we are running on VMware's hypervisor and bail out * if we are not. */ -if (x86_hyper != &x86_hyper_vmware) +if (x86_hyper_type !=X86_HYPER_VMWARE )return -ENODEV ; for (is_2m_pages = 0; is_2m_pages < VMW_BALLOON_NUM_PAGE_SIZES;
Greg Kroah-Hartman
maintainerPATCH 65/159 x86/virt: Add enum for hypervisors to replace x86_hyper
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit 03b2a320b19f1424e9ac9c21696be9c60b6d0d93 upstream.
The x86_hyper pointer is only used for checking whether a virtual device is supporting the hypervisor the system is running on.
Use an enum for that purpose instead and drop the x86_hyper pointer.
--- arch/x86/hyperv/hv_init.c | 2 +- arch/x86/include/asm/hypervisor.h | 23 ++++++++++++++--------- arch/x86/kernel/cpu/hypervisor.c | 12 +++++++++--- arch/x86/kernel/cpu/mshyperv.c | 4 ++-- arch/x86/kernel/cpu/vmware.c | 4 ++-- arch/x86/kernel/kvm.c | 4 ++-- arch/x86/xen/enlighten_hvm.c | 4 ++-- arch/x86/xen/enlighten_pv.c | 4 ++-- drivers/hv/vmbus_drv.c | 2 +- drivers/input/mouse/vmmouse.c | 10 ++++------ drivers/misc/vmw_balloon.c | 2 +- 11 files changed, 40 insertions(+), 31 deletions(-)
arch/x86/hyperv/hv_init.c +1 -1
@@ -113,7 +113,7 @@ void hyperv_init(void)u64 guest_id;union hv_x64_msr_hypercall_contents hypercall_msr; -if (x86_hyper != &x86_hyper_ms_hyperv) +if (x86_hyper_type !=X86_HYPER_MS_HYPERV )return ;/* Allocate percpu VP index */
arch/x86/include/asm/hypervisor.h +14 -9
@@ -29,6 +29,16 @@/* * x86 hypervisor information */ + +enum x86_hypervisor_type { +X86_HYPER_NATIVE =0 , +X86_HYPER_VMWARE , +X86_HYPER_MS_HYPERV , +X86_HYPER_XEN_PV , +X86_HYPER_XEN_HVM , +X86_HYPER_KVM , +}; +struct hypervisor_x86 {/* Hypervisor name */ const char *name;
@@ -36,6 +46,9 @@ struct hypervisor_x86 {/* Detection routine */ uint32_t (*detect)(void ); +/* Hypervisor type */ +enum x86_hypervisor_type type; +/* init time callbacks */ struct x86_hyper_init init;
@@ -43,15 +56,7 @@ struct hypervisor_x86 { struct x86_hyper_runtime runtime; }; -extern const struct hypervisor_x86 *x86_hyper; - -/* Recognized hypervisors */ -extern const struct hypervisor_x86 x86_hyper_vmware; -extern const struct hypervisor_x86 x86_hyper_ms_hyperv; -extern const struct hypervisor_x86 x86_hyper_xen_pv; -extern const struct hypervisor_x86 x86_hyper_xen_hvm; -extern const struct hypervisor_x86 x86_hyper_kvm; - +extern enum x86_hypervisor_type x86_hyper_type;extern void init_hypervisor_platform (void );#else static inline void init_hypervisor_platform (void ) { }
arch/x86/kernel/cpu/hypervisor.c +9 -3
@@ -26,6 +26,12 @@#include <asm/processor.h> #include <asm/hypervisor.h> +extern const struct hypervisor_x86 x86_hyper_vmware; +extern const struct hypervisor_x86 x86_hyper_ms_hyperv; +extern const struct hypervisor_x86 x86_hyper_xen_pv; +extern const struct hypervisor_x86 x86_hyper_xen_hvm; +extern const struct hypervisor_x86 x86_hyper_kvm; +static const __initconst struct hypervisor_x86 *const hypervisors[] = { #ifdef CONFIG_XEN_PV
@@ -41,8 +47,8 @@ static const __initconst struct hypervis#endif }; -const struct hypervisor_x86 *x86_hyper; -EXPORT_SYMBOL (x86_hyper); +enum x86_hypervisor_type x86_hyper_type; +EXPORT_SYMBOL (x86_hyper_type);static inline const struct hypervisor_x86 *__init detect_hypervisor_vendor (void )
@@ -87,6 +93,6 @@ void __init init_hypervisor_platform(voicopy_array (&h->init, &x86_init.hyper,sizeof (h->init));copy_array (&h->runtime, &x86_platform.hyper,sizeof (h->runtime)); - x86_hyper = h; + x86_hyper_type = h->type; x86_init.hyper.init_platform (); }
arch/x86/kernel/cpu/mshyperv.c +2 -2
@@ -254,9 +254,9 @@ static void __init ms_hyperv_init_platfo#endif } -const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { +const __initconst struct hypervisor_x86 x86_hyper_ms_hyperv = { .name ="Microsoft Hyper-V" , .detect = ms_hyperv_platform, + .type =X86_HYPER_MS_HYPERV , .init.init_platform = ms_hyperv_init_platform, }; -EXPORT_SYMBOL (x86_hyper_ms_hyperv);
arch/x86/kernel/cpu/vmware.c +2 -2
@@ -205,10 +205,10 @@ static bool __init vmware_legacy_x2apic_ (eax & (1 <<VMWARE_PORT_CMD_LEGACY_X2APIC )) !=0 ; } -const __refconst struct hypervisor_x86 x86_hyper_vmware = { +const __initconst struct hypervisor_x86 x86_hyper_vmware = { .name ="VMware" , .detect = vmware_platform, + .type =X86_HYPER_VMWARE , .init.init_platform = vmware_platform_setup, .init.x2apic_available = vmware_legacy_x2apic_available, }; -EXPORT_SYMBOL (x86_hyper_vmware);
arch/x86/kernel/kvm.c +2 -2
@@ -544,12 +544,12 @@ static uint32_t __init kvm_detect(void)return kvm_cpuid_base (); } -const struct hypervisor_x86 x86_hyper_kvm__refconst = { +const __initconst struct hypervisor_x86 x86_hyper_kvm = { .name ="KVM" , .detect = kvm_detect, + .type =X86_HYPER_KVM , .init.x2apic_available = kvm_para_available, }; -EXPORT_SYMBOL_GPL (x86_hyper_kvm);static __init int activate_jump_labels (void ) {
arch/x86/xen/enlighten_hvm.c +2 -2
@@ -226,12 +226,12 @@ static uint32_t __init xen_platform_hvm(return xen_cpuid_base (); } -const struct hypervisor_x86 x86_hyper_xen_hvm = { +const __initconst struct hypervisor_x86 x86_hyper_xen_hvm = { .name ="Xen HVM" , .detect = xen_platform_hvm, + .type =X86_HYPER_XEN_HVM , .init.init_platform = xen_hvm_guest_init, .init.x2apic_available = xen_x2apic_para_available, .init.init_mem_mapping = xen_hvm_init_mem_mapping, .runtime.pin_vcpu = xen_pin_vcpu, }; -EXPORT_SYMBOL (x86_hyper_xen_hvm);
arch/x86/xen/enlighten_pv.c +2 -2
@@ -1459,9 +1459,9 @@ static uint32_t __init xen_platform_pv(vreturn 0 ; } -const struct hypervisor_x86 x86_hyper_xen_pv = { +const __initconst struct hypervisor_x86 x86_hyper_xen_pv = { .name ="Xen PV" , .detect = xen_platform_pv, + .type =X86_HYPER_XEN_PV , .runtime.pin_vcpu = xen_pin_vcpu, }; -EXPORT_SYMBOL (x86_hyper_xen_pv);
drivers/hv/vmbus_drv.c +1 -1
@@ -1534,7 +1534,7 @@ static int __init hv_acpi_init(void) {int ret, t; -if (x86_hyper != &x86_hyper_ms_hyperv) +if (x86_hyper_type !=X86_HYPER_MS_HYPERV )return -ENODEV ;init_completion (&probe_event);
drivers/input/mouse/vmmouse.c +4 -6
@@ -316,11 +316,9 @@ static int vmmouse_enable(struct psmouse/* * Array of supported hypervisors. */ -static const struct hypervisor_x86 *vmmouse_supported_hypervisors[] = { - &x86_hyper_vmware, -#ifdef CONFIG_KVM_GUEST - &x86_hyper_kvm, -#endif +static enum x86_hypervisor_type vmmouse_supported_hypervisors[] = { +X86_HYPER_VMWARE , +X86_HYPER_KVM , };/**
@@ -331,7 +329,7 @@ static bool vmmouse_check_hypervisor(voiint i;for (i =0 ; i <ARRAY_SIZE (vmmouse_supported_hypervisors); i++) -if (vmmouse_supported_hypervisors[i] == x86_hyper) +if (vmmouse_supported_hypervisors[i] == x86_hyper_type)return true;return false;
drivers/misc/vmw_balloon.c +1 -1
@@ -1271,7 +1271,7 @@ static int __init vmballoon_init(void)* Check if we are running on VMware's hypervisor and bail out * if we are not. */ -if (x86_hyper != &x86_hyper_vmware) +if (x86_hyper_type !=X86_HYPER_VMWARE )return -ENODEV ; for (is_2m_pages = 0; is_2m_pages < VMW_BALLOON_NUM_PAGE_SIZES;
Greg Kroah-Hartman
maintainerPATCH 66/159 drivers/misc/intel/pti: Rename the header file to free up the namespace
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
commit 1784f9144b143a1e8b19fe94083b040aa559182b upstream.
We'd like to use the 'PTI' acronym for 'Page Table Isolation' - free up the namespace by renaming the <linux/pti.h> driver header to <linux/intel-pti.h>.
(Also standardize the header guard name while at it.)
--- drivers/misc/pti.c | 2 +- include/linux/intel-pti.h | 43 +++++++++++++++++++++++++++++++++++++++++++ include/linux/pti.h | 43 ------------------------------------------- 3 files changed, 44 insertions(+), 44 deletions(-)
drivers/misc/pti.c +1 -1
@@ -32,7 +32,7 @@#include <linux/pci.h> #include <linux/mutex.h> #include <linux/miscdevice.h> -#include <linux/pti.h> +#include <linux/intel-pti.h> #include <linux/slab.h> #include <linux/uaccess.h>
include/linux/intel-pti.h new file +43 -0
43 lines not on this page · raw message
include/linux/pti.h deleted +0 -43
43 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 69/159 perf/x86: Enable free running PEBS for REGS_USER/INTR
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andi Kleen <[email protected]>
commit 2fe1bc1f501d55e5925b4035bcd85781adc76c63 upstream.
[ Note, this is a Git cherry-pick of the following commit:
a47ba4d77e12 ("perf/x86: Enable free running PEBS for REGS_USER/INTR")
... for easier x86 PTI code testing and back-porting. ]
Currently free running PEBS is disabled when user or interrupt registers are requested. Most of the registers are actually available in the PEBS record and can be supported.
So we just need to check for the supported registers and then allow it: it is all except for the segment register.
For user registers this only works when the counter is limited to ring 3 only, so this also needs to be checked.
--- arch/x86/events/intel/core.c | 4 ++++ arch/x86/events/perf_event.h | 24 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-)
arch/x86/events/intel/core.c +4 -0
@@ -2958,6 +2958,10 @@ static unsigned long intel_pmu_free_runnif (event->attr.use_clockid) flags &= ~PERF_SAMPLE_TIME ; +if (!event->attr.exclude_kernel) + flags &= ~PERF_SAMPLE_REGS_USER ; +if (event->attr.sample_regs_user & ~PEBS_REGS ) + flags &= ~(PERF_SAMPLE_REGS_USER |PERF_SAMPLE_REGS_INTR );return flags; }
arch/x86/events/perf_event.h +23 -1
@@ -85,13 +85,15 @@ struct amd_nb {* Flags PEBS can handle without an PMI. * * TID can only be handled by flushing at context switch. +* REGS_USER can be handled for events limited to ring 3. * */ #define PEBS_FREERUNNING_FLAGS \ (PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_ADDR | \ PERF_SAMPLE_ID | PERF_SAMPLE_CPU | PERF_SAMPLE_STREAM_ID | \ PERF_SAMPLE_DATA_SRC | PERF_SAMPLE_IDENTIFIER | \ - PERF_SAMPLE_TRANSACTION | PERF_SAMPLE_PHYS_ADDR) + PERF_SAMPLE_TRANSACTION | PERF_SAMPLE_PHYS_ADDR | \ + PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER)/* * A debug store configuration.
@@ -110,6 +112,26 @@ struct debug_store {u64 pebs_event_reset[MAX_PEBS_EVENTS ]; }; +#define PEBS_REGS \ + (PERF_REG_X86_AX | \ + PERF_REG_X86_BX | \ + PERF_REG_X86_CX | \ + PERF_REG_X86_DX | \ + PERF_REG_X86_DI | \ + PERF_REG_X86_SI | \ + PERF_REG_X86_SP | \ + PERF_REG_X86_BP | \ + PERF_REG_X86_IP | \ + PERF_REG_X86_FLAGS | \ + PERF_REG_X86_R8 | \ + PERF_REG_X86_R9 | \ + PERF_REG_X86_R10 | \ + PERF_REG_X86_R11 | \ + PERF_REG_X86_R12 | \ + PERF_REG_X86_R13 | \ + PERF_REG_X86_R14 | \ + PERF_REG_X86_R15) +/* * Per register state. */
Greg Kroah-Hartman
maintainerPATCH 70/159 bpf: fix build issues on um due to mising bpf_perf_event.h
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
commit ab95477e7cb35557ecfc837687007b646bab9a9f upstream.
[ Note, this is a Git cherry-pick of the following commit:
a23f06f06dbe ("bpf: fix build issues on um due to mising bpf_perf_event.h")
... for easier x86 PTI code testing and back-porting. ]
Since c895f6f703ad ("bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT program type") um (uml) won't build on i386 or x86_64:
[...]
CC init/main.o
In file included from ../include/linux/perf_event.h:18:0,
from ../include/linux/trace_events.h:10,
from ../include/trace/syscall.h:7,
from ../include/linux/syscalls.h:82,
from ../init/main.c:20: ../include/uapi/linux/bpf_perf_event.h:11:32: fatal error:
asm/bpf_perf_event.h: No such file or directory #include <asm/bpf_perf_event.h>
[...]
Lets add missing bpf_perf_event.h also to um arch. This seems to be the only one still missing.
--- arch/um/include/asm/Kbuild | 1 + 1 file changed, 1 insertion(+)
arch/um/include/asm/Kbuild +1 -0
@@ -1,4 +1,5 @@ generic-y += barrier.h +generic-y += bpf_perf_event.h generic-y += bug.h generic-y += clkdev.h generic-y += current.h
Greg Kroah-Hartman
maintainerPATCH 71/159 locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit c2bc66082e1048c7573d72e62f597bdc5ce13fea upstream.
[ Note, this is a Git cherry-pick of the following commit:
76ebbe78f739 ("locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()")
... for easier x86 PTI code testing and back-porting. ]
In preparation for the removal of lockless_dereference(), which is the same as READ_ONCE() on all architectures other than Alpha, add an implicit smp_read_barrier_depends() to READ_ONCE() so that it can be used to head dependency chains on all architectures.
--- include/linux/compiler.h | 1 + 1 file changed, 1 insertion(+)
include/linux/compiler.h +1 -0
@@ -341,6 +341,7 @@ static __always_inline void __write_once__read_once_size (&(x), __u.__c,sizeof (x)); \ else \ __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \ +smp_read_barrier_depends ();/* Enforce dependency ordering from x */ \ __u.__val; \ })#define READ_ONCE (x) __READ_ONCE(x, 1)
Greg Kroah-Hartman
maintainerPATCH 74/159 x86/entry/64/paravirt: Use paravirt-safe macro to access eflags
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Ostrovsky <[email protected]>
commit e17f8234538d1ff708673f287a42457c4dee720d upstream.
Commit 1d3e53e8624a ("x86/entry/64: Refactor IRQ stacks and make them NMI-safe") added DEBUG_ENTRY_ASSERT_IRQS_OFF macro that acceses eflags using 'pushfq' instruction when testing for IF bit. On PV Xen guests looking at IF flag directly will always see it set, resulting in 'ud2'.
Introduce SAVE_FLAGS() macro that will use appropriate save_fl pv op when running paravirt.
--- arch/x86/entry/entry_64.S | 7 ++++--- arch/x86/include/asm/irqflags.h | 3 +++ arch/x86/include/asm/paravirt.h | 9 +++++++++ arch/x86/kernel/asm-offsets_64.c | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-)
arch/x86/entry/entry_64.S +4 -3
@@ -462,12 +462,13 @@ END(irq_entries_start) .macro DEBUG_ENTRY_ASSERT_IRQS_OFF #ifdef CONFIG_DEBUG_ENTRY - pushfq - testl $X86_EFLAGS_IF, (%rsp) + pushq %rax + SAVE_FLAGS(CLBR_RAX) + testl $X86_EFLAGS_IF, %eax jz .Lokay_\@ ud2 .Lokay_\@: - addq $8, %rsp + popq %rax #endif .endm
arch/x86/include/asm/irqflags.h +3 -0
@@ -142,6 +142,9 @@ static inline notrace unsigned long archswapgs ; \ sysretl +#ifdef CONFIG_DEBUG_ENTRY +#define SAVE_FLAGS (x) pushfq; popq %rax +#endif #else #define INTERRUPT_RETURN iret#define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit
arch/x86/include/asm/paravirt.h +9 -0
@@ -927,6 +927,15 @@ extern void default_banner(void);PARA_SITE (PARA_PATCH (pv_cpu_ops, PV_CPU_usergs_sysret64), \CLBR_NONE , \ jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64)) + +#ifdef CONFIG_DEBUG_ENTRY +#define SAVE_FLAGS (clobbers) \ + PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_save_fl), clobbers, \ + PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ + call PARA_INDIRECT(pv_irq_ops+PV_IRQ_save_fl); \ + PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);) +#endif +#endif /* CONFIG_X86_32 */ #endif /* __ASSEMBLY__ */
arch/x86/kernel/asm-offsets_64.c +3 -0
@@ -23,6 +23,9 @@ int main(void)#ifdef CONFIG_PARAVIRT OFFSET (PV_CPU_usergs_sysret64, pv_cpu_ops, usergs_sysret64);OFFSET (PV_CPU_swapgs, pv_cpu_ops, swapgs); +#ifdef CONFIG_DEBUG_ENTRY +OFFSET (PV_IRQ_save_fl, pv_irq_ops, save_fl); +#endif BLANK ();#endif
Greg Kroah-Hartman
maintainerPATCH 75/159 x86/unwinder/orc: Dont bail on stack overflow
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit d3a09104018cf2ad5973dfa8a9c138ef9f5015a3 upstream.
If the stack overflows into a guard page and the ORC unwinder should work
well: by construction, there can't be any meaningful data in the guard page because no writes to the guard page will have succeeded.
But there is a bug that prevents unwinding from working correctly: if the starting register state has RSP pointing into a stack guard page, the ORC unwinder bails out immediately.
Instead of bailing out immediately check whether the next page up is a valid check page and if so analyze that. As a result the ORC unwinder will start the unwind.
Tested by intentionally overflowing the task stack. The result is an accurate call trace instead of a trace consisting purely of '?' entries.
There are a few other bugs that are triggered if the unwinder encounters a stack overflow after the first step, but they are outside the scope of this fix.
--- arch/x86/kernel/unwind_orc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
arch/x86/kernel/unwind_orc.c +12 -2
@@ -553,8 +553,18 @@ void __unwind_start(struct unwind_state }if (get_stack_info ((unsigned long *)state->sp, state->task, - &state->stack_info, &state->stack_mask)) -return ; + &state->stack_info, &state->stack_mask)) { +/* +* We weren't on a valid stack. It's possible that +* we overflowed a valid stack into a guard page. +* See if the next page up is valid so that we can +* generate some kind of backtrace if this happens. +*/ +void *next_page = (void *)PAGE_ALIGN ((unsigned long )state->sp); +if (get_stack_info (next_page, state->task, &state->stack_info, + &state->stack_mask)) +return ; + }/* * The caller can provide the address of the first frame directly
Greg Kroah-Hartman
maintainerPATCH 76/159 x86/unwinder: Handle stack overflows more gracefully
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit b02fcf9ba1211097754b286043cd87a8b4907e75 upstream.
There are at least two unwinder bugs hindering the debugging of stack-overflow crashes:
- It doesn't deal gracefully with the case where the stack overflows and the stack pointer itself isn't on a valid stack but the to-be-dereferenced data *is*.
- The ORC oops dump code doesn't know how to print partial pt_regs, for the case where if we get an interrupt/exception in *early* entry code before the full pt_regs have been saved.
Fix both issues.
http://lkml.kernel.org/r/20171126024031.uxi4numpbjm5rlbr@treble
--- arch/x86/include/asm/kdebug.h | 1 arch/x86/include/asm/unwind.h | 7 +++ arch/x86/kernel/dumpstack.c | 32 ++++++++++++++--- arch/x86/kernel/process_64.c | 11 ++---- arch/x86/kernel/unwind_orc.c | 76 ++++++++++++++---------------------------- 5 files changed, 66 insertions(+), 61 deletions(-)
arch/x86/include/asm/kdebug.h +1 -0
@@ -26,6 +26,7 @@ extern void die(const char *, struct pt_extern int __must_check __die (const char *,struct pt_regs *,long );extern void show_stack_regs (struct pt_regs *regs);extern void __show_regs (struct pt_regs *regs,int all); +extern void show_iret_regs (struct pt_regs *regs);extern unsigned long oops_begin (void );extern void oops_end (unsigned long ,struct pt_regs *,int signr);
arch/x86/include/asm/unwind.h +7 -0
@@ -7,6 +7,9 @@#include <asm/ptrace.h> #include <asm/stacktrace.h> +#define IRET_FRAME_OFFSET (offsetof(struct pt_regs, ip)) +#define IRET_FRAME_SIZE (sizeof(struct pt_regs) - IRET_FRAME_OFFSET) +struct unwind_state {struct stack_info stack_info;unsigned long stack_mask;
@@ -52,6 +55,10 @@ void unwind_start(struct unwind_state *s }#if defined(CONFIG_UNWINDER_ORC ) || defined(CONFIG_UNWINDER_FRAME_POINTER ) +/* +* WARNING: The entire pt_regs may not be safe to dereference. In some cases, +* only the iret frame registers are accessible. Use with caution! +*/ static inline struct pt_regs *unwind_get_entry_regs (struct unwind_state *state) {if (unwind_done (state))
arch/x86/kernel/dumpstack.c +27 -5
@@ -50,6 +50,28 @@ static void printk_stack_address(unsigneprintk ("%s %s%pB\n" , log_lvl, reliable ?"" :"? " , (void *)address); } +void show_iret_regs (struct pt_regs *regs) +{ +printk (KERN_DEFAULT "RIP: %04x:%pS\n" , (int )regs->cs, (void *)regs->ip); +printk (KERN_DEFAULT "RSP: %04x:%016lx EFLAGS: %08lx" , (int )regs->ss, + regs->sp, regs->flags); +} + +static void show_regs_safe (struct stack_info *info,struct pt_regs *regs) +{ +if (on_stack (info, regs,sizeof (*regs))) +__show_regs (regs,0 ); +else if (on_stack (info, (void *)regs +IRET_FRAME_OFFSET , +IRET_FRAME_SIZE )) { +/* +* When an interrupt or exception occurs in entry code, the +* full pt_regs might not have been saved yet. In that case +* just print the iret frame. +*/ +show_iret_regs (regs); + } +} +void show_trace_log_lvl (struct task_struct *task,struct pt_regs *regs,unsigned long *stack,char *log_lvl) {
@@ -94,8 +116,8 @@ void show_trace_log_lvl(struct task_struif (stack_name)printk ("%s <%s>\n" , log_lvl, stack_name); -if (regs &&on_stack (&stack_info, regs,sizeof (*regs))) -__show_regs (regs,0 ); +if (regs) +show_regs_safe (&stack_info, regs);/* * Scan the stack, printing any text addresses we find. At the
@@ -119,7 +141,7 @@ void show_trace_log_lvl(struct task_stru/* * Don't print regs->ip again if it was already printed -* by __show_regs() below. +* by show_regs_safe() below. */ if (regs && stack == ®s->ip) goto next;
@@ -155,8 +177,8 @@ next:/* if the frame has entry regs, print them */ regs =unwind_get_entry_regs (&state); -if (regs &&on_stack (&stack_info, regs,sizeof (*regs))) -__show_regs (regs,0 ); +if (regs) +show_regs_safe (&stack_info, regs); }if (stack_name)
arch/x86/kernel/process_64.c +5 -6
@@ -69,9 +69,8 @@ void __show_regs(struct pt_regs *regs, iunsigned int fsindex, gsindex;unsigned int ds, cs, es; -printk (KERN_DEFAULT "RIP: %04lx:%pS\n" , regs->cs, (void *)regs->ip); -printk (KERN_DEFAULT "RSP: %04lx:%016lx EFLAGS: %08lx" , regs->ss, - regs->sp, regs->flags); +show_iret_regs (regs); +if (regs->orig_ax !=-1 )pr_cont (" ORIG_RAX: %016lx\n" , regs->orig_ax);else
@@ -88,6 +87,9 @@ void __show_regs(struct pt_regs *regs, iprintk (KERN_DEFAULT "R13: %016lx R14: %016lx R15: %016lx\n" , regs->r13, regs->r14, regs->r15); +if (!all) +return ; + asm("movl %%ds,%0" :"=r" (ds)); asm("movl %%cs,%0" :"=r" (cs)); asm("movl %%es,%0" :"=r" (es));
@@ -98,9 +100,6 @@ void __show_regs(struct pt_regs *regs, irdmsrl (MSR_GS_BASE , gs);rdmsrl (MSR_KERNEL_GS_BASE , shadowgs); -if (!all) -return ; - cr0 =read_cr0 (); cr2 =read_cr2 (); cr3 =__read_cr3 ();
arch/x86/kernel/unwind_orc.c +26 -50
124 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 77/159 x86/irq: Remove an old outdated comment about context tracking races
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 6669a692605547892a026445e460bf233958bd7f upstream.
That race has been fixed and code cleaned up for a while now.
--- arch/x86/kernel/irq.c | 12 ------------ 1 file changed, 12 deletions(-)
arch/x86/kernel/irq.c +0 -12
@@ -219,18 +219,6 @@ __visible unsigned int __irq_entry do_IR/* high bit used in ret_from_ code */ unsigned vector = ~regs->orig_ax; -/* -* NB: Unlike exception entries, IRQ entries do not reliably -* handle context tracking in the low-level entry code. This is -* because syscall entries execute briefly with IRQs on before -* updating context tracking state, so we can take an IRQ from -* kernel mode with CONTEXT_USER. The low-level entry code only -* updates the context if we came from user mode, so we won't -* switch to CONTEXT_KERNEL. We'll fix that once the syscall -* code is cleaned up enough that we can cleanly defer enabling -* IRQs. -*/ -entering_irq ();/* entering_irq() tells RCU that we're not quiescent. Check it. */
Greg Kroah-Hartman
maintainerPATCH 81/159 x86/entry/gdt: Put per-CPU GDT remaps in ascending order
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit aaeed3aeb39c1ba69f0a49baec8cb728121d0a91 upstream.
We currently have CPU 0's GDT at the top of the GDT range and higher-numbered CPUs at lower addresses. This happens because the fixmap is upside down (index 0 is the top of the fixmap).
Flip it so that GDTs are in ascending order by virtual address. This will simplify a future patch that will generalize the GDT remap to contain multiple pages.
--- arch/x86/include/asm/desc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/desc.h +1 -1
@@ -63,7 +63,7 @@ static inline struct desc_struct *get_cu/* Get the fixmap index for a specific processor */ static inline unsigned int get_cpu_gdt_ro_index (int cpu) { -return FIX_GDT_REMAP_BEGIN + cpu; +return FIX_GDT_REMAP_END - cpu; }/* Provide the fixmap address of the remapped GDT */
Greg Kroah-Hartman
maintainerPATCH 82/159 x86/mm/fixmap: Generalize the GDT fixmap mechanism, introduce struct cpu_entry_area
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit ef8813ab280507972bb57e4b1b502811ad4411e9 upstream.
Currently, the GDT is an ad-hoc array of pages, one per CPU, in the fixmap. Generalize it to be an array of a new 'struct cpu_entry_area' so that we can cleanly add new things to it.
--- arch/x86/include/asm/desc.h | 9 +-------- arch/x86/include/asm/fixmap.h | 37 +++++++++++++++++++++++++++++++++++-- arch/x86/kernel/cpu/common.c | 14 +++++++------- arch/x86/xen/mmu_pv.c | 2 +- 4 files changed, 44 insertions(+), 18 deletions(-)
arch/x86/include/asm/desc.h +1 -8
@@ -60,17 +60,10 @@ static inline struct desc_struct *get_cureturn this_cpu_ptr (&gdt_page)->gdt; } -/* Get the fixmap index for a specific processor */ -static inline unsigned int get_cpu_gdt_ro_index (int cpu) -{ -return FIX_GDT_REMAP_END - cpu; -} -/* Provide the fixmap address of the remapped GDT */ static inline struct desc_struct *get_cpu_gdt_ro (int cpu) { -unsigned int idx =get_cpu_gdt_ro_index (cpu); -return (struct desc_struct *)__fix_to_virt (idx); +return (struct desc_struct *)&get_cpu_entry_area (cpu)->gdt; }/* Provide the current read-only GDT */
arch/x86/include/asm/fixmap.h +35 -2
@@ -44,6 +44,19 @@ extern unsigned long __FIXADDR_TOP; PAGE_SIZE)#endif +/* +* cpu_entry_area is a percpu region in the fixmap that contains things +* needed by the CPU and early entry/exit code. Real types aren't used +* for all fields here to avoid circular header dependencies. +* +* Every field is a virtual alias of some other allocated backing store. +* There is no direct allocation of a struct cpu_entry_area. +*/ +struct cpu_entry_area { +char gdt[PAGE_SIZE ]; +}; + +#define CPU_ENTRY_AREA_PAGES (sizeof(struct cpu_entry_area) / PAGE_SIZE)/* * Here we define all the compile-time 'special' virtual
@@ -101,8 +114,8 @@ enum fixed_addresses {FIX_LNW_VRTC , #endif/* Fixmap entries to remap the GDTs, one per processor. */ -FIX_GDT_REMAP_BEGIN , -FIX_GDT_REMAP_END =FIX_GDT_REMAP_BEGIN +NR_CPUS -1 , +FIX_CPU_ENTRY_AREA_TOP , +FIX_CPU_ENTRY_AREA_BOTTOM =FIX_CPU_ENTRY_AREA_TOP + (CPU_ENTRY_AREA_PAGES *NR_CPUS ) -1 , #ifdef CONFIG_ACPI_APEI_GHES/* Used for GHES mapping from assorted contexts */
@@ -191,5 +204,25 @@ void __init *early_memremap_decrypted_wpvoid __early_set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags); +static inline unsigned int __get_cpu_entry_area_page_index (int cpu,int page) +{ +BUILD_BUG_ON (sizeof (struct cpu_entry_area ) %PAGE_SIZE !=0 ); + +return FIX_CPU_ENTRY_AREA_BOTTOM - cpu*CPU_ENTRY_AREA_PAGES - page; +} + +#define __get_cpu_entry_area_offset_index (cpu, offset) ({ \ + BUILD_BUG_ON(offset % PAGE_SIZE != 0); \ + __get_cpu_entry_area_page_index(cpu, offset / PAGE_SIZE); \ + }) + +#define get_cpu_entry_area_index (cpu, field) \ + __get_cpu_entry_area_offset_index((cpu), offsetof(struct cpu_entry_area, field)) + +static inline struct cpu_entry_area *get_cpu_entry_area (int cpu) +{ +return (struct cpu_entry_area *)__fix_to_virt (__get_cpu_entry_area_page_index (cpu,0 )); +} +#endif /* !__ASSEMBLY__ */ #endif /* _ASM_X86_FIXMAP_H */
arch/x86/kernel/cpu/common.c +7 -7
@@ -466,12 +466,12 @@ void load_percpu_segment(int cpu)load_stack_canary_segment (); } -/* Setup the fixmap mapping only once per-processor */ -static inline void setup_fixmap_gdt (int cpu) +/* Setup the fixmap mappings only once per-processor */ +static inline void setup_cpu_entry_area (int cpu) {#ifdef CONFIG_X86_64 /* On 64-bit systems, we use a read-only fixmap GDT. */ -pgprot_t prot =PAGE_KERNEL_RO ; +pgprot_t gdt_prot =PAGE_KERNEL_RO ;#else /* * On native 32-bit systems, the GDT cannot be read-only because
@@ -482,11 +482,11 @@ static inline void setup_fixmap_gdt(int* On Xen PV, the GDT must be read-only because the hypervisor requires * it. */ -pgprot_t prot =boot_cpu_has (X86_FEATURE_XENPV ) ? +pgprot_t gdt_prot =boot_cpu_has (X86_FEATURE_XENPV ) ?PAGE_KERNEL_RO :PAGE_KERNEL ;#endif -__set_fixmap (get_cpu_gdt_ro_index (cpu),get_cpu_gdt_paddr (cpu), prot); +__set_fixmap (get_cpu_entry_area_index (cpu, gdt),get_cpu_gdt_paddr (cpu), gdt_prot); }/* Load the original GDT from the per-cpu structure */
@@ -1589,7 +1589,7 @@ void cpu_init(void)if (is_uv_system ())uv_cpu_init (); -setup_fixmap_gdt (cpu); +setup_cpu_entry_area (cpu);load_fixmap_gdt (cpu); }
@@ -1651,7 +1651,7 @@ void cpu_init(void)fpu__init_cpu (); -setup_fixmap_gdt (cpu); +setup_cpu_entry_area (cpu); load_fixmap_gdt(cpu); }#endif
arch/x86/xen/mmu_pv.c +1 -1
@@ -2272,7 +2272,7 @@ static void xen_set_fixmap(unsigned idx,#endif case FIX_TEXT_POKE0 :case FIX_TEXT_POKE1 : - case FIX_GDT_REMAP_BEGIN ... FIX_GDT_REMAP_END: + case FIX_CPU_ENTRY_AREA_TOP ... FIX_CPU_ENTRY_AREA_BOTTOM:/* All local page mappings */ pte =pfn_pte (phys, prot);break ;
Greg Kroah-Hartman
maintainerPATCH 83/159 x86/kasan/64: Teach KASAN about the cpu_entry_area
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 21506525fb8ddb0342f2a2370812d47f6a1f3833 upstream.
The cpu_entry_area will contain stacks. Make sure that KASAN has appropriate shadow mappings for them.
--- arch/x86/mm/kasan_init_64.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
arch/x86/mm/kasan_init_64.c +17 -1
@@ -277,6 +277,7 @@ void __init kasan_early_init(void)void __init kasan_init (void ) {int i; +void *shadow_cpu_entry_begin, *shadow_cpu_entry_end;#ifdef CONFIG_KASAN_INLINE register_die_notifier (&kasan_die_notifier);
@@ -329,8 +330,23 @@ void __init kasan_init(void) (unsigned long )kasan_mem_to_shadow (_end), early_pfn_to_nid(__pa(_stext))); + shadow_cpu_entry_begin = (void *)__fix_to_virt (FIX_CPU_ENTRY_AREA_BOTTOM ); + shadow_cpu_entry_begin =kasan_mem_to_shadow (shadow_cpu_entry_begin); + shadow_cpu_entry_begin = (void *)round_down ((unsigned long )shadow_cpu_entry_begin, +PAGE_SIZE ); + + shadow_cpu_entry_end = (void *)(__fix_to_virt (FIX_CPU_ENTRY_AREA_TOP ) +PAGE_SIZE ); + shadow_cpu_entry_end =kasan_mem_to_shadow (shadow_cpu_entry_end); + shadow_cpu_entry_end = (void *)round_up ((unsigned long )shadow_cpu_entry_end, +PAGE_SIZE ); +kasan_populate_zero_shadow (kasan_mem_to_shadow ((void *)MODULES_END ), - (void *)KASAN_SHADOW_END ); + shadow_cpu_entry_begin); + +kasan_populate_shadow ((unsigned long )shadow_cpu_entry_begin, + (unsigned long )shadow_cpu_entry_end,0 ); + +kasan_populate_zero_shadow (shadow_cpu_entry_end, (void *)KASAN_SHADOW_END );load_cr3 (init_top_pgt);__flush_tlb_all ();
Greg Kroah-Hartman
maintainerPATCH 84/159 x86/entry: Fix assumptions that the HW TSS is at the beginning of cpu_tss
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 7fb983b4dd569e08564134a850dfd4eb1c63d9b8 upstream.
A future patch will move SYSENTER_stack to the beginning of cpu_tss to help detect overflow. Before this can happen, fix several code paths that hardcode assumptions about the old layout.
--- arch/x86/include/asm/desc.h | 2 +- arch/x86/include/asm/processor.h | 9 +++++++-- arch/x86/kernel/cpu/common.c | 8 ++++---- arch/x86/kernel/doublefault.c | 32 +++++++++++++++----------------- arch/x86/kvm/vmx.c | 2 +- arch/x86/power/cpu.c | 13 +++++++------ 6 files changed, 35 insertions(+), 31 deletions(-)
arch/x86/include/asm/desc.h +1 -1
@@ -178,7 +178,7 @@ static inline void set_tssldt_descriptor#endif } -static inline void __set_tss_desc (unsigned cpu,unsigned int entry,void *addr) +static inline void __set_tss_desc (unsigned cpu,unsigned int entry,struct x86_hw_tss *addr) {struct desc_struct *d =get_cpu_gdt_rw (cpu);tss_desc tss;
arch/x86/include/asm/processor.h +7 -2
@@ -162,7 +162,7 @@ enum cpuid_regs_idx {extern struct cpuinfo_x86 boot_cpu_data;extern struct cpuinfo_x86 new_cpu_data; -extern struct tss_struct doublefault_tss; +extern struct x86_hw_tss doublefault_tss;extern __u32 cpu_caps_cleared[NCAPINTS ];extern __u32 cpu_caps_set[NCAPINTS ];
@@ -252,6 +252,11 @@ static inline void load_cr3(pgd_t *pgdirwrite_cr3 (__sme_pa (pgdir)); } +/* +* Note that while the legacy 'TSS' name comes from 'Task State Segment', +* on modern x86 CPUs the TSS also holds information important to 64-bit mode, +* unrelated to the task-switch mechanism: +*/ #ifdef CONFIG_X86_32 /* This is the TSS defined by the hardware. */ struct x86_hw_tss {
@@ -322,7 +327,7 @@ struct x86_hw_tss {#define IO_BITMAP_BITS 65536#define IO_BITMAP_BYTES (IO_BITMAP_BITS/8)#define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long)) -#define IO_BITMAP_OFFSET offsetof(struct tss_struct, io_bitmap) +#define IO_BITMAP_OFFSET (offsetof(struct tss_struct, io_bitmap) - offsetof(struct tss_struct, x86_tss))#define INVALID_IO_BITMAP_OFFSET 0x8000struct tss_struct {
arch/x86/kernel/cpu/common.c +4 -4
@@ -1557,7 +1557,7 @@ void cpu_init(void) } } - t->x86_tss.io_bitmap_base = offsetof(struct tss_struct , io_bitmap); + t->x86_tss.io_bitmap_base =IO_BITMAP_OFFSET ;/* * <= is required because the CPU will access up to
@@ -1576,7 +1576,7 @@ void cpu_init(void)* Initialize the TSS. Don't bother initializing sp0, as the initial * task never enters user mode. */ -set_tss_desc (cpu, t); +set_tss_desc (cpu, &t->x86_tss);load_TR_desc ();load_mm_ldt (&init_mm);
@@ -1634,12 +1634,12 @@ void cpu_init(void)* Initialize the TSS. Don't bother initializing sp0, as the initial * task never enters user mode. */ -set_tss_desc (cpu, t); +set_tss_desc (cpu, &t->x86_tss);load_TR_desc ();load_mm_ldt (&init_mm); - t->x86_tss.io_bitmap_base = offsetof(struct tss_struct , io_bitmap); + t->x86_tss.io_bitmap_base =IO_BITMAP_OFFSET ;#ifdef CONFIG_DOUBLEFAULT /* Set up doublefault TSS pointer in the GDT */
arch/x86/kernel/doublefault.c +15 -17
@@ -50,25 +50,23 @@ static void doublefault_fn(void)cpu_relax (); } -struct tss_struct doublefault_tss __cacheline_aligned = { - .x86_tss = { - .sp0 =STACK_START , - .ss0 = __KERNEL_DS, - .ldt =0 , - .io_bitmap_base =INVALID_IO_BITMAP_OFFSET , +struct x86_hw_tss doublefault_tss __cacheline_aligned = { + .sp0 =STACK_START , + .ss0 = __KERNEL_DS, + .ldt =0 , + .io_bitmap_base =INVALID_IO_BITMAP_OFFSET , - .ip = (unsigned long ) doublefault_fn, -/* 0x2 bit is always set */ - .flags =X86_EFLAGS_SF |0x2 , - .sp =STACK_START , - .es = __USER_DS, - .cs = __KERNEL_CS, - .ss = __KERNEL_DS, - .ds = __USER_DS, - .fs = __KERNEL_PERCPU, + .ip = (unsigned long ) doublefault_fn, +/* 0x2 bit is always set */ + .flags =X86_EFLAGS_SF |0x2 , + .sp =STACK_START , + .es = __USER_DS, + .cs = __KERNEL_CS, + .ss = __KERNEL_DS, + .ds = __USER_DS, + .fs = __KERNEL_PERCPU, - .__cr3 =__pa_nodebug (swapper_pg_dir), - } + .__cr3 =__pa_nodebug (swapper_pg_dir), };/* dummy for do_double_fault() call */
arch/x86/kvm/vmx.c +1 -1
@@ -2295,7 +2295,7 @@ static void vmx_vcpu_load(struct kvm_vcp* processors. See 22.2.4. */ vmcs_writel (HOST_TR_BASE , - (unsigned long )this_cpu_ptr (&cpu_tss)); + (unsigned long )this_cpu_ptr (&cpu_tss.x86_tss));vmcs_writel (HOST_GDTR_BASE , (unsigned long )gdt);/* 22.2.4 */ /*
arch/x86/power/cpu.c +7 -6
@@ -165,12 +165,13 @@ static void fix_processor_context(void)struct desc_struct *desc =get_cpu_gdt_rw (cpu);tss_desc tss;#endif -set_tss_desc (cpu, t);/* -* This just modifies memory; should not be -* necessary. But... This is necessary, because -* 386 hardware has concept of busy TSS or some -* similar stupidity. -*/ + +/* +* This just modifies memory; should not be necessary. But... This is +* necessary, because 386 hardware has concept of busy TSS or some +* similar stupidity. +*/ +set_tss_desc (cpu, &t->x86_tss);#ifdef CONFIG_X86_64 memcpy (&tss, &desc[GDT_ENTRY_TSS ],sizeof (tss_desc));
Greg Kroah-Hartman
maintainerPATCH 87/159 x86/entry: Remap the TSS into the CPU entry area
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 72f5e08dbba2d01aa90b592cf76c378ea233b00b upstream.
This has a secondary purpose: it puts the entry stack into a region with a well-controlled layout. A subsequent patch will take advantage of this to streamline the SYSCALL entry code to be able to find it more easily.
--- arch/x86/entry/entry_32.S | 6 ++++-- arch/x86/include/asm/fixmap.h | 7 +++++++ arch/x86/kernel/asm-offsets.c | 3 +++ arch/x86/kernel/cpu/common.c | 41 +++++++++++++++++++++++++++++++++++------ arch/x86/kernel/dumpstack.c | 3 ++- arch/x86/kvm/vmx.c | 2 +- arch/x86/power/cpu.c | 11 ++++++----- 7 files changed, 58 insertions(+), 15 deletions(-)
arch/x86/entry/entry_32.S +4 -2
@@ -941,7 +941,8 @@ ENTRY(debug) movl %esp, %eax # pt_regs pointer /* Are we currently on the SYSENTER stack? */ - PER_CPU(cpu_tss + CPU_TSS_SYSENTER_stack + SIZEOF_SYSENTER_stack, %ecx) + movl PER_CPU_VAR(cpu_entry_area), %ecx + addl $CPU_ENTRY_AREA_tss + CPU_TSS_SYSENTER_stack + SIZEOF_SYSENTER_stack, %ecx subl %eax, %ecx /* ecx = (end of SYSENTER_stack) - esp */ cmpl $SIZEOF_SYSENTER_stack, %ecx jb .Ldebug_from_sysenter_stack
@@ -984,7 +985,8 @@ ENTRY(nmi) movl %esp, %eax # pt_regs pointer /* Are we currently on the SYSENTER stack? */ - PER_CPU(cpu_tss + CPU_TSS_SYSENTER_stack + SIZEOF_SYSENTER_stack, %ecx) + movl PER_CPU_VAR(cpu_entry_area), %ecx + addl $CPU_ENTRY_AREA_tss + CPU_TSS_SYSENTER_stack + SIZEOF_SYSENTER_stack, %ecx subl %eax, %ecx /* ecx = (end of SYSENTER_stack) - esp */ cmpl $SIZEOF_SYSENTER_stack, %ecx jb .Lnmi_from_sysenter_stack
arch/x86/include/asm/fixmap.h +7 -0
@@ -54,6 +54,13 @@ extern unsigned long __FIXADDR_TOP;*/ struct cpu_entry_area {char gdt[PAGE_SIZE ]; + +/* +* The GDT is just below cpu_tss and thus serves (on x86_64) as a +* a read-only guard page for the SYSENTER stack at the bottom +* of the TSS region. +*/ +struct tss_struct tss; };#define CPU_ENTRY_AREA_PAGES (sizeof(struct cpu_entry_area) / PAGE_SIZE)
arch/x86/kernel/asm-offsets.c +3 -0
@@ -98,4 +98,7 @@ void common(void) {OFFSET (CPU_TSS_SYSENTER_stack, tss_struct, SYSENTER_stack);/* Size of SYSENTER_stack */ DEFINE (SIZEOF_SYSENTER_stack,sizeof (((struct tss_struct *)0 )->SYSENTER_stack)); + +/* Layout info for cpu_entry_area */ +OFFSET (CPU_ENTRY_AREA_tss, cpu_entry_area, tss); }
arch/x86/kernel/cpu/common.c +35 -6
104 lines not on this page · raw message
arch/x86/kernel/dumpstack.c +2 -1
@@ -45,7 +45,8 @@ bool in_task_stack(unsigned long *stack,bool in_sysenter_stack (unsigned long *stack,struct stack_info *info) { -struct tss_struct *tss =this_cpu_ptr (&cpu_tss); +int cpu =smp_processor_id (); +struct tss_struct *tss = &get_cpu_entry_area (cpu)->tss;/* Treat the canary as part of the stack for unwinding purposes. */ void *begin = &tss->SYSENTER_stack_canary;
arch/x86/kvm/vmx.c +1 -1
@@ -2295,7 +2295,7 @@ static void vmx_vcpu_load(struct kvm_vcp* processors. See 22.2.4. */ vmcs_writel (HOST_TR_BASE , - (unsigned long )this_cpu_ptr (&cpu_tss.x86_tss)); + (unsigned long )&get_cpu_entry_area (cpu)->tss.x86_tss);vmcs_writel (HOST_GDTR_BASE , (unsigned long )gdt);/* 22.2.4 */ /*
arch/x86/power/cpu.c +6 -5
@@ -160,18 +160,19 @@ static void do_fpu_end(void)static void fix_processor_context (void ) {int cpu =smp_processor_id (); -struct tss_struct *t = &per_cpu (cpu_tss, cpu);#ifdef CONFIG_X86_64 struct desc_struct *desc =get_cpu_gdt_rw (cpu);tss_desc tss;#endif /* -* This just modifies memory; should not be necessary. But... This is -* necessary, because 386 hardware has concept of busy TSS or some -* similar stupidity. +* We need to reload TR, which requires that we change the +* GDT entry to indicate "available" first. +* +* XXX: This could probably all be replaced by a call to +* force_reload_TR(). */ -set_tss_desc (cpu, &t->x86_tss); +set_tss_desc (cpu, &get_cpu_entry_area (cpu)->tss.x86_tss);#ifdef CONFIG_X86_64 memcpy (&tss, &desc[GDT_ENTRY_TSS ],sizeof (tss_desc));
Greg Kroah-Hartman
maintainerPATCH 88/159 x86/entry/64: Separate cpu_current_top_of_stack from TSS.sp0
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 9aaefe7b59ae00605256a7d6bd1c1456432495fc upstream.
On 64-bit kernels, we used to assume that TSS.sp0 was the current top of stack. With the addition of an entry trampoline, this will no longer be the case. Store the current top of stack in TSS.sp1, which is otherwise unused but shares the same cacheline.
--- arch/x86/include/asm/processor.h | 18 +++++++++++++----- arch/x86/include/asm/thread_info.h | 2 +- arch/x86/kernel/asm-offsets_64.c | 1 + arch/x86/kernel/process.c | 10 ++++++++++ arch/x86/kernel/process_64.c | 1 + 5 files changed, 26 insertions(+), 6 deletions(-)
arch/x86/include/asm/processor.h +13 -5
@@ -309,7 +309,13 @@ struct x86_hw_tss {struct x86_hw_tss {u32 reserved1;u64 sp0; + +/* +* We store cpu_current_top_of_stack in sp1 so it's always accessible. +* Linux does not use ring 1, so sp1 is not otherwise needed. +*/ u64 sp1; +u64 sp2;u64 reserved2;u64 ist[7 ];
@@ -368,6 +374,8 @@ DECLARE_PER_CPU_PAGE_ALIGNED(struct tss_#ifdef CONFIG_X86_32 DECLARE_PER_CPU(unsigned long, cpu_current_top_of_stack); +#else +#define cpu_current_top_of_stack cpu_tss.x86_tss.sp1#endif /*
@@ -539,12 +547,12 @@ static inline void native_swapgs(void)static inline unsigned long current_top_of_stack (void ) { -#ifdef CONFIG_X86_64 -return this_cpu_read_stable (cpu_tss.x86_tss.sp0); -#else -/* sp0 on x86_32 is special in and around vm86 mode. */ +/* +* We can't read directly from tss.sp0: sp0 on x86_32 is special in +* and around vm86 mode and sp0 on x86_64 is special because of the +* entry trampoline. +*/ return this_cpu_read_stable (cpu_current_top_of_stack); -#endif }static inline bool on_thread_stack (void )
arch/x86/include/asm/thread_info.h +1 -1
@@ -207,7 +207,7 @@ static inline int arch_within_stack_fram#else /* !__ASSEMBLY__ */ #ifdef CONFIG_X86_64 -# define cpu_current_top_of_stack (cpu_tss + TSS_sp0) +# define cpu_current_top_of_stack (cpu_tss + TSS_sp1)#endif #endif
arch/x86/kernel/asm-offsets_64.c +1 -0
@@ -66,6 +66,7 @@ int main(void)OFFSET (TSS_ist, tss_struct, x86_tss.ist);OFFSET (TSS_sp0, tss_struct, x86_tss.sp0); +OFFSET (TSS_sp1, tss_struct, x86_tss.sp1);BLANK ();#ifdef CONFIG_CC_STACKPROTECTOR
arch/x86/kernel/process.c +10 -0
@@ -56,6 +56,16 @@ __visible DEFINE_PER_CPU_SHARED_ALIGNED(* Poison it. */ .sp0 = (1UL << (BITS_PER_LONG-1)) + 1, + +#ifdef CONFIG_X86_64 +/* +* .sp1 is cpu_current_top_of_stack. The init task never +* runs user code, but cpu_current_top_of_stack should still +* be well defined before the first context switch. +*/ + .sp1 = TOP_OF_INIT_STACK, +#endif +#ifdef CONFIG_X86_32 .ss0 = __KERNEL_DS, .ss1 = __KERNEL_CS,
arch/x86/kernel/process_64.c +1 -0
@@ -461,6 +461,7 @@ __switch_to(struct task_struct *prev_p,* Switch the PDA and FPU contexts. */ this_cpu_write (current_task, next_p); +this_cpu_write (cpu_current_top_of_stack,task_top_of_stack (next_p));/* Reload sp0. */ update_sp0 (next_p);
Greg Kroah-Hartman
maintainerPATCH 89/159 x86/espfix/64: Stop assuming that pt_regs is on the entry stack
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 6d9256f0a89eaff97fca6006100bcaea8d1d8bdb upstream.
When we start using an entry trampoline, a #GP from userspace will be delivered on the entry stack, not on the task stack. Fix the espfix64 #DF fixup to set up #GP according to TSS.SP0, rather than assuming that pt_regs + 1 == SP0. This won't change anything without an entry stack, but it will make the code continue to work when an entry stack is added.
While we're at it, improve the comments to explain what's actually going on.
--- arch/x86/kernel/traps.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-)
arch/x86/kernel/traps.c +28 -9
@@ -348,9 +348,15 @@ dotraplinkage void do_double_fault(struc/* * If IRET takes a non-IST fault on the espfix64 stack, then we -* end up promoting it to a doublefault. In that case, modify -* the stack to make it look like we just entered the #GP -* handler from user space, similar to bad_iret. +* end up promoting it to a doublefault. In that case, take +* advantage of the fact that we're not using the normal (TSS.sp0) +* stack right now. We can write a fake #GP(0) frame at TSS.sp0 +* and then modify our own IRET frame so that, when we return, +* we land directly at the #GP(0) vector with the stack already +* set up according to its expectations. +* +* The net result is that our #GP handler will think that we +* entered from usermode with the bad user context. * * No need for ist_enter here because we don't use RCU. */
@@ -358,13 +364,26 @@ dotraplinkage void do_double_fault(struc regs->cs == __KERNEL_CS && regs->ip == (unsigned long)native_irq_return_iret) { -struct pt_regs *normal_regs =task_pt_regs (current); +struct pt_regs *gpregs = (struct pt_regs *)this_cpu_read (cpu_tss.x86_tss.sp0) -1 ; -/* Fake a #GP(0) from userspace. */ -memmove (&normal_regs->ip, (void *)regs->sp,5 *8 ); - normal_regs->orig_ax =0 ;/* Missing (lost) #GP error code */ +/* +* regs->sp points to the failing IRET frame on the +* ESPFIX64 stack. Copy it to the entry stack. This fills +* in gpregs->ss through gpregs->ip. +* +*/ +memmove (&gpregs->ip, (void *)regs->sp,5 *8 ); + gpregs->orig_ax =0 ;/* Missing (lost) #GP error code */ + +/* +* Adjust our frame so that we return straight to the #GP +* vector with the expected RSP value. This is safe because +* we won't enable interupts or schedule before we invoke +* general_protection, so nothing will clobber the stack +* frame we just set up. +*/ regs->ip = (unsigned long )general_protection; - regs->sp = (unsigned long )&normal_regs->orig_ax; + regs->sp = (unsigned long )&gpregs->orig_ax;return ; }
@@ -389,7 +408,7 @@ dotraplinkage void do_double_fault(struc* * Processors update CR2 whenever a page fault is detected. If a * second page fault occurs while an earlier page fault is being -* deliv- ered, the faulting linear address of the second fault will +* delivered, the faulting linear address of the second fault will * overwrite the contents of CR2 (replacing the previous * address). These updates to CR2 occur even if the page fault * results in a double fault or occurs during the delivery of a
Greg Kroah-Hartman
maintainerPATCH 91/159 x86/entry/64: Return to userspace from the trampoline stack
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 3e3b9293d392c577b62e24e4bc9982320438e749 upstream.
By itself, this is useless. It gives us the ability to run some final code before exit that cannnot run on the kernel stack. This could include a CR3 switch a la PAGE_TABLE_ISOLATION or some kernel stack erasing, for example. (Or even weird things like *changing* which kernel stack gets used as an ASLR-strengthening mechanism.)
The SYSRET32 path is not covered yet. It could be in the future or we could just ignore it and force the slow path if needed.
--- arch/x86/entry/entry_64.S | 55 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-)
arch/x86/entry/entry_64.S +51 -4
@@ -326,8 +326,24 @@ syscall_return_via_sysret: popq %rsi /* skip rcx */ popq %rdx popq %rsi + + /* + * Now all regs are restored except RSP and RDI. + * Save old stack pointer and switch to trampoline stack. + */ + movq %rsp, %rdi + movq PER_CPU_VAR(cpu_tss + TSS_sp0), %rsp + + pushq RSP-RDI(%rdi) /* RSP */ + pushq (%rdi) /* RDI */ + + /* + * We are on the trampoline stack. All regs except RDI are live. + * We can do future final exit work right here. + */ + popq %rdi - movq RSP-ORIG_RAX(%rsp), %rsp + popq %rsp USERGS_SYSRET64 END(entry_SYSCALL_64)
@@ -630,10 +646,41 @@ GLOBAL(swapgs_restore_regs_and_return_to ud2 1: #endif - SWAPGS POP_EXTRA_REGS - POP_C_REGS - addq $8, %rsp /* skip regs->orig_ax */ + popq %r11 + popq %r10 + popq %r9 + popq %r8 + popq %rax + popq %rcx + popq %rdx + popq %rsi + + /* + * The stack is now user RDI, orig_ax, RIP, CS, EFLAGS, RSP, SS. + * Save old stack pointer and switch to trampoline stack. + */ + movq %rsp, %rdi + movq PER_CPU_VAR(cpu_tss + TSS_sp0), %rsp + + /* Copy the IRET frame to the trampoline stack. */ + pushq 6*8(%rdi) /* SS */ + pushq 5*8(%rdi) /* RSP */ + pushq 4*8(%rdi) /* EFLAGS */ + pushq 3*8(%rdi) /* CS */ + pushq 2*8(%rdi) /* RIP */ + + /* Push user RDI on the trampoline stack. */ + pushq (%rdi) + + /* + * We are on the trampoline stack. All regs except RDI are live. + * We can do future final exit work right here. + */ + + /* Restore RDI. */ + popq %rdi + SWAPGS INTERRUPT_RETURN
Greg Kroah-Hartman
maintainerPATCH 93/159 x86/entry/64: Move the IST stacks into struct cpu_entry_area
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 40e7f949e0d9a33968ebde5d67f7e3a47c97742a upstream.
The IST stacks are needed when an IST exception occurs and are accessed before any kernel code at all runs. Move them into struct cpu_entry_area.
The IST stacks are unlike the rest of cpu_entry_area: they're used even for entries from kernel mode. This means that they should be set up before we load the final IDT. Move cpu_entry_area setup to trap_init() for the boot CPU and set it up for all possible CPUs at once in native_smp_prepare_cpus().
--- arch/x86/include/asm/fixmap.h | 12 ++++++ arch/x86/kernel/cpu/common.c | 74 +++++++++++++++++++++++------------------- arch/x86/kernel/traps.c | 3 + 3 files changed, 57 insertions(+), 32 deletions(-)
arch/x86/include/asm/fixmap.h +12 -0
@@ -63,10 +63,22 @@ struct cpu_entry_area {struct tss_struct tss;char entry_trampoline[PAGE_SIZE ]; + +#ifdef CONFIG_X86_64 +/* +* Exception stacks used for IST entries. +* +* In the future, this should have a separate slot for each stack +* with guard pages between them. +*/ +char exception_stacks[(N_EXCEPTION_STACKS -1 ) *EXCEPTION_STKSZ +DEBUG_STKSZ ]; +#endif };#define CPU_ENTRY_AREA_PAGES (sizeof(struct cpu_entry_area) / PAGE_SIZE) +extern void setup_cpu_entry_areas (void ); +/* * Here we define all the compile-time 'special' virtual * addresses. The point is to have a constant address at
arch/x86/kernel/cpu/common.c +42 -32
124 lines not on this page · raw message
arch/x86/kernel/traps.c +3 -0
@@ -947,6 +947,9 @@ dotraplinkage void do_iret_error(structvoid __init trap_init (void ) { +/* Init cpu_entry_area before IST entries are set up */ +setup_cpu_entry_areas (); +idt_setup_traps ();/*
Greg Kroah-Hartman
maintainerPATCH 97/159 x86/paravirt: Dont patch flush_tlb_single
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit a035795499ca1c2bd1928808d1a156eda1420383 upstream.
native_flush_tlb_single() will be changed with the upcoming PAGE_TABLE_ISOLATION feature. This requires to have more code in there than INVLPG.
Remove the paravirt patching for it.
--- arch/x86/kernel/paravirt_patch_64.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/kernel/paravirt_patch_64.c +0 -2
@@ -10,7 +10,6 @@ DEF_NATIVE(pv_irq_ops, save_fl, "pushfq;DEF_NATIVE (pv_mmu_ops, read_cr2,"movq %cr2, %rax" );DEF_NATIVE (pv_mmu_ops, read_cr3,"movq %cr3, %rax" );DEF_NATIVE (pv_mmu_ops, write_cr3,"movq %rdi, %cr3" ); -DEF_NATIVE (pv_mmu_ops, flush_tlb_single,"invlpg (%rdi)" );DEF_NATIVE (pv_cpu_ops, wbinvd,"wbinvd" );DEF_NATIVE (pv_cpu_ops, usergs_sysret64,"swapgs; sysretq" );
@@ -60,7 +59,6 @@ unsigned native_patch(u8 type, u16 clobbPATCH_SITE (pv_mmu_ops, read_cr2);PATCH_SITE (pv_mmu_ops, read_cr3);PATCH_SITE (pv_mmu_ops, write_cr3); -PATCH_SITE (pv_mmu_ops, flush_tlb_single);PATCH_SITE (pv_cpu_ops, wbinvd);#if defined(CONFIG_PARAVIRT_SPINLOCKS )case PARAVIRT_PATCH (pv_lock_ops.queued_spin_unlock):
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Greg Kroah-Hartman
maintainerPATCH 100/159 optee: fix invalid of_node_put() in optee_driver_init()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Wiklander <[email protected]>
commit f044113113dd95ba73916bde10e804d3cdfa2662 upstream.
The first node supplied to of_find_matching_node() has its reference counter decreased as part of call to that function. In optee_driver_init() after calling of_find_matching_node() it's invalid to call of_node_put() on the supplied node again.
So remove the invalid call to of_node_put().
--- drivers/tee/optee/core.c | 1 - 1 file changed, 1 deletion(-)
drivers/tee/optee/core.c +0 -1
@@ -590,7 +590,6 @@ static int __init optee_driver_init(voidreturn -ENODEV ; np =of_find_matching_node (fw_np, optee_match); -of_node_put (fw_np);if (!np)return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 102/159 drm: Add retries for lspcon mode detection
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shashank Sharma <[email protected]>
[ Upstream commit f687e25a7a245952349f1f9f9cc238ac5a3be258 ]
Quoted 1 line
Quoted 1 line
From the CI builds, its been observed that during a driver
reload/insert, dp dual mode read function sometimes fails to read from LSPCON device over i2c-over-aux channel.
This patch:
- adds some delay and few retries, allowing a scope for these devices to settle down and respond.
- changes one error log's level from ERROR->DEBUG as we want to call it an error only after all the retries are exhausted.
V2: Addressed review comments from Jani (for loop for retry)
V3: Addressed review comments from Imre (break on partial read too)
V3: Addressed review comments from Ville/Imre (Add the retries
exclusively for LSPCON, not for all dp_dual_mode devices)
V4: Added r-b from Imre, sending it to dri-devel (Jani)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102294
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102295
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102359
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103186
--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +13 -3
@@ -410,6 +410,7 @@ int drm_lspcon_get_mode(struct i2c_adapt {u8 data;int ret =0 ; +int retry;if (!mode) {DRM_ERROR ("NULL input\n" );
@@ -417,10 +418,19 @@ int drm_lspcon_get_mode(struct i2c_adapt }/* Read Status: i2c over aux */ - ret =drm_dp_dual_mode_read (adapter,DP_DUAL_MODE_LSPCON_CURRENT_MODE , - &data,sizeof (data)); +for (retry =0 ; retry <6 ; retry++) { +if (retry) +usleep_range (500 ,1000 ); + + ret =drm_dp_dual_mode_read (adapter, +DP_DUAL_MODE_LSPCON_CURRENT_MODE , + &data,sizeof (data)); +if (!ret) +break ; + } +if (ret <0 ) { -DRM_ERROR ("LSPCON read(0x80, 0x41) failed\n" ); +DRM_DEBUG_KMS ("LSPCON read(0x80, 0x41) failed\n" );return -EFAULT ; }
Greg Kroah-Hartman
maintainerPATCH 105/159 crypto: crypto4xx - increase context and scatter ring buffer elements
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Lamparter <[email protected]>
[ Upstream commit 778f81d6cdb7d25360f082ac0384d5103f04eca5 ]
If crypto4xx is used in conjunction with dm-crypt, the available ring buffer elements are not enough to handle the load properly.
On an aes-cbc-essiv:sha256 encrypted swap partition the read performance is abyssal: (tested with hdparm -t)
/dev/mapper/swap_crypt:
Timing buffered disk reads: 14 MB in 3.68 seconds = 3.81 MB/sec
The patch increases both PPC4XX_NUM_SD and PPC4XX_NUM_PD to 256. This improves the performance considerably:
/dev/mapper/swap_crypt:
Timing buffered disk reads: 104 MB in 3.03 seconds = 34.31 MB/sec
Furthermore, PPC4XX_LAST_SD, PPC4XX_LAST_GD and PPC4XX_LAST_PD can be easily calculated from their respective PPC4XX_NUM_* constant.
--- drivers/crypto/amcc/crypto4xx_core.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/crypto/amcc/crypto4xx_core.h +5 -5
@@ -34,12 +34,12 @@#define PPC405EX_CE_RESET 0x00000008#define CRYPTO4XX_CRYPTO_PRIORITY 300 -#define PPC4XX_LAST_PD 63 -#define PPC4XX_NUM_PD 64 -#define PPC4XX_LAST_GD 1023 +#define PPC4XX_NUM_PD 256 +#define PPC4XX_LAST_PD (PPC4XX_NUM_PD - 1)#define PPC4XX_NUM_GD 1024 -#define PPC4XX_LAST_SD 63 -#define PPC4XX_NUM_SD 64 +#define PPC4XX_LAST_GD (PPC4XX_NUM_GD - 1) +#define PPC4XX_NUM_SD 256 +#define PPC4XX_LAST_SD (PPC4XX_NUM_SD - 1)#define PPC4XX_SD_BUFFER_SIZE 2048#define PD_ENTRY_INUSE 1
Greg Kroah-Hartman
maintainerPATCH 106/159 crypto: lrw - Fix an error handling path in create()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Jaillet <[email protected]>
[ Upstream commit 616129cc6e75fb4da6681c16c981fa82dfe5e4c7 ]
All error handling paths 'goto err_drop_spawn' except this one. In order to avoid some resources leak, we should do it as well here.
--- crypto/lrw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
crypto/lrw.c +4 -2
@@ -610,8 +610,10 @@ static int create(struct crypto_template ecb_name[len -1 ] =0 ;if (snprintf (inst->alg.base.cra_name,CRYPTO_MAX_ALG_NAME , -"lrw(%s)" , ecb_name) >=CRYPTO_MAX_ALG_NAME ) -return -ENAMETOOLONG ; +"lrw(%s)" , ecb_name) >=CRYPTO_MAX_ALG_NAME ) { + err = -ENAMETOOLONG ; + goto err_drop_spawn; + } } inst->alg.base.cra_flags = alg->base.cra_flags &CRYPTO_ALG_ASYNC ;
Greg Kroah-Hartman
maintainerPATCH 108/159 kvm, mm: account kvm related kmem slabs to kmemcg
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <[email protected]>
[ Upstream commit 46bea48ac241fe0b413805952dda74dd0c09ba8b ]
The kvm slabs can consume a significant amount of system memory and indeed in our production environment we have observed that a lot of machines are spending significant amount of memory that can not be left as system memory overhead. Also the allocations from these slabs can be triggered directly by user space applications which has access to kvm and thus a buggy application can leak such memory. So, these caches should be accounted to kmemcg.
--- arch/x86/kvm/mmu.c | 4 ++-- virt/kvm/kvm_main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/kvm/mmu.c +2 -2
@@ -5476,13 +5476,13 @@ int kvm_mmu_module_init(void) pte_list_desc_cache =kmem_cache_create ("pte_list_desc" ,sizeof (struct pte_list_desc ), -0 ,0 ,NULL ); +0 ,SLAB_ACCOUNT ,NULL );if (!pte_list_desc_cache) goto nomem; mmu_page_header_cache =kmem_cache_create ("kvm_mmu_page_header" ,sizeof (struct kvm_mmu_page ), -0 ,0 ,NULL ); +0 ,SLAB_ACCOUNT ,NULL );if (!mmu_page_header_cache) goto nomem;
virt/kvm/kvm_main.c +1 -1
@@ -4018,7 +4018,7 @@ int kvm_init(void *opaque, unsigned vcpuif (!vcpu_align) vcpu_align = __alignof__(struct kvm_vcpu ); kvm_vcpu_cache =kmem_cache_create ("kvm_vcpu" , vcpu_size, vcpu_align, -0 ,NULL ); +SLAB_ACCOUNT ,NULL );if (!kvm_vcpu_cache) { r = -ENOMEM ; goto out_free_3;
Greg Kroah-Hartman
maintainerPATCH 109/159 net: phy: at803x: Change error to EINVAL for invalid MAC
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Murphy <[email protected]>
[ Upstream commit fc7556877d1748ac00958822a0a3bba1d4bd9e0d ]
Change the return error code to EINVAL if the MAC address is not valid in the set_wol function.
--- drivers/net/phy/at803x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/at803x.c +1 -1
@@ -167,7 +167,7 @@ static int at803x_set_wol(struct phy_dev mac = (const u8 *) ndev->dev_addr;if (!is_valid_ether_addr (mac)) -return -EFAULT ; +return -EINVAL ;for (i =0 ; i <3 ; i++) { phy_write(phydev, AT803X_MMD_ACCESS_CONTROL,
Greg Kroah-Hartman
maintainerPATCH 110/159 PCI: Avoid bus reset if bridge itself is broken
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Daney <[email protected]>
[ Upstream commit 357027786f3523d26f42391aa4c075b8495e5d28 ]
When checking to see if a PCI bus can safely be reset, we previously checked to see if any of the children had their PCI_DEV_FLAGS_NO_BUS_RESET flag set. Children marked with that flag are known not to behave well after a bus reset.
Some PCIe root port bridges also do not behave well after a bus reset, sometimes causing the devices behind the bridge to become unusable.
Add a check for PCI_DEV_FLAGS_NO_BUS_RESET being set in the bridge device to allow these bridges to be flagged, and prevent their secondary buses from being reset.
--- drivers/pci/pci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pci/pci.c +4 -0
@@ -4356,6 +4356,10 @@ static bool pci_bus_resetable(struct pci {struct pci_dev *dev; + +if (bus->self && (bus->self->dev_flags &PCI_DEV_FLAGS_NO_BUS_RESET )) +return false; +list_for_each_entry (dev, &bus->devices, bus_list) {if (dev->dev_flags &PCI_DEV_FLAGS_NO_BUS_RESET || (dev->subordinate && !pci_bus_resetable (dev->subordinate)))
Greg Kroah-Hartman
maintainerPATCH 111/159 scsi: cxgb4i: fix Tx skb leak
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Varun Prakash <[email protected]>
[ Upstream commit 9b3a081fb62158b50bcc90522ca2423017544367 ]
In case of connection reset Tx skb queue can have some skbs which are not transmitted so purge Tx skb queue in release_offload_resources() to avoid skb leak.
--- drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +1 -0
@@ -1575,6 +1575,7 @@ static void release_offload_resources(st csk, csk->state, csk->flags, csk->tid);cxgbi_sock_free_cpl_skbs (csk); +cxgbi_sock_purge_write_queue (csk);if (csk->wr_cred != csk->wr_max_cred) {cxgbi_sock_purge_wr_queue (csk);cxgbi_sock_reset_wr_list (csk);
Greg Kroah-Hartman
maintainerPATCH 113/159 PCI: Create SR-IOV virtfn/physfn links before attaching driver
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stuart Hayes <[email protected]>
[ Upstream commit 27d6162944b9b34c32cd5841acd21786637ee743 ]
When creating virtual functions, create the "virtfn%u" and "physfn" links in sysfs *before* attaching the driver instead of after. When we attach the driver to the new virtual network interface first, there is a race when the driver attaches to the new sends out an "add" udev event, and the network interface naming software (biosdevname or systemd, for example) tries to look at these links.
--- drivers/pci/iov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/iov.c +2 -1
@@ -162,7 +162,6 @@ int pci_iov_add_virtfn(struct pci_dev *dpci_device_add (virtfn, virtfn->bus); -pci_bus_add_device (virtfn);sprintf (buf,"virtfn%u" , id); rc =sysfs_create_link (&dev->dev.kobj, &virtfn->dev.kobj, buf);if (rc)
@@ -173,6 +172,8 @@ int pci_iov_add_virtfn(struct pci_dev *dkobject_uevent (&virtfn->dev.kobj,KOBJ_CHANGE ); +pci_bus_add_device (virtfn); +return 0 ; failed2:
Greg Kroah-Hartman
maintainerPATCH 114/159 PM / OPP: Move error message to debug level
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit 035ed07208dc501d023873447113f3f178592156 ]
On some i.MX6 platforms which do not have speed grading check, opp table will not be created in platform code, so cpufreq driver prints the following error message:
cpu cpu0: dev_pm_opp_get_opp_count: OPP table not found (-19)
However, this is not really an error in this case because the imx6q-cpufreq driver first calls dev_pm_opp_get_opp_count() and if it fails, it means that platform code does not provide OPP and then dev_pm_opp_of_add_table() will be called.
In order to avoid such confusing error message, move it to debug level.
It is up to the caller of dev_pm_opp_get_opp_count() to check its return value and decide if it will print an error or not.
--- drivers/base/power/opp/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/opp/core.c +1 -1
@@ -296,7 +296,7 @@ int dev_pm_opp_get_opp_count(struct devi opp_table =_find_opp_table (dev);if (IS_ERR (opp_table)) { count =PTR_ERR (opp_table); -dev_err (dev,"%s: OPP table not found (%d)\n" , +dev_dbg (dev,"%s: OPP table not found (%d)\n" , __func__, count);return count; }
Greg Kroah-Hartman
maintainerPATCH 115/159 igb: check memory allocation failure
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 18eb86362a52f0af933cc0fd5e37027317eb2d1c ]
Check memory allocation failures and return -ENOMEM in such cases, as already done for other memory allocations in this function.
This avoids NULL pointers dereference.
--- drivers/net/ethernet/intel/igb/igb_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/igb/igb_main.c +2 -0
@@ -3162,6 +3162,8 @@ static int igb_sw_init(struct igb_adapte/* Setup and initialize a copy of the hw vlan table array */ adapter->shadow_vfta =kcalloc (E1000_VLAN_FILTER_TBL_SIZE ,sizeof (u32),GFP_ATOMIC ); +if (!adapter->shadow_vfta) +return -ENOMEM ;/* This call may decrease the number of queues */ if (igb_init_interrupt_scheme (adapter, true)) {
Greg Kroah-Hartman
maintainerPATCH 117/159 iio: st_sensors: add register mask for status register
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit e72a060151e5bb673af24993665e270fc4f674a7 ]
Introduce register mask for data-ready status register since pressure sensors (e.g. LPS22HB) export just two channels (BIT(0) and BIT(1)) and BIT(2) is marked reserved while in st_sensors_new_samples_available() value read from status register is masked using 0x7.
Moreover do not mask status register using active_scan_mask since now status value is properly masked and if the result is not zero the interrupt has to be consumed by the driver. This fix an issue on LPS25H and LPS331AP where channel definition is swapped respect to status register.
Furthermore that change allows to properly support new devices (e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register to figure out if the interrupt has been generated by the device.
--- drivers/iio/accel/st_accel_core.c | 35 ++++++++++++++++----- drivers/iio/common/st_sensors/st_sensors_core.c | 2 - drivers/iio/common/st_sensors/st_sensors_trigger.c | 16 ++------- drivers/iio/gyro/st_gyro_core.c | 15 +++++++-- drivers/iio/magnetometer/st_magn_core.c | 10 ++++-- drivers/iio/pressure/st_pressure_core.c | 15 +++++++-- include/linux/iio/common/st_sensors.h | 7 +++- 7 files changed, 70 insertions(+), 30 deletions(-)
drivers/iio/accel/st_accel_core.c +28 -7
@@ -164,7 +164,10 @@ static const struct st_sensor_settings s .mask_int2 = 0x00, .addr_ihl = 0x25, .mask_ihl = 0x02, - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, }, .sim = { .addr = 0x23,
@@ -236,7 +239,10 @@ static const struct st_sensor_settings s .mask_ihl = 0x80, .addr_od = 0x22, .mask_od = 0x40, - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, }, .sim = { .addr = 0x23,
@@ -318,7 +324,10 @@ static const struct st_sensor_settings s .mask_int2 = 0x00, .addr_ihl = 0x23, .mask_ihl = 0x40, - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, .ig1 = { .en_addr = 0x23, .en_mask = 0x08,
@@ -389,7 +398,10 @@ static const struct st_sensor_settings s .drdy_irq = { .addr = 0x21, .mask_int1 = 0x04, - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, }, .sim = { .addr = 0x21,
@@ -451,7 +463,10 @@ static const struct st_sensor_settings s .mask_ihl = 0x80, .addr_od = 0x22, .mask_od = 0x40, - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, }, .sim = { .addr = 0x21,
@@ -569,7 +584,10 @@ static const struct st_sensor_settings s .drdy_irq = { .addr = 0x21, .mask_int1 = 0x04, - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, }, .sim = { .addr = 0x21,
@@ -640,7 +658,10 @@ static const struct st_sensor_settings s .mask_int2 = 0x00, .addr_ihl = 0x25, .mask_ihl = 0x02, - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, }, .sim = { .addr = 0x23,
drivers/iio/common/st_sensors/st_sensors_core.c +1 -1
@@ -470,7 +470,7 @@ int st_sensors_set_dataready_irq(struct* different one. Take into account irq status register * to understand if irq trigger can be properly supported */ -if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) +if (sdata->sensor_settings->drdy_irq.stat_drdy.addr) sdata->hw_irq_trigger = enable;return 0 ; }
drivers/iio/common/st_sensors/st_sensors_trigger.c +4 -12
@@ -31,7 +31,7 @@ static int st_sensors_new_samples_availaint ret;/* How would I know if I can't check it? */ -if (!sdata->sensor_settings->drdy_irq.addr_stat_drdy) +if (!sdata->sensor_settings->drdy_irq.stat_drdy.addr)return -EINVAL ;/* No scan mask, no interrupt */
@@ -39,23 +39,15 @@ static int st_sensors_new_samples_availareturn 0 ; ret = sdata->tf->read_byte (&sdata->tb, sdata->dev, - sdata->sensor_settings->drdy_irq.addr_stat_drdy, + sdata->sensor_settings->drdy_irq.stat_drdy.addr, &status);if (ret <0 ) {dev_err (sdata->dev,"error checking samples available\n" );return ret; } -/* -* the lower bits of .active_scan_mask[0] is directly mapped -* to the channels on the sensor: either bit 0 for -* one-dimensional sensors, or e.g. x,y,z for accelerometers, -* gyroscopes or magnetometers. No sensor use more than 3 -* channels, so cut the other status bits here. -*/ - status &=0x07 ; -if (status & (u8 )indio_dev->active_scan_mask[0 ]) +if (status & sdata->sensor_settings->drdy_irq.stat_drdy.mask)return 1 ;return 0 ;
@@ -212,7 +204,7 @@ int st_sensors_allocate_trigger(struct i* it was "our" interrupt. */ if (sdata->int_pin_open_drain && - sdata->sensor_settings->drdy_irq.addr_stat_drdy) + sdata->sensor_settings->drdy_irq.stat_drdy.addr) irq_trig |=IRQF_SHARED ; err = request_threaded_irq(sdata->get_irq_data_ready(indio_dev),
drivers/iio/gyro/st_gyro_core.c +12 -3
@@ -118,7 +118,10 @@ static const struct st_sensor_settings s* drain settings, but only for INT1 and not * for the DRDY line on INT2. */ - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, }, .multi_read_bit = true, .bootime = 2,
@@ -188,7 +191,10 @@ static const struct st_sensor_settings s* drain settings, but only for INT1 and not * for the DRDY line on INT2. */ - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, }, .multi_read_bit = true, .bootime = 2,
@@ -253,7 +259,10 @@ static const struct st_sensor_settings s* drain settings, but only for INT1 and not * for the DRDY line on INT2. */ - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, }, .multi_read_bit = true, .bootime = 2,
drivers/iio/magnetometer/st_magn_core.c +8 -2
@@ -317,7 +317,10 @@ static const struct st_sensor_settings s }, .drdy_irq = {/* drdy line is routed drdy pin */ - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x07, + }, }, .multi_read_bit = true, .bootime = 2,
@@ -361,7 +364,10 @@ static const struct st_sensor_settings s .drdy_irq = { .addr = 0x62, .mask_int1 = 0x01, - .addr_stat_drdy = 0x67, + .stat_drdy = { + .addr = 0x67, + .mask = 0x07, + }, }, .multi_read_bit = false, .bootime = 2,
drivers/iio/pressure/st_pressure_core.c +12 -3
@@ -287,7 +287,10 @@ static const struct st_sensor_settings s .mask_ihl = 0x80, .addr_od = 0x22, .mask_od = 0x40, - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x03, + }, }, .multi_read_bit = true, .bootime = 2,
@@ -395,7 +398,10 @@ static const struct st_sensor_settings s .mask_ihl = 0x80, .addr_od = 0x22, .mask_od = 0x40, - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x03, + }, }, .multi_read_bit = true, .bootime = 2,
@@ -454,7 +460,10 @@ static const struct st_sensor_settings s .mask_ihl = 0x80, .addr_od = 0x12, .mask_od = 0x40, - .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR, + .stat_drdy = { + .addr = ST_SENSORS_DEFAULT_STAT_ADDR, + .mask = 0x03, + }, }, .multi_read_bit = false, .bootime = 2,
include/linux/iio/common/st_sensors.h +5 -2
@@ -139,7 +139,7 @@ struct st_sensor_das {* @mask_ihl: mask to enable/disable active low on the INT lines. * @addr_od: address to enable/disable Open Drain on the INT lines. * @mask_od: mask to enable/disable Open Drain on the INT lines. -* @addr_stat_drdy: address to read status of DRDY (data ready) interrupt +* struct stat_drdy - status register of DRDY (data ready) interrupt. * struct ig1 - represents the Interrupt Generator 1 of sensors. * @en_addr: address of the enable ig1 register. * @en_mask: mask to write the on/off value for enable.
@@ -152,7 +152,10 @@ struct st_sensor_data_ready_irq {u8 mask_ihl;u8 addr_od;u8 mask_od; -u8 addr_stat_drdy; +struct { +u8 addr; +u8 mask; + } stat_drdy;struct {u8 en_addr;u8 en_mask;
Greg Kroah-Hartman
maintainerPATCH 118/159 ixgbe: fix use of uninitialized padding
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emil Tantilov <[email protected]>
[ Upstream commit dcfd6b839c998bc9838e2a47f44f37afbdf3099c ]
This patch is resolving Coverity hits where padding in a structure could be used uninitialized.
- Initialize fwd_cmd.pad/2 before ixgbe_calculate_checksum()
- Initialize buffer.pad2/3 before ixgbe_hic_unlocked()
--- drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 4 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +2 -2
@@ -3781,10 +3781,10 @@ s32 ixgbe_set_fw_drv_ver_generic(struct fw_cmd.ver_build = build; fw_cmd.ver_sub = sub; fw_cmd.hdr.checksum =0 ; - fw_cmd.hdr.checksum =ixgbe_calculate_checksum ((u8 *)&fw_cmd, - (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len)); fw_cmd.pad =0 ; fw_cmd.pad2 =0 ; + fw_cmd.hdr.checksum =ixgbe_calculate_checksum ((u8 *)&fw_cmd, + (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len));for (i =0 ; i <=FW_CEM_MAX_RETRIES ; i++) { ret_val = ixgbe_host_interface_command(hw, &fw_cmd,
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +2 -0
@@ -900,6 +900,8 @@ static s32 ixgbe_read_ee_hostif_buffer_X/* convert offset from words to bytes */ buffer.address =cpu_to_be32 ((offset + current_word) *2 ); buffer.length =cpu_to_be16 (words_to_read *2 ); + buffer.pad2 =0 ; + buffer.pad3 =0 ; status =ixgbe_hic_unlocked (hw, (u32 *)&buffer,sizeof (buffer),IXGBE_HI_COMMAND_TIMEOUT );
Greg Kroah-Hartman
maintainerPATCH 119/159 IB/rxe: check for allocation failure on elem
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit 4831ca9e4a8e48cb27e0a792f73250390827a228 ]
The allocation for elem may fail (especially because we're using GFP_ATOMIC) so best to check for a null return. This fixes a potential null pointer dereference when assigning elem->pool.
Detected by CoverityScan CID#1357507 ("Dereference null return value")
--- drivers/infiniband/sw/rxe/rxe_pool.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/sw/rxe/rxe_pool.c +2 -0
@@ -404,6 +404,8 @@ void *rxe_alloc(struct rxe_pool *pool) elem =kmem_cache_zalloc (pool_cache (pool), (pool->flags &RXE_POOL_ATOMIC ) ?GFP_ATOMIC :GFP_KERNEL ); +if (!elem) +return NULL ; elem->pool = pool;kref_init (&elem->ref_cnt);
Greg Kroah-Hartman
maintainerPATCH 131/159 ASoC: img-parallel-out: Add pm_runtime_get/put to set_fmt callback
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ed Blake <[email protected]>
[ Upstream commit c70458890ff15d858bd347fa9f563818bcd6e457 ]
Add pm_runtime_get_sync and pm_runtime_put calls to set_fmt callback function. This fixes a bus error during boot when CONFIG_SUSPEND is defined when this function gets called while the device is runtime disabled and device registers are accessed while the clock is disabled.
--- sound/soc/img/img-parallel-out.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/img/img-parallel-out.c +2 -0
@@ -164,9 +164,11 @@ static int img_prl_out_set_fmt(struct snreturn -EINVAL ; } +pm_runtime_get_sync (prl->dev); reg =img_prl_out_readl (prl,IMG_PRL_OUT_CTL ); reg = (reg & ~IMG_PRL_OUT_CTL_EDGE_MASK ) | control_set;img_prl_out_writel (prl, reg,IMG_PRL_OUT_CTL ); +pm_runtime_put (prl->dev);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 132/159 powerpc/xmon: Avoid tripping SMP hardlockup watchdog
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
[ Upstream commit 064996d62a33ffe10264b5af5dca92d54f60f806 ]
The SMP hardlockup watchdog cross-checks other CPUs for lockups, which causes xmon headaches because it's assuming interrupts hard disabled means no watchdog troubles. Try to improve that by calling touch_nmi_watchdog() in obvious places where secondaries are spinning.
Also annotate these spin loops with spin_begin/end calls.
--- arch/powerpc/xmon/xmon.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
arch/powerpc/xmon/xmon.c +13 -4
@@ -530,14 +530,19 @@ static int xmon_core(struct pt_regs *reg waiting: secondary =1 ; +spin_begin ();while (secondary && !xmon_gate) {if (in_xmon ==0 ) { -if (fromipi) +if (fromipi) { +spin_end (); goto leave; + } secondary =test_and_set_bit (0 , &in_xmon); } -barrier (); +spin_cpu_relax (); +touch_nmi_watchdog (); } +spin_end ();if (!secondary && !xmon_gate) {/* we are the first cpu to come in */
@@ -568,21 +573,25 @@ static int xmon_core(struct pt_regs *regmb (); xmon_gate =1 ;barrier (); +touch_nmi_watchdog (); } cmdloop:while (in_xmon) {if (secondary) { +spin_begin ();if (cpu == xmon_owner) {if (!test_and_set_bit (0 , &xmon_taken)) { secondary =0 ; +spin_end ();continue ; }/* missed it */ while (cpu == xmon_owner) -barrier (); +spin_cpu_relax (); } -barrier (); +spin_cpu_relax (); +touch_nmi_watchdog (); }else { cmd =cmds (regs);if (cmd !=0 ) {
Greg Kroah-Hartman
maintainerPATCH 136/159 fm10k: fix mis-ordered parameters in declaration for .ndo_set_vf_bw
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit 3e256ac5b1ec307e5dd5a4c99fbdbc651446c738 ]
We've had support for setting both a minimum and maximum bandwidth via .ndo_set_vf_bw since commit 883a9ccbae56 ("fm10k: Add support for SR-IOV to driver", 2014-09-20).
Likely because we do not support minimum rates, the declaration mis-ordered the "unused" parameter, which causes warnings when analyzed with cppcheck.
Fix this warning by properly declaring the min_rate and max_rate variables in the declaration and definition (rather than using "unused"). Also rename "rate" to max_rate so as to clarify that we only support setting the maximum rate.
--- drivers/net/ethernet/intel/fm10k/fm10k.h | 4 ++-- drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k.h +2 -2
@@ -526,8 +526,8 @@ s32 fm10k_iov_update_pvid(struct fm10k_iint fm10k_ndo_set_vf_mac (struct net_device *netdev,int vf_idx,u8 *mac);int fm10k_ndo_set_vf_vlan (struct net_device *netdev,int vf_idx,u16 vid,u8 qos,__be16 vlan_proto); -int fm10k_ndo_set_vf_bw (struct net_device *netdev,int vf_idx,int rate, -int unused); +int fm10k_ndo_set_vf_bw (struct net_device *netdev,int vf_idx, +int __always_unused min_rate,int max_rate);int fm10k_ndo_get_vf_config (struct net_device *netdev,int vf_idx,struct ifla_vf_info *ivi);
drivers/net/ethernet/intel/fm10k/fm10k_iov.c +5 -4
@@ -482,7 +482,7 @@ int fm10k_ndo_set_vf_vlan(struct net_dev }int fm10k_ndo_set_vf_bw (struct net_device *netdev,int vf_idx, -int __always_unused unused,int rate) +int __always_unused min_rate,int max_rate) {struct fm10k_intfc *interface =netdev_priv (netdev);struct fm10k_iov_data *iov_data = interface->iov_data;
@@ -493,14 +493,15 @@ int fm10k_ndo_set_vf_bw(struct net_devicreturn -EINVAL ;/* rate limit cannot be less than 10Mbs or greater than link speed */ -if (rate && ((rate <FM10K_VF_TC_MIN ) || rate >FM10K_VF_TC_MAX )) +if (max_rate && + (max_rate <FM10K_VF_TC_MIN || max_rate >FM10K_VF_TC_MAX ))return -EINVAL ;/* store values */ - iov_data->vf_info[vf_idx].rate = rate; + iov_data->vf_info[vf_idx].rate = max_rate;/* update hardware configuration */ - hw->iov.ops.configure_tc (hw, vf_idx, rate); + hw->iov.ops.configure_tc (hw, vf_idx, max_rate);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 140/159 i40e: fix client notify of VF reset
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Brady <[email protected]>
[ Upstream commit c53d11f669c0e7d0daf46a717b6712ad0b09de99 ]
Currently there is a bug in which the PF driver fails to inform clients of a VF reset which then causes clients to leak resources. The bug exists because we were incorrectly checking the I40E_VF_STATE_PRE_ENABLE bit.
When a VF is first init we go through a reset to initialize variables and allocate resources but we don't want to inform clients of this first reset since the client isn't fully enabled yet so we set a state bit signifying we're in a "pre-enabled" client state. During the first reset we should be clearing the bit, allowing all following resets to notify the client of the reset when the bit is not set. This patch fixes the issue by negating the 'test_and_clear_bit' check to accurately reflect the behavior we want.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -2
@@ -1008,8 +1008,8 @@ static void i40e_cleanup_reset_vf(structset_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states);clear_bit (I40E_VF_STATE_DISABLED , &vf->vf_states);/* Do not notify the client during VF init */ -if (test_and_clear_bit (I40E_VF_STATE_PRE_ENABLE , - &vf->vf_states)) +if (!test_and_clear_bit (I40E_VF_STATE_PRE_ENABLE , + &vf->vf_states))i40e_notify_client_of_vf_reset (pf, abs_vf_id); vf->num_vlan =0 ; }
Greg Kroah-Hartman
maintainerPATCH 142/159 ARM: exynos_defconfig: Enable UAS support for Odroid HC1 board
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
[ Upstream commit a99897f550de96841aecb811455a67ad7a4e39a7 ]
Odroid HC1 board has built-in JMicron USB to SATA bridge, which supports UAS protocol. Compile-in support for it (instead of enabling it as module) to make sure that all built-in storage devices are available for rootfs. The bridge itself also supports fallback to standard USB Mass Storage protocol, but USB Mass Storage class doesn't bind to it when UAS is compiled as module and modules are not (yet) available.
--- arch/arm/configs/exynos_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/configs/exynos_defconfig +1 -1
@@ -244,7 +244,7 @@ CONFIG_USB_STORAGE_ONETOUCH=m CONFIG_USB_STORAGE_KARMA=m CONFIG_USB_STORAGE_CYPRESS_ATACB=m CONFIG_USB_STORAGE_ENE_UB6250=m -CONFIG_USB_UAS=m +CONFIG_USB_UAS=y CONFIG_USB_DWC3=y CONFIG_USB_DWC2=y CONFIG_USB_HSIC_USB3503=y
Greg Kroah-Hartman
maintainerPATCH 143/159 fm10k: ensure we process SM mbx when processing VF mbx
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit 17a91809942ca32c70026d2d5ba3348a2c4fdf8f ]
When we process VF mailboxes, the driver is likely going to also queue up messages to the switch manager. This process merely queues up the FIFO, but doesn't actually begin the transmission process. Because we hold the mailbox lock during this VF processing, the PF<->SM mailbox is not getting processed at this time. Ensure that we actually process the PF<->SM mailbox in between each PF<->VF mailbox.
This should ensure prompt transmission of the messages queued up after each VF message is received and handled.
--- drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/fm10k/fm10k_iov.c +3 -0
@@ -126,6 +126,9 @@ process_mbx:struct fm10k_mbx_info *mbx = &vf_info->mbx;u16 glort = vf_info->glort; +/* process the SM mailbox first to drain outgoing messages */ + hw->mbx.ops.process (hw, &hw->mbx); +/* verify port mapping is valid, if not reset port */ if (vf_info->vf_flags && !fm10k_glort_valid_pf (hw, glort)) hw->iov.ops.reset_lport (hw, vf_info);
Greg Kroah-Hartman
maintainerPATCH 145/159 net: ipv6: send NS for DAD when link operationally up
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Manning <[email protected]>
[ Upstream commit 1f372c7bfb23286d2bf4ce0423ab488e86b74bb2 ]
The NS for DAD are sent on admin up as long as a valid qdisc is found. A race condition exists by which these packets will not egress the interface if the operational state of the lower device is not yet up. The solution is to delay DAD until the link is operationally up according to RFC2863. Rather than only doing this, follow the existing code checks by deferring IPv6 device initialization altogether. The fix allows DAD on devices like tunnels that are controlled by userspace control plane. The fix has no impact on regular deployments, but means that there is no IPv6 connectivity until the port has been opened in the case of port-based network access control, which should be desirable.
--- net/ipv6/addrconf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/ipv6/addrconf.c +6 -6
@@ -303,10 +303,10 @@ static struct ipv6_devconf ipv6_devconf_ .disable_policy = 0, }; -/* Check if a valid qdisc is available */ -static inline bool addrconf_qdisc_ok (const struct net_device *dev) +/* Check if link is ready: is it up and is a valid qdisc available */ +static inline bool addrconf_link_ready (const struct net_device *dev) { -return !qdisc_tx_is_noop (dev); +return netif_oper_up (dev) && !qdisc_tx_is_noop (dev); }static void addrconf_del_rs_timer (struct inet6_dev *idev)
@@ -451,7 +451,7 @@ static struct inet6_dev *ipv6_add_dev(st ndev->token = in6addr_any; -if (netif_running (dev) &&addrconf_qdisc_ok (dev)) +if (netif_running (dev) &&addrconf_link_ready (dev)) ndev->if_flags |=IF_READY ;ipv6_mc_init_dev (ndev);
@@ -3404,7 +3404,7 @@ static int addrconf_notify(struct notifi/* restore routes for permanent addresses */ addrconf_permanent_addr (dev); -if (!addrconf_qdisc_ok (dev)) { +if (!addrconf_link_ready (dev)) {/* device is not ready yet. */ pr_info ("ADDRCONF(NETDEV_UP): %s: link is not ready\n" , dev->name);
@@ -3419,7 +3419,7 @@ static int addrconf_notify(struct notifi run_pending =1 ; } }else if (event ==NETDEV_CHANGE ) { -if (!addrconf_qdisc_ok (dev)) { +if (!addrconf_link_ready (dev)) {/* device is still not ready. */ break ; }
Greg Kroah-Hartman
maintainerPATCH 147/159 staging: greybus: light: Release memory obtained by kasprintf
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arvind Yadav <[email protected]>
[ Upstream commit 04820da21050b35eed68aa046115d810163ead0c ]
Free memory region, if gb_lights_channel_config is not successful.
--- drivers/staging/greybus/light.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/greybus/light.c +2 -0
@@ -925,6 +925,8 @@ static void __gb_lights_led_unregister(sreturn ;led_classdev_unregister (cdev); +kfree (cdev->name); + cdev->name =NULL ; channel->led =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 149/159 tcp: fix under-evaluated ssthresh in TCP Vegas
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hoang Tran <[email protected]>
[ Upstream commit cf5d74b85ef40c202c76d90959db4d850f301b95 ]
With the commit 76174004a0f19785 (tcp: do not slow start when cwnd equals ssthresh), the comparison to the reduced cwnd in tcp_vegas_ssthresh() would under-evaluate the ssthresh.
--- net/ipv4/tcp_vegas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_vegas.c +1 -1
@@ -158,7 +158,7 @@ EXPORT_SYMBOL_GPL(tcp_vegas_cwnd_event);static inline u32 tcp_vegas_ssthresh (struct tcp_sock *tp) { -return min (tp->snd_ssthresh, tp->snd_cwnd-1 ); +return min (tp->snd_ssthresh, tp->snd_cwnd); }static void tcp_vegas_cong_avoid (struct sock *sk,u32 ack,u32 acked)
Greg Kroah-Hartman
maintainerPATCH 150/159 rtc: set the alarm to the next expiring timer
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Belloni <[email protected]>
[ Upstream commit 74717b28cb32e1ad3c1042cafd76b264c8c0f68d ]
If there is any non expired timer in the queue, the RTC alarm is never set. This is an issue when adding a timer that expires before the next non expired timer.
Ensure the RTC alarm is set in that case.
--- drivers/rtc/interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/interface.c +1 -1
@@ -779,7 +779,7 @@ static int rtc_timer_enqueue(struct rtc_ }timerqueue_add (&rtc->timerqueue, &timer->node); -if (!next) { +if (!next ||ktime_before (timer->node.expires, next->expires)) {struct rtc_wkalrm alarm;int err; alarm.time =rtc_ktime_to_tm (timer->node.expires);
Greg Kroah-Hartman
maintainerPATCH 152/159 drm/vc4: Avoid using vrefresh==0 mode in DSI htotal math.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Anholt <[email protected]>
[ Upstream commit af2eca53206c59ce9308a4f5f46c4a104a179b6b ]
The incoming mode might have a missing vrefresh field if it came from drmModeSetCrtc(), which the kernel is supposed to calculate using drm_mode_vrefresh(). We could either use that or the adjusted_mode's original vrefresh value.
However, we can maintain a more exact vrefresh value (not just the integer approximation), by scaling by the ratio of our clocks.
v2: Use math suggested by Andrzej Hajda instead.
v3: Simplify math now that adjusted_mode->clock isn't padded.
v4: Drop some parens.
--- drivers/gpu/drm/vc4/vc4_dsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_dsi.c +2 -1
@@ -866,7 +866,8 @@ static bool vc4_dsi_encoder_mode_fixup(s adjusted_mode->clock = pixel_clock_hz /1000 +1 ;/* Given the new pixel clock, adjust HFP to keep vrefresh the same. */ - adjusted_mode->htotal = pixel_clock_hz / (mode->vrefresh * mode->vtotal); + adjusted_mode->htotal = adjusted_mode->clock * mode->htotal / + mode->clock; adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal; adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal;
Greg Kroah-Hartman
maintainerPATCH 153/159 IB/opa_vnic: Properly clear Mac Table Digest
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scott Franco <[email protected]>
[ Upstream commit 4bbdfe25600c1909c26747d0b5c39fd0e409bb87 ]
Clear the MAC table digest when the MAC table is freed.
--- drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c +1 -0
@@ -139,6 +139,7 @@ void opa_vnic_release_mac_tbl(struct oparcu_assign_pointer (adapter->mactbl,NULL );synchronize_rcu ();opa_vnic_free_mac_tbl (mactbl); + adapter->info.vport.mac_tbl_digest =0 ;mutex_unlock (&adapter->mactbl_lock); }
Greg Kroah-Hartman
maintainerPATCH 154/159 IB/opa_vnic: Properly return the total MACs in UC MAC list
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niranjana Vishwanathapura <[email protected]>
[ Upstream commit b77eb45e0d9c324245d165656ab3b38b6f386436 ]
Do not include EM specified MAC address in total MACs of the UC MAC list.
--- drivers/infiniband/ulp/opa_vnic/opa_vnic_vema_iface.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/infiniband/ulp/opa_vnic/opa_vnic_vema_iface.c +5 -3
@@ -348,7 +348,7 @@ void opa_vnic_query_mcast_macs(struct opvoid opa_vnic_query_ucast_macs (struct opa_vnic_adapter *adapter,struct opa_veswport_iface_macs *macs) { -u16 start_idx, tot_macs, num_macs, idx =0 , count =0 ; +u16 start_idx, tot_macs, num_macs, idx =0 , count =0 , em_macs =0 ;struct netdev_hw_addr *ha; start_idx =be16_to_cpu (macs->start_idx);
@@ -359,8 +359,10 @@ void opa_vnic_query_ucast_macs(struct op/* Do not include EM specified MAC address */ if (!memcmp (adapter->info.vport.base_mac_addr, ha->addr, -ARRAY_SIZE (adapter->info.vport.base_mac_addr))) +ARRAY_SIZE (adapter->info.vport.base_mac_addr))) { + em_macs++;continue ; + }if (start_idx > idx++)continue ;
@@ -383,7 +385,7 @@ void opa_vnic_query_ucast_macs(struct op } tot_macs =netdev_hw_addr_list_count (&adapter->netdev->dev_addrs) + -netdev_uc_count (adapter->netdev); +netdev_uc_count (adapter->netdev) - em_macs; macs->tot_macs_in_lst =cpu_to_be16 (tot_macs); macs->num_macs_in_msg =cpu_to_be16 (count); macs->gen_count =cpu_to_be16 (adapter->info.vport.uc_macs_gen_count);
Greg Kroah-Hartman
maintainerPATCH 156/159 thermal/drivers/hisi: Fix kernel panic on alarm interrupt
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Lezcano <[email protected]>
commit 2cb4de785c40d4a2132cfc13e63828f5a28c3351 upstream.
The threaded interrupt for the alarm interrupt is requested before the temperature controller is setup. This one can fire an interrupt immediately leading to a kernel panic as the sensor data is not initialized.
In order to prevent that, move the threaded irq after the Tsensor is setup.
--- drivers/thermal/hisi_thermal.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/thermal/hisi_thermal.c +9 -9
@@ -317,15 +317,6 @@ static int hisi_thermal_probe(struct plaif (data->irq <0 )return data->irq; - ret =devm_request_threaded_irq (&pdev->dev, data->irq, - hisi_thermal_alarm_irq, - hisi_thermal_alarm_irq_thread, -0 ,"hisi_thermal" , data); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to request alarm irq: %d\n" , ret); -return ret; - } -platform_set_drvdata (pdev, data); data->clk =devm_clk_get (&pdev->dev,"thermal_clk" );
@@ -357,6 +348,15 @@ static int hisi_thermal_probe(struct plahisi_thermal_toggle_sensor (&data->sensors[i], true); } + ret =devm_request_threaded_irq (&pdev->dev, data->irq, + hisi_thermal_alarm_irq, + hisi_thermal_alarm_irq_thread, +0 ,"hisi_thermal" , data); +if (ret <0 ) { +dev_err (&pdev->dev,"failed to request alarm irq: %d\n" , ret); +return ret; + } +enable_irq (data->irq);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 157/159 thermal/drivers/hisi: Simplify the temperature/step computation
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Lezcano <[email protected]>
commit 48880b979cdc9ef5a70af020f42b8ba1e51dbd34 upstream.
The step and the base temperature are fixed values, we can simplify the computation by converting the base temperature to milli celsius and use a pre-computed step value. That saves us a lot of mult + div for nothing at runtime.
Take also the opportunity to change the function names to be consistent with the rest of the code.
--- drivers/thermal/hisi_thermal.c | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-)
drivers/thermal/hisi_thermal.c +28 -13
@@ -35,8 +35,9 @@#define TEMP0_RST_MSK (0x1C)#define TEMP0_VALUE (0x28) -#define HISI_TEMP_BASE (-60) +#define HISI_TEMP_BASE (-60000)#define HISI_TEMP_RESET (100000) +#define HISI_TEMP_STEP (784)#define HISI_MAX_SENSORS 4
@@ -61,19 +62,32 @@ struct hisi_thermal_data {void __iomem *regs; }; -/* in millicelsius */ -static inline int _step_to_temp (int step) +/* +* The temperature computation on the tsensor is as follow: +* Unit: millidegree Celsius +* Step: 255/200 (0.7843) +* Temperature base: -60°C +* +* The register is programmed in temperature steps, every step is 784 +* millidegree and begins at -60 000 m°C +* +* The temperature from the steps: +* +* Temp = TempBase + (steps x 784) +* +* and the steps from the temperature: +* +* steps = (Temp - TempBase) / 784 +* +*/ +static inline int hisi_thermal_step_to_temp (int step) { -/* -* Every step equals (1 * 200) / 255 celsius, and finally -* need convert to millicelsius. -*/ -return (HISI_TEMP_BASE *1000 + (step *200000 /255 )); +return HISI_TEMP_BASE + (step *HISI_TEMP_STEP ); } -static inline long _temp_to_step (long temp) +static inline long hisi_thermal_temp_to_step (long temp) { -return ((temp -HISI_TEMP_BASE *1000 ) *255 ) /200000 ; +return (temp -HISI_TEMP_BASE ) /HISI_TEMP_STEP ; } static long hisi_thermal_get_sensor_temp(struct hisi_thermal_data *data,
@@ -99,7 +113,7 @@ static long hisi_thermal_get_sensor_tempusleep_range (3000 ,5000 ); val =readl (data->regs +TEMP0_VALUE ); - val =_step_to_temp (val); + val =hisi_thermal_step_to_temp (val);mutex_unlock (&data->thermal_lock);
@@ -126,10 +140,11 @@ static void hisi_thermal_enable_bind_irqwritel ((sensor->id <<12 ), data->regs +TEMP0_CFG );/* enable for interrupt */ -writel (_temp_to_step (sensor->thres_temp) |0x0FFFFFF00 , +writel (hisi_thermal_temp_to_step (sensor->thres_temp) |0x0FFFFFF00 , data->regs +TEMP0_TH ); -writel (_temp_to_step (HISI_TEMP_RESET ), data->regs +TEMP0_RST_TH ); +writel (hisi_thermal_temp_to_step (HISI_TEMP_RESET ), + data->regs +TEMP0_RST_TH );/* enable module */ writel (0x1 , data->regs +TEMP0_RST_MSK );
Greg Kroah-Hartman
maintainerPATCH 158/159 thermal/drivers/hisi: Fix multiple alarm interrupts firing
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Lezcano <[email protected]>
commit db2b0332608c8e648ea1e44727d36ad37cdb56cb upstream.
The DT specifies a threshold of 65000, we setup the register with a value in the temperature resolution for the controller, 64656.
When we reach 64656, the interrupt fires, the interrupt is disabled. Then the irq thread runs and calls thermal_zone_device_update() which will call in turn hisi_thermal_get_temp().
The function will look if the temperature decreased, assuming it was more than 65000, but that is not the case because the current temperature is 64656 (because of the rounding when setting the threshold). This condition being true, we re-enable the interrupt which fires immediately after exiting the irq thread. That happens again and again until the temperature goes to more than 65000.
Potentially, there is here an interrupt storm if the temperature stabilizes at this temperature. A very unlikely case but possible.
In any case, it does not make sense to handle dozens of alarm interrupt for nothing.
Fix this by rounding the threshold value to the controller resolution so the check against the threshold is consistent with the one set in the controller.
--- drivers/thermal/hisi_thermal.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/thermal/hisi_thermal.c +8 -2
@@ -90,6 +90,12 @@ static inline long hisi_thermal_temp_to_return (temp -HISI_TEMP_BASE ) /HISI_TEMP_STEP ; } +static inline long hisi_thermal_round_temp (int temp) +{ +return hisi_thermal_step_to_temp ( +hisi_thermal_temp_to_step (temp)); +} +static long hisi_thermal_get_sensor_temp (struct hisi_thermal_data *data,struct hisi_thermal_sensor *sensor) {
@@ -245,7 +251,7 @@ static irqreturn_t hisi_thermal_alarm_ir sensor = &data->sensors[data->irq_bind_sensor];dev_crit (&data->pdev->dev,"THERMAL ALARM: T > %d\n" , - sensor->thres_temp /1000 ); + sensor->thres_temp);mutex_unlock (&data->thermal_lock);for (i =0 ; i <HISI_MAX_SENSORS ; i++) {
@@ -284,7 +290,7 @@ static int hisi_thermal_register_sensor(for (i =0 ; i <of_thermal_get_ntrips (sensor->tzd); i++) {if (trip[i].type ==THERMAL_TRIP_PASSIVE ) { - sensor->thres_temp = trip[i].temperature; + sensor->thres_temp =hisi_thermal_round_temp (trip[i].temperature);break ; } }
Greg Kroah-Hartman
maintainerPATCH 159/159 platform/x86: asus-wireless: send an EV_SYN/SYN_REPORT between state changes
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Hutterer <[email protected]>
commit bff5bf9db1c9453ffd0a78abed3e2d040c092fd9 upstream.
Sending the switch state change twice within the same frame is invalid evdev protocol and only works if the client handles keys immediately as well. Processing events immediately is incorrect, it forces a fake order of events that does not exist on the device.
Recent versions of libinput changed to only process the device state and SYN_REPORT time, so now the key event is lost.
https://bugs.freedesktop.org/show_bug.cgi?id=104041
--- drivers/platform/x86/asus-wireless.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/asus-wireless.c +1 -0
@@ -118,6 +118,7 @@ static void asus_wireless_notify(structreturn ; }input_report_key (data->idev,KEY_RFKILL ,1 ); +input_sync (data->idev);input_report_key (data->idev,KEY_RFKILL ,0 );input_sync (data->idev); }
Greg Kroah-Hartman
maintainerPATCH 2/159 objtool: Dont report end of section error after an empty unwind hint
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit 00d96180dc38ef872ac471c2d3e14b067cbd895d upstream.
If asm code specifies an UNWIND_HINT_EMPTY hint, don't warn if the section ends unexpectedly. This can happen with the xen-head.S code because the hypercall_page is "text" but it's all zeros.
--- tools/objtool/check.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/objtool/check.c +5 -2
@@ -1757,11 +1757,14 @@ static int validate_branch(struct objtooif (insn->dead_end)return 0 ; - insn = next_insn; -if (!insn) { +if (!next_insn) { +if (state.cfa.base ==CFI_UNDEFINED ) +return 0 ;WARN ("%s: unexpected end of section" , sec->name);return 1 ; } + + insn = next_insn; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 4/159 x86/head: Remove unused bad_address code
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit a8b88e84d124bc92c4808e72b8b8c0e0bb538630 upstream.
It's no longer possible for this code to be executed, so remove it.
--- arch/x86/kernel/head_64.S | 3 --- 1 file changed, 3 deletions(-)
arch/x86/kernel/head_64.S +0 -3
@@ -266,9 +266,6 @@ ENDPROC(start_cpu0) .quad init_thread_union + THREAD_SIZE - SIZEOF_PTREGS __FINITDATA -bad_address: - jmp bad_address - __INIT ENTRY(early_idt_handler_array) i = 0
Greg Kroah-Hartman
maintainercover 4.14.9-stable review
This is the start of the stable review cycle for the 4.14.9 release. There are 159 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Dec 24 08:45:36 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.9-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.9-rc1
Peter Hutterer <[email protected]>
platform/x86: asus-wireless: send an EV_SYN/SYN_REPORT between state changes
Daniel Lezcano <[email protected]>
thermal/drivers/hisi: Fix multiple alarm interrupts firing
Daniel Lezcano <[email protected]>
thermal/drivers/hisi: Simplify the temperature/step computation
Daniel Lezcano <[email protected]>
thermal/drivers/hisi: Fix kernel panic on alarm interrupt
Daniel Lezcano <[email protected]>
thermal/drivers/hisi: Fix missing interrupt enablement
Niranjana Vishwanathapura <[email protected]>
IB/opa_vnic: Properly return the total MACs in UC MAC list
Scott Franco <[email protected]>
IB/opa_vnic: Properly clear Mac Table Digest
Eric Anholt <[email protected]>
drm/vc4: Avoid using vrefresh==0 mode in DSI htotal math.
Nicholas Piggin <[email protected]>
cpuidle: fix broadcast control when broadcast can not be entered
Alexandre Belloni <[email protected]>
rtc: set the alarm to the next expiring timer
Hoang Tran <[email protected]>
tcp: fix under-evaluated ssthresh in TCP Vegas
Chen-Yu Tsai <[email protected]>
clk: sunxi-ng: sun6i: Rename HDMI DDC clock to avoid name collision
Arvind Yadav <[email protected]>
staging: greybus: light: Release memory obtained by kasprintf
Wei Hu(Xavier) <[email protected]>
RDMA/hns: Avoid NULL pointer exception
Mike Manning <[email protected]>
net: ipv6: send NS for DAD when link operationally up
Mick Tarsel <[email protected]>
ibmvnic: Set state UP
Jacob Keller <[email protected]>
fm10k: ensure we process SM mbx when processing VF mbx
Marek Szyprowski <[email protected]>
ARM: exynos_defconfig: Enable UAS support for Odroid HC1 board
Alex Williamson <[email protected]>
vfio/pci: Virtualize Maximum Payload Size
Alan Brady <[email protected]>
i40e: fix client notify of VF reset
Dick Kennedy <[email protected]>
scsi: lpfc: Fix warning messages when NVME_TARGET_FC not defined
Dick Kennedy <[email protected]>
scsi: lpfc: PLOGI failures during NPIV testing
Dick Kennedy <[email protected]>
scsi: lpfc: Fix secure firmware updates
Jacob Keller <[email protected]>
fm10k: fix mis-ordered parameters in declaration for .ndo_set_vf_bw
Nicolas Dechesne <[email protected]>
ASoC: codecs: msm8916-wcd-analog: fix module autoload
Marcelo Ricardo Leitner <[email protected]>
sctp: silence warns on sctp_stream_init allocations
Nicholas Piggin <[email protected]>
powerpc/watchdog: Do not trigger SMP crash from touch_nmi_watchdog
Nicholas Piggin <[email protected]>
powerpc/xmon: Avoid tripping SMP hardlockup watchdog
Ed Blake <[email protected]>
ASoC: img-parallel-out: Add pm_runtime_get/put to set_fmt callback
Jean-François Têtu <[email protected]>
ASoC: codecs: msm8916-wcd-analog: fix micbias level
Tom Zanussi <[email protected]>
tracing: Exclude 'generic fields' from histograms
Gabriele Paoloni <[email protected]>
PCI/AER: Report non-fatal errors only to the affected endpoint
Jacob Keller <[email protected]>
i40e/i40evf: spread CPU affinity hints across online CPUs only
Hans de Goede <[email protected]>
Bluetooth: hci_bcm: Fix setting of irq trigger type
Hans de Goede <[email protected]>
Bluetooth: hci_uart_set_flow_control: Fix NULL deref when using serdev
Andrew Jeffery <[email protected]>
leds: pca955x: Don't invert requested value in pca955x_gpio_set_value()
Wei Wang <[email protected]>
ipv6: grab rt->rt6i_ref before allocating pcpu rt
William Tu <[email protected]>
ip_gre: check packet length and mtu correctly in erspan tx
Guoqing Jiang <[email protected]>
md: always set THREAD_WAKEUP and wake up wqueue if thread existed
Luca Miccio <[email protected]>
block,bfq: Disable writeback throttling
Colin Ian King <[email protected]>
IB/rxe: check for allocation failure on elem
Emil Tantilov <[email protected]>
ixgbe: fix use of uninitialized padding
Lorenzo Bianconi <[email protected]>
iio: st_sensors: add register mask for status register
Lihong Yang <[email protected]>
i40e: use the safe hash table iterator when deleting mac filters
Christophe JAILLET <[email protected]>
igb: check memory allocation failure
Fabio Estevam <[email protected]>
PM / OPP: Move error message to debug level
Stuart Hayes <[email protected]>
PCI: Create SR-IOV virtfn/physfn links before attaching driver
Sreekanth Reddy <[email protected]>
scsi: mpt3sas: Fix IO error occurs on pulling out a drive from RAID1 volume created on two SATA drive
Varun Prakash <[email protected]>
scsi: cxgb4i: fix Tx skb leak
David Daney <[email protected]>
PCI: Avoid bus reset if bridge itself is broken
Dan Murphy <[email protected]>
net: phy: at803x: Change error to EINVAL for invalid MAC
Shakeel Butt <[email protected]>
kvm, mm: account kvm related kmem slabs to kmemcg
Russell King <[email protected]>
rtc: pl031: make interrupt optional
Christophe Jaillet <[email protected]>
crypto: lrw - Fix an error handling path in 'create()'
Christian Lamparter <[email protected]>
crypto: crypto4xx - increase context and scatter ring buffer elements
Chen-Yu Tsai <[email protected]>
clk: sunxi-ng: sun5i: Fix bit offset of audio PLL post-divider
Chen-Yu Tsai <[email protected]>
clk: sunxi-ng: nm: Check if requested rate is supported by fractional clock
Shashank Sharma <[email protected]>
drm: Add retries for lspcon mode detection
Derek Basehore <[email protected]>
backlight: pwm_bl: Fix overflow condition
Jens Wiklander <[email protected]>
optee: fix invalid of_node_put() in optee_driver_init()
Thomas Gleixner <[email protected]>
x86/cpufeatures: Make CPU bugs sticky
Thomas Gleixner <[email protected]>
x86/paravirt: Provide a way to check for hypervisors
Thomas Gleixner <[email protected]>
x86/paravirt: Dont patch flush_tlb_single
Andy Lutomirski <[email protected]>
x86/entry/64: Make cpu_entry_area.tss read-only
Andy Lutomirski <[email protected]>
x86/entry: Clean up the SYSENTER_stack code
Andy Lutomirski <[email protected]>
x86/entry/64: Remove the SYSENTER stack canary
Andy Lutomirski <[email protected]>
x86/entry/64: Move the IST stacks into struct cpu_entry_area
Andy Lutomirski <[email protected]>
x86/entry/64: Create a per-CPU SYSCALL entry trampoline
Andy Lutomirski <[email protected]>
x86/entry/64: Return to userspace from the trampoline stack
Andy Lutomirski <[email protected]>
x86/entry/64: Use a per-CPU trampoline stack for IDT entries
Andy Lutomirski <[email protected]>
x86/espfix/64: Stop assuming that pt_regs is on the entry stack
Andy Lutomirski <[email protected]>
x86/entry/64: Separate cpu_current_top_of_stack from TSS.sp0
Andy Lutomirski <[email protected]>
x86/entry: Remap the TSS into the CPU entry area
Andy Lutomirski <[email protected]>
x86/entry: Move SYSENTER_stack to the beginning of struct tss_struct
Andy Lutomirski <[email protected]>
x86/dumpstack: Handle stack overflow on all stacks
Andy Lutomirski <[email protected]>
x86/entry: Fix assumptions that the HW TSS is at the beginning of cpu_tss
Andy Lutomirski <[email protected]>
x86/kasan/64: Teach KASAN about the cpu_entry_area
Andy Lutomirski <[email protected]>
x86/mm/fixmap: Generalize the GDT fixmap mechanism, introduce struct cpu_entry_area
Andy Lutomirski <[email protected]>
x86/entry/gdt: Put per-CPU GDT remaps in ascending order
Andy Lutomirski <[email protected]>
x86/dumpstack: Add get_stack_info() support for the SYSENTER stack
Andy Lutomirski <[email protected]>
x86/entry/64: Allocate and enable the SYSENTER stack
Andy Lutomirski <[email protected]>
x86/irq/64: Print the offending IP in the stack overflow warning
Andy Lutomirski <[email protected]>
x86/irq: Remove an old outdated comment about context tracking races
Josh Poimboeuf <[email protected]>
x86/unwinder: Handle stack overflows more gracefully
Andy Lutomirski <[email protected]>
x86/unwinder/orc: Dont bail on stack overflow
Boris Ostrovsky <[email protected]>
x86/entry/64/paravirt: Use paravirt-safe macro to access eflags
Andrey Ryabinin <[email protected]>
x86/mm/kasan: Don't use vmemmap_populate() to initialize shadow
Will Deacon <[email protected]>
locking/barriers: Convert users of lockless_dereference() to READ_ONCE()
Will Deacon <[email protected]>
locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
Daniel Borkmann <[email protected]>
bpf: fix build issues on um due to mising bpf_perf_event.h
Andi Kleen <[email protected]>
perf/x86: Enable free running PEBS for REGS_USER/INTR
Rudolf Marek <[email protected]>
x86: Make X86_BUG_FXSAVE_LEAK detectable in CPUID on AMD
Ricardo Neri <[email protected]>
x86/cpufeature: Add User-Mode Instruction Prevention definitions
Ingo Molnar <[email protected]>
drivers/misc/intel/pti: Rename the header file to free up the namespace
Juergen Gross <[email protected]>
x86/virt: Add enum for hypervisors to replace x86_hyper
Juergen Gross <[email protected]>
x86/virt, x86/platform: Merge 'struct x86_hyper' into 'struct x86_platform' and 'struct x86_init'
James Morse <[email protected]>
ACPI / APEI: Replace ioremap_page_range() with fixmap
Andy Lutomirski <[email protected]>
selftests/x86/ldt_gdt: Run most existing LDT test cases against the GDT as well
Andy Lutomirski <[email protected]>
selftests/x86/ldt_gdt: Add infrastructure to test set_thread_area()
Ingo Molnar <[email protected]>
x86/cpufeatures: Fix various details in the feature definitions
Ingo Molnar <[email protected]>
x86/cpufeatures: Re-tabulate the X86_FEATURE definitions
Borislav Petkov <[email protected]>
x86/mm: Define _PAGE_TABLE using _KERNPG_TABLE
Thomas Gleixner <[email protected]>
bitops: Revert cbe96375025e ("bitops: Add clear/set_bit32() to linux/bitops.h")Thomas Gleixner <[email protected]>
x86/cpuid: Replace set/clear_bit32()
Borislav Petkov <[email protected]>
x86/entry/64: Shorten TEST instructions
Andy Lutomirski <[email protected]>
x86/traps: Use a new on_thread_stack() helper to clean up an assertion
Andy Lutomirski <[email protected]>
x86/entry/64: Remove thread_struct::sp0
Andy Lutomirski <[email protected]>
x86/entry/32: Fix cpu_current_top_of_stack initialization at boot
Andy Lutomirski <[email protected]>
x86/entry/64: Remove all remaining direct thread_struct::sp0 reads
Andy Lutomirski <[email protected]>
x86/entry/64: Stop initializing TSS.sp0 at boot
Andy Lutomirski <[email protected]>
x86/xen/64, x86/entry/64: Clean up SP code in cpu_initialize_context()
Andy Lutomirski <[email protected]>
x86/entry: Add task_top_of_stack() to find the top of a task's stack
Andy Lutomirski <[email protected]>
x86/entry/64: Pass SP0 directly to load_sp0()
Andy Lutomirski <[email protected]>
x86/entry/32: Pull the MSR_IA32_SYSENTER_CS update code out of native_load_sp0()
Andy Lutomirski <[email protected]>
x86/entry/64: De-Xen-ify our NMI code
Juergen Gross <[email protected]>
xen, x86/entry/64: Add xen NMI trap entry
Andy Lutomirski <[email protected]>
x86/entry/64: Remove the RESTORE_..._REGS infrastructure
Andy Lutomirski <[email protected]>
x86/entry/64: Use POP instead of MOV to restore regs on NMI return
Andy Lutomirski <[email protected]>
x86/entry/64: Merge the fast and slow SYSRET paths
Andy Lutomirski <[email protected]>
x86/entry/64: Use pop instead of movq in syscall_return_via_sysret
Andy Lutomirski <[email protected]>
x86/entry/64: Shrink paranoid_exit_restore and make labels local
Andy Lutomirski <[email protected]>
x86/entry/64: Simplify reg restore code in the standard IRET paths
Andy Lutomirski <[email protected]>
x86/entry/64: Move SWAPGS into the common IRET-to-usermode path
Andy Lutomirski <[email protected]>
x86/entry/64: Split the IRET-to-user and IRET-to-kernel paths
Andy Lutomirski <[email protected]>
x86/entry/64: Remove the restore_c_regs_and_iret label
Ricardo Neri <[email protected]>
ptrace,x86: Make user_64bit_mode() available to 32-bit builds
Ricardo Neri <[email protected]>
x86/boot: Relocate definition of the initial state of CR0
Ricardo Neri <[email protected]>
x86/mm: Relocate page fault error codes to traps.h
Gayatri Kammela <[email protected]>
x86/cpufeatures: Enable new SSE/AVX/AVX512 CPU features
Baoquan He <[email protected]>
x86/mm/64: Rename the register_page_bootmem_memmap() 'size' parameter to 'nr_pages'
Masahiro Yamada <[email protected]>
x86/build: Beautify build log of syscall headers
Josh Poimboeuf <[email protected]>
x86/asm: Don't use the confusing '.ifeq' directive
Dongjiu Geng <[email protected]>
ACPI / APEI: remove the unused dead-code for SEA/NMI notification type
Kirill A. Shutemov <[email protected]>
x86/xen: Drop 5-level paging support code from the XEN_PV code
Kirill A. Shutemov <[email protected]>
x86/xen: Provide pre-built page tables only for CONFIG_XEN_PV=y and CONFIG_XEN_PVH=y
Andrey Ryabinin <[email protected]>
x86/kasan: Use the same shadow offset for 4- and 5-level paging
Kirill A. Shutemov <[email protected]>
mm/sparsemem: Allocate mem_section at runtime for CONFIG_SPARSEMEM_EXTREME=y
Thomas Gleixner <[email protected]>
x86/cpuid: Prevent out of bound access in do_clear_cpu_cap()
Kamalesh Babulal <[email protected]>
objtool: Print top level commands on incorrect usage
Kees Cook <[email protected]>
x86/platform/UV: Convert timers to use timer_setup()
Andi Kleen <[email protected]>
x86/fpu: Remove the explicit clearing of XSAVE dependent features
Andi Kleen <[email protected]>
x86/fpu: Make XSAVE check the base CPUID features before enabling
Andi Kleen <[email protected]>
x86/fpu: Parse clearcpuid= as early XSAVE argument
Andi Kleen <[email protected]>
x86/cpuid: Add generic table for CPUID dependencies
Andi Kleen <[email protected]>
bitops: Add clear/set_bit32() to linux/bitops.h
Josh Poimboeuf <[email protected]>
x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in kconfig for 64-bit
Josh Poimboeuf <[email protected]>
x86/unwind: Rename unwinder config options to 'CONFIG_UNWINDER_*'
Steven Rostedt (VMware) <[email protected]>
x86/fpu/debug: Remove unused 'x86_fpu_state' and 'x86_fpu_deactivate_state' tracepoints
Ingo Molnar <[email protected]>
x86/unwinder: Make CONFIG_UNWINDER_ORC=y the default in the 64-bit defconfig
Jan Beulich <[email protected]>
ACPI / APEI: adjust a local variable type in ghes_ioremap_pfn_irq()
Josh Poimboeuf <[email protected]>
x86/head: Add unwind hint annotations
Josh Poimboeuf <[email protected]>
x86/xen: Add unwind hint annotations
Josh Poimboeuf <[email protected]>
x86/xen: Fix xen head ELF annotations
Josh Poimboeuf <[email protected]>
x86/boot: Annotate verify_cpu() as a callable function
Josh Poimboeuf <[email protected]>
x86/head: Fix head ELF function annotations
Josh Poimboeuf <[email protected]>
x86/head: Remove unused 'bad_address' code
Josh Poimboeuf <[email protected]>
x86/head: Remove confusing comment
Josh Poimboeuf <[email protected]>
objtool: Don't report end of section error after an empty unwind hint
Uros Bizjak <[email protected]>
x86/asm: Remove unnecessary \n\t in front of CC_SET() from asm templates
-------------
Diffstat:
Documentation/x86/orc-unwinder.txt | 2 +-
Documentation/x86/x86_64/mm.txt | 2 +-
Makefile | 8 +-
arch/arm/configs/exynos_defconfig | 2 +-
arch/arm64/include/asm/fixmap.h | 7 +
arch/powerpc/kernel/watchdog.c | 7 +-
arch/powerpc/xmon/xmon.c | 17 +-
arch/um/include/asm/Kbuild | 1 +
arch/x86/Kconfig | 5 +-
arch/x86/Kconfig.debug | 39 +-
arch/x86/configs/tiny.config | 4 +-
arch/x86/configs/x86_64_defconfig | 1 +
arch/x86/entry/calling.h | 69 +--
arch/x86/entry/entry_32.S | 6 +-
arch/x86/entry/entry_64.S | 322 +++++++++---
arch/x86/entry/entry_64_compat.S | 10 +-
arch/x86/entry/syscalls/Makefile | 4 +-
arch/x86/events/core.c | 2 +-
arch/x86/events/intel/core.c | 4 +
arch/x86/events/perf_event.h | 24 +-
arch/x86/hyperv/hv_init.c | 2 +-
arch/x86/include/asm/archrandom.h | 8 +-
arch/x86/include/asm/bitops.h | 10 +-
arch/x86/include/asm/compat.h | 1 +
arch/x86/include/asm/cpufeature.h | 11 +-
arch/x86/include/asm/cpufeatures.h | 538 +++++++++++----------
arch/x86/include/asm/desc.h | 11 +-
arch/x86/include/asm/fixmap.h | 74 ++-
arch/x86/include/asm/hypervisor.h | 53 +-
arch/x86/include/asm/irqflags.h | 3 +
arch/x86/include/asm/kdebug.h | 1 +
arch/x86/include/asm/mmu_context.h | 4 +-
arch/x86/include/asm/module.h | 2 +-
arch/x86/include/asm/paravirt.h | 14 +-
arch/x86/include/asm/paravirt_types.h | 2 +-
arch/x86/include/asm/percpu.h | 2 +-
arch/x86/include/asm/pgtable_types.h | 3 +-
arch/x86/include/asm/processor.h | 109 +++--
arch/x86/include/asm/ptrace.h | 6 +-
arch/x86/include/asm/rmwcc.h | 2 +-
arch/x86/include/asm/stacktrace.h | 3 +
arch/x86/include/asm/switch_to.h | 26 +
arch/x86/include/asm/thread_info.h | 2 +-
arch/x86/include/asm/trace/fpu.h | 10 -
arch/x86/include/asm/traps.h | 21 +-
arch/x86/include/asm/unwind.h | 15 +-
arch/x86/include/asm/x86_init.h | 24 +
arch/x86/include/uapi/asm/processor-flags.h | 3 +
arch/x86/kernel/Makefile | 10 +-
arch/x86/kernel/apic/apic.c | 2 +-
arch/x86/kernel/apic/x2apic_uv_x.c | 5 +-
arch/x86/kernel/asm-offsets.c | 6 +
arch/x86/kernel/asm-offsets_32.c | 9 +-
arch/x86/kernel/asm-offsets_64.c | 4 +
arch/x86/kernel/cpu/Makefile | 1 +
arch/x86/kernel/cpu/amd.c | 7 +-
arch/x86/kernel/cpu/common.c | 195 +++++---
arch/x86/kernel/cpu/cpuid-deps.c | 121 +++++
arch/x86/kernel/cpu/hypervisor.c | 64 +--
arch/x86/kernel/cpu/mshyperv.c | 6 +-
arch/x86/kernel/cpu/vmware.c | 8 +-
arch/x86/kernel/doublefault.c | 36 +-
arch/x86/kernel/dumpstack.c | 74 ++-
arch/x86/kernel/dumpstack_32.c | 6 +
arch/x86/kernel/dumpstack_64.c | 6 +
arch/x86/kernel/fpu/init.c | 11 +
arch/x86/kernel/fpu/xstate.c | 43 +-
arch/x86/kernel/head_32.S | 5 +-
arch/x86/kernel/head_64.S | 45 +-
arch/x86/kernel/ioport.c | 2 +-
arch/x86/kernel/irq.c | 12 -
arch/x86/kernel/irq_64.c | 4 +-
arch/x86/kernel/kvm.c | 6 +-
arch/x86/kernel/ldt.c | 2 +-
arch/x86/kernel/paravirt_patch_64.c | 2 -
arch/x86/kernel/process.c | 27 +-
arch/x86/kernel/process_32.c | 8 +-
arch/x86/kernel/process_64.c | 19 +-
arch/x86/kernel/smpboot.c | 3 +-
arch/x86/kernel/traps.c | 72 +--
arch/x86/kernel/unwind_orc.c | 88 ++--
arch/x86/kernel/verify_cpu.S | 3 +-
arch/x86/kernel/vm86_32.c | 20 +-
arch/x86/kernel/vmlinux.lds.S | 9 +
arch/x86/kernel/x86_init.c | 9 +
arch/x86/kvm/mmu.c | 4 +-
arch/x86/kvm/vmx.c | 2 +-
arch/x86/lib/delay.c | 4 +-
arch/x86/mm/fault.c | 88 ++--
arch/x86/mm/init.c | 2 +-
arch/x86/mm/init_64.c | 10 +-
arch/x86/mm/kasan_init_64.c | 262 ++++++++--
arch/x86/power/cpu.c | 16 +-
arch/x86/xen/enlighten_hvm.c | 12 +-
arch/x86/xen/enlighten_pv.c | 15 +-
arch/x86/xen/mmu_pv.c | 161 +++---
arch/x86/xen/smp_pv.c | 17 +-
arch/x86/xen/xen-asm_64.S | 2 +-
arch/x86/xen/xen-head.S | 11 +-
block/bfq-iosched.c | 3 +-
block/blk-wbt.c | 2 +-
crypto/lrw.c | 6 +-
drivers/acpi/apei/ghes.c | 78 +--
drivers/base/power/opp/core.c | 2 +-
drivers/bluetooth/hci_bcm.c | 23 +-
drivers/bluetooth/hci_ldisc.c | 7 +
drivers/clk/sunxi-ng/ccu-sun5i.c | 4 +-
drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 2 +-
drivers/clk/sunxi-ng/ccu_nm.c | 3 +
drivers/cpuidle/cpuidle.c | 1 +
drivers/crypto/amcc/crypto4xx_core.h | 10 +-
drivers/gpu/drm/drm_dp_dual_mode_helper.c | 16 +-
drivers/gpu/drm/vc4/vc4_dsi.c | 3 +-
drivers/hv/vmbus_drv.c | 2 +-
drivers/iio/accel/st_accel_core.c | 35 +-
drivers/iio/common/st_sensors/st_sensors_core.c | 2 +-
drivers/iio/common/st_sensors/st_sensors_trigger.c | 16 +-
drivers/iio/gyro/st_gyro_core.c | 15 +-
drivers/iio/magnetometer/st_magn_core.c | 10 +-
drivers/iio/pressure/st_pressure_core.c | 15 +-
drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 5 +
drivers/infiniband/sw/rxe/rxe_pool.c | 2 +
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c | 1 +
.../infiniband/ulp/opa_vnic/opa_vnic_vema_iface.c | 8 +-
drivers/input/mouse/vmmouse.c | 10 +-
drivers/leds/leds-pca955x.c | 17 +-
drivers/md/dm-mpath.c | 20 +-
drivers/md/md.c | 4 +-
drivers/misc/pti.c | 2 +-
drivers/misc/vmw_balloon.c | 2 +-
drivers/net/ethernet/ibm/ibmvnic.c | 2 +
drivers/net/ethernet/intel/fm10k/fm10k.h | 4 +-
drivers/net/ethernet/intel/fm10k/fm10k_iov.c | 12 +-
drivers/net/ethernet/intel/i40e/i40e_main.c | 16 +-
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 7 +-
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 9 +-
drivers/net/ethernet/intel/igb/igb_main.c | 2 +
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 4 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 2 +
drivers/net/phy/at803x.c | 2 +-
drivers/pci/iov.c | 3 +-
drivers/pci/pci.c | 4 +
drivers/pci/pcie/aer/aerdrv_core.c | 9 +-
drivers/platform/x86/asus-wireless.c | 1 +
drivers/rtc/interface.c | 2 +-
drivers/rtc/rtc-pl031.c | 14 +-
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 +
drivers/scsi/lpfc/lpfc_hbadisc.c | 3 +-
drivers/scsi/lpfc/lpfc_hw4.h | 2 +-
drivers/scsi/lpfc/lpfc_nvmet.c | 2 +
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 5 +
drivers/staging/greybus/light.c | 2 +
drivers/tee/optee/core.c | 1 -
drivers/thermal/hisi_thermal.c | 74 ++-
drivers/vfio/pci/vfio_pci_config.c | 6 +-
drivers/video/backlight/pwm_bl.c | 7 +-
fs/dcache.c | 4 +-
fs/overlayfs/ovl_entry.h | 2 +-
fs/overlayfs/readdir.c | 2 +-
include/asm-generic/vmlinux.lds.h | 2 +-
include/linux/compiler.h | 1 +
include/linux/hypervisor.h | 8 +-
include/linux/iio/common/st_sensors.h | 7 +-
include/linux/{pti.h => intel-pti.h} | 6 +-
include/linux/mm.h | 2 +-
include/linux/mmzone.h | 6 +-
include/linux/rculist.h | 4 +-
include/linux/rcupdate.h | 4 +-
kernel/events/core.c | 4 +-
kernel/seccomp.c | 2 +-
kernel/task_work.c | 2 +-
kernel/trace/trace_events_hist.c | 4 +-
lib/Kconfig.debug | 2 +-
mm/page_alloc.c | 10 +
mm/slab.h | 2 +-
mm/sparse.c | 17 +-
net/ipv4/ip_gre.c | 8 +-
net/ipv4/tcp_vegas.c | 2 +-
net/ipv6/addrconf.c | 12 +-
net/ipv6/route.c | 58 +--
net/sctp/stream.c | 8 +-
scripts/Makefile.build | 2 +-
sound/soc/codecs/msm8916-wcd-analog.c | 9 +-
sound/soc/img/img-parallel-out.c | 2 +
tools/objtool/check.c | 7 +-
tools/objtool/objtool.c | 6 +-
tools/testing/selftests/x86/ldt_gdt.c | 61 ++-
virt/kvm/kvm_main.c | 2 +-
188 files changed, 2414 insertions(+), 1428 deletions(-)Greg Kroah-Hartman
maintainerPATCH 16/159 x86/cpuid: Add generic table for CPUID dependencies
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andi Kleen <[email protected]>
commit 0b00de857a648dafe7020878c7a27cf776f5edf4 upstream.
Some CPUID features depend on other features. Currently it's possible to to clear dependent features, but not clear the base features, which can cause various interesting problems.
This patch implements a generic table to describe dependencies between CPUID features, to be used by all code that clears CPUID.
Some subsystems (like XSAVE) had an own implementation of this, but it's better to do it all in a single place for everyone.
Then clear_cpu_cap and setup_clear_cpu_cap always look up this table and clear all dependencies too.
This is intended to be a practical table: only for features that make sense to clear. If someone for example clears FPU, or other features that are essentially part of the required base feature set, not much is going to work. Handling that is right now out of scope. We're only handling features which can be usefully cleared.
--- arch/x86/include/asm/cpufeature.h | 9 +- arch/x86/include/asm/cpufeatures.h | 5 + arch/x86/kernel/cpu/Makefile | 1 arch/x86/kernel/cpu/cpuid-deps.c | 113 +++++++++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 5 deletions(-)
arch/x86/include/asm/cpufeature.h +4 -5
@@ -126,11 +126,10 @@ extern const char * const x86_bug_flags[#define boot_cpu_has (bit) cpu_has(&boot_cpu_data, bit)#define set_cpu_cap (c, bit) set_bit(bit, (unsigned long *)((c)->x86_capability)) -#define clear_cpu_cap (c, bit) clear_bit(bit, (unsigned long *)((c)->x86_capability)) -#define setup_clear_cpu_cap (bit) do { \ - clear_cpu_cap(&boot_cpu_data, bit); \ - set_bit(bit, (unsigned long *)cpu_caps_cleared); \ -} while (0) + +extern void setup_clear_cpu_cap (unsigned int bit); +extern void clear_cpu_cap (struct cpuinfo_x86 *c,unsigned int bit); +#define setup_force_cpu_cap (bit) do { \ set_cpu_cap(&boot_cpu_data, bit); \ set_bit(bit, (unsigned long *)cpu_caps_set); \
arch/x86/include/asm/cpufeatures.h +5 -0
@@ -22,6 +22,11 @@* this feature bit is not displayed in /proc/cpuinfo at all. */ +/* +* When adding new features here that depend on other features, +* please update the table in kernel/cpu/cpuid-deps.c +*/ +/* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */ #define X86_FEATURE_FPU ( 0*32+ 0)/* Onboard FPU */ #define X86_FEATURE_VME ( 0*32+ 1)/* Virtual Mode Extensions */
arch/x86/kernel/cpu/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-y += rdrand.o obj-y += match.o obj-y += bugs.o obj-$(CONFIG_CPU_FREQ) += aperfmperf.o +obj-y += cpuid-deps.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
arch/x86/kernel/cpu/cpuid-deps.c new file +113 -0
113 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 17/159 x86/fpu: Parse clearcpuid= as early XSAVE argument
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andi Kleen <[email protected]>
commit 0c2a3913d6f50503f7c59d83a6219e39508cc898 upstream.
With a followon patch we want to make clearcpuid affect the XSAVE configuration. But xsave is currently initialized before arguments are parsed. Move the clearcpuid= parsing into the special early xsave argument parsing code.
Since clearcpuid= contains a = we need to keep the old __setup around as a dummy, otherwise it would end up as a environment variable in init's environment.
--- arch/x86/kernel/cpu/common.c | 16 +++++++--------- arch/x86/kernel/fpu/init.c | 11 +++++++++++ 2 files changed, 18 insertions(+), 9 deletions(-)
arch/x86/kernel/cpu/common.c +7 -9
@@ -1301,18 +1301,16 @@ void print_cpu_info(struct cpuinfo_x86 *pr_cont (")\n" ); } -static __init int setup_disablecpuid (char *arg) +/* +* clearcpuid= was already parsed in fpu__init_parse_early_param. +* But we need to keep a dummy __setup around otherwise it would +* show up as an environment variable for init. +*/ +static __init int setup_clearcpuid (char *arg) { -int bit; - -if (get_option (&arg, &bit) && bit >=0 && bit <NCAPINTS *32 ) -setup_clear_cpu_cap (bit); -else -return 0 ; -return 1 ; } -__setup ("clearcpuid=" , setup_disablecpuid); +__setup ("clearcpuid=" , setup_clearcpuid);#ifdef CONFIG_X86_64 DEFINE_PER_CPU_FIRST(union irq_stack_union,
arch/x86/kernel/fpu/init.c +11 -0
@@ -249,6 +249,10 @@ static void __init fpu__init_system_ctx_*/ static void __init fpu__init_parse_early_param (void ) { +char arg[32 ]; +char *argptr = arg; +int bit; +if (cmdline_find_option_bool (boot_command_line,"no387" ))setup_clear_cpu_cap (X86_FEATURE_FPU );
@@ -266,6 +270,13 @@ static void __init fpu__init_parse_earlyif (cmdline_find_option_bool (boot_command_line,"noxsaves" ))setup_clear_cpu_cap (X86_FEATURE_XSAVES ); + +if (cmdline_find_option (boot_command_line,"clearcpuid" , arg, +sizeof (arg)) && +get_option (&argptr, &bit) && + bit >=0 && + bit <NCAPINTS *32 ) +setup_clear_cpu_cap (bit); }/*
Greg Kroah-Hartman
maintainerPATCH 20/159 x86/platform/UV: Convert timers to use timer_setup()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit 376f3bcebdc999cc737d9052109cc33b573b3a8b upstream.
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.
--- arch/x86/kernel/apic/x2apic_uv_x.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/x2apic_uv_x.c +2 -3
@@ -920,9 +920,8 @@ static __init void uv_rtc_init(void)/* * percpu heartbeat timer */ -static void uv_heartbeat (unsigned long ignored) +static void uv_heartbeat (struct timer_list *timer) { -struct timer_list *timer = &uv_scir_info->timer;unsigned char bits = uv_scir_info->state;/* Flip heartbeat bit: */
@@ -947,7 +946,7 @@ static int uv_heartbeat_enable(unsignedstruct timer_list *timer = &uv_cpu_scir_info (cpu)->timer;uv_set_cpu_scir_bits (cpu,SCIR_CPU_HEARTBEAT |SCIR_CPU_ACTIVITY ); -setup_pinned_timer (timer, uv_heartbeat, cpu); +timer_setup (timer, uv_heartbeat,TIMER_PINNED ); timer->expires = jiffies +SCIR_CPU_HB_INTERVAL ;add_timer_on (timer, cpu);uv_cpu_scir_info (cpu)->enabled =1 ;
Greg Kroah-Hartman
maintainerPATCH 21/159 objtool: Print top level commands on incorrect usage
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kamalesh Babulal <[email protected]>
commit 6a93bb7e4a7d6670677d5b0eb980936eb9cc5d2e upstream.
Print top-level objtool commands, along with the error on incorrect command line usage. Objtool command line parser exit's with code 129, for incorrect usage. Convert the cmd_usage() exit code also, to maintain consistency across objtool.
After the patch:
$ ./objtool -j
Unknown option: -j
usage: objtool COMMAND [ARGS]
Commands:
check Perform stack metadata validation on an object file
orc Generate in-place ORC unwind tables for an object file
$ echo $? 129
--- tools/objtool/objtool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/objtool/objtool.c +2 -4
@@ -70,7 +70,7 @@ static void cmd_usage(void)printf ("\n" ); -exit (1 ); +exit (129 ); }static void handle_options (int *argc,const char ***argv)
@@ -86,9 +86,7 @@ static void handle_options(int *argc, cobreak ; }else {fprintf (stderr,"Unknown option: %s\n" , cmd); -fprintf (stderr,"\n Usage: %s\n" , - objtool_usage_string); -exit (1 ); +cmd_usage (); } (*argv)++;
Greg Kroah-Hartman
maintainerPATCH 8/159 x86/xen: Add unwind hint annotations
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit abbe1cac6214d81d2f4e149aba64a8760703144e upstream.
Add unwind hint annotations to the xen head code so the ORC unwinder can read head_64.o.
hypercall_page needs empty annotations at 32-byte intervals to match the 'xen_hypercall_*' ELF functions at those locations.
--- arch/x86/xen/xen-head.S | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/xen/xen-head.S +6 -1
@@ -10,6 +10,7 @@ #include <asm/boot.h> #include <asm/asm.h> #include <asm/page_types.h> +#include <asm/unwind_hints.h> #include <xen/interface/elfnote.h> #include <xen/interface/features.h>
@@ -20,6 +21,7 @@ #ifdef CONFIG_XEN_PV __INIT ENTRY(startup_xen) + UNWIND_HINT_EMPTY cld /* Clear .bss */
@@ -41,7 +43,10 @@ END(startup_xen) .pushsection .text .balign PAGE_SIZE ENTRY(hypercall_page) - .skip PAGE_SIZE + .rept (PAGE_SIZE / 32) + UNWIND_HINT_EMPTY + .skip 32 + .endr #define HYPERCALL(n) \ .equ xen_hypercall_##n, hypercall_page + __HYPERVISOR_##n * 32; \
Greg Kroah-Hartman
maintainerPATCH 29/159 x86/build: Beautify build log of syscall headers
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
commit af8e947079a7dab0480b5d6db6b093fd04b86fc9 upstream.
This makes the build log look nicer.
Before:
SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h SYSHDR arch/x86/entry/syscalls/../../include/generated/asm/unistd_32_ia32.h SYSHDR arch/x86/entry/syscalls/../../include/generated/asm/unistd_64_x32.h SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_64.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_64.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_x32.h
After:
SYSTBL arch/x86/include/generated/asm/syscalls_32.h SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h SYSHDR arch/x86/include/generated/asm/unistd_64_x32.h SYSTBL arch/x86/include/generated/asm/syscalls_64.h SYSHDR arch/x86/include/generated/uapi/asm/unistd_32.h SYSHDR arch/x86/include/generated/uapi/asm/unistd_64.h SYSHDR arch/x86/include/generated/uapi/asm/unistd_x32.h
--- arch/x86/entry/syscalls/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/syscalls/Makefile +2 -2
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -out := $(obj)/../../include/generated/asm -uapi := $(obj)/../../include/generated/uapi/asm +out := arch/$(SRCARCH)/include/generated/asm +uapi := arch/$(SRCARCH)/include/generated/uapi/asm # Create output directory if not already present _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') \
Greg Kroah-Hartman
maintainerPATCH 31/159 x86/cpufeatures: Enable new SSE/AVX/AVX512 CPU features
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gayatri Kammela <[email protected]>
commit c128dbfa0f879f8ce7b79054037889b0b2240728 upstream.
Add a few new SSE/AVX/AVX512 instruction groups/features for enumeration in /proc/cpuinfo: AVX512_VBMI2, GFNI, VAES, VPCLMULQDQ, AVX512_VNNI, AVX512_BITALG.
CPUID.(EAX=7,ECX=0):ECX[bit 6] AVX512_VBMI2 CPUID.(EAX=7,ECX=0):ECX[bit 8] GFNI CPUID.(EAX=7,ECX=0):ECX[bit 9] VAES
CPUID.(EAX=7,ECX=0):ECX[bit 10] VPCLMULQDQ
CPUID.(EAX=7,ECX=0):ECX[bit 11] AVX512_VNNI
CPUID.(EAX=7,ECX=0):ECX[bit 12] AVX512_BITALG
Detailed information of CPUID bits for these features can be found in the Intel Architecture Instruction Set Extensions and Future Features Programming Interface document (refer to Table 1-1. and Table 1-2.). A copy of this document is available at
https://bugzilla.kernel.org/show_bug.cgi?id=197239
--- arch/x86/include/asm/cpufeatures.h | 6 ++++++ arch/x86/kernel/cpu/cpuid-deps.c | 6 ++++++ 2 files changed, 12 insertions(+)
arch/x86/include/asm/cpufeatures.h +6 -0
@@ -300,6 +300,12 @@#define X86_FEATURE_AVX512VBMI (16*32+ 1)/* AVX512 Vector Bit Manipulation instructions*/ #define X86_FEATURE_PKU (16*32+ 3)/* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4)/* OS Protection Keys Enable */ +#define X86_FEATURE_AVX512_VBMI2 (16*32+ 6)/* Additional AVX512 Vector Bit Manipulation Instructions */ +#define X86_FEATURE_GFNI (16*32+ 8)/* Galois Field New Instructions */ +#define X86_FEATURE_VAES (16*32+ 9)/* Vector AES */ +#define X86_FEATURE_VPCLMULQDQ (16*32+ 10)/* Carry-Less Multiplication Double Quadword */ +#define X86_FEATURE_AVX512_VNNI (16*32+ 11)/* Vector Neural Network Instructions */ +#define X86_FEATURE_AVX512_BITALG (16*32+12)/* Support for VPOPCNT[B,W] and VPSHUF-BITQMB */ #define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14)/* POPCNT for vectors of DW/QW */ #define X86_FEATURE_LA57 (16*32+16)/* 5-level page tables */ #define X86_FEATURE_RDPID (16*32+22)/* RDPID instruction */
arch/x86/kernel/cpu/cpuid-deps.c +6 -0
@@ -50,6 +50,12 @@ const static struct cpuid_dep cpuid_deps { X86_FEATURE_AVX512BW, X86_FEATURE_AVX512F }, { X86_FEATURE_AVX512VL, X86_FEATURE_AVX512F }, { X86_FEATURE_AVX512VBMI, X86_FEATURE_AVX512F }, + { X86_FEATURE_AVX512_VBMI2, X86_FEATURE_AVX512VL }, + { X86_FEATURE_GFNI, X86_FEATURE_AVX512VL }, + { X86_FEATURE_VAES, X86_FEATURE_AVX512VL }, + { X86_FEATURE_VPCLMULQDQ, X86_FEATURE_AVX512VL }, + { X86_FEATURE_AVX512_VNNI, X86_FEATURE_AVX512VL }, + { X86_FEATURE_AVX512_BITALG, X86_FEATURE_AVX512VL }, { X86_FEATURE_AVX512_4VNNIW, X86_FEATURE_AVX512F }, { X86_FEATURE_AVX512_4FMAPS, X86_FEATURE_AVX512F }, { X86_FEATURE_AVX512_VPOPCNTDQ, X86_FEATURE_AVX512F },
Greg Kroah-Hartman
maintainerPATCH 9/159 x86/head: Add unwind hint annotations
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit 2704fbb672d0d9a19414907fda7949283dcef6a1 upstream.
Jiri Slaby reported an ORC issue when unwinding from an idle task. The stack was:
ffffffff811083c2 do_idle+0x142/0x1e0
ffffffff8110861d cpu_startup_entry+0x5d/0x60
ffffffff82715f58 start_kernel+0x3ff/0x407
ffffffff827153e8 x86_64_start_kernel+0x14e/0x15d
ffffffff810001bf secondary_startup_64+0x9f/0xa0The ORC unwinder errored out at secondary_startup_64 because the head code isn't annotated yet so there wasn't a corresponding ORC entry.
Fix that and any other head-related unwinding issues by adding unwind hints to the head code.
--- arch/x86/kernel/Makefile | 1 - arch/x86/kernel/head_64.S | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-)
arch/x86/kernel/Makefile +0 -1
@@ -27,7 +27,6 @@ KASAN_SANITIZE_dumpstack.o := n KASAN_SANITIZE_dumpstack_$(BITS).o := n KASAN_SANITIZE_stacktrace.o := n -OBJECT_FILES_NON_STANDARD_head_$(BITS).o := y OBJECT_FILES_NON_STANDARD_relocate_kernel_$(BITS).o := y OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o := y OBJECT_FILES_NON_STANDARD_test_nx.o := y
arch/x86/kernel/head_64.S +12 -2
@@ -50,6 +50,7 @@ L3_START_KERNEL = pud_index(__START_KERN .code64 .globl startup_64 startup_64: + UNWIND_HINT_EMPTY /* * At this point the CPU runs in 64bit mode CS.L = 1 CS.D = 0, * and someone has loaded an identity mapped page table
@@ -89,6 +90,7 @@ startup_64: addq $(early_top_pgt - __START_KERNEL_map), %rax jmp 1f ENTRY(secondary_startup_64) + UNWIND_HINT_EMPTY /* * At this point the CPU runs in 64bit mode CS.L = 1 CS.D = 0, * and someone has loaded a mapped page table.
@@ -133,6 +135,7 @@ ENTRY(secondary_startup_64) movq $1f, %rax jmp *%rax 1: + UNWIND_HINT_EMPTY /* Check if nx is implemented */ movl $0x80000001, %eax
@@ -247,6 +250,7 @@ END(secondary_startup_64) */ ENTRY(start_cpu0) movq initial_stack(%rip), %rsp + UNWIND_HINT_EMPTY jmp .Ljump_to_C_code ENDPROC(start_cpu0) #endif
@@ -271,13 +275,18 @@ ENTRY(early_idt_handler_array) i = 0 .rept NUM_EXCEPTION_VECTORS .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1 - pushq $0 # Dummy error code, to make stack frame uniform + UNWIND_HINT_IRET_REGS + pushq $0 # Dummy error code, to make stack frame uniform + .else + UNWIND_HINT_IRET_REGS offset=8 .endif pushq $i # 72(%rsp) Vector number jmp early_idt_handler_common + UNWIND_HINT_IRET_REGS i = i + 1 .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc .endr + UNWIND_HINT_IRET_REGS offset=16 END(early_idt_handler_array) early_idt_handler_common:
@@ -306,6 +315,7 @@ early_idt_handler_common: pushq %r13 /* pt_regs->r13 */ pushq %r14 /* pt_regs->r14 */ pushq %r15 /* pt_regs->r15 */ + UNWIND_HINT_REGS cmpq $14,%rsi /* Page fault? */ jnz 10f
@@ -428,7 +438,7 @@ ENTRY(phys_base) EXPORT_SYMBOL(phys_base) #include "../../x86/xen/xen-head.S" - + __PAGE_ALIGNED_BSS NEXT_PAGE(empty_zero_page) .skip PAGE_SIZE
Greg Kroah-Hartman
maintainerPATCH 36/159 x86/entry/64: Split the IRET-to-user and IRET-to-kernel paths
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 26c4ef9c49d8a0341f6d97ce2cfdd55d1236ed29 upstream.
These code paths will diverge soon.
--- arch/x86/entry/entry_64.S | 34 +++++++++++++++++++++++++--------- arch/x86/entry/entry_64_compat.S | 2 +- arch/x86/kernel/head_64.S | 2 +- 3 files changed, 27 insertions(+), 11 deletions(-)
arch/x86/entry/entry_64.S +25 -9
@@ -322,7 +322,7 @@ syscall_return_via_sysret: opportunistic_sysret_failed: SWAPGS - jmp restore_regs_and_iret + jmp restore_regs_and_return_to_usermode END(entry_SYSCALL_64) ENTRY(stub_ptregs_64)
@@ -424,7 +424,7 @@ ENTRY(ret_from_fork) call syscall_return_slowpath /* returns with IRQs disabled */ TRACE_IRQS_ON /* user mode is traced as IRQS on */ SWAPGS - jmp restore_regs_and_iret + jmp restore_regs_and_return_to_usermode 1: /* kernel thread */
@@ -613,7 +613,20 @@ GLOBAL(retint_user) call prepare_exit_to_usermode TRACE_IRQS_IRETQ SWAPGS - jmp restore_regs_and_iret + +GLOBAL(restore_regs_and_return_to_usermode) +#ifdef CONFIG_DEBUG_ENTRY + /* Assert that pt_regs indicates user mode. */ + testl $3, CS(%rsp) + jnz 1f + ud2 +1: +#endif + RESTORE_EXTRA_REGS + RESTORE_C_REGS + REMOVE_PT_GPREGS_FROM_STACK 8 + INTERRUPT_RETURN + /* Returning to kernel space */ retint_kernel:
@@ -633,11 +646,14 @@ retint_kernel: */ TRACE_IRQS_IRETQ -/* - * At this label, code paths which return to kernel and to user, - * which come from interrupts/exception and from syscalls, merge. - */ -GLOBAL(restore_regs_and_iret) +GLOBAL(restore_regs_and_return_to_kernel) +#ifdef CONFIG_DEBUG_ENTRY + /* Assert that pt_regs indicates kernel mode. */ + testl $3, CS(%rsp) + jz 1f + ud2 +1: +#endif RESTORE_EXTRA_REGS RESTORE_C_REGS REMOVE_PT_GPREGS_FROM_STACK 8
@@ -1328,7 +1344,7 @@ ENTRY(nmi) * work, because we don't want to enable interrupts. */ SWAPGS - jmp restore_regs_and_iret + jmp restore_regs_and_return_to_usermode .Lnmi_from_kernel: /*
arch/x86/entry/entry_64_compat.S +1 -1
@@ -338,7 +338,7 @@ ENTRY(entry_INT80_compat) /* Go back to user mode. */ TRACE_IRQS_ON SWAPGS - jmp restore_regs_and_iret + jmp restore_regs_and_return_to_usermode END(entry_INT80_compat) ENTRY(stub32_clone)
arch/x86/kernel/head_64.S +1 -1
@@ -328,7 +328,7 @@ early_idt_handler_common: 20: decl early_recursion_flag(%rip) - jmp restore_regs_and_iret + jmp restore_regs_and_return_to_kernel END(early_idt_handler_common) __INITDATA
Greg Kroah-Hartman
maintainerPATCH 38/159 x86/entry/64: Simplify reg restore code in the standard IRET paths
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit e872045bfd9c465a8555bab4b8567d56a4d2d3bb upstream.
The old code restored all the registers with movq instead of pop.
In theory, this was done because some CPUs have higher movq throughput, but any gain there would be tiny and is almost certainly outweighed by the higher text size.
This saves 96 bytes of text.
--- arch/x86/entry/calling.h | 21 +++++++++++++++++++++ arch/x86/entry/entry_64.S | 12 ++++++------ 2 files changed, 27 insertions(+), 6 deletions(-)
arch/x86/entry/calling.h +21 -0
@@ -152,6 +152,27 @@ For 32-bit we have the following convent UNWIND_HINT_REGS offset=\offset extra=0 .endm + .macro POP_EXTRA_REGS + popq %r15 + popq %r14 + popq %r13 + popq %r12 + popq %rbp + popq %rbx + .endm + + .macro POP_C_REGS + popq %r11 + popq %r10 + popq %r9 + popq %r8 + popq %rax + popq %rcx + popq %rdx + popq %rsi + popq %rdi + .endm + .macro RESTORE_C_REGS_HELPER rstor_rax=1, rstor_rcx=1, rstor_r11=1, rstor_r8910=1, rstor_rdx=1 .if \rstor_r11 movq 6*8(%rsp), %r11
arch/x86/entry/entry_64.S +6 -6
@@ -619,9 +619,9 @@ GLOBAL(swapgs_restore_regs_and_return_to 1: #endif SWAPGS - RESTORE_EXTRA_REGS - RESTORE_C_REGS - REMOVE_PT_GPREGS_FROM_STACK 8 + POP_EXTRA_REGS + POP_C_REGS + addq $8, %rsp /* skip regs->orig_ax */ INTERRUPT_RETURN
@@ -651,9 +651,9 @@ GLOBAL(restore_regs_and_return_to_kernel ud2 1: #endif - RESTORE_EXTRA_REGS - RESTORE_C_REGS - REMOVE_PT_GPREGS_FROM_STACK 8 + POP_EXTRA_REGS + POP_C_REGS + addq $8, %rsp /* skip regs->orig_ax */ INTERRUPT_RETURN ENTRY(native_iret)
Greg Kroah-Hartman
maintainerPATCH 39/159 x86/entry/64: Shrink paranoid_exit_restore and make labels local
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit e53178328c9b96fbdbc719e78c93b5687ee007c3 upstream.
paranoid_exit_restore was a copy of restore_regs_and_return_to_kernel. Merge them and make the paranoid_exit internal labels local.
Keeping .Lparanoid_exit makes the code a bit shorter because it allows a 2-byte jnz instead of a 5-byte jnz.
Saves 96 bytes of text.
( This is still a bit suboptimal in a non-CONFIG_TRACE_IRQFLAGS
kernel, but fixing that would make the code rather messy. )
--- arch/x86/entry/entry_64.S | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
arch/x86/entry/entry_64.S +5 -8
@@ -1124,17 +1124,14 @@ ENTRY(paranoid_exit) DISABLE_INTERRUPTS(CLBR_ANY) TRACE_IRQS_OFF_DEBUG testl %ebx, %ebx /* swapgs needed? */ - jnz paranoid_exit_no_swapgs + jnz .Lparanoid_exit_no_swapgs TRACE_IRQS_IRETQ SWAPGS_UNSAFE_STACK - jmp paranoid_exit_restore -paranoid_exit_no_swapgs: + jmp .Lparanoid_exit_restore +.Lparanoid_exit_no_swapgs: TRACE_IRQS_IRETQ_DEBUG -paranoid_exit_restore: - RESTORE_EXTRA_REGS - RESTORE_C_REGS - REMOVE_PT_GPREGS_FROM_STACK 8 - INTERRUPT_RETURN +.Lparanoid_exit_restore: + jmp restore_regs_and_return_to_kernel END(paranoid_exit) /*
Greg Kroah-Hartman
maintainerPATCH 42/159 x86/entry/64: Use POP instead of MOV to restore regs on NMI return
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 471ee4832209e986029b9fabdaad57b1eecb856b upstream.
This gets rid of the last user of the old RESTORE_..._REGS infrastructure.
--- arch/x86/entry/entry_64.S | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/x86/entry/entry_64.S +7 -4
@@ -1560,11 +1560,14 @@ end_repeat_nmi: nmi_swapgs: SWAPGS_UNSAFE_STACK nmi_restore: - RESTORE_EXTRA_REGS - RESTORE_C_REGS + POP_EXTRA_REGS + POP_C_REGS - /* Point RSP at the "iret" frame. */ - REMOVE_PT_GPREGS_FROM_STACK 6*8 + /* + * Skip orig_ax and the "outermost" frame to point RSP at the "iret" + * at the "iret" frame. + */ + addq $6*8, %rsp /* * Clear "NMI executing". Set DF first so that we can easily
Greg Kroah-Hartman
maintainerPATCH 44/159 xen, x86/entry/64: Add xen NMI trap entry
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit 43e4111086a70c78bedb6ad990bee97f17b27a6e upstream.
Instead of trying to execute any NMI via the bare metal's NMI trap handler use a Xen specific one for PV domains, like we do for e.g. debug traps. As in a PV domain the NMI is handled via the normal kernel stack this is the correct thing to do.
This will enable us to get rid of the very fragile and questionable dependencies between the bare metal NMI handler and Xen assumptions believed to be broken anyway.
--- arch/x86/entry/entry_64.S | 2 +- arch/x86/include/asm/traps.h | 2 +- arch/x86/xen/enlighten_pv.c | 2 +- arch/x86/xen/xen-asm_64.S | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/entry/entry_64.S +1 -1
@@ -1079,6 +1079,7 @@ idtentry int3 do_int3 has_error_code idtentry stack_segment do_stack_segment has_error_code=1 #ifdef CONFIG_XEN +idtentry xennmi do_nmi has_error_code=0 idtentry xendebug do_debug has_error_code=0 idtentry xenint3 do_int3 has_error_code=0 #endif
@@ -1241,7 +1242,6 @@ ENTRY(error_exit) END(error_exit) /* Runs on exception stack */ -/* XXX: broken on Xen PV */ ENTRY(nmi) UNWIND_HINT_IRET_REGS /*
arch/x86/include/asm/traps.h +1 -1
@@ -38,9 +38,9 @@ asmlinkage void simd_coprocessor_error(v#if defined(CONFIG_X86_64 ) && defined(CONFIG_XEN_PV ) asmlinkage void xen_divide_error(void); +asmlinkage void xen_xennmi(void); asmlinkage void xen_xendebug(void); asmlinkage void xen_xenint3(void); -asmlinkage void xen_nmi(void); asmlinkage void xen_overflow(void); asmlinkage void xen_bounds(void); asmlinkage void xen_invalid_op(void);
arch/x86/xen/enlighten_pv.c +1 -1
@@ -601,7 +601,7 @@ static struct trap_array_entry trap_arra #ifdef CONFIG_X86_MCE { machine_check, xen_machine_check, true }, #endif - { nmi, xen_nmi, true }, + { nmi, xen_xennmi, true }, { overflow, xen_overflow, false }, #ifdef CONFIG_IA32_EMULATION { entry_INT80_compat, xen_entry_INT80_compat, false },
arch/x86/xen/xen-asm_64.S +1 -1
@@ -30,7 +30,7 @@ xen_pv_trap debug xen_pv_trap xendebug xen_pv_trap int3 xen_pv_trap xenint3 -xen_pv_trap nmi +xen_pv_trap xennmi xen_pv_trap overflow xen_pv_trap bounds xen_pv_trap invalid_op
Greg Kroah-Hartman
maintainerPATCH 45/159 x86/entry/64: De-Xen-ify our NMI code
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 929bacec21478a72c78e4f29f98fb799bd00105a upstream.
Xen PV is fundamentally incompatible with our fancy NMI code: it doesn't use IST at all, and Xen entries clobber two stack slots below the hardware frame.
Drop Xen PV support from our NMI code entirely.
--- arch/x86/entry/entry_64.S | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
arch/x86/entry/entry_64.S +18 -12
@@ -1241,9 +1241,13 @@ ENTRY(error_exit) jmp retint_user END(error_exit) -/* Runs on exception stack */ +/* + * Runs on exception stack. Xen PV does not go through this path at all, + * so we can use real assembly here. + */ ENTRY(nmi) UNWIND_HINT_IRET_REGS + /* * We allow breakpoints in NMIs. If a breakpoint occurs, then * the iretq it performs will take us out of NMI context.
@@ -1301,7 +1305,7 @@ ENTRY(nmi) * stacks lest we corrupt the "NMI executing" variable. */ - SWAPGS_UNSAFE_STACK + swapgs cld movq %rsp, %rdx movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
@@ -1466,7 +1470,7 @@ nested_nmi_out: popq %rdx /* We are returning to kernel mode, so this cannot result in a fault. */ - INTERRUPT_RETURN + iretq first_nmi: /* Restore rdx. */
@@ -1497,7 +1501,7 @@ first_nmi: pushfq /* RFLAGS */ pushq $__KERNEL_CS /* CS */ pushq $1f /* RIP */ - INTERRUPT_RETURN /* continues at repeat_nmi below */ + iretq /* continues at repeat_nmi below */ UNWIND_HINT_IRET_REGS 1: #endif
@@ -1572,20 +1576,22 @@ nmi_restore: /* * Clear "NMI executing". Set DF first so that we can easily * distinguish the remaining code between here and IRET from - * the SYSCALL entry and exit paths. On a native kernel, we - * could just inspect RIP, but, on paravirt kernels, - * INTERRUPT_RETURN can translate into a jump into a - * hypercall page. + * the SYSCALL entry and exit paths. + * + * We arguably should just inspect RIP instead, but I (Andy) wrote + * this code when I had the misapprehension that Xen PV supported + * NMIs, and Xen PV would break that approach. */ std movq $0, 5*8(%rsp) /* clear "NMI executing" */ /* - * INTERRUPT_RETURN reads the "iret" frame and exits the NMI - * stack in a single instruction. We are returning to kernel - * mode, so this cannot result in a fault. + * iretq reads the "iret" frame and exits the NMI stack in a + * single instruction. We are returning to kernel mode, so this + * cannot result in a fault. Similarly, we don't need to worry + * about espfix64 on the way back to kernel mode. */ - INTERRUPT_RETURN + iretq END(nmi) ENTRY(ignore_sysret)
Greg Kroah-Hartman
maintainerPATCH 62/159 selftests/x86/ldt_gdt: Run most existing LDT test cases against the GDT as well
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit adedf2893c192dd09b1cc2f2dcfdd7cad99ec49d upstream.
Now that the main test infrastructure supports the GDT, run tests that will pass the kernel's GDT permission tests against the GDT.
--- tools/testing/selftests/x86/ldt_gdt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/x86/ldt_gdt.c +9 -1
@@ -189,7 +189,15 @@ static bool install_valid_mode(const strstatic bool install_valid (const struct user_desc *desc,uint32_t ar) { -return install_valid_mode (desc, ar, false, true); +bool ret =install_valid_mode (desc, ar, false, true); + +if (desc->contents <=1 && desc->seg_32bit && + !desc->seg_not_present) { +/* Should work in the GDT, too. */ +install_valid_mode (desc, ar, false, false); + } + +return ret; }static void install_invalid (const struct user_desc *desc,bool oldmode)
Greg Kroah-Hartman
maintainerPATCH 63/159 ACPI / APEI: Replace ioremap_page_range() with fixmap
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
commit 4f89fa286f6729312e227e7c2d764e8e7b9d340e upstream.
Replace ghes_io{re,un}map_pfn_{nmi,irq}()s use of ioremap_page_range() with __set_fixmap() as ioremap_page_range() may sleep to allocate a new level of page-table, even if its passed an existing final-address to use in the mapping.
The GHES driver can only be enabled for architectures that selectHAVE_ACPI_APEI: Add fixmap entries to both x86 and arm64.
clear_fixmap() does the TLB invalidation in __set_fixmap() for arm64 and __set_pte_vaddr() for x86. In each case its the same as the respective arch_apei_flush_tlb_one().
--- arch/arm64/include/asm/fixmap.h | 7 ++++++ arch/x86/include/asm/fixmap.h | 6 +++++ drivers/acpi/apei/ghes.c | 44 ++++++++++++---------------------------- 3 files changed, 27 insertions(+), 30 deletions(-)
arch/arm64/include/asm/fixmap.h +7 -0
@@ -51,6 +51,13 @@ enum fixed_addresses {FIX_EARLYCON_MEM_BASE ,FIX_TEXT_POKE0 , + +#ifdef CONFIG_ACPI_APEI_GHES +/* Used for GHES mapping from assorted contexts */ +FIX_APEI_GHES_IRQ , +FIX_APEI_GHES_NMI , +#endif /* CONFIG_ACPI_APEI_GHES */ + __end_of_permanent_fixed_addresses,/*
arch/x86/include/asm/fixmap.h +6 -0
@@ -104,6 +104,12 @@ enum fixed_addresses {FIX_GDT_REMAP_BEGIN ,FIX_GDT_REMAP_END =FIX_GDT_REMAP_BEGIN +NR_CPUS -1 , +#ifdef CONFIG_ACPI_APEI_GHES +/* Used for GHES mapping from assorted contexts */ +FIX_APEI_GHES_IRQ , +FIX_APEI_GHES_NMI , +#endif + __end_of_permanent_fixed_addresses,/*
drivers/acpi/apei/ghes.c +14 -30
98 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 64/159 x86/virt, x86/platform: Merge struct x86_hyper into struct x86_platform and struct x86_init
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit f72e38e8ec8869ac0ba5a75d7d2f897d98a1454e upstream.
Instead of x86_hyper being either NULL on bare metal or a pointer to a struct hypervisor_x86 in case of the kernel running as a guest merge the struct into x86_platform and x86_init.
This will remove the need for wrappers making it hard to find out what is being called. With dummy functions added for all callbacks testing for a NULL function pointer can be removed, too.
--- arch/x86/include/asm/hypervisor.h | 25 +++------------- arch/x86/include/asm/x86_init.h | 24 ++++++++++++++++ arch/x86/kernel/apic/apic.c | 2 - arch/x86/kernel/cpu/hypervisor.c | 56 ++++++++++++++++++-------------------- arch/x86/kernel/cpu/mshyperv.c | 2 - arch/x86/kernel/cpu/vmware.c | 4 +- arch/x86/kernel/kvm.c | 2 - arch/x86/kernel/x86_init.c | 9 ++++++ arch/x86/mm/init.c | 2 - arch/x86/xen/enlighten_hvm.c | 8 ++--- arch/x86/xen/enlighten_pv.c | 2 - include/linux/hypervisor.h | 8 ++++- 12 files changed, 82 insertions(+), 62 deletions(-)
arch/x86/include/asm/hypervisor.h +5 -20
@@ -23,6 +23,7 @@#ifdef CONFIG_HYPERVISOR_GUEST #include <asm/kvm_para.h> +#include <asm/x86_init.h> #include <asm/xen/hypervisor.h> /*
@@ -35,17 +36,11 @@ struct hypervisor_x86 {/* Detection routine */ uint32_t (*detect)(void ); -/* Platform setup (run once per boot) */ -void (*init_platform)(void ); +/* init time callbacks */ +struct x86_hyper_init init; -/* X2APIC detection (run once per boot) */ -bool (*x2apic_available)(void ); - -/* pin current vcpu to specified physical cpu (run rarely) */ -void (*pin_vcpu)(int ); - -/* called during init_mem_mapping() to setup early mappings. */ -void (*init_mem_mapping)(void ); +/* runtime callbacks */ +struct x86_hyper_runtime runtime; };extern const struct hypervisor_x86 *x86_hyper;
@@ -58,17 +53,7 @@ extern const struct hypervisor_x86 x86_hextern const struct hypervisor_x86 x86_hyper_kvm;extern void init_hypervisor_platform (void ); -extern bool hypervisor_x2apic_available (void ); -extern void hypervisor_pin_vcpu (int cpu); - -static inline void hypervisor_init_mem_mapping (void ) -{ -if (x86_hyper && x86_hyper->init_mem_mapping) - x86_hyper->init_mem_mapping (); -}#else static inline void init_hypervisor_platform (void ) { } -static inline bool hypervisor_x2apic_available (void ) {return false; } -static inline void hypervisor_init_mem_mapping (void ) { }#endif /* CONFIG_HYPERVISOR_GUEST */ #endif /* _ASM_X86_HYPERVISOR_H */
arch/x86/include/asm/x86_init.h +24 -0
@@ -115,6 +115,18 @@ struct x86_init_pci { };/** +* struct x86_hyper_init - x86 hypervisor init functions +* @init_platform: platform setup +* @x2apic_available: X2APIC detection +* @init_mem_mapping: setup early mappings during init_mem_mapping() +*/ +struct x86_hyper_init { +void (*init_platform)(void ); +bool (*x2apic_available)(void ); +void (*init_mem_mapping)(void ); +}; + +/** * struct x86_init_ops - functions for platform specific setup * */
@@ -127,6 +139,7 @@ struct x86_init_ops {struct x86_init_timers timers;struct x86_init_iommu iommu;struct x86_init_pci pci; +struct x86_hyper_init hyper; };/**
@@ -200,6 +213,15 @@ struct x86_legacy_features { };/** +* struct x86_hyper_runtime - x86 hypervisor specific runtime callbacks +* +* @pin_vcpu: pin current vcpu to specified physical cpu (run rarely) +*/ +struct x86_hyper_runtime { +void (*pin_vcpu)(int cpu); +}; + +/** * struct x86_platform_ops - platform specific runtime functions * @calibrate_cpu: calibrate CPU * @calibrate_tsc: calibrate TSC, if different from CPU
@@ -218,6 +240,7 @@ struct x86_legacy_features {* possible in x86_early_init_platform_quirks() by * only using the current x86_hardware_subarch * semantics. +* @hyper: x86 hypervisor specific runtime callbacks */ struct x86_platform_ops {unsigned long (*calibrate_cpu)(void );
@@ -233,6 +256,7 @@ struct x86_platform_ops {void (*apic_post_init)(void );struct x86_legacy_features legacy;void (*set_legacy_features)(void ); +struct x86_hyper_runtime hyper; };struct pci_dev ;
arch/x86/kernel/apic/apic.c +1 -1
@@ -1645,7 +1645,7 @@ static __init void try_to_enable_x2apic(* under KVM */ if (max_physical_apicid >255 || - !hypervisor_x2apic_available ()) { + !x86_init.hyper.x2apic_available ()) {pr_info ("x2apic: IRQ remapping doesn't support X2APIC mode\n" );x2apic_disable ();return ;
arch/x86/kernel/cpu/hypervisor.c +27 -29
78 lines not on this page · raw message
arch/x86/kernel/cpu/mshyperv.c +1 -1
@@ -257,6 +257,6 @@ static void __init ms_hyperv_init_platfoconst __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { .name ="Microsoft Hyper-V" , .detect = ms_hyperv_platform, - .init_platform = ms_hyperv_init_platform, + .init.init_platform = ms_hyperv_init_platform, };EXPORT_SYMBOL (x86_hyper_ms_hyperv);
arch/x86/kernel/cpu/vmware.c +2 -2
@@ -208,7 +208,7 @@ static bool __init vmware_legacy_x2apic_const __refconst struct hypervisor_x86 x86_hyper_vmware = { .name ="VMware" , .detect = vmware_platform, - .init_platform = vmware_platform_setup, - .x2apic_available = vmware_legacy_x2apic_available, + .init.init_platform = vmware_platform_setup, + .init.x2apic_available = vmware_legacy_x2apic_available, };EXPORT_SYMBOL (x86_hyper_vmware);
arch/x86/kernel/kvm.c +1 -1
@@ -547,7 +547,7 @@ static uint32_t __init kvm_detect(void)const struct hypervisor_x86 x86_hyper_kvm__refconst = { .name ="KVM" , .detect = kvm_detect, - .x2apic_available = kvm_para_available, + .init.x2apic_available = kvm_para_available, };EXPORT_SYMBOL_GPL (x86_hyper_kvm);
arch/x86/kernel/x86_init.c +9 -0
@@ -28,6 +28,8 @@ void x86_init_noop(void) { }void __init x86_init_uint_noop (unsigned int unused) { }int __init iommu_init_noop (void ) {return 0 ; }void iommu_shutdown_noop (void ) { } +bool __init bool_x86_init_noop (void ) {return false; } +void x86_op_int_noop (int cpu) { }/* * The platform setup functions are preset with the default functions
@@ -81,6 +83,12 @@ struct x86_init_ops x86_init __initdata .init_irq = x86_default_pci_init_irq, .fixup_irqs = x86_default_pci_fixup_irqs, }, + + .hyper = { + .init_platform = x86_init_noop, + .x2apic_available = bool_x86_init_noop, + .init_mem_mapping = x86_init_noop, + }, };struct x86_cpuinit_ops x86_cpuinit = {
@@ -101,6 +109,7 @@ struct x86_platform_ops x86_platform __r .get_nmi_reason = default_get_nmi_reason, .save_sched_clock_state = tsc_save_sched_clock_state, .restore_sched_clock_state = tsc_restore_sched_clock_state, + .hyper.pin_vcpu = x86_op_int_noop, };EXPORT_SYMBOL_GPL (x86_platform);
arch/x86/mm/init.c +1 -1
@@ -671,7 +671,7 @@ void __init init_mem_mapping(void)load_cr3 (swapper_pg_dir);__flush_tlb_all (); -hypervisor_init_mem_mapping (); + x86_init.hyper.init_mem_mapping ();early_memtest (0 , max_pfn_mapped <<PAGE_SHIFT ); }
arch/x86/xen/enlighten_hvm.c +4 -4
@@ -229,9 +229,9 @@ static uint32_t __init xen_platform_hvm(const struct hypervisor_x86 x86_hyper_xen_hvm = { .name ="Xen HVM" , .detect = xen_platform_hvm, - .init_platform = xen_hvm_guest_init, - .pin_vcpu = xen_pin_vcpu, - .x2apic_available = xen_x2apic_para_available, - .init_mem_mapping = xen_hvm_init_mem_mapping, + .init.init_platform = xen_hvm_guest_init, + .init.x2apic_available = xen_x2apic_para_available, + .init.init_mem_mapping = xen_hvm_init_mem_mapping, + .runtime.pin_vcpu = xen_pin_vcpu, };EXPORT_SYMBOL (x86_hyper_xen_hvm);
arch/x86/xen/enlighten_pv.c +1 -1
@@ -1462,6 +1462,6 @@ static uint32_t __init xen_platform_pv(vconst struct hypervisor_x86 x86_hyper_xen_pv = { .name ="Xen PV" , .detect = xen_platform_pv, - .pin_vcpu = xen_pin_vcpu, + .runtime.pin_vcpu = xen_pin_vcpu, };EXPORT_SYMBOL (x86_hyper_xen_pv);
include/linux/hypervisor.h +6 -2
@@ -7,8 +7,12 @@* Juergen Gross <[email protected]> */ -#ifdef CONFIG_HYPERVISOR_GUEST -#include <asm/hypervisor.h> +#ifdef CONFIG_X86 +#include <asm/x86_init.h> +static inline void hypervisor_pin_vcpu (int cpu) +{ + x86_platform.hyper.pin_vcpu (cpu); +}#else static inline void hypervisor_pin_vcpu (int cpu) {
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel