Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3645621ioo; Wed, 25 May 2022 05:18:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypvH02tu+3vai3YcnZdMVtxfeFL/PHsqX847uQNOf54btiEW3gHogq9Lu7QI41Rijo9uHp X-Received: by 2002:a17:906:a397:b0:6fe:a1e5:de70 with SMTP id k23-20020a170906a39700b006fea1e5de70mr24820658ejz.2.1653481118855; Wed, 25 May 2022 05:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653481118; cv=none; d=google.com; s=arc-20160816; b=Zb0r6CxVDz8UzGzohz47vbw55GAE3UhRoaxF2FBvkBhkt+utM7g5E26PqfhPYo1ACd eBlSxCscTcPV6ujr6mG67NJtuHfg92etk9Va90PbvIuNv6LVLp9qlrKXLHG6OCBDhwmE h5BqHFoOxFOxKOAkzqtvmeapTthFHM1Q9talBkIaG6KI9g+TCFLyrOIHlc3AoHRYycoi 4H1+dLShpCIpfog5RzR3CJ64svjPwYLPAQj+LfiVEFRZz7JifnIw3gB7zpzlCr9hwNBb BxqUn/9TA6iVLSBSdrixKgGgARBZfDYqyNOEnOFRf/a/Ivv9/1hkBjOCpompsRNAlOnY RzTw== 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=QTMjpAhqr30T7UzhLTbm0P0Rcs6UzkSurOrawcHnHKE=; b=uPnISOckdwyXx2nDQh2dCnqL22DVwBYpbJnhfSY6tGBG+HoGSh1m+BXVvDuqu3uiAF A1XXevKN2lvdKgubG2Kr+7ERLbo3xMgTTxt++KKHBI18v8yHSC0HVCeaGeht+Mh7idg2 zQp1ZFISLA0nh9sPGhlnejFCvcewI3ONLPmf1P/AD+/sXsUReQbIJRtGTR3PzH+0kkap BAbwAFuPKOQGG9d4l6UzJH4jFanUvnm9lfamSZ3f/ZnNGfNpP/7qbhEq9pgdvDbRi6ge oa2Q4ovPI9XB+sdnc/Mull1NdGX2vsETR35FDXV1Q/1n0TL4Ye13k54fjHUqgZmsvLoX mAiA== 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 di5-20020a170906730500b006efc25199e7si12128229ejc.985.2022.05.25.05.18.12; Wed, 25 May 2022 05:18:38 -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 S237693AbiEYIQF (ORCPT + 99 others); Wed, 25 May 2022 04:16:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242551AbiEYIPH (ORCPT ); Wed, 25 May 2022 04:15:07 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A92DC87A24 for ; Wed, 25 May 2022 01:15:04 -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 2060A1FB; Wed, 25 May 2022 01:15:04 -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 4DCE23F73D; Wed, 25 May 2022 01:15:02 -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 15/16] arch_topology: Set cluster identifier in each core/thread from /cpu-map Date: Wed, 25 May 2022 09:14:15 +0100 Message-Id: <20220525081416.3306043-16-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220525081416.3306043-15-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> <20220525081416.3306043-4-sudeep.holla@arm.com> <20220525081416.3306043-5-sudeep.holla@arm.com> <20220525081416.3306043-6-sudeep.holla@arm.com> <20220525081416.3306043-7-sudeep.holla@arm.com> <20220525081416.3306043-8-sudeep.holla@arm.com> <20220525081416.3306043-9-sudeep.holla@arm.com> <20220525081416.3306043-10-sudeep.holla@arm.com> <20220525081416.3306043-11-sudeep.holla@arm.com> <20220525081416.3306043-12-sudeep.holla@arm.com> <20220525081416.3306043-13-sudeep.holla@arm.com> <20220525081416.3306043-14-sudeep.holla@arm.com> <20220525081416.3306043-15-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 Let us set the cluster identifier as parsed from the device tree cluster nodes within /cpu-map. We don't support nesting of clusters yet as there are no real hardware to support clusters of clusters. Signed-off-by: Sudeep Holla --- drivers/base/arch_topology.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index b8f0d72908c8..5f4f148a7769 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -492,7 +492,7 @@ static int __init get_cpu_for_node(struct device_node *node) } static int __init parse_core(struct device_node *core, int package_id, - int core_id) + int cluster_id, int core_id) { char name[20]; bool leaf = true; @@ -508,6 +508,7 @@ static int __init parse_core(struct device_node *core, int package_id, cpu = get_cpu_for_node(t); if (cpu >= 0) { cpu_topology[cpu].package_id = package_id; + cpu_topology[cpu].cluster_id = cluster_id; cpu_topology[cpu].core_id = core_id; cpu_topology[cpu].thread_id = i; } else if (cpu != -ENODEV) { @@ -529,6 +530,7 @@ static int __init parse_core(struct device_node *core, int package_id, } cpu_topology[cpu].package_id = package_id; + cpu_topology[cpu].cluster_id = cluster_id; cpu_topology[cpu].core_id = core_id; } else if (leaf && cpu != -ENODEV) { pr_err("%pOF: Can't get CPU for leaf core\n", core); @@ -538,7 +540,8 @@ static int __init parse_core(struct device_node *core, int package_id, return 0; } -static int __init parse_cluster(struct device_node *cluster, int depth) +static int __init +parse_cluster(struct device_node *cluster, int cluster_id, int depth) { char name[20]; bool leaf = true; @@ -558,7 +561,7 @@ static int __init parse_cluster(struct device_node *cluster, int depth) c = of_get_child_by_name(cluster, name); if (c) { leaf = false; - ret = parse_cluster(c, depth + 1); + ret = parse_cluster(c, i, depth + 1); of_node_put(c); if (ret != 0) return ret; @@ -582,7 +585,7 @@ static int __init parse_cluster(struct device_node *cluster, int depth) } if (leaf) { - ret = parse_core(c, 0, core_id++); + ret = parse_core(c, 0, cluster_id, core_id++); } else { pr_err("%pOF: Non-leaf cluster with core %s\n", cluster, name); @@ -621,7 +624,7 @@ static int __init parse_dt_topology(void) if (!map) goto out; - ret = parse_cluster(map, 0); + ret = parse_cluster(map, -1, 0); if (ret != 0) goto out_map; -- 2.36.1