Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1776738rwl; Thu, 6 Apr 2023 00:39:04 -0700 (PDT) X-Google-Smtp-Source: AKy350YmryHaxMZqqOCEanfJwPHfto39aG9Vr70B1Enfiku0QSG1l5X5SHSFB6/8q6uBgZ9FOZ7t X-Received: by 2002:a05:6a20:a89c:b0:c2:f930:45e8 with SMTP id ca28-20020a056a20a89c00b000c2f93045e8mr1947395pzb.46.1680766743835; Thu, 06 Apr 2023 00:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680766743; cv=none; d=google.com; s=arc-20160816; b=EVyr9YfTZvDvROH8Hyz2sQZMwaj0OCYZwp2mcI5KEo6Qg7yZyUN9oiPmO5+c2sZ1HY +GpMFWOz9jwM3ctPJeIicJb1bVj1iwWnwtifDTyb/WAr8stNneD9MiXGtnZQPE5UZKOX uswHIa1hUwNp9no9G5Ee5fBw4nebpMeMK7PocW8EOanxeZNKQLtdUKF1XDn1kVdLZZOx G7IOxNVdTmtZTJjbWQOcPkCZbk92CEuRb/R5R6SveHdww6CNubu1lmq7wrTPbrW+eFXI ADJNIajLI+nf2TqRll7JoJ51mrL/ThugVb6x9uQURXOG2Sfepg0alrrHHMMle06Ea6ok UUyw== 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=DbHeKEfxjDXZv4hfDO/jeQQtbIN+4ApUfHDxx0oXgE8=; b=XLFTqkipPEDwGnBC8VTNLHvFfXqugW3e+lRDtcS5PCEXVlVz1OcUwPyXz/UjE3SkM7 2RTmgn86aywHwWXV0xT/Ij+w0u5yDrZYMri3OZ/j8mNauk0imF9iYmJv17ZNZsV0pS0Y abXlDYk5VVhEPywXZkoES47B6+qEJLYA18vVpXGX1OCb8wGR7bociJN8mX5bm/qxOIeW BZ1U0/eigxQKQLppN34Y60K2rjf42v/b4gltC/pz67KXOANtkTR3CeAH4gfORVOOaPdu myfrap3JafPxGKLTcZD+61DAccF+sFWoFuj9AWtwhebQhOa7Ch3ep/pYXHCUYEVrz8GP w+vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a63d744000000b005140cca17d1si661976pgi.520.2023.04.06.00.38.51; Thu, 06 Apr 2023 00:39:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235463AbjDFH2s (ORCPT + 99 others); Thu, 6 Apr 2023 03:28:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233235AbjDFH2r (ORCPT ); Thu, 6 Apr 2023 03:28:47 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 506AF6E88 for ; Thu, 6 Apr 2023 00:28:46 -0700 (PDT) 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 F1CA316F8; Thu, 6 Apr 2023 00:29:29 -0700 (PDT) Received: from [192.168.1.12] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B173A3F73F; Thu, 6 Apr 2023 00:28:42 -0700 (PDT) Message-ID: Date: Thu, 6 Apr 2023 09:28:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 3/3] cacheinfo: Add use_arch[|_cache]_info field/function Content-Language: en-US To: Will Deacon Cc: linux-kernel@vger.kernel.org, Radu Rendec , Catalin Marinas , Greg Kroah-Hartman , "Rafael J. Wysocki" , Sudeep Holla , Palmer Dabbelt , Oliver Upton , Akihiko Odaki , Gavin Shan , Conor Dooley , linux-arm-kernel@lists.infradead.org References: <20230327115953.788244-1-pierre.gondois@arm.com> <20230327115953.788244-4-pierre.gondois@arm.com> <20230327121734.GB31342@willie-the-truck> From: Pierre Gondois In-Reply-To: <20230327121734.GB31342@willie-the-truck> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Will, On 3/27/23 14:17, Will Deacon wrote: > On Mon, Mar 27, 2023 at 01:59:51PM +0200, Pierre Gondois wrote: >> The cache information can be extracted from either a Device >> Tree (DT), the PPTT ACPI table, or arch registers (clidr_el1 >> for arm64). >> >> The clidr_el1 register is used only if DT/ACPI information is not >> available. It does not states how caches are shared among CPUs. >> >> Add a use_arch_cache_info field/function to identify when the >> DT/ACPI doesn't provide cache information. Use this information >> to assume L1 caches are privates and L2 and higher are shared among >> all CPUs. >> >> Signed-off-by: Pierre Gondois >> --- >> arch/arm64/kernel/cacheinfo.c | 5 +++++ >> drivers/base/cacheinfo.c | 20 ++++++++++++++++++-- >> include/linux/cacheinfo.h | 2 ++ >> 3 files changed, 25 insertions(+), 2 deletions(-) >> >> diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c >> index c307f69e9b55..b6306cda0fa7 100644 >> --- a/arch/arm64/kernel/cacheinfo.c >> +++ b/arch/arm64/kernel/cacheinfo.c >> @@ -96,3 +96,8 @@ int populate_cache_leaves(unsigned int cpu) >> } >> return 0; >> } >> + >> +bool use_arch_cache_info(unsigned int cpu) >> +{ >> + return true; >> +} > > It would be a lot nicer if this was a static inline function in a header > rather than a weak symbol. I am not sure I see where the static inline function should be added. Do you prefer to have function like the following in include/linux/cacheinfo.h ? static inline bool use_arch_cache_info(unsigned int cpu) { #if defined(CONFIG_ARM64) return true; #else return false; #endif } Regards, Pierre > > Will