Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3792429ioo; Wed, 25 May 2022 08:13:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGBCemHfxi2T4nWtFyOSrv6CyIFk5LQgqlhiBE7bcjzD0ZnJt8vz41tJW/XF0POeXANq32 X-Received: by 2002:a50:fe8d:0:b0:42a:b3a4:6ac2 with SMTP id d13-20020a50fe8d000000b0042ab3a46ac2mr34806035edt.131.1653491630581; Wed, 25 May 2022 08:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653491630; cv=none; d=google.com; s=arc-20160816; b=robTwuKjsKvhAn46+9fA/gXCn4cwemsmau3oPnBY+dmxcPgmlSV+ISSeaceNKiSTrJ XCKudh6ajxVrV6PhRtQ6sLQGzWcc6Vn8RgmHPrWuMGbY6se+QZtj5MTXQDDyIyP4ocVQ 43kJ2dn00o3t6+I7mWbyE8bMmFJBNXs/L5/x+KiKYFnYq1mqDO9mj9lvKLaZ2VqRO/In iUwa9/qoru8bMFvQFvIN/S4VJyPHOwFqBzE2FZTwVIl5u6fl4ngAMYiS9TLAPGwV5oAO UAhsc0eoQp7bJpTdtCpRdjD6TrX4HRNKUlYkXL3b0nOy9xIb0eFTbzim9KgjBlAEL22K C5Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Mmr0+e2r9V08jgai4H+iYZI96FhX91x2UNNSS6nWe9Y=; b=efaGZTrJTx68GdNtHv3qkMv9lP0SYJ3PVoifJE8djwXdlICVM1Iq1KR03CIYB1rO3i Ilrn4nB/9BNFkLv9GGksEt3+NvvoHfhnt4oAzC733hKvDTmLDc5S0PcI8oolOrRWfc5Y EVBzZeB9NArf97PlqC2ctsp8Dtb/AQFxtl/ar5NuOTySPM5+q/dyqC+pRgZH3GyOHKdI MstFwSJ3IjYe3Vz9hl4Jua6pl77lpf/djgLUpOyxoPtBMK6UpT7AAdPRvKgg3jkerIHF b1ajoDV8ZTAgOKVM2Eu7vJaZ8Jw5KLt0NpHwBcM3Xatxr1yzULA9o2ti5JCW/qPgZVte 01Yw== 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 r10-20020a05640251ca00b0042b2c6c56f7si18978873edd.559.2022.05.25.08.13.22; Wed, 25 May 2022 08:13:50 -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 S238260AbiEYIOy (ORCPT + 99 others); Wed, 25 May 2022 04:14:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236702AbiEYIOj (ORCPT ); Wed, 25 May 2022 04:14:39 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6093B7CDD3 for ; Wed, 25 May 2022 01:14:38 -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 225A51FB; Wed, 25 May 2022 01:14:38 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 474293F73D; Wed, 25 May 2022 01:14:36 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Atish Patra , Atish Patra , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Qing Wang , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Rob Herring Subject: [PATCH v3 03/16] cacheinfo: Move cache_leaves_are_shared out of CONFIG_OF Date: Wed, 25 May 2022 09:14:03 +0100 Message-Id: <20220525081416.3306043-4-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220525081416.3306043-3-sudeep.holla@arm.com> References: <20220525081416.3306043-1-sudeep.holla@arm.com> <20220525081416.3306043-2-sudeep.holla@arm.com> <20220525081416.3306043-3-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 cache_leaves_are_shared is already used even with ACPI and PPTT. It checks if the cache leaves are the shared based on fw_token pointer. However it is defined conditionally only if CONFIG_OF is enabled which is wrong. Move the function cache_leaves_are_shared out of CONFIG_OF and keep it generic. It also handles the case where both OF and ACPI is not defined. Signed-off-by: Sudeep Holla --- drivers/base/cacheinfo.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index c4547d8ac6f3..417e1ebf5525 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -33,13 +33,21 @@ struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu) return ci_cacheinfo(cpu); } -#ifdef CONFIG_OF static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, struct cacheinfo *sib_leaf) { + /* + * For non DT/ACPI systems, assume unique level 1 caches, + * system-wide shared caches for all other levels. This will be used + * only if arch specific code has not populated shared_cpu_map + */ + if (!IS_ENABLED(CONFIG_OF) && !(IS_ENABLED(CONFIG_ACPI))) + return !(this_leaf->level == 1); + return sib_leaf->fw_token == this_leaf->fw_token; } +#ifdef CONFIG_OF /* OF properties to query for a given cache type */ struct cache_type_info { const char *size_prop; @@ -193,16 +201,6 @@ static int cache_setup_of_node(unsigned int cpu) } #else static inline int cache_setup_of_node(unsigned int cpu) { return 0; } -static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, - struct cacheinfo *sib_leaf) -{ - /* - * For non-DT/ACPI systems, assume unique level 1 caches, system-wide - * shared caches for all other levels. This will be used only if - * arch specific code has not populated shared_cpu_map - */ - return !(this_leaf->level == 1); -} #endif int __weak cache_setup_acpi(unsigned int cpu) -- 2.36.1