Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1448245imk; Mon, 4 Jul 2022 03:20:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vJRG5Tgmg3r1Mc1yffPwDZVTRJe7CE+i8eOgqbNdmzvPBkJJlUUkkyuvl81HnnnjcrEPwt X-Received: by 2002:a05:6402:5255:b0:435:bec2:9e33 with SMTP id t21-20020a056402525500b00435bec29e33mr38320458edd.398.1656930046603; Mon, 04 Jul 2022 03:20:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656930046; cv=none; d=google.com; s=arc-20160816; b=ps9f8v04FO1sqYvRruys3B0MtibF8yz4eogcTT4eCZyaLIn+uzZS8GNr7vwrT7/Vbl 9LdVAeeSb0n3LKgyd2BPqtq5TLFLvlMlYeDChC2Frt4D2yUETpwitc056f5m8plyMUqy nDzq0g2TDqD3MgNPpce0rf6rejPGBsmV/76G+Xm4srUXaHY8MJ6A7bSyLgKtSFPme10p l2Io5oWifWdMmBNs4PMupYQU0S+DfHnwxop08gHHYzZVNNSHFMkUQEKtTyyuWH4zLQzM gtBk6u1tjXeXD5WUFnSg+5f54EwdmrcupbMEcQ9bUZFoaRJjLZBEex7UcVbXjgbLlYYl wktQ== 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=gzuk5iCiQqCIDVM0yihT+sAbHPJ4qWicO3g51/29zM8=; b=ywxd6VMVLZRyavKCUbHM7RlvglSf+3aGP2zdh97mtKS9bHtokv8AygLAN0aFL90vik +jz7sG9bMEGsiKuVZTYfxlxxlp/oJbegzhx7kLocYy7yHcS0Y0Oa2ULxBrOaIZINO5Dg agk0B98fOEj8vxbrGGWTixLHDXOVPAhfvyuBNgXP5D1zNGU+UinNq3yPMGHtVtGumAdz yepGVe8TNpx26dypmtaQgtjpovJyCxJ6W2Rb0a1x+gk/+AB0ltB1Hwhd9mYRvlfTMlnP SpjP3UMGNWyrovlO31EKULeL+LxsXjyQdm8SQ5VE5royoUDZNgAjA+daak1drMX1J7ZD dRwQ== 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 hu8-20020a170907a08800b00722efd22affsi8403182ejc.751.2022.07.04.03.20.22; Mon, 04 Jul 2022 03:20:46 -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 S234453AbiGDKSO (ORCPT + 99 others); Mon, 4 Jul 2022 06:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234242AbiGDKQy (ORCPT ); Mon, 4 Jul 2022 06:16:54 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 082C4DFE0 for ; Mon, 4 Jul 2022 03:16:53 -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 1B29CD6E; Mon, 4 Jul 2022 03:16:53 -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 0918B3F792; Mon, 4 Jul 2022 03:16:50 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman Cc: Sudeep Holla , conor.dooley@microchip.com, valentina.fernandezalanis@microchip.com, 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 v6 18/21] arch_topology: Set cluster identifier in each core/thread from /cpu-map Date: Mon, 4 Jul 2022 11:16:02 +0100 Message-Id: <20220704101605.1318280-19-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220704101605.1318280-1-sudeep.holla@arm.com> References: <20220704101605.1318280-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. 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 591c1f8e15e2..217a91fc1f59 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.37.0