Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp352505lqm; Wed, 1 May 2024 02:35:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVzG5LI6mPdl6hmHbQgMWd3uDPN0jXxPzNB/aeTHdLB3zToDRj2JcG2jVQ2sUIRoEeNraH/2bCVb+xU25q//UbGaoVLqflvLSCr8vQkdw== X-Google-Smtp-Source: AGHT+IG9rxbY+jl+e1Me6azWMdR2ftpBeVvn0KRJUanb15nzuoK4Gbk0oJIAy8lfRD0vL04q/IAb X-Received: by 2002:a17:903:1c9:b0:1eb:5b59:fab9 with SMTP id e9-20020a17090301c900b001eb5b59fab9mr1769050plh.53.1714556146152; Wed, 01 May 2024 02:35:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714556146; cv=pass; d=google.com; s=arc-20160816; b=kDcey5eA1IR1xFgYBFyc/bl0mNfvs2bEfmhdMvFo1JP5HNqPiXG7/klNT/A1ItjiY2 JPe/d9h8eZupmPUt1vjAm6fDnNqGQC9kipP3drcYu7aZ/iQx/KWu9I11+LXzqCKbP9fr Zky9Cy8NQYFdFhN4Fob4ZjKsr5dUb5i4TjLIldHBdCTkTGrQPNQSNTW8qT++Wf7guiF2 sW5ibVRn63Jj8n61VDUwU40+oQyAXsqAxUszGCw3w7bVXuDvivU8XbNbwwBVOTutXFxp hhP0rSK4fuy++GEX280SAfS2LGrLMeCMQZc1/L0k0L9waD3+SyA39CGia4ziiU7GPgox GOmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=JzzBBYdfbpkYRRPzD+2312geqs5tYQGgovXlYgOXQTY=; fh=BJcJj7uEhInGfUB7ADR8CEVcZVzNiHUlZ0cTRC6Cc6k=; b=A2fN1Ph+ywNwSQJ5IY1kbwpWKjouIzKhvmUdqf8uEe3AyY2StIye3yT+C3gGLakJ50 ftpL6YBqm+ZcL9Wmyacx6XZ+dn3+wYDxAzf/MomIdHHjxy3lD42vv8UI7EJ5wbxh35qI dXFpgyA1pCP3ozMiAKyWsSBz3aU/14wKyDWDnIzMpMwX/eX/twJ7KcuI2lgTYizFe6JO Zapk/C6jwz2DgoNr5mF6ms7SBOk/yLYDjqBA3ZtAvApIlsc/rEk9if/pu9/SC067G5xR l1157RK3XnuXoboSelcRf0P/VI56zBNBxi1djeq96pDUF4MPXxcRMZ9sRbxnzMpdXnS4 Sfbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-165103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165103-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n12-20020a170902d2cc00b001e4b16b5aa1si24465610plc.219.2024.05.01.02.35.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 02:35:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-165103-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165103-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 14EC4285703 for ; Wed, 1 May 2024 09:34:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7430C524D7; Wed, 1 May 2024 09:31:07 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 396933FB09; Wed, 1 May 2024 09:31:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714555866; cv=none; b=kTFwaW5MmNDzafUSjonYbpSHl32gSiInhdH0wJnh0v8HSk3g+EON7lHavHolFQ5K3WBfe2siX/W4mE+YB4BG9sWBWOlJIv9NrwJ+ybL1AW+keizwUPT3YGbv+bN29ICNaKMCIbyh2aZvipy7cQH7Mt6w41LIAMLa2SUK69DIuvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714555866; c=relaxed/simple; bh=/WvfKNTqeV3Kh/V7Imy68oPA+fzwWDSPALr2nzaFSR4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KDymHvjPSRjtyLOu5v8CWL2hoWRYS5Z8qvdNDajk1FRZdnacybL0NIcXmH3G2RdjGU5vAyO5bTkPUVGKMyor2w7i9FJw9jOoMNDNkxMOQOwJkMalOoq/ckSY5GJgtVVXmrjQkhIP8aO/Nb/v17Vmp6ssLljTJyWKKwhJ+8MepAw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 8D9AA2F4; Wed, 1 May 2024 02:31:30 -0700 (PDT) Received: from donnerap.manchester.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E87563F793; Wed, 1 May 2024 02:31:02 -0700 (PDT) Date: Wed, 1 May 2024 10:30:59 +0100 From: Andre Przywara To: Dragan Simic Cc: linux-sunxi@lists.linux.dev, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: dts: allwinner: Add cache information to the SoC dtsi for H6 Message-ID: <20240501103059.10a8f7de@donnerap.manchester.arm.com> In-Reply-To: References: <6a772756c2c677dbdaaab4a2c71a358d8e4b27e9.1714304058.git.dsimic@manjaro.org> <49abb93000078c692c48c0a65ff677893909361a.1714304071.git.dsimic@manjaro.org> <20240430001002.4797e4e3@minigeek.lan> <6fdeb49d57ccccca62e4f43dbe9475e3@manjaro.org> <20240430114627.0cfcd14a@donnerap.manchester.arm.com> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 30 Apr 2024 13:10:41 +0200 Dragan Simic wrote: > Hello Andre, > > On 2024-04-30 12:46, Andre Przywara wrote: > > On Tue, 30 Apr 2024 02:01:42 +0200 > > Dragan Simic wrote: > >> On 2024-04-30 01:10, Andre Przywara wrote: > >> > On Sun, 28 Apr 2024 13:40:36 +0200 > >> > Dragan Simic wrote: > >> > > >> >> Add missing cache information to the Allwinner H6 SoC dtsi, to allow > >> >> the userspace, which includes lscpu(1) that uses the virtual files > >> >> provided > >> >> by the kernel under the /sys/devices/system/cpu directory, to display > >> >> the > >> >> proper H6 cache information. > >> >> > >> >> Adding the cache information to the H6 SoC dtsi also makes the > >> >> following > >> >> warning message in the kernel log go away: > >> >> > >> >> cacheinfo: Unable to detect cache hierarchy for CPU 0 > >> >> > >> >> The cache parameters for the H6 dtsi were obtained and partially > >> >> derived > >> >> by hand from the cache size and layout specifications found in the > >> >> following > >> >> datasheets and technical reference manuals: > >> >> > >> >> - Allwinner H6 V200 datasheet, version 1.1 > >> >> - ARM Cortex-A53 revision r0p3 TRM, version E > >> >> > >> >> For future reference, here's a brief summary of the documentation: > >> >> > >> >> - All caches employ the 64-byte cache line length > >> >> - Each Cortex-A53 core has 32 KB of L1 2-way, set-associative > >> >> instruction > >> >> cache and 32 KB of L1 4-way, set-associative data cache > >> >> - The entire SoC has 512 KB of unified L2 16-way, set-associative > >> >> cache > >> >> > >> >> Signed-off-by: Dragan Simic > >> > > >> > I can confirm that the data below matches the manuals, but also the > >> > decoding of the architectural cache type registers (CCSIDR_EL1): > >> > L1D: 32 KB: 128 sets, 4 way associative, 64 bytes/line > >> > L1I: 32 KB: 256 sets, 2 way associative, 64 bytes/line > >> > L2: 512 KB: 512 sets, 16 way associative, 64 bytes/line > >> > >> Thank you very much for reviewing my patch in such a detailed way! > >> It's good to know that the values in the Allwinner datasheets match > >> with the observed reality, so to speak. :) > > > > YW, and yes, I like to double check things when it comes to Allwinner > > documentation ;-) And it was comparably easy for this problem. > > Double checking is always good, IMHO. :) > > > Out of curiosity: what triggered that patch? Trying to get rid of false > > warning/error messages? > > Yes, one of the motivators was to get rid of the false kernel warning, > and the other was to have the cache information nicely available through > lscpu(1). I already did the same for a few Rockchip SoCs, [1][2][3] so > a couple of Allwinner SoCs were the next on my mental TODO list. :) Thanks for doing this! > > And do you plan to address the H616 as well? It's a bit more tricky > > there, > > since there are two die revisions out: one with 256(?)KB of L2, one > > with > > 1MB(!). We know how to tell them apart, so I could provide some TF-A > > code > > to patch that up in the DT. The kernel DT copy could go with 256KB > > then. > > I have no boards based on the Allwinner H616, so it wasn't on my radar. > Though, I'd be happy to prepare and submit a similar kernel patch for > the H616, if you'd then take it further and submit a TF-A patch that > fixes the DT according to the detected die revision? Did I understand > the plan right? Yes, that was the idea. I have a working version of that TF-A patch now, just need to figure out some details about the best way to only build this for the H616 port. Neither the data sheet nor the user manual mention the cache sizes for the H616, but I checked the CSSIDR_EL1 register readouts on both an old H616 and a new H618, and they confirm that the former has 256 KB L2, and the latter 1MB. Also I ran tinymembench on two boards to confirm this, community benchmarks results are available here: https://github.com/ThomasKaiser/sbc-bench/blob/master/Results.md The OrangePi Zero2 and OrangePi Zero3 are good examples, respectively. Associativity and cache line size are dictated by the Arm Cortex cores, and the L1I & L1D sizes are the same as in the other SoCs. Cheers, Andre > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=67a6a98575974416834c2294853b3814376a7ce7 > [2] > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=8612169a05c5e979af033868b7a9b177e0f9fcdf > [3] > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b72633ba5cfa932405832de25d0f0a11716903b4