diff options
Diffstat (limited to 'arch/x86/kernel/cpu')
34 files changed, 137 insertions, 119 deletions
| diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index e17942c131c8..236999c54edc 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0  #  # Makefile for x86-compatible CPU details, features and quirks  # @@ -21,7 +22,7 @@ obj-y			+= common.o  obj-y			+= rdrand.o  obj-y			+= match.o  obj-y			+= bugs.o -obj-$(CONFIG_CPU_FREQ)	+= aperfmperf.o +obj-y			+= aperfmperf.o  obj-$(CONFIG_PROC_FS)	+= proc.o  obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 9862e2cd6d93..d58184b7cd44 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -763,6 +763,16 @@ static void init_amd_bd(struct cpuinfo_x86 *c)  	}  } +static void init_amd_zn(struct cpuinfo_x86 *c) +{ +	/* +	 * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects +	 * all up to and including B1. +	 */ +	if (c->x86_model <= 1 && c->x86_mask <= 1) +		set_cpu_cap(c, X86_FEATURE_CPB); +} +  static void init_amd(struct cpuinfo_x86 *c)  {  	early_init_amd(c); @@ -791,6 +801,7 @@ static void init_amd(struct cpuinfo_x86 *c)  	case 0x10: init_amd_gh(c); break;  	case 0x12: init_amd_ln(c); break;  	case 0x15: init_amd_bd(c); break; +	case 0x17: init_amd_zn(c); break;  	}  	/* Enable workaround for FXSAVE leak */ diff --git a/arch/x86/kernel/cpu/aperfmperf.c b/arch/x86/kernel/cpu/aperfmperf.c index 0ee83321a313..957813e0180d 100644 --- a/arch/x86/kernel/cpu/aperfmperf.c +++ b/arch/x86/kernel/cpu/aperfmperf.c @@ -42,10 +42,6 @@ static void aperfmperf_snapshot_khz(void *dummy)  	s64 time_delta = ktime_ms_delta(now, s->time);  	unsigned long flags; -	/* Don't bother re-computing within the cache threshold time. */ -	if (time_delta < APERFMPERF_CACHE_THRESHOLD_MS) -		return; -  	local_irq_save(flags);  	rdmsrl(MSR_IA32_APERF, aperf);  	rdmsrl(MSR_IA32_MPERF, mperf); @@ -74,6 +70,7 @@ static void aperfmperf_snapshot_khz(void *dummy)  unsigned int arch_freq_get_on_cpu(int cpu)  { +	s64 time_delta;  	unsigned int khz;  	if (!cpu_khz) @@ -82,6 +79,12 @@ unsigned int arch_freq_get_on_cpu(int cpu)  	if (!static_cpu_has(X86_FEATURE_APERFMPERF))  		return 0; +	/* Don't bother re-computing within the cache threshold time. */ +	time_delta = ktime_ms_delta(ktime_get(), per_cpu(samples.time, cpu)); +	khz = per_cpu(samples.khz, cpu); +	if (khz && time_delta < APERFMPERF_CACHE_THRESHOLD_MS) +		return khz; +  	smp_call_function_single(cpu, aperfmperf_snapshot_khz, NULL, 1);  	khz = per_cpu(samples.khz, cpu);  	if (khz) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index db684880d74a..ba0b2424c9b0 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   *  Copyright (C) 1994  Linus Torvalds   * @@ -21,14 +22,6 @@  void __init check_bugs(void)  { -#ifdef CONFIG_X86_32 -	/* -	 * Regardless of whether PCID is enumerated, the SDM says -	 * that it can't be enabled in 32-bit mode. -	 */ -	setup_clear_cpu_cap(X86_FEATURE_PCID); -#endif -  	identify_boot_cpu();  	if (!IS_ENABLED(CONFIG_SMP)) { diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c index 44207b71fee1..68bc6d9b3132 100644 --- a/arch/x86/kernel/cpu/centaur.c +++ b/arch/x86/kernel/cpu/centaur.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #include <linux/sched.h>  #include <linux/sched/clock.h> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 775f10100d7f..c9176bae7fd8 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -904,6 +904,14 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)  	setup_force_cpu_cap(X86_FEATURE_ALWAYS);  	fpu__init_system(c); + +#ifdef CONFIG_X86_32 +	/* +	 * Regardless of whether PCID is enumerated, the SDM says +	 * that it can't be enabled in 32-bit mode. +	 */ +	setup_clear_cpu_cap(X86_FEATURE_PCID); +#endif  }  void __init early_cpu_init(void) diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h index 2584265d4745..f52a370b6c00 100644 --- a/arch/x86/kernel/cpu/cpu.h +++ b/arch/x86/kernel/cpu/cpu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef ARCH_X86_CPU_H  #define ARCH_X86_CPU_H diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c index 6f077445647a..6b4bb335641f 100644 --- a/arch/x86/kernel/cpu/cyrix.c +++ b/arch/x86/kernel/cpu/cyrix.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #include <linux/bitops.h>  #include <linux/delay.h>  #include <linux/pci.h> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index dfa90a3a5145..b720dacac051 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #include <linux/kernel.h>  #include <linux/string.h> diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index 24f749324c0f..54d04d574148 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   *	Routines to identify caches on Intel CPU.   * @@ -831,7 +832,6 @@ static int __cache_amd_cpumap_setup(unsigned int cpu, int index,  	} else if (boot_cpu_has(X86_FEATURE_TOPOEXT)) {  		unsigned int apicid, nshared, first, last; -		this_leaf = this_cpu_ci->info_list + index;  		nshared = base->eax.split.num_threads_sharing + 1;  		apicid = cpu_data(cpu).apicid;  		first = apicid - (apicid % nshared); diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h index ebaddaeef023..a43a72d8e88e 100644 --- a/arch/x86/kernel/cpu/intel_rdt.h +++ b/arch/x86/kernel/cpu/intel_rdt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  #ifndef _ASM_X86_INTEL_RDT_H  #define _ASM_X86_INTEL_RDT_H diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c index e42117d5f4d7..3fed38812eea 100644 --- a/arch/x86/kernel/cpu/match.c +++ b/arch/x86/kernel/cpu/match.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #include <asm/cpu_device_id.h>  #include <asm/cpufeature.h>  #include <linux/cpu.h> diff --git a/arch/x86/kernel/cpu/mcheck/Makefile b/arch/x86/kernel/cpu/mcheck/Makefile index 43051f0777d4..bcc7c54c7041 100644 --- a/arch/x86/kernel/cpu/mcheck/Makefile +++ b/arch/x86/kernel/cpu/mcheck/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0  obj-y				=  mce.o mce-severity.o mce-genpool.o  obj-$(CONFIG_X86_ANCIENT_MCE)	+= winchip.o p5.o diff --git a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c index 10cec43aac38..7f85b76f43bc 100644 --- a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c +++ b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c @@ -24,14 +24,6 @@ static DEFINE_MUTEX(mce_chrdev_read_mutex);  static char mce_helper[128];  static char *mce_helper_argv[2] = { mce_helper, NULL }; -#define mce_log_get_idx_check(p) \ -({ \ -	RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held() && \ -			 !lockdep_is_held(&mce_chrdev_read_mutex), \ -			 "suspicious mce_log_get_idx_check() usage"); \ -	smp_load_acquire(&(p)); \ -}) -  /*   * Lockless MCE logging infrastructure.   * This avoids deadlocks on printk locks without having to break locks. Also @@ -53,43 +45,32 @@ static int dev_mce_log(struct notifier_block *nb, unsigned long val,  				void *data)  {  	struct mce *mce = (struct mce *)data; -	unsigned int next, entry; - -	wmb(); -	for (;;) { -		entry = mce_log_get_idx_check(mcelog.next); -		for (;;) { - -			/* -			 * When the buffer fills up discard new entries. -			 * Assume that the earlier errors are the more -			 * interesting ones: -			 */ -			if (entry >= MCE_LOG_LEN) { -				set_bit(MCE_OVERFLOW, -					(unsigned long *)&mcelog.flags); -				return NOTIFY_OK; -			} -			/* Old left over entry. Skip: */ -			if (mcelog.entry[entry].finished) { -				entry++; -				continue; -			} -			break; -		} -		smp_rmb(); -		next = entry + 1; -		if (cmpxchg(&mcelog.next, entry, next) == entry) -			break; +	unsigned int entry; + +	mutex_lock(&mce_chrdev_read_mutex); + +	entry = mcelog.next; + +	/* +	 * When the buffer fills up discard new entries. Assume that the +	 * earlier errors are the more interesting ones: +	 */ +	if (entry >= MCE_LOG_LEN) { +		set_bit(MCE_OVERFLOW, (unsigned long *)&mcelog.flags); +		goto unlock;  	} + +	mcelog.next = entry + 1; +  	memcpy(mcelog.entry + entry, mce, sizeof(struct mce)); -	wmb();  	mcelog.entry[entry].finished = 1; -	wmb();  	/* wake processes polling /dev/mcelog */  	wake_up_interruptible(&mce_chrdev_wait); +unlock: +	mutex_unlock(&mce_chrdev_read_mutex); +  	return NOTIFY_OK;  } @@ -177,13 +158,6 @@ static int mce_chrdev_release(struct inode *inode, struct file *file)  	return 0;  } -static void collect_tscs(void *data) -{ -	unsigned long *cpu_tsc = (unsigned long *)data; - -	cpu_tsc[smp_processor_id()] = rdtsc(); -} -  static int mce_apei_read_done;  /* Collect MCE record of previous boot in persistent storage via APEI ERST. */ @@ -231,14 +205,9 @@ static ssize_t mce_chrdev_read(struct file *filp, char __user *ubuf,  				size_t usize, loff_t *off)  {  	char __user *buf = ubuf; -	unsigned long *cpu_tsc; -	unsigned prev, next; +	unsigned next;  	int i, err; -	cpu_tsc = kmalloc(nr_cpu_ids * sizeof(long), GFP_KERNEL); -	if (!cpu_tsc) -		return -ENOMEM; -  	mutex_lock(&mce_chrdev_read_mutex);  	if (!mce_apei_read_done) { @@ -247,65 +216,29 @@ static ssize_t mce_chrdev_read(struct file *filp, char __user *ubuf,  			goto out;  	} -	next = mce_log_get_idx_check(mcelog.next); -  	/* Only supports full reads right now */  	err = -EINVAL;  	if (*off != 0 || usize < MCE_LOG_LEN*sizeof(struct mce))  		goto out; +	next = mcelog.next;  	err = 0; -	prev = 0; -	do { -		for (i = prev; i < next; i++) { -			unsigned long start = jiffies; -			struct mce *m = &mcelog.entry[i]; - -			while (!m->finished) { -				if (time_after_eq(jiffies, start + 2)) { -					memset(m, 0, sizeof(*m)); -					goto timeout; -				} -				cpu_relax(); -			} -			smp_rmb(); -			err |= copy_to_user(buf, m, sizeof(*m)); -			buf += sizeof(*m); -timeout: -			; -		} - -		memset(mcelog.entry + prev, 0, -		       (next - prev) * sizeof(struct mce)); -		prev = next; -		next = cmpxchg(&mcelog.next, prev, 0); -	} while (next != prev); - -	synchronize_sched(); -	/* -	 * Collect entries that were still getting written before the -	 * synchronize. -	 */ -	on_each_cpu(collect_tscs, cpu_tsc, 1); - -	for (i = next; i < MCE_LOG_LEN; i++) { +	for (i = 0; i < next; i++) {  		struct mce *m = &mcelog.entry[i]; -		if (m->finished && m->tsc < cpu_tsc[m->cpu]) { -			err |= copy_to_user(buf, m, sizeof(*m)); -			smp_rmb(); -			buf += sizeof(*m); -			memset(m, 0, sizeof(*m)); -		} +		err |= copy_to_user(buf, m, sizeof(*m)); +		buf += sizeof(*m);  	} +	memset(mcelog.entry, 0, next * sizeof(struct mce)); +	mcelog.next = 0; +  	if (err)  		err = -EFAULT;  out:  	mutex_unlock(&mce_chrdev_read_mutex); -	kfree(cpu_tsc);  	return err ? err : buf - ubuf;  } diff --git a/arch/x86/kernel/cpu/mcheck/mce-internal.h b/arch/x86/kernel/cpu/mcheck/mce-internal.h index 098530a93bb7..aa0d5df9dc60 100644 --- a/arch/x86/kernel/cpu/mcheck/mce-internal.h +++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h @@ -1,3 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __X86_MCE_INTERNAL_H__ +#define __X86_MCE_INTERNAL_H__ +  #include <linux/device.h>  #include <asm/mce.h> @@ -108,3 +112,7 @@ static inline void mce_work_trigger(void)	{ }  static inline void mce_register_injector_chain(struct notifier_block *nb)	{ }  static inline void mce_unregister_injector_chain(struct notifier_block *nb)	{ }  #endif + +extern struct mca_config mca_cfg; + +#endif /* __X86_MCE_INTERNAL_H__ */ diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index 40e28ed77fbf..486f640b02ef 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c @@ -28,6 +28,8 @@  #include <asm/msr.h>  #include <asm/trace/irq_vectors.h> +#include "mce-internal.h" +  #define NR_BLOCKS         5  #define THRESHOLD_MAX     0xFFF  #define INT_TYPE_APIC     0x00020000 diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c index e84db79ef272..d05be307d081 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_intel.c +++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Intel specific MCE features.   * Copyright 2004 Zwane Mwaikambo <[email protected]> diff --git a/arch/x86/kernel/cpu/mcheck/p5.c b/arch/x86/kernel/cpu/mcheck/p5.c index 2a0717bf8033..5cddf831720f 100644 --- a/arch/x86/kernel/cpu/mcheck/p5.c +++ b/arch/x86/kernel/cpu/mcheck/p5.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * P5 specific Machine Check Exception Reporting   * (C) Copyright 2002 Alan Cox <[email protected]> diff --git a/arch/x86/kernel/cpu/mcheck/threshold.c b/arch/x86/kernel/cpu/mcheck/threshold.c index 5e7249e42f8f..2b584b319eff 100644 --- a/arch/x86/kernel/cpu/mcheck/threshold.c +++ b/arch/x86/kernel/cpu/mcheck/threshold.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Common corrected MCE threshold handler code:   */ diff --git a/arch/x86/kernel/cpu/mcheck/winchip.c b/arch/x86/kernel/cpu/mcheck/winchip.c index c6a722e1d011..3b45b270a865 100644 --- a/arch/x86/kernel/cpu/mcheck/winchip.c +++ b/arch/x86/kernel/cpu/mcheck/winchip.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * IDT Winchip specific Machine Check Exception Reporting   * (C) Copyright 2002 Alan Cox <[email protected]> diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 86e8f0b2537b..c4fa4a85d4cb 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -122,9 +122,6 @@ static bool __init check_loader_disabled_bsp(void)  	bool *res = &dis_ucode_ldr;  #endif -	if (!have_cpuid_p()) -		return *res; -  	/*  	 * CPUID(1).ECX[31]: reserved for hypervisor use. This is still not  	 * completely accurate as xen pv guests don't see that CPUID bit set but @@ -166,24 +163,36 @@ bool get_builtin_firmware(struct cpio_data *cd, const char *name)  void __init load_ucode_bsp(void)  {  	unsigned int cpuid_1_eax; +	bool intel = true; -	if (check_loader_disabled_bsp()) +	if (!have_cpuid_p())  		return;  	cpuid_1_eax = native_cpuid_eax(1);  	switch (x86_cpuid_vendor()) {  	case X86_VENDOR_INTEL: -		if (x86_family(cpuid_1_eax) >= 6) -			load_ucode_intel_bsp(); +		if (x86_family(cpuid_1_eax) < 6) +			return;  		break; +  	case X86_VENDOR_AMD: -		if (x86_family(cpuid_1_eax) >= 0x10) -			load_ucode_amd_bsp(cpuid_1_eax); +		if (x86_family(cpuid_1_eax) < 0x10) +			return; +		intel = false;  		break; +  	default: -		break; +		return;  	} + +	if (check_loader_disabled_bsp()) +		return; + +	if (intel) +		load_ucode_intel_bsp(); +	else +		load_ucode_amd_bsp(cpuid_1_eax);  }  static bool check_loader_disabled_ap(void) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 8f7a9bbad514..7dbcb7adf797 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -34,6 +34,7 @@  #include <linux/mm.h>  #include <asm/microcode_intel.h> +#include <asm/intel-family.h>  #include <asm/processor.h>  #include <asm/tlbflush.h>  #include <asm/setup.h> @@ -918,6 +919,18 @@ static int get_ucode_fw(void *to, const void *from, size_t n)  	return 0;  } +static bool is_blacklisted(unsigned int cpu) +{ +	struct cpuinfo_x86 *c = &cpu_data(cpu); + +	if (c->x86 == 6 && c->x86_model == INTEL_FAM6_BROADWELL_X) { +		pr_err_once("late loading on model 79 is disabled.\n"); +		return true; +	} + +	return false; +} +  static enum ucode_state request_microcode_fw(int cpu, struct device *device,  					     bool refresh_fw)  { @@ -926,6 +939,9 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device,  	const struct firmware *firmware;  	enum ucode_state ret; +	if (is_blacklisted(cpu)) +		return UCODE_NFOUND; +  	sprintf(name, "intel-ucode/%02x-%02x-%02x",  		c->x86, c->x86_model, c->x86_mask); @@ -950,6 +966,9 @@ static int get_ucode_user(void *to, const void *from, size_t n)  static enum ucode_state  request_microcode_user(int cpu, const void __user *buf, size_t size)  { +	if (is_blacklisted(cpu)) +		return UCODE_NFOUND; +  	return generic_load_microcode(cpu, (void *)buf, size, &get_ucode_user);  } diff --git a/arch/x86/kernel/cpu/mkcapflags.sh b/arch/x86/kernel/cpu/mkcapflags.sh index 6988c74409a8..d0dfb892c72f 100644 --- a/arch/x86/kernel/cpu/mkcapflags.sh +++ b/arch/x86/kernel/cpu/mkcapflags.sh @@ -1,4 +1,5 @@  #!/bin/sh +# SPDX-License-Identifier: GPL-2.0  #  # Generate the x86_cap/bug_flags[] arrays from include/asm/cpufeatures.h  # diff --git a/arch/x86/kernel/cpu/mtrr/amd.c b/arch/x86/kernel/cpu/mtrr/amd.c index 92ba9cd31c9a..a65a0272096d 100644 --- a/arch/x86/kernel/cpu/mtrr/amd.c +++ b/arch/x86/kernel/cpu/mtrr/amd.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #include <linux/init.h>  #include <linux/mm.h>  #include <asm/mtrr.h> diff --git a/arch/x86/kernel/cpu/mtrr/centaur.c b/arch/x86/kernel/cpu/mtrr/centaur.c index 3d689937fc1b..f27177816569 100644 --- a/arch/x86/kernel/cpu/mtrr/centaur.c +++ b/arch/x86/kernel/cpu/mtrr/centaur.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #include <linux/init.h>  #include <linux/mm.h> diff --git a/arch/x86/kernel/cpu/mtrr/cyrix.c b/arch/x86/kernel/cpu/mtrr/cyrix.c index b1086f79e57e..4296c702a3f7 100644 --- a/arch/x86/kernel/cpu/mtrr/cyrix.c +++ b/arch/x86/kernel/cpu/mtrr/cyrix.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #include <linux/init.h>  #include <linux/io.h>  #include <linux/mm.h> diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c index 6d9b45549109..558444b23923 100644 --- a/arch/x86/kernel/cpu/mtrr/if.c +++ b/arch/x86/kernel/cpu/mtrr/if.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #include <linux/capability.h>  #include <linux/seq_file.h>  #include <linux/uaccess.h> diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.h b/arch/x86/kernel/cpu/mtrr/mtrr.h index ad8bd763efa5..2ac99e561181 100644 --- a/arch/x86/kernel/cpu/mtrr/mtrr.h +++ b/arch/x86/kernel/cpu/mtrr/mtrr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */  /*   * local MTRR defines.   */ diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c index 181eabecae25..d389083330c5 100644 --- a/arch/x86/kernel/cpu/perfctr-watchdog.c +++ b/arch/x86/kernel/cpu/perfctr-watchdog.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * local apic based NMI watchdog for various CPUs.   * diff --git a/arch/x86/kernel/cpu/powerflags.c b/arch/x86/kernel/cpu/powerflags.c index 1dd8294fd730..fd6ec2aa0303 100644 --- a/arch/x86/kernel/cpu/powerflags.c +++ b/arch/x86/kernel/cpu/powerflags.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Strings for the various x86 power flags   * diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index 218f79825b3c..4378a729b933 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c @@ -1,7 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0  #include <linux/smp.h>  #include <linux/timex.h>  #include <linux/string.h>  #include <linux/seq_file.h> +#include <linux/cpufreq.h>  /*   *	Get CPU information for use by the procfs. @@ -75,9 +77,16 @@ static int show_cpuinfo(struct seq_file *m, void *v)  	if (c->microcode)  		seq_printf(m, "microcode\t: 0x%x\n", c->microcode); -	if (cpu_has(c, X86_FEATURE_TSC)) +	if (cpu_has(c, X86_FEATURE_TSC)) { +		unsigned int freq = arch_freq_get_on_cpu(cpu); + +		if (!freq) +			freq = cpufreq_quick_get(cpu); +		if (!freq) +			freq = cpu_khz;  		seq_printf(m, "cpu MHz\t\t: %u.%03u\n", -			   cpu_khz / 1000, (cpu_khz % 1000)); +			   freq / 1000, (freq % 1000)); +	}  	/* Cache size */  	if (c->x86_cache_size >= 0) diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c index cd531355e838..b099024d339c 100644 --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Check for extended topology enumeration cpuid leaf 0xb and if it   * exists, use it for populating initial_apicid and cpu topology diff --git a/arch/x86/kernel/cpu/transmeta.c b/arch/x86/kernel/cpu/transmeta.c index d77d07ab310b..42c939827621 100644 --- a/arch/x86/kernel/cpu/transmeta.c +++ b/arch/x86/kernel/cpu/transmeta.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #include <linux/kernel.h>  #include <linux/sched.h>  #include <linux/sched/clock.h> diff --git a/arch/x86/kernel/cpu/umc.c b/arch/x86/kernel/cpu/umc.c index ef9c2a0078bd..65a58a390fc3 100644 --- a/arch/x86/kernel/cpu/umc.c +++ b/arch/x86/kernel/cpu/umc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0  #include <linux/kernel.h>  #include <asm/processor.h>  #include "cpu.h" |