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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 4684DC433ED for ; Thu, 15 Apr 2021 20:10:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF0C2610F7 for ; Thu, 15 Apr 2021 20:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235314AbhDOULR (ORCPT ); Thu, 15 Apr 2021 16:11:17 -0400 Received: from foss.arm.com ([217.140.110.172]:53988 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234654AbhDOULP (ORCPT ); Thu, 15 Apr 2021 16:11:15 -0400 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 46EEF11B3; Thu, 15 Apr 2021 13:10:51 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 29A103FA35; Thu, 15 Apr 2021 13:10:48 -0700 (PDT) Subject: Re: [PATCH v2 0/1] arm: topology: parse the topology from the dt To: Valentin Schneider , Ruifeng Zhang , linux@armlinux.org.uk, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, a.p.zijlstra@chello.nl, mingo@kernel.org, ruifeng.zhang1@unisoc.com, nianfu.bai@unisoc.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20210414122326.5255-1-ruifeng.zhang0110@gmail.com> <8735vrmnc7.mognet@arm.com> From: Dietmar Eggemann Message-ID: Date: Thu, 15 Apr 2021 22:10:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <8735vrmnc7.mognet@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/04/2021 20:09, Valentin Schneider wrote: > On 14/04/21 20:23, Ruifeng Zhang wrote: >> From: Ruifeng Zhang >> >> In Unisoc, the sc9863a SoC which using cortex-a55, it has two software >> version, one of them is the kernel running on EL1 using aarch32. >> user(EL0) kernel(EL1) >> sc9863a_go aarch32 aarch32 >> sc9863a aarch64 aarch64 >> >> When kernel runs on EL1 using aarch32, the topology will parse wrong. >> For example, >> The MPIDR has been written to the chip register in armv8.2 format. >> For example, >> core0: 0000000080000000 >> core1: 0000000080000100 >> core2: 0000000080000200 >> ... >> >> It will parse to: >> | | aff2 | packageid | coreid | >> |-------+------+-----------+--------| >> | Core0 | 0 | 0 | 0 | >> | Core1 | 0 | 1 | 0 | >> | Core2 | 0 | 2 | 0 | >> | ... | | | | >> >> The wrong topology is that all of the coreid are 0 and unexpected >> packageid. >> >> The reason is the MPIDR format is different between armv7 and armv8.2. >> armv7 (A7) mpidr is: >> [11:8] [7:2] [1:0] >> cluster reserved cpu >> The cortex-a7 spec DDI0464F 4.3.5 >> https://developer.arm.com/documentation/ddi0464/f/?lang=en >> >> armv8.2 (A55) mpidr is: >> [23:16] [15:8] [7:0] >> cluster cpu thread >> > > What I had understood from our conversation was that there *isn't* a format > difference (at least for the bottom 32 bits) - arm64/kernel/topopology.c > would parse it the same, except that MPIDR parsing has been deprecated for > arm64. > > The problem is that those MPIDR values don't match the actual topology. If > they had the MT bit set, i.e. > > core0: 0000000081000000 > core1: 0000000081000100 > core2: 0000000081000200 > > then it would be parsed as: > > | | package_id | core_id | thread_id | > |-------+------------+---------+-----------| > | Core0 | 0 | 0 | 0 | > | Core1 | 0 | 1 | 0 | > | Core2 | 0 | 2 | 0 | > > which would make more sense (wrt the actual, physical topology). ... and this would be in sync with https://developer.arm.com/documentation/100442/0200/register-descriptions/aarch32-system-registers/mpidr--multiprocessor-affinity-register MT, [24] 0b1 ... There is no 0b0 for MT. 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=-5.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 2E534C433B4 for ; Thu, 15 Apr 2021 20:13:03 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A3EC6113B for ; Thu, 15 Apr 2021 20:13:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A3EC6113B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4LULV1SFKqzWg+ATO94IvJmO3azOCiq/DlvcdGPJFOs=; b=fCuwGjUpX61+lwpSASbxUKFhu EmEDBilndLIlE0rhOVrpAP22Yfe31ALOWPkipyKivWxHRgGOwf4rb779gjYc6BhufjOfROywxVs9X fLeglELUHNhHUrCWnv6mljjuQtBnKuc0Wp5GXqoEAKs2cQ5IXE5Y63LWjNw2p0ycaZWljfsfI3RP6 nj3c2mouP4yCG8U8BwYEQWPlJ3SEVB1840L/QP7f+PZk9Gt7Jt9PJSH7rDEeK0fLzDjtXwgHwiRuO Rs4XbhJ1N0/sursM0/fcgr/rWq/+FGDX+OlFi6b9W+BPMI46z+4hHdDEYLa9YMPrtZrPDQDoj26p9 DEqRw9AoA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lX8KU-00HDwN-2N; Thu, 15 Apr 2021 20:11:10 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lX8KJ-00HDvG-BC for linux-arm-kernel@desiato.infradead.org; Thu, 15 Apr 2021 20:11:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=sRtzERdg2lNdUEQwfr9NXOolnPtFkhIckgL01Bx1Ei4=; b=Ndca+5tb30qT2qlYdHN8T2OXqq CrPA4jIxDwVbRVgjfqzk/X0WjuUeTw3V8NH8VEyZ6v44SC/9iNXdj0n9FvhcZtvGXibmrK8KCfxrz S5IPQhpQfKT+5Z5Y0lgk0N2RY8NGTAAsPmFLq2nFlO0aX/na++3y9KNd9BLVbSXZa77yWsxM/wzmq aL7vnme5mYsm+/tPF0hLyF2XOmVx8e1Y/LbFLHukXz/UbuOZwshjVv7jLFl6d97d46QujRYDrZusn 6lwDRO9PbuLUI5XyDVOztjr+wq+SYpdTxS7iqnGz87PezAt1GhW1C0hsPgdx/qYRHTqcYCxgcD2tY M3wZ1PiQ==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lX8KG-008rs8-B1 for linux-arm-kernel@lists.infradead.org; Thu, 15 Apr 2021 20:10:57 +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 46EEF11B3; Thu, 15 Apr 2021 13:10:51 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 29A103FA35; Thu, 15 Apr 2021 13:10:48 -0700 (PDT) Subject: Re: [PATCH v2 0/1] arm: topology: parse the topology from the dt To: Valentin Schneider , Ruifeng Zhang , linux@armlinux.org.uk, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, a.p.zijlstra@chello.nl, mingo@kernel.org, ruifeng.zhang1@unisoc.com, nianfu.bai@unisoc.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20210414122326.5255-1-ruifeng.zhang0110@gmail.com> <8735vrmnc7.mognet@arm.com> From: Dietmar Eggemann Message-ID: Date: Thu, 15 Apr 2021 22:10:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <8735vrmnc7.mognet@arm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210415_131056_458101_BD2C2089 X-CRM114-Status: GOOD ( 19.14 ) 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 On 15/04/2021 20:09, Valentin Schneider wrote: > On 14/04/21 20:23, Ruifeng Zhang wrote: >> From: Ruifeng Zhang >> >> In Unisoc, the sc9863a SoC which using cortex-a55, it has two software >> version, one of them is the kernel running on EL1 using aarch32. >> user(EL0) kernel(EL1) >> sc9863a_go aarch32 aarch32 >> sc9863a aarch64 aarch64 >> >> When kernel runs on EL1 using aarch32, the topology will parse wrong. >> For example, >> The MPIDR has been written to the chip register in armv8.2 format. >> For example, >> core0: 0000000080000000 >> core1: 0000000080000100 >> core2: 0000000080000200 >> ... >> >> It will parse to: >> | | aff2 | packageid | coreid | >> |-------+------+-----------+--------| >> | Core0 | 0 | 0 | 0 | >> | Core1 | 0 | 1 | 0 | >> | Core2 | 0 | 2 | 0 | >> | ... | | | | >> >> The wrong topology is that all of the coreid are 0 and unexpected >> packageid. >> >> The reason is the MPIDR format is different between armv7 and armv8.2. >> armv7 (A7) mpidr is: >> [11:8] [7:2] [1:0] >> cluster reserved cpu >> The cortex-a7 spec DDI0464F 4.3.5 >> https://developer.arm.com/documentation/ddi0464/f/?lang=en >> >> armv8.2 (A55) mpidr is: >> [23:16] [15:8] [7:0] >> cluster cpu thread >> > > What I had understood from our conversation was that there *isn't* a format > difference (at least for the bottom 32 bits) - arm64/kernel/topopology.c > would parse it the same, except that MPIDR parsing has been deprecated for > arm64. > > The problem is that those MPIDR values don't match the actual topology. If > they had the MT bit set, i.e. > > core0: 0000000081000000 > core1: 0000000081000100 > core2: 0000000081000200 > > then it would be parsed as: > > | | package_id | core_id | thread_id | > |-------+------------+---------+-----------| > | Core0 | 0 | 0 | 0 | > | Core1 | 0 | 1 | 0 | > | Core2 | 0 | 2 | 0 | > > which would make more sense (wrt the actual, physical topology). ... and this would be in sync with https://developer.arm.com/documentation/100442/0200/register-descriptions/aarch32-system-registers/mpidr--multiprocessor-affinity-register MT, [24] 0b1 ... There is no 0b0 for MT. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel