From nobody Tue Jun 30 03:37:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DFAEC2BA4C for ; Wed, 26 Jan 2022 09:26:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239088AbiAZJ0D (ORCPT ); Wed, 26 Jan 2022 04:26:03 -0500 Received: from szxga08-in.huawei.com ([45.249.212.255]:32060 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiAZJ0C (ORCPT ); Wed, 26 Jan 2022 04:26:02 -0500 Received: from kwepemi100012.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4JkJC20RGtz1FD1X; Wed, 26 Jan 2022 17:22:06 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by kwepemi100012.china.huawei.com (7.221.188.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 26 Jan 2022 17:26:00 +0800 Received: from huawei.com (10.175.101.6) by kwepemm600010.china.huawei.com (7.193.23.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 26 Jan 2022 17:25:59 +0800 From: Chao Liu To: , CC: , , , Subject: [PATCH v2] add cpu frequency to cpuinfo in arm64 Date: Wed, 26 Jan 2022 09:23:49 +0000 Message-ID: <20220126092349.285642-1-liuchao173@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600010.china.huawei.com (7.193.23.86) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There is cpu frequency in /proc/cpuinfo in x86 but not in arm64 Signed-off-by: Chao Liu --- 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 #include #include +#include =20 /* * 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 =3D &per_cpu(cpu_data, i); u32 midr =3D cpuinfo->reg_midr; + unsigned int freq =3D cpufreq_quick_get(i); =20 /* * 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); =20 + 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) --=20 2.23.0