diff options
| author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2025-09-13 15:00:48 +0100 | 
|---|---|---|
| committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2025-09-13 15:00:48 +0100 | 
| commit | 421d4487ef2ead206f57a8950ea9bdd1f7a7b39a (patch) | |
| tree | b679546eeaa70f88b5c8d6caeb79e214efb68121 /arch/x86/kernel | |
| parent | 3422b4bc606eee2ba7758ea9347c83332eeec3e3 (diff) | |
| parent | 1b237f190eb3d36f52dffe07a40b5eb210280e00 (diff) | |
Merge tag 'v6.17-rc3' into togreg
Linux 6.17-rc3
Diffstat (limited to 'arch/x86/kernel')
| -rw-r--r-- | arch/x86/kernel/cpu/amd.c | 8 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/bugs.c | 17 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/hygon.c | 3 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/scattered.c | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/fpu/xstate.c | 19 | 
5 files changed, 32 insertions, 16 deletions
| diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index a5ece6ebe8a7..a6f88ca1a6b4 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -1326,8 +1326,8 @@ static const char * const s5_reset_reason_txt[] = {  static __init int print_s5_reset_status_mmio(void)  { -	unsigned long value;  	void __iomem *addr; +	u32 value;  	int i;  	if (!cpu_feature_enabled(X86_FEATURE_ZEN)) @@ -1340,12 +1340,16 @@ static __init int print_s5_reset_status_mmio(void)  	value = ioread32(addr);  	iounmap(addr); +	/* Value with "all bits set" is an error response and should be ignored. */ +	if (value == U32_MAX) +		return 0; +  	for (i = 0; i < ARRAY_SIZE(s5_reset_reason_txt); i++) {  		if (!(value & BIT(i)))  			continue;  		if (s5_reset_reason_txt[i]) { -			pr_info("x86/amd: Previous system reset reason [0x%08lx]: %s\n", +			pr_info("x86/amd: Previous system reset reason [0x%08x]: %s\n",  				value, s5_reset_reason_txt[i]);  		}  	} diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index b74bf937cd9f..49ef1b832c1a 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -386,7 +386,6 @@ static bool __init should_mitigate_vuln(unsigned int bug)  	case X86_BUG_SPECTRE_V2:  	case X86_BUG_RETBLEED: -	case X86_BUG_SRSO:  	case X86_BUG_L1TF:  	case X86_BUG_ITS:  		return cpu_attack_vector_mitigated(CPU_MITIGATE_USER_KERNEL) || @@ -1069,10 +1068,8 @@ static void __init gds_select_mitigation(void)  	if (gds_mitigation == GDS_MITIGATION_AUTO) {  		if (should_mitigate_vuln(X86_BUG_GDS))  			gds_mitigation = GDS_MITIGATION_FULL; -		else { +		else  			gds_mitigation = GDS_MITIGATION_OFF; -			return; -		}  	}  	/* No microcode */ @@ -3184,8 +3181,18 @@ static void __init srso_select_mitigation(void)  	}  	if (srso_mitigation == SRSO_MITIGATION_AUTO) { -		if (should_mitigate_vuln(X86_BUG_SRSO)) { +		/* +		 * Use safe-RET if user->kernel or guest->host protection is +		 * required.  Otherwise the 'microcode' mitigation is sufficient +		 * to protect the user->user and guest->guest vectors. +		 */ +		if (cpu_attack_vector_mitigated(CPU_MITIGATE_GUEST_HOST) || +		    (cpu_attack_vector_mitigated(CPU_MITIGATE_USER_KERNEL) && +		     !boot_cpu_has(X86_FEATURE_SRSO_USER_KERNEL_NO))) {  			srso_mitigation = SRSO_MITIGATION_SAFE_RET; +		} else if (cpu_attack_vector_mitigated(CPU_MITIGATE_USER_USER) || +			   cpu_attack_vector_mitigated(CPU_MITIGATE_GUEST_GUEST)) { +			srso_mitigation = SRSO_MITIGATION_MICROCODE;  		} else {  			srso_mitigation = SRSO_MITIGATION_NONE;  			return; diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c index 2154f12766fb..1fda6c3a2b65 100644 --- a/arch/x86/kernel/cpu/hygon.c +++ b/arch/x86/kernel/cpu/hygon.c @@ -16,6 +16,7 @@  #include <asm/spec-ctrl.h>  #include <asm/delay.h>  #include <asm/msr.h> +#include <asm/resctrl.h>  #include "cpu.h" @@ -117,6 +118,8 @@ static void bsp_init_hygon(struct cpuinfo_x86 *c)  			x86_amd_ls_cfg_ssbd_mask = 1ULL << 10;  		}  	} + +	resctrl_cpu_detect(c);  }  static void early_init_hygon(struct cpuinfo_x86 *c) diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c index b4a1f6732a3a..6b868afb26c3 100644 --- a/arch/x86/kernel/cpu/scattered.c +++ b/arch/x86/kernel/cpu/scattered.c @@ -48,6 +48,7 @@ static const struct cpuid_bit cpuid_bits[] = {  	{ X86_FEATURE_PROC_FEEDBACK,		CPUID_EDX, 11, 0x80000007, 0 },  	{ X86_FEATURE_AMD_FAST_CPPC,		CPUID_EDX, 15, 0x80000007, 0 },  	{ X86_FEATURE_MBA,			CPUID_EBX,  6, 0x80000008, 0 }, +	{ X86_FEATURE_COHERENCY_SFW_NO,		CPUID_EBX, 31, 0x8000001f, 0 },  	{ X86_FEATURE_SMBA,			CPUID_EBX,  2, 0x80000020, 0 },  	{ X86_FEATURE_BMEC,			CPUID_EBX,  3, 0x80000020, 0 },  	{ X86_FEATURE_TSA_SQ_NO,		CPUID_ECX,  1, 0x80000021, 0 }, diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index 12ed75c1b567..28e4fd65c9da 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -1881,19 +1881,20 @@ long fpu_xstate_prctl(int option, unsigned long arg2)  #ifdef CONFIG_PROC_PID_ARCH_STATUS  /*   * Report the amount of time elapsed in millisecond since last AVX512 - * use in the task. + * use in the task. Report -1 if no AVX-512 usage.   */  static void avx512_status(struct seq_file *m, struct task_struct *task)  { -	unsigned long timestamp = READ_ONCE(x86_task_fpu(task)->avx512_timestamp); -	long delta; +	unsigned long timestamp; +	long delta = -1; -	if (!timestamp) { -		/* -		 * Report -1 if no AVX512 usage -		 */ -		delta = -1; -	} else { +	/* AVX-512 usage is not tracked for kernel threads. Don't report anything. */ +	if (task->flags & (PF_KTHREAD | PF_USER_WORKER)) +		return; + +	timestamp = READ_ONCE(x86_task_fpu(task)->avx512_timestamp); + +	if (timestamp) {  		delta = (long)(jiffies - timestamp);  		/*  		 * Cap to LONG_MAX if time difference > LONG_MAX | 
