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 X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6A70C432C3 for ; Tue, 19 Jan 2021 12:42:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5F9323121 for ; Tue, 19 Jan 2021 12:42:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393266AbhASMk3 (ORCPT ); Tue, 19 Jan 2021 07:40:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:40874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393150AbhASMdY (ORCPT ); Tue, 19 Jan 2021 07:33:24 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 979EE22D2A; Tue, 19 Jan 2021 12:32:40 +0000 (UTC) Date: Tue, 19 Jan 2021 12:32:38 +0000 From: Catalin Marinas To: =?utf-8?B?5Lmx55+z?= Cc: Will Deacon , Anshuman Khandual , Suzuki K Poulose , Mark Brown , gustavoars@kernel.org, Vincenzo Frascino , Dave Martin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64/cpuinfo: Show right CPU architecture information Message-ID: <20210119123237.GA17369@gaia> References: <20210119105510.27836-1-zhangliguang@linux.alibaba.com> <20210119110131.GA18433@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 19, 2021 at 07:26:31PM +0800, 乱石 wrote: > 锟斤拷 2021/1/19 19:01, Will Deacon 写锟斤拷: > > On Tue, Jan 19, 2021 at 06:55:10PM +0800, Liguang Zhang wrote: > > > CPU architecture is assigned to be a fixed value, it should be obtained > > > from midr register. > > > > > > Signed-off-by: Liguang Zhang > > > --- > > > arch/arm64/kernel/cpuinfo.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c > > > index 77605aec25fe..0bd11e0fe9f2 100644 > > > --- a/arch/arm64/kernel/cpuinfo.c > > > +++ b/arch/arm64/kernel/cpuinfo.c > > > @@ -191,7 +191,7 @@ static int c_show(struct seq_file *m, void *v) > > > seq_printf(m, "CPU implementer\t: 0x%02x\n", > > > MIDR_IMPLEMENTOR(midr)); > > > - seq_printf(m, "CPU architecture: 8\n"); > > > + seq_printf(m, "CPU architecture: %d\n", MIDR_ARCHITECTURE(midr)); > > Huh? Won't this always return 0xf? > > Hi Will, > > I'm not sure. My platform return 0xf, but /proc/cpuinfo show 8. Why we > assign a fixed > > value to cpu architecture? Because 0xf first appeared on some ARMv6 CPUs (1176, 11MPcore and some newer revisions of 1136). A field value of 0xf means don't bother with architecture version but rather check the CPUID information for the features you need. We decided to call it 8 here with 64-bit as that was announced as ARMv8. A 32-bit kernel running on ARMv8 hardware would report 7 (as it would on some ARMv6 hardware like 1176 etc.) -- Catalin