Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3167786iog; Mon, 27 Jun 2022 10:31:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uNy6uJFAu39J0DgljTHfpnlkUYnEH/R0nEz4p+x74vsLUKo+J0X6Od4ggkpMgSst3yG9ne X-Received: by 2002:a05:6402:11d1:b0:435:d76d:f985 with SMTP id j17-20020a05640211d100b00435d76df985mr17664430edw.8.1656351072087; Mon, 27 Jun 2022 10:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656351072; cv=none; d=google.com; s=arc-20160816; b=u+t2AQPn8dwPew6MdNPnVTNPj8EZgauRUjGcGSvBvbAnkJbnOlv5ufjGciK9Z1PiNH JEr73/l30BBGc3D6sSUCHsHlnm5e2ihPcTWiE7dEUdW0z7pwNIrCaU6Co70xST0xZ1Pk DFdt8zQDAREuranV+Fo4a9q5d9lEdAloQRPSdWLUZch4cGoofNL3PT3BeSqnRlpEl/EU SaxEIHhSsMCseGnmm53iEqBlkwP53UoiU45tjPjYJzkBLigpsXw4DnJwf6C5U+lhX+8U 9Ra5YKNgq3sj0DATEqKH0XTFPFCrdyXTX9f3b/6/mi/H+HEFHhtTiOMHzhxVZjLWzrAB p/sg== 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=b/k4buu5IyIisrCDCf3AR3a7W2XelsSlrb1cLcXj+bA=; b=lT4FDUpJFPQxRgwvgLlH74w5n52q3Sl5Ase45dy2VaXDYKXZSAjMA25pjcfm15KwiN kACiJkOzAuV4nuhtwo86IOaNkjJnODpvhSenLFuBPzy/gP/rrqmafn9DmUguc9DRruil Z4TqJsiRqfa2pe7M/P06tPwew0QBfDjxWypNPINshTAsjs2zTrcDH0cwnHdcEN3MBmBE WcldpVKQ22ekpuoD7xsiWlpAD9O04QSMHz3+jrHVG8wCrRMQaRxMVGI+cwZ38i0wuDbT nQDrobCFyxZJyklRZamtLrf4Gxej8tjT+FWeXYGznRvdafnUO1xBEuO5hCdhomsBoYgx 9rYg== 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 b15-20020a056402084f00b0043779a90504si8460733edz.606.2022.06.27.10.30.47; Mon, 27 Jun 2022 10:31:12 -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 S239690AbiF0QwK (ORCPT + 99 others); Mon, 27 Jun 2022 12:52:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239575AbiF0Qvc (ORCPT ); Mon, 27 Jun 2022 12:51:32 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7F97211174 for ; Mon, 27 Jun 2022 09:51:31 -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 811C81758; Mon, 27 Jun 2022 09:51:31 -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 9E45F3F792; Mon, 27 Jun 2022 09:51:29 -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 Subject: [PATCH v5 17/19] arch_topology: Set cluster identifier in each core/thread from /cpu-map Date: Mon, 27 Jun 2022 17:50:45 +0100 Message-Id: <20220627165047.336669-18-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 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. Link: https://lore.kernel.org/r/20220621192034.3332546-19-sudeep.holla@arm.com Tested-by: Ionela Voinescu Reviewed-by: Ionela Voinescu 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 277b65cf3306..80184c91c919 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -497,7 +497,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; @@ -513,6 +513,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) { @@ -534,6 +535,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); @@ -543,7 +545,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; @@ -563,7 +566,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; @@ -587,7 +590,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); @@ -627,7 +630,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