Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5469381pxb; Wed, 26 Jan 2022 12:44:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzc4q/kML1Rgng+Z/tAYU2N6oOJ4Ac3kMqYJ1wpEjOI4ILHue7Pz6A/EqJiUnk42oE3WRjp X-Received: by 2002:a62:cf81:: with SMTP id b123mr545277pfg.47.1643229890090; Wed, 26 Jan 2022 12:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643229890; cv=none; d=google.com; s=arc-20160816; b=zi+U0JKKuLEncDXhCvDNDPFOHPWrBXY0SwDSClmsxzew5C7ZLWsROnkTHziCDzxE2/ vtJXG7qB/w40kq+dUC6ie2oNJSRjQ7SOLmASQFclRpiz7LzzRtO3djzWD1+cS3f//zi0 q8csxEztB4jsPKL5PQ7oXOyrLeBed1IVQebeDPzfcgh5Y4GQXnXKK4XTRXnmdbVaocX5 FVsjqTpJIxWg6ejCTsZRAi0rjSjG9PSdxWi02qy4Hzn1U5oR0XqbpyzvGzEHzjqYRZi5 9KXBmLOAyNpRPKPTrop4XY3cE/ITAh4kAwna0wmoHNrYgBOG1BFMzK3mS6WjpYuDKgPb uOiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=4XZv2ZZZNXXLTdMKP3VH9/NhGXtEUEDVBMmpucKIMhQ=; b=PT61nUezdEn6R5/9X1A4JpZqc3XrmCPnzwvztNeXJJhslxkZJUUucELekKtL6fntGN jGrvKEAVf14nyudmFTUxiuXu7fhfQt1cYei1kmy5oTqEeCoJqw0sWwb9F/OCxaOl5mSs AZQ1sJpw0njGz/1nLf1qBxrdwSqS0NcnIq1QVREnrUfLJv/IAWLLrzgJvn+tR2mrEtX7 1aLwilc/Sbvc9O85qi3nb6t5jOpETDXoz71WjvztTeEomsB2Mgv9gVoxCXBRADZX1UzP t01qr4+DPVD4SaBKhdCU41XcQPJSsy223tV9ouK5mGg/90DYVM25MO8tkSvhnefLFT8O l8eQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e68si227482pfe.241.2022.01.26.12.44.36; Wed, 26 Jan 2022 12:44:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239086AbiAZJ0C (ORCPT + 99 others); Wed, 26 Jan 2022 04:26:02 -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: 7BIT Content-Type: text/plain; charset=US-ASCII 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 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