aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/x86/kernel/cpu/proc.c
diff options
context:
space:
mode:
authorBeata Michalska <beata.michalska@arm.com>2025-01-31 16:24:36 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2025-02-17 18:09:20 +0000
commit38e480d4fcac2e191e2f24f381aa8957865c49b2 (patch)
tree3576ed5a036e86f398d97dae82dc0847291d6b76 /arch/x86/kernel/cpu/proc.c
parentarch_topology: init capacity_freq_ref to 0 (diff)
downloadwireguard-linux-38e480d4fcac2e191e2f24f381aa8957865c49b2.tar.xz
wireguard-linux-38e480d4fcac2e191e2f24f381aa8957865c49b2.zip
cpufreq: Allow arch_freq_get_on_cpu to return an error
Allow arch_freq_get_on_cpu to return an error for cases when retrieving current CPU frequency is not possible, whether that being due to lack of required arch support or due to other circumstances when the current frequency cannot be determined at given point of time. Signed-off-by: Beata Michalska <beata.michalska@arm.com> Reviewed-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Link: https://lore.kernel.org/r/20250131162439.3843071-2-beata.michalska@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/x86/kernel/cpu/proc.c')
-rw-r--r--arch/x86/kernel/cpu/proc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 41ed01f46bd9..6571d432cbe3 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -86,9 +86,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_printf(m, "microcode\t: 0x%x\n", c->microcode);
if (cpu_has(c, X86_FEATURE_TSC)) {
- unsigned int freq = arch_freq_get_on_cpu(cpu);
+ int freq = arch_freq_get_on_cpu(cpu);
- seq_printf(m, "cpu MHz\t\t: %u.%03u\n", freq / 1000, (freq % 1000));
+ if (freq < 0)
+ seq_puts(m, "cpu MHz\t\t: Unknown\n");
+ else
+ seq_printf(m, "cpu MHz\t\t: %u.%03u\n", freq / 1000, (freq % 1000));
}
/* Cache size */