Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'x86_cleanups_for_v7.0_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 cleanups from Borislav Petkov:

- The usual set of cleanups and simplifications all over the tree

* tag 'x86_cleanups_for_v7.0_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/segment: Use MOVL when reading segment registers
selftests/x86: Clean up sysret_rip coding style
x86/mm: Hide mm_free_global_asid() definition under CONFIG_BROADCAST_TLB_FLUSH
x86/crash: Use set_memory_p() instead of __set_memory_prot()
x86/CPU/AMD: Simplify the spectral chicken fix
x86/platform/olpc: Replace strcpy() with strscpy() in xo15_sci_add()
x86/split_lock: Remove dead string when split_lock_detect=fatal

+24 -50
-2
arch/x86/include/asm/mmu_context.h
··· 139 139 #define enter_lazy_tlb enter_lazy_tlb 140 140 extern void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk); 141 141 142 - #define mm_init_global_asid mm_init_global_asid 143 142 extern void mm_init_global_asid(struct mm_struct *mm); 144 - 145 143 extern void mm_free_global_asid(struct mm_struct *mm); 146 144 147 145 /*
+2 -2
arch/x86/include/asm/msr-index.h
··· 799 799 #define MSR_F19H_UMC_PERF_CTR 0xc0010801 800 800 801 801 /* Zen 2 */ 802 - #define MSR_ZEN2_SPECTRAL_CHICKEN 0xc00110e3 803 - #define MSR_ZEN2_SPECTRAL_CHICKEN_BIT BIT_ULL(1) 802 + #define MSR_ZEN2_SPECTRAL_CHICKEN 0xc00110e3 803 + #define MSR_ZEN2_SPECTRAL_CHICKEN_BIT 1 804 804 805 805 /* Fam 17h MSRs */ 806 806 #define MSR_F17H_IRPERF 0xc00000e9
+1 -1
arch/x86/include/asm/segment.h
··· 348 348 * Save a segment register away: 349 349 */ 350 350 #define savesegment(seg, value) \ 351 - asm("mov %%" #seg ",%0":"=r" (value) : : "memory") 351 + asm("movl %%" #seg ",%k0" : "=r" (value) : : "memory") 352 352 353 353 #endif /* !__ASSEMBLER__ */ 354 354 #endif /* __KERNEL__ */
-1
arch/x86/include/asm/set_memory.h
··· 38 38 * The caller is required to take care of these. 39 39 */ 40 40 41 - int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot); 42 41 int _set_memory_uc(unsigned long addr, int numpages); 43 42 int _set_memory_wc(unsigned long addr, int numpages); 44 43 int _set_memory_wt(unsigned long addr, int numpages);
+3
arch/x86/include/asm/tlbflush.h
··· 292 292 293 293 return mm && READ_ONCE(mm->context.asid_transition); 294 294 } 295 + 296 + extern void mm_free_global_asid(struct mm_struct *mm); 295 297 #else 296 298 static inline u16 mm_global_asid(struct mm_struct *mm) { return 0; } 297 299 static inline void mm_init_global_asid(struct mm_struct *mm) { } 300 + static inline void mm_free_global_asid(struct mm_struct *mm) { } 298 301 static inline void mm_assign_global_asid(struct mm_struct *mm, u16 asid) { } 299 302 static inline void mm_clear_asid_transition(struct mm_struct *mm) { } 300 303 static inline bool mm_in_asid_transition(struct mm_struct *mm) { return false; }
+2 -8
arch/x86/kernel/cpu/amd.c
··· 900 900 void init_spectral_chicken(struct cpuinfo_x86 *c) 901 901 { 902 902 #ifdef CONFIG_MITIGATION_UNRET_ENTRY 903 - u64 value; 904 - 905 903 /* 906 904 * On Zen2 we offer this chicken (bit) on the altar of Speculation. 907 905 * 908 906 * This suppresses speculation from the middle of a basic block, i.e. it 909 907 * suppresses non-branch predictions. 910 908 */ 911 - if (!cpu_has(c, X86_FEATURE_HYPERVISOR)) { 912 - if (!rdmsrq_safe(MSR_ZEN2_SPECTRAL_CHICKEN, &value)) { 913 - value |= MSR_ZEN2_SPECTRAL_CHICKEN_BIT; 914 - wrmsrq_safe(MSR_ZEN2_SPECTRAL_CHICKEN, value); 915 - } 916 - } 909 + if (!cpu_has(c, X86_FEATURE_HYPERVISOR)) 910 + msr_set_bit(MSR_ZEN2_SPECTRAL_CHICKEN, MSR_ZEN2_SPECTRAL_CHICKEN_BIT); 917 911 #endif 918 912 } 919 913
+3 -6
arch/x86/kernel/cpu/bus_lock.c
··· 410 410 } 411 411 break; 412 412 case sld_fatal: 413 - if (boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT)) { 413 + if (boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT)) 414 414 pr_info("#AC: crashing the kernel on kernel split_locks and sending SIGBUS on user-space split_locks\n"); 415 - } else if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT)) { 416 - pr_info("#DB: sending SIGBUS on user-space bus_locks%s\n", 417 - boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT) ? 418 - " from non-WB" : ""); 419 - } 415 + else if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT)) 416 + pr_info("#DB: sending SIGBUS on user-space bus_locks\n"); 420 417 break; 421 418 case sld_ratelimit: 422 419 if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT))
+1 -4
arch/x86/kernel/machine_kexec_64.c
··· 673 673 if (protect) 674 674 set_memory_np((unsigned long)phys_to_virt(start_paddr), nr_pages); 675 675 else 676 - __set_memory_prot( 677 - (unsigned long)phys_to_virt(start_paddr), 678 - nr_pages, 679 - __pgprot(_PAGE_PRESENT | _PAGE_NX | _PAGE_RW)); 676 + set_memory_p((unsigned long)phys_to_virt(start_paddr), nr_pages); 680 677 } 681 678 } 682 679
-13
arch/x86/mm/pat/set_memory.c
··· 2145 2145 CPA_PAGES_ARRAY, pages); 2146 2146 } 2147 2147 2148 - /* 2149 - * __set_memory_prot is an internal helper for callers that have been passed 2150 - * a pgprot_t value from upper layers and a reservation has already been taken. 2151 - * If you want to set the pgprot to a specific page protocol, use the 2152 - * set_memory_xx() functions. 2153 - */ 2154 - int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot) 2155 - { 2156 - return change_page_attr_set_clr(&addr, numpages, prot, 2157 - __pgprot(~pgprot_val(prot)), 0, 0, 2158 - NULL); 2159 - } 2160 - 2161 2148 int _set_memory_uc(unsigned long addr, int numpages) 2162 2149 { 2163 2150 /*
+2 -2
arch/x86/mm/tlb.c
··· 401 401 mm_assign_global_asid(mm, asid); 402 402 } 403 403 404 + #ifdef CONFIG_BROADCAST_TLB_FLUSH 404 405 void mm_free_global_asid(struct mm_struct *mm) 405 406 { 406 407 if (!cpu_feature_enabled(X86_FEATURE_INVLPGB)) ··· 413 412 guard(raw_spinlock_irqsave)(&global_asid_lock); 414 413 415 414 /* The global ASID can be re-used only after flush at wrap-around. */ 416 - #ifdef CONFIG_BROADCAST_TLB_FLUSH 417 415 __set_bit(mm->context.global_asid, global_asid_freed); 418 416 419 417 mm->context.global_asid = 0; 420 418 global_asid_available++; 421 - #endif 422 419 } 420 + #endif 423 421 424 422 /* 425 423 * Is the mm transitioning from a CPU-local ASID to a global ASID?
+3 -2
arch/x86/platform/olpc/olpc-xo15-sci.c
··· 7 7 8 8 #include <linux/device.h> 9 9 #include <linux/slab.h> 10 + #include <linux/string.h> 10 11 #include <linux/workqueue.h> 11 12 #include <linux/power_supply.h> 12 13 #include <linux/olpc-ec.h> ··· 145 144 if (!device) 146 145 return -EINVAL; 147 146 148 - strcpy(acpi_device_name(device), XO15_SCI_DEVICE_NAME); 149 - strcpy(acpi_device_class(device), XO15_SCI_CLASS); 147 + strscpy(acpi_device_name(device), XO15_SCI_DEVICE_NAME); 148 + strscpy(acpi_device_class(device), XO15_SCI_CLASS); 150 149 151 150 /* Get GPE bit assignment (EC events). */ 152 151 status = acpi_evaluate_integer(device->handle, "_GPE", NULL, &tmp);
+2 -2
tools/arch/x86/include/asm/msr-index.h
··· 794 794 #define MSR_F19H_UMC_PERF_CTR 0xc0010801 795 795 796 796 /* Zen 2 */ 797 - #define MSR_ZEN2_SPECTRAL_CHICKEN 0xc00110e3 798 - #define MSR_ZEN2_SPECTRAL_CHICKEN_BIT BIT_ULL(1) 797 + #define MSR_ZEN2_SPECTRAL_CHICKEN 0xc00110e3 798 + #define MSR_ZEN2_SPECTRAL_CHICKEN_BIT 1 799 799 800 800 /* Fam 17h MSRs */ 801 801 #define MSR_F17H_IRPERF 0xc00000e9
+5 -7
tools/testing/selftests/x86/sysret_rip.c
··· 31 31 void test_syscall_ins(void); 32 32 extern const char test_page[]; 33 33 34 - static void const *current_test_page_addr = test_page; 34 + static const void *current_test_page_addr = test_page; 35 35 36 36 /* State used by our signal handlers. */ 37 37 static gregset_t initial_regs; ··· 40 40 41 41 static void sigsegv_for_sigreturn_test(int sig, siginfo_t *info, void *ctx_void) 42 42 { 43 - ucontext_t *ctx = (ucontext_t*)ctx_void; 43 + ucontext_t *ctx = (ucontext_t *)ctx_void; 44 44 45 45 if (rip != ctx->uc_mcontext.gregs[REG_RIP]) { 46 46 printf("[FAIL]\tRequested RIP=0x%lx but got RIP=0x%lx\n", ··· 56 56 57 57 static void sigusr1(int sig, siginfo_t *info, void *ctx_void) 58 58 { 59 - ucontext_t *ctx = (ucontext_t*)ctx_void; 59 + ucontext_t *ctx = (ucontext_t *)ctx_void; 60 60 61 61 memcpy(&initial_regs, &ctx->uc_mcontext.gregs, sizeof(gregset_t)); 62 62 ··· 69 69 ctx->uc_mcontext.gregs[REG_R11]); 70 70 71 71 sethandler(SIGSEGV, sigsegv_for_sigreturn_test, SA_RESETHAND); 72 - 73 - return; 74 72 } 75 73 76 74 static void test_sigreturn_to(unsigned long ip) ··· 82 84 83 85 static void sigsegv_for_fallthrough(int sig, siginfo_t *info, void *ctx_void) 84 86 { 85 - ucontext_t *ctx = (ucontext_t*)ctx_void; 87 + ucontext_t *ctx = (ucontext_t *)ctx_void; 86 88 87 89 if (rip != ctx->uc_mcontext.gregs[REG_RIP]) { 88 90 printf("[FAIL]\tExpected SIGSEGV at 0x%lx but got RIP=0x%lx\n", ··· 128 130 printf("[OK]\tWe survived\n"); 129 131 } 130 132 131 - int main() 133 + int main(void) 132 134 { 133 135 /* 134 136 * When the kernel returns from a slow-path syscall, it will