From: Chao Liu <liuchao173@huawei.com>
To: <catalin.marinas@arm.com>, <will@kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <hewenliang4@huawei.com>,
<zhoukang7@huawei.com>
Subject: [PATCH v2] add cpu frequency to cpuinfo in arm64
Date: Wed, 26 Jan 2022 09:23:49 +0000 [thread overview]
Message-ID: <20220126092349.285642-1-liuchao173@huawei.com> (raw)
There is cpu frequency in /proc/cpuinfo in x86 but not in arm64
Signed-off-by: Chao Liu <liuchao173@huawei.com>
---
Change in v2:
- fix spelling errors and remove remove redundant blank line
arch/arm64/kernel/cpuinfo.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 591c18a889a5..39a36e6e8079 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -24,6 +24,7 @@
#include <linux/sched.h>
#include <linux/smp.h>
#include <linux/delay.h>
+#include <linux/cpufreq.h>
/*
* In case the boot CPU is hotpluggable, we record its initial state and
@@ -144,6 +145,7 @@ static int c_show(struct seq_file *m, void *v)
for_each_online_cpu(i) {
struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
u32 midr = cpuinfo->reg_midr;
+ unsigned int freq = cpufreq_quick_get(i);
/*
* glibc reads /proc/cpuinfo to determine the number of
@@ -159,6 +161,10 @@ static int c_show(struct seq_file *m, void *v)
loops_per_jiffy / (500000UL/HZ),
loops_per_jiffy / (5000UL/HZ) % 100);
+ if (freq)
+ seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
+ freq / 1000, (freq % 1000));
+
/*
* Dump out the common processor features in a single line.
* Userspace should read the hwcaps with getauxval(AT_HWCAP)
--
2.23.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2022-01-26 9:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 9:23 Chao Liu [this message]
2022-01-26 10:08 ` [PATCH v2] add cpu frequency to cpuinfo in arm64 Sudeep Holla
2022-01-26 12:05 ` Robin Murphy
2022-01-26 12:29 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220126092349.285642-1-liuchao173@huawei.com \
--to=liuchao173@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=hewenliang4@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@kernel.org \
--cc=zhoukang7@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox