Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp961954iob; Fri, 13 May 2022 17:50:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHQP66DtaeYBa9zUGsEbmcm5YhiK2kUpnc/BMz+tmPzz6tEbdh44RnQoIN3/4MgeGoq4v7 X-Received: by 2002:a5d:484b:0:b0:20c:eb79:f237 with SMTP id n11-20020a5d484b000000b0020ceb79f237mr5960659wrs.101.1652489433169; Fri, 13 May 2022 17:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652489433; cv=none; d=google.com; s=arc-20160816; b=f2VPg9Hf3b1u9j5TTvlH01+2mBYDVjFx5gtDZDI7ET+qgk0PVGLHJsnOptmSEVCpI6 r3RisJMnLjsPjHiJt+bONZx9v2ZaP87nwc5xcOQ7pqueGR2CeEmuZny8xCJMsTwoIudS JrzqJG/4Be+hz5+JvCq8Oi+15/z4qn/8jKne8guFvDphnIvjGzjPpP8O+UQuJfiWQrni oKpGMEbEJArPmW/F1MzekucjjcKoi9LN/7o0pp8DVlMFSluQa9Pt0N2P/Z45nFmGVeB1 wC6idLub6VwnrX6l1P6k2UTXk8vPLyB65CXsZLASVcPGp6nANJoyoBN57AZkFsnhtWp+ tHkw== 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=oQdp/sv4uVTSpJWPw0Nh3zB0MYGjYGwhOPSgfmw3FcU=; b=VLhsfilLBNPEzElaNVaMN1vg7NdIJ4qUsw/YfSxCxUwfhFtM4arW7jAGtp+oetSgBT 96qFQSMcOuu4uPbnQffv7l0unydbPhH51l8GCf4UcvHYvy8+vk/oxId3fyyjy283IrX1 QXZteW1H5pNSjLtuhyI5jYqjmJvMPxlrIfNxXiWW5E+HfN6KLA6rhhXjeMEuB4zUT890 tkw/Lon+Nz/oAOjC6qJ8HlQqTPSXZfzXKTqqkiOgfgexba6MwROAB0LDr9lvnHg1MjVI 63sgZ/mKHCJVwI5zmyKSwFQdPR2D6Uxnuc3di6TgL8JBzyEsBYp/hXNrs7pSJZv2xyMQ pRFQ== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l19-20020adfc793000000b0020c67eba8f9si3400165wrg.880.2022.05.13.17.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 17:50:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 69E1D34037B; Fri, 13 May 2022 16:28:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379268AbiEMJ4d (ORCPT + 99 others); Fri, 13 May 2022 05:56:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379229AbiEMJ4Q (ORCPT ); Fri, 13 May 2022 05:56:16 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AF0C7193F5 for ; Fri, 13 May 2022 02:56:15 -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 A12B5143D; Fri, 13 May 2022 02:56:15 -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 615403F5A1; Fri, 13 May 2022 02:56:14 -0700 (PDT) From: Sudeep Holla To: Atish Patra , Atish Patra , linux-kernel@vger.kernel.org Cc: Sudeep Holla , Atish Patra , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Qing Wang Subject: [PATCH 3/4] arch_topology: Set cluster identifier in each core/thread from /cpu-map Date: Fri, 13 May 2022 10:55:58 +0100 Message-Id: <20220513095559.1034633-4-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220513095559.1034633-1-sudeep.holla@arm.com> References: <20220513095559.1034633-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 5812428253d8..46420db5a836 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -491,7 +491,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; @@ -507,6 +507,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) { @@ -528,6 +529,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); @@ -537,7 +539,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; @@ -557,7 +560,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; @@ -581,7 +584,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