Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5487729pxb; Wed, 26 Jan 2022 13:12:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzT0rWo/yMiPRv3XZh+uCYQwDbx8aRVZKAM3Cou87AskPI1JegEq+HUXnGpdYTqqSCdG0e+ X-Received: by 2002:a17:902:db01:: with SMTP id m1mr503052plx.25.1643231550889; Wed, 26 Jan 2022 13:12:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643231550; cv=none; d=google.com; s=arc-20160816; b=WNOr7MfrPf+/EaIsJX/Tr44hXcDo5bIl0UhdvgxcOY0ABEB2MoLkY/AiY/oYGqJ2kn WvTjvvUzvKpwJoIZdE36MW1tHci3Qg4PcAT244eFut8yTbPbJGdqZZwdm9SRGdqq9xIx vnrEXa0XLOJY/0n4dfQoXA6Hk75yoOVw6KcJV3PowLrIXbYNkW1lBRk6IEkyF/2nADfp lny8sKy91I5YosM47nKyoEYfhWhHuGWDtkZmrS4ZGaCAqCJjHQMZpwnqvb/D37E6Satv mxobml17A9BOZi0uyfDvUEJL5MJ6TurOnbStMqi/fctikZgXEGdkSjgER07C21dFgsFA kXJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=jtefo0JMVX/OoATAPwGck3nOfv3jdPjdW/RhtcdjCjI=; b=nF716cFxFs/qksh3U6eNqtHtpTySqO+gsWA2cfWP03ro54wA7qZy7veZLqMMEZA1qJ oV+poS6gegQhOKc8e3JWBzcXef0Hg+kU1xfX+YHLGH6PTZ7CHJT0w0FVeliJdDJKMJ7Y 4LFiIFF1SYK0I/Vc2aWdY20KpLrGsO3dTuICJMh1DpXhQg9XFZ52lUMOcNvgHwsWKR1T eDt2bnNRZzAgwzK6ki1CxlWhQp46OKPPrN4RcpP97phEl5xd/AgRDzou/y5WV+JIRS2V tgcLsxCnL2bb/PRBVpnsiXMWcZ6zxJrjfZUmylD1Ac+TPXs8opCbRlc8IGPTB5/7vI4n CKJw== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p1si313254plf.509.2022.01.26.13.12.18; Wed, 26 Jan 2022 13:12:30 -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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241052AbiAZMF3 (ORCPT + 99 others); Wed, 26 Jan 2022 07:05:29 -0500 Received: from foss.arm.com ([217.140.110.172]:35170 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233883AbiAZMF3 (ORCPT ); Wed, 26 Jan 2022 07:05:29 -0500 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> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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)