Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp311562iob; Wed, 18 May 2022 02:45:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz18uLoSTv1Z/84UFRiJWrvD1Z+83+/bLsFljORfuNhnXK63RJMwvtFZXzAYt4dI4P58x6u X-Received: by 2002:a17:902:e74d:b0:15e:94f7:611e with SMTP id p13-20020a170902e74d00b0015e94f7611emr27283185plf.37.1652867122382; Wed, 18 May 2022 02:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652867122; cv=none; d=google.com; s=arc-20160816; b=fNMU0qhuoOpdHe4vx6hgYWDXOilgN9F6eWU98opwaiKEQHV4E+H/6CbYc8Wd7K3xZL Vv+4/wMl5H46HiV1ux3tIfclAH4RY6gdKbg2NNyovPZMh1lrueY/TcsS9fAoXDDj80U0 6EQJNBaSrs7IX8JV2zUye5rFBzp29wo4tJYYQMrafBM+C9eMp0uJPnlfitxuDshkKKva 8eOQVMZqfbYLpSg+6r3ZqJTR643hrVa+eFEon4TUBsKSSapWxdMLax6Pq1YjKrHU9XXQ XPh5hSJ8gG5+NOhDUxJa1lqU9/BfkifeIlNx5mGSqntUI+GDNuyyfY1PHzrKB/v0HIld DQCA== 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=EIavj3zH3Z3ZGO3zcJN6wvFOSb++/e25ZaD4FvB5UC8=; b=H3xLrJBOaThvzojt/QeuMks1Pz5aHuI+sG+J8nH1Z6dL9e20KncxVnwFkgZDP8zQx8 RoPK/ZKMSxOBnKDNC+5ZVwnO09VoNnMbiDKTYqMj9z9DUJj7Tgk7pmZxkEn08Anyk7FQ J5UUhTrf8odRul6zssaRt0Lr/QxmTBa8tloTeF9FNSqnPkxdU820nd258XFVH7moFmWa WOFg8r9GGJHN4y4Ws+mEKHEZ+ZehaJnPjs5lw4tdHaxezzCcOF04QnzRpzNpRKG6RsBG lydL/F+tq1OEpNk+9s8elZ0YxxZyaXjoxiO76gyd+vEYLP8C7ps3OdfRZ6OglzJhPS0l s06w== 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 oc1-20020a17090b1c0100b001df3583472bsi2321224pjb.91.2022.05.18.02.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 02:45:22 -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 0CDADB0A4C; Wed, 18 May 2022 02:34:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234360AbiERJeL (ORCPT + 99 others); Wed, 18 May 2022 05:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234342AbiERJeB (ORCPT ); Wed, 18 May 2022 05:34:01 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C364AF317 for ; Wed, 18 May 2022 02:33:58 -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 43B6B150C; Wed, 18 May 2022 02:33:58 -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 B684D3F66F; Wed, 18 May 2022 02:33:56 -0700 (PDT) From: Sudeep Holla To: Atish Patra , linux-kernel@vger.kernel.org Cc: Sudeep Holla , 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 v2 3/8] arch_topology: Set cluster identifier in each core/thread from /cpu-map Date: Wed, 18 May 2022 10:33:20 +0100 Message-Id: <20220518093325.2070336-4-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220518093325.2070336-1-sudeep.holla@arm.com> References: <20220518093325.2070336-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 7f5aa655c1f4..bdb6f2a17df0 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