Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3136993iog; Mon, 27 Jun 2022 09:53:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sDQJlAaGpUGxlOiEvbsL4Txo+u1xSxyyBxVM1mGsrZDF8WT2oIBH0lvLht8GuRwRvpRwV5 X-Received: by 2002:a17:90a:c4f:b0:1df:a178:897f with SMTP id u15-20020a17090a0c4f00b001dfa178897fmr16670200pje.19.1656348809322; Mon, 27 Jun 2022 09:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656348809; cv=none; d=google.com; s=arc-20160816; b=QZ+3N/VNWnd2E42IYeCGEcwLsBnnmam4ucr+oP4oJv+nHA376Dn102B9HUlRt61vqz GfmP2rUkfjjQgh6nAlg3xb10zH3bx40iqdoytC3QY8hzGiuZl2yjYVgqUZTrH69n9iGT KuAGkw06oOUR+6O3KJtPmPg2nM0J3XP6M4Z5K7ug0rDO3eMcjyv1BYlo5zFEWYH6CVVb Mkn9FQF7xyWJyGXaaHRD5955EGYVSy8Lhh/+cb46aw+tVKPCWUA+MrXMLMThwqlosVI8 wkUNZ+NrqAE2upQFxr3pXI+AQ11YTrsGFoByrR4fxxbkYC0Giu9mW/S3uLHGPGe9QVpA Z6Pg== 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=prgcW7Y4GNZbtYAHrkI5jyTaEShMbpQnsmXzKCtuCp4=; b=qmAWL8vWmAbl8y5lM+O2gpnIMU/6US5/5VSudozcYXTw63zd9fabN1kyaQDSZANQGW rEM7Z+yBA8D3w4emdk1ocjOk7A02ehaNb4rhZzgbKSeEaeO3OWC166Hto1Uc2K90uHBq zO1w7pCcOvCWPhZAcRqdyAfnW9D76hKgMkZhiGHm04hTEt+DzUZCX1YjOjsuq/2W+2AS xyAVcmWTQilGJrDwksKAhQU30e4IOBKn8PJLv0IiQ4HEvRaMrLiqn/tDni/7kDQEjX9j dhxvWuGijkKzY1IBVSKfl0CkrI2VWHtzGtuxovLgtmXrnpDKbE81hXLeJr58L36lCVdI qR7g== 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 q17-20020a63bc11000000b003ffafbc0463si14598543pge.369.2022.06.27.09.53.17; Mon, 27 Jun 2022 09:53:29 -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 S239456AbiF0QvM (ORCPT + 99 others); Mon, 27 Jun 2022 12:51:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239430AbiF0QvG (ORCPT ); Mon, 27 Jun 2022 12:51:06 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 05B1F1115B for ; Mon, 27 Jun 2022 09:51:06 -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 E7F081758; Mon, 27 Jun 2022 09:51:05 -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 EC1023F792; Mon, 27 Jun 2022 09:51:03 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , Atish Patra , Atish Patra , Vincent Guittot , Dietmar Eggemann , Qing Wang , Rob Herring , "Rafael J . Wysocki" , Ionela Voinescu , Pierre Gondois , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Gavin Shan Subject: [PATCH v5 04/19] cacheinfo: Move cache_leaves_are_shared out of CONFIG_OF Date: Mon, 27 Jun 2022 17:50:32 +0100 Message-Id: <20220627165047.336669-5-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627165047.336669-1-sudeep.holla@arm.com> References: <20220627165047.336669-1-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_NONE,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. Link: https://lore.kernel.org/r/20220621192034.3332546-5-sudeep.holla@arm.com Tested-by: Ionela Voinescu Reviewed-by: Gavin Shan 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 e13ef41763e4..2cea9201f31c 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