From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5DABC2BA4C for ; Wed, 26 Jan 2022 09:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=LlAPRnw8FDrI1vIpzPDb4tlcQLi91Dw39t+DBpbglSw=; b=F4ta6LVsyWvmQw ZZ8ysLDYlS+W215GKyehdOLj0vr2vuqrDz0m79MBG2C+Gd0OD/nolxnFWRaqkLPH+J/gX8wQusx3F OZRYdcknCCnRZJf/lu9J7NPVR5XCqZTWQNZQnGCLCxaDoHV+RhQ5/QinZRfZJ7gC+wMbcgQgO8U7D 6Pwm8rd3HCaWOltFbkpKnO1Es30vWTfnlsU2YRsq9BxODZ1nw9A7y7fvngpTQkJ5f9AbjIl1ETYtF kiLn1Q0189Q+3J5whkgLMbwsUGR+Ps5fwi733JdChp8N/zYUtY6jfXLnG0EFl27Rn0WNrUA/lt9Ii r7Ea8uoycB1RuziuxiDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCebu-00AyIq-Uo; Wed, 26 Jan 2022 09:29:03 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCeZ4-00AxMS-If for linux-arm-kernel@lists.infradead.org; Wed, 26 Jan 2022 09:26:08 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220126_012606_857178_2A44D7BF X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 /* * 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