Skip to content

Commit 9fbb481

Browse files
committed
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
2 parents dcb4971 + 53ed3d9 commit 9fbb481

13 files changed

Lines changed: 24 additions & 50 deletions

File tree

arch/x86/include/asm/mmu_context.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ static inline void mm_reset_untag_mask(struct mm_struct *mm)
139139
#define enter_lazy_tlb enter_lazy_tlb
140140
extern void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk);
141141

142-
#define mm_init_global_asid mm_init_global_asid
143142
extern void mm_init_global_asid(struct mm_struct *mm);
144-
145143
extern void mm_free_global_asid(struct mm_struct *mm);
146144

147145
/*

arch/x86/include/asm/msr-index.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,8 @@
799799
#define MSR_F19H_UMC_PERF_CTR 0xc0010801
800800

801801
/* 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
804804

805805
/* Fam 17h MSRs */
806806
#define MSR_F17H_IRPERF 0xc00000e9

arch/x86/include/asm/segment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static inline void __loadsegment_fs(unsigned short value)
348348
* Save a segment register away:
349349
*/
350350
#define savesegment(seg, value) \
351-
asm("mov %%" #seg ",%0":"=r" (value) : : "memory")
351+
asm("movl %%" #seg ",%k0" : "=r" (value) : : "memory")
352352

353353
#endif /* !__ASSEMBLER__ */
354354
#endif /* __KERNEL__ */

arch/x86/include/asm/set_memory.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ int set_memory_rox(unsigned long addr, int numpages);
3838
* The caller is required to take care of these.
3939
*/
4040

41-
int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot);
4241
int _set_memory_uc(unsigned long addr, int numpages);
4342
int _set_memory_wc(unsigned long addr, int numpages);
4443
int _set_memory_wt(unsigned long addr, int numpages);

arch/x86/include/asm/tlbflush.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,12 @@ static inline bool mm_in_asid_transition(struct mm_struct *mm)
292292

293293
return mm && READ_ONCE(mm->context.asid_transition);
294294
}
295+
296+
extern void mm_free_global_asid(struct mm_struct *mm);
295297
#else
296298
static inline u16 mm_global_asid(struct mm_struct *mm) { return 0; }
297299
static inline void mm_init_global_asid(struct mm_struct *mm) { }
300+
static inline void mm_free_global_asid(struct mm_struct *mm) { }
298301
static inline void mm_assign_global_asid(struct mm_struct *mm, u16 asid) { }
299302
static inline void mm_clear_asid_transition(struct mm_struct *mm) { }
300303
static inline bool mm_in_asid_transition(struct mm_struct *mm) { return false; }

arch/x86/kernel/cpu/amd.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -900,20 +900,14 @@ static void fix_erratum_1386(struct cpuinfo_x86 *c)
900900
void init_spectral_chicken(struct cpuinfo_x86 *c)
901901
{
902902
#ifdef CONFIG_MITIGATION_UNRET_ENTRY
903-
u64 value;
904-
905903
/*
906904
* On Zen2 we offer this chicken (bit) on the altar of Speculation.
907905
*
908906
* This suppresses speculation from the middle of a basic block, i.e. it
909907
* suppresses non-branch predictions.
910908
*/
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);
917911
#endif
918912
}
919913

arch/x86/kernel/cpu/bus_lock.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,10 @@ static void sld_state_show(void)
410410
}
411411
break;
412412
case sld_fatal:
413-
if (boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT)) {
413+
if (boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT))
414414
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");
420417
break;
421418
case sld_ratelimit:
422419
if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT))

arch/x86/kernel/machine_kexec_64.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,10 +673,7 @@ static void kexec_mark_dm_crypt_keys(bool protect)
673673
if (protect)
674674
set_memory_np((unsigned long)phys_to_virt(start_paddr), nr_pages);
675675
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);
680677
}
681678
}
682679

arch/x86/mm/pat/set_memory.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,19 +2145,6 @@ static inline int cpa_clear_pages_array(struct page **pages, int numpages,
21452145
CPA_PAGES_ARRAY, pages);
21462146
}
21472147

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-
21612148
int _set_memory_uc(unsigned long addr, int numpages)
21622149
{
21632150
/*

arch/x86/mm/tlb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ static void use_global_asid(struct mm_struct *mm)
401401
mm_assign_global_asid(mm, asid);
402402
}
403403

404+
#ifdef CONFIG_BROADCAST_TLB_FLUSH
404405
void mm_free_global_asid(struct mm_struct *mm)
405406
{
406407
if (!cpu_feature_enabled(X86_FEATURE_INVLPGB))
@@ -412,13 +413,12 @@ void mm_free_global_asid(struct mm_struct *mm)
412413
guard(raw_spinlock_irqsave)(&global_asid_lock);
413414

414415
/* The global ASID can be re-used only after flush at wrap-around. */
415-
#ifdef CONFIG_BROADCAST_TLB_FLUSH
416416
__set_bit(mm->context.global_asid, global_asid_freed);
417417

418418
mm->context.global_asid = 0;
419419
global_asid_available++;
420-
#endif
421420
}
421+
#endif
422422

423423
/*
424424
* Is the mm transitioning from a CPU-local ASID to a global ASID?

0 commit comments

Comments
 (0)