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 77C7DC28CF5 for ; Wed, 26 Jan 2022 12:06:55 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GPJ/cb8gjxHZ3Qy5WBlIr9vCzCNPB/Cq3dUyyNCxfdg=; b=lCi6HqvyAtgqBU JvDN4esEy3SupPoWzVzpdbIhTcVmbQbrE6f2OwBJKIoSBP6dIhQ6NyFiF4v6OeksCn1JZcMfaURfs H+X+GB+/PtXgta79Il2QPTA+HqMSReg9CIL4lY5M/4+IIfSW93OtykG/b9/fch7jhr3Cy7wWfOM6m BA3iJbQX+3G4AjqB8+M9bLkTuG/SMC4nwef3Wn0fSex8Y0ohTQXcM597bGTUI39IeGB919gjyhCDZ YHiy0F7xRwGYM+vAaIzSLm0EIQfMcceEpapGtv2KiDEa+witJrm8YfTwv3QsCUZvTqdK7ySaRcYyG OBf63yILBALz1JzsHkgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCh3N-00BdnH-Rg; Wed, 26 Jan 2022 12:05:33 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCh3K-00BdmS-4u for linux-arm-kernel@lists.infradead.org; Wed, 26 Jan 2022 12:05:31 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B5C3BD6E; Wed, 26 Jan 2022 04:05:28 -0800 (PST) Received: from [10.57.68.47] (unknown [10.57.68.47]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 843A73F793; Wed, 26 Jan 2022 04:05:27 -0800 (PST) Message-ID: Date: Wed, 26 Jan 2022 12:05:22 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v2] add cpu frequency to cpuinfo in arm64 Content-Language: en-GB To: Chao Liu , 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 References: <20220126092349.285642-1-liuchao173@huawei.com> From: Robin Murphy In-Reply-To: <20220126092349.285642-1-liuchao173@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220126_040530_276761_AEE526AD X-CRM114-Status: GOOD ( 15.88 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-01-26 09:23, Chao Liu wrote: > There is cpu frequency in /proc/cpuinfo in x86 but not in arm64 arm64 cpuinfo also doesn't show the APIC ID or microcode version. Different architectures are different. Besides, x86 cpuinfo only shows MHz if the CPU has X86_FEATURE_TSC, so for compatibility we should only do this on AArch64 CPUs which have X86_FEATURE_TSC. Robin. > 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) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel