From nobody Wed Sep 10 05:35:33 2025 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A664263F2D; Fri, 5 Sep 2025 16:19:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089152; cv=none; b=D2Wg2jXBm1ONtkeRVHBfnjQ/qxfIpXU7eYuWlylTlmGFghgk9tenSk9bO+VOJ6AWjpuY8mfL5ZpMy/kGnVXjWPcxJ7qzahk6xWYKhvHMBSuR2sVVpqKfV/J9r6NkE+VDn6Vg/6iYI28y5TmXLRoDYd1CmCAs0TlVnL7t6rLaUP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089152; c=relaxed/simple; bh=C2t4tSU3Clk9k0uygTv6O4hhL18A4eELuW2Ca/p3YHk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GdsbWaKvoV2KyqWOgCfBQvaCp7c7PTm1vaWvXnA7lQyrTnzjq8V3EEwi2iFDwzviYarrwv4w43YQtC9cWUUmNBVLWuCdapT0CbSapFLXpN8/IS4uBVLl3zDCMNL+T+jkhng3Se5lqF4iqtsLAb6XELITURkU4sf08x+T9IPgyz8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cJM2m72SLz6L51Z; Sat, 6 Sep 2025 00:18:08 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id 2C8B1140159; Sat, 6 Sep 2025 00:19:08 +0800 (CST) Received: from a2303103017.china.huawei.com (10.202.66.105) by frapeml500003.china.huawei.com (7.182.85.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 5 Sep 2025 18:19:05 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , Subject: [PATCH v4 1/6] of: add infra for finding CPU id from phandle Date: Fri, 5 Sep 2025 17:18:24 +0100 Message-ID: <20250905161830.37-2-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250905161830.37-1-alireza.sanaee@huawei.com> References: <20250905161830.37-1-alireza.sanaee@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Get CPU ID from phandle. Some drivers such as coresight, cti-coresight, or arm-dsu use this API for finding CPU node in DT. In particular, drivers do this by getting the CPU device_node through a phandle and then find the CPU ID using of_cpu_node_to_id(). This commit encapsulates CPU node finding and improves readability. The interface takes three parameters, 1) node, 2) pointer to pointer of CPU node, 3) CPU node index. API sets the pointer to the CPU node and allows the driver to work with the CPU node, for logging purposes for instance. Reviewed-by: Rob Herring (Arm) Reviewed-by: Jonathan Cameron Signed-off-by: Alireza Sanaee --- drivers/of/cpu.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ include/linux/of.h | 9 +++++++++ 2 files changed, 57 insertions(+) diff --git a/drivers/of/cpu.c b/drivers/of/cpu.c index 5214dc3d05ae..9e0d3ec10bc2 100644 --- a/drivers/of/cpu.c +++ b/drivers/of/cpu.c @@ -173,6 +173,54 @@ int of_cpu_node_to_id(struct device_node *cpu_node) } EXPORT_SYMBOL(of_cpu_node_to_id); =20 +/** + * of_cpu_phandle_to_id: Get the logical CPU number for a given device_node + * + * @node: Pointer to the device_node containing CPU phandle. + * @cpu_np: Pointer to the device_node for CPU. + * @cpu_idx: The index of the CPU in the list of CPUs. + * + * *cpu_np is only set when cpu_np is not NULL. Use of_node_put() to rele= ase + * the node reference if cpu_np !=3D NULL and this function succeeds. + * + * Return: This function has three different possible return situations: + * 1) returns -EINVAL if the node is NULL. + * 2) returns -ENODEV if the CPU node is not found or of_cpu_node_to_id is + * not successful. + * 3) returns the logical CPU number if the CPU node is found. + */ +int of_cpu_phandle_to_id(const struct device_node *node, + struct device_node **cpu_np, + uint8_t cpu_idx) +{ + struct device_node *local_cpu_node =3D NULL; + int cpu; + + if (!node) + return -EINVAL; + + if (cpu_idx =3D=3D 0) + local_cpu_node =3D of_parse_phandle(node, "cpu", 0); + if (!local_cpu_node) + local_cpu_node =3D of_parse_phandle(node, "cpus", cpu_idx); + if (!local_cpu_node) + return -ENODEV; + + cpu =3D of_cpu_node_to_id(local_cpu_node); + if (cpu < 0) { + of_node_put(local_cpu_node); + return cpu; + } + + if (cpu_np) + *cpu_np =3D local_cpu_node; + else + of_node_put(local_cpu_node); + + return cpu; +} +EXPORT_SYMBOL(of_cpu_phandle_to_id); + /** * of_get_cpu_state_node - Get CPU's idle state node at the given index * diff --git a/include/linux/of.h b/include/linux/of.h index a62154aeda1b..717e55065d99 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -365,6 +365,8 @@ extern const void *of_get_property(const struct device_= node *node, extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); extern struct device_node *of_cpu_device_node_get(int cpu); extern int of_cpu_node_to_id(struct device_node *np); +extern int of_cpu_phandle_to_id(const struct device_node *np, + struct device_node **cpu_np, uint8_t cpu_idx); extern struct device_node *of_get_next_cpu_node(struct device_node *prev); extern struct device_node *of_get_cpu_state_node(const struct device_node = *cpu_node, int index); @@ -680,6 +682,13 @@ static inline int of_cpu_node_to_id(struct device_node= *np) return -ENODEV; } =20 +static inline int of_cpu_phandle_to_id(const struct device_node *np, + struct device_node **cpu_np, + uint8_t cpu_idx) +{ + return -ENODEV; +} + static inline struct device_node *of_get_next_cpu_node(struct device_node = *prev) { return NULL; --=20 2.43.0 From nobody Wed Sep 10 05:35:33 2025 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBDD52F7ABF; Fri, 5 Sep 2025 16:19:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089185; cv=none; b=eKQiw9MB7T2oI5AtccE2LFvb6XXl6Yn8xMHzyZOvOTSzOnhVey15Cuf54hi0WTQOLvMj/lMmb/m0ufnhEc/Zn35o6ncnDU8/qUsj7sMqMoucTX/lHIBqWd8aqsm2tt++slBxIo9vgKZxpoIeCFkS8GYLLg7GzyioRiDVQfRbKPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089185; c=relaxed/simple; bh=eZSDeiM7HCdeqqRsi4zXh+9r6X3OLsFdI7dGcGk4yoc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=baXXoKM1cBrZSr4VnSZ9Lz1w1mnbJLOawpWvfui4Zlgc1yImzf7bpSO9MVdL5LAO6EkTX2P9tVY/06gXyJrhvDjWAi9H8Kfd+3TqsB8P0sZMPTM0iddapGvoRHJwYyhLVs8MWpaYXMqJUon47/Z1SrNlCKs0dtsTl8wZFX2Oeg4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cJM3Q6vwsz6L51J; Sat, 6 Sep 2025 00:18:42 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id 2803F1401DC; Sat, 6 Sep 2025 00:19:42 +0800 (CST) Received: from a2303103017.china.huawei.com (10.202.66.105) by frapeml500003.china.huawei.com (7.182.85.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 5 Sep 2025 18:19:39 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , Subject: [PATCH v4 2/6] arch_topology: drop the use of cpu_node in the pr_info Date: Fri, 5 Sep 2025 17:18:25 +0100 Message-ID: <20250905161830.37-3-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250905161830.37-1-alireza.sanaee@huawei.com> References: <20250905161830.37-1-alireza.sanaee@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Remove the use of cpu_node in the pr_info(). When of_cpu_node_to_id() fails, it may set a pointer, cpu_node, and the get_cpu_for_node() function uses th= at pointer to log further in the fail scenario. Also, change the structure to exit early in fail scenarios which will help enabling code unification that follows in this series. Reviewed-by: Jonathan Cameron Signed-off-by: Alireza Sanaee --- drivers/base/arch_topology.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 1037169abb45..6fafd86f608a 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -481,12 +481,13 @@ static int __init get_cpu_for_node(struct device_node= *node) return -1; =20 cpu =3D of_cpu_node_to_id(cpu_node); - if (cpu >=3D 0) - topology_parse_cpu_capacity(cpu_node, cpu); - else - pr_info("CPU node for %pOF exist but the possible cpu range is :%*pbl\n", - cpu_node, cpumask_pr_args(cpu_possible_mask)); + if (cpu < 0) { + pr_info("CPU node exist but the possible cpu range is :%*pbl\n", + cpumask_pr_args(cpu_possible_mask)); + return cpu; + } =20 + topology_parse_cpu_capacity(cpu_node, cpu); return cpu; } =20 --=20 2.43.0 From nobody Wed Sep 10 05:35:33 2025 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E97A7309F03; Fri, 5 Sep 2025 16:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089220; cv=none; b=UqZjZzPf36QCTqnHulPSJXC/aA/nH9zcwixzP6rkTg6TLkz3lJxgkj+XD5DqGapdewT/ZCYd0xDXo7U47MMDEXtj6CKTXuNiZzw04jCjNjh6vuTqwxUttTS+bm7oFJ5uPEXn/NkZMu9Pp5TLl3L5tFoQuPDh9kyYAIhJAg9kTGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089220; c=relaxed/simple; bh=g0c2Th4MPywjqWoMfjQxZfkoQutYHoteM3HnE467LTU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=O8FZp8GkimWAEkwsZr+QSi0tuBOZXIZ9pUhonAg3x5ZKsAKdUKJwoMDLnRdqym/FfItvHU4XSPl2x9BqpUqQp5JqrBuuWJ7SZw07lQiXyGlLcEXc+My4UgrEGP3nwNgiHLijy1VO0E7K9IVGBSvs4u4NjBjYamwFQQe0Wk3jtEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cJM0j1rRgz6L5FV; Sat, 6 Sep 2025 00:16:21 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id EEE7F14037D; Sat, 6 Sep 2025 00:20:15 +0800 (CST) Received: from a2303103017.china.huawei.com (10.202.66.105) by frapeml500003.china.huawei.com (7.182.85.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 5 Sep 2025 18:20:13 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , Subject: [PATCH v4 3/6] arch_topology: update CPU map to use of_cpu_phandle_to_id Date: Fri, 5 Sep 2025 17:18:26 +0100 Message-ID: <20250905161830.37-4-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250905161830.37-1-alireza.sanaee@huawei.com> References: <20250905161830.37-1-alireza.sanaee@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Refactor get_cpu_for_node to use of_cpu_phandle_to_id instead of of_cpu_node_to_id. Reviewed-by: Jonathan Cameron Signed-off-by: Alireza Sanaee --- drivers/base/arch_topology.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 6fafd86f608a..72bf23cdf469 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -474,20 +474,19 @@ static unsigned int max_smt_thread_num =3D 1; static int __init get_cpu_for_node(struct device_node *node) { int cpu; - struct device_node *cpu_node __free(device_node) =3D - of_parse_phandle(node, "cpu", 0); + struct device_node *cpu_node =3D NULL; =20 - if (!cpu_node) - return -1; - - cpu =3D of_cpu_node_to_id(cpu_node); - if (cpu < 0) { + cpu =3D of_cpu_phandle_to_id(node, &cpu_node, 0); + if (cpu =3D=3D -ENODEV) { pr_info("CPU node exist but the possible cpu range is :%*pbl\n", cpumask_pr_args(cpu_possible_mask)); return cpu; + } else if (cpu < 0) { + return -1; } =20 topology_parse_cpu_capacity(cpu_node, cpu); + of_node_put(cpu_node); return cpu; } =20 --=20 2.43.0 From nobody Wed Sep 10 05:35:33 2025 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B48D30216D; Fri, 5 Sep 2025 16:20:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089254; cv=none; b=Y9rb/H+GRid1vggJwl1M+vl8KGisaIYWuneb5pw6Ez0EeWnMSsmuf0f3RdyyG7eK5nMQTKRyYE0XSfsXcAV9xfyVorI3BTfzO2586wzFByh/fLdiUZDRfECPErCt2pBQkBeZSzryhyT2Bb2L+GHILt/GEwssX9nNmRAVEd7uu3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089254; c=relaxed/simple; bh=Js52YSrumg222yAKOftKRfB9QqbZxN8cV0XnR+M9QJ8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A1YE/lWWQDjVd+JlVqx8oPMm1FOIVhZgAZXMnkORF+eWTcOhq0aTY1mIhAa+J7sI0RP2Yyn8S+GiJLXYA80wOe3lDeKH4UxxuogHV+9Ssq4rF3dRXyYvk1wruYFHzOjsMf8/LsX5/gElb+hfL+JLycz9fb3r+tTVMv4T7k4Mq84= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cJM1M2lj6z6L5WT; Sat, 6 Sep 2025 00:16:55 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id 178001400D4; Sat, 6 Sep 2025 00:20:50 +0800 (CST) Received: from a2303103017.china.huawei.com (10.202.66.105) by frapeml500003.china.huawei.com (7.182.85.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 5 Sep 2025 18:20:47 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , Subject: [PATCH v4 4/6] coresight: cti: Use of_cpu_phandle_to_id for grabbing CPU id Date: Fri, 5 Sep 2025 17:18:27 +0100 Message-ID: <20250905161830.37-5-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250905161830.37-1-alireza.sanaee@huawei.com> References: <20250905161830.37-1-alireza.sanaee@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Use the newly created API (of_cpu_phandle_to_id) to grab CPU ID. Reviewed-by: Mike Leach Reviewed-by: Jonathan Cameron Signed-off-by: Alireza Sanaee --- .../hwtracing/coresight/coresight-cti-platform.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers= /hwtracing/coresight/coresight-cti-platform.c index d0ae10bf6128..2629962dbe3e 100644 --- a/drivers/hwtracing/coresight/coresight-cti-platform.c +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c @@ -41,18 +41,7 @@ */ static int of_cti_get_cpu_at_node(const struct device_node *node) { - int cpu; - struct device_node *dn; - - if (node =3D=3D NULL) - return -1; - - dn =3D of_parse_phandle(node, "cpu", 0); - /* CTI affinity defaults to no cpu */ - if (!dn) - return -1; - cpu =3D of_cpu_node_to_id(dn); - of_node_put(dn); + int cpu =3D of_cpu_phandle_to_id(node, NULL, 0); =20 /* No Affinity if no cpu nodes are found */ return (cpu < 0) ? -1 : cpu; --=20 2.43.0 From nobody Wed Sep 10 05:35:33 2025 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9DF7309EFE; Fri, 5 Sep 2025 16:21:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089287; cv=none; b=Q5NAC85Uo9W2DXu6fvOWU2wsual1XST9OADrv+mPRwa7JoA0i7ujjkVJ2ULPfbr/cxLmkK/OROqe5vz1jHETnfdnJuHA1tk/VebXG0t4BPgwlJzoMDWClDVvl90m+R8T4WlNZbFDlh0x/f62P0Dpvmb4NfsjpBRFBPW0JyraiNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089287; c=relaxed/simple; bh=JyGpkO5xvJ2CDutAEOuCOmU05rAt1Mc+tZrzmBhfD8k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KyMciW8LzXLb43DoN/0JQ8qZumT8GKPEIVEqOD3DgBs6IYp5toIfCvDcshWcOgBuKQxH6fUILdUkfGgTPFVpyJkEI9c3ZOutfXwx57cPCH66zT9+RCGguEHH94YxlOa4twN/4rlym3QsM2HW3lpVZo3MGoVQ6GiUnnEN6Jiig2c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cJM3c3GJKz6M51s; Sat, 6 Sep 2025 00:18:52 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id DFA4F140114; Sat, 6 Sep 2025 00:21:23 +0800 (CST) Received: from a2303103017.china.huawei.com (10.202.66.105) by frapeml500003.china.huawei.com (7.182.85.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 5 Sep 2025 18:21:21 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , Subject: [PATCH v4 5/6] coresight: Use of_cpu_phandle_to_id for grabbing CPU ID Date: Fri, 5 Sep 2025 17:18:28 +0100 Message-ID: <20250905161830.37-6-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250905161830.37-1-alireza.sanaee@huawei.com> References: <20250905161830.37-1-alireza.sanaee@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Use the newly created API (of_cpu_phandle_to_id) to grab CPU ID. Reviewed-by: Jonathan Cameron Reviewed-by: Mike Leach Signed-off-by: Alireza Sanaee --- drivers/hwtracing/coresight/coresight-platform.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwt= racing/coresight/coresight-platform.c index 0db64c5f4995..95d46ea08936 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -167,20 +167,7 @@ of_coresight_get_output_ports_node(const struct device= _node *node) =20 static int of_coresight_get_cpu(struct device *dev) { - int cpu; - struct device_node *dn; - - if (!dev->of_node) - return -ENODEV; - - dn =3D of_parse_phandle(dev->of_node, "cpu", 0); - if (!dn) - return -ENODEV; - - cpu =3D of_cpu_node_to_id(dn); - of_node_put(dn); - - return cpu; + return of_cpu_phandle_to_id(dev->of_node, NULL, 0); } =20 /* --=20 2.43.0 From nobody Wed Sep 10 05:35:33 2025 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6E2B30B536; Fri, 5 Sep 2025 16:21:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089321; cv=none; b=OSZdbkAMolI+9hfxOa2GCR01uppxF3d4LK1YHU3lL1Bf80ISPaaE7tsI2o16Nd7kye/SYR+8gG5VmQb2soLvjpSsXGzOcoDmszE+gL1AqTRxDMHycxA92Kdmy1AD9D4EQV0kAQuaaszRwqQ2D2goY5xav1nNEU2wZ+v+YfsJm8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757089321; c=relaxed/simple; bh=/d9BRwNVCUpXdCDeP2my7gaYCf/Bu+JCn8u7cOrc+Sk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mHxC5W7E/UIfJjY0WU79AwVjlzVq0gxbmJ6O+zmYe3uXTi0Fkq4JrC+5FFmK8rj/mR2KA55sy/Qvieet2xQ2ytj4zMpf4+ICemEbzNTSG8jGXzWSacksqqgVguLbRCz9MRlOJ/dkRRG7ZPeZSvZPxW6BgctikGZM9Pc/R8XS2tI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cJM4G4DCGz6M54Q; Sat, 6 Sep 2025 00:19:26 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id 08DC8140114; Sat, 6 Sep 2025 00:21:58 +0800 (CST) Received: from a2303103017.china.huawei.com (10.202.66.105) by frapeml500003.china.huawei.com (7.182.85.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 5 Sep 2025 18:21:55 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , Subject: [PATCH v4 6/6] perf/arm-dsu: refactor cpu id retrieval via new API of_cpu_phandle_to_id Date: Fri, 5 Sep 2025 17:18:29 +0100 Message-ID: <20250905161830.37-7-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250905161830.37-1-alireza.sanaee@huawei.com> References: <20250905161830.37-1-alireza.sanaee@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Update arm-dsu to use the new API (of_cpu_phandle_to_id). Reviewed-by: Jonathan Cameron Signed-off-by: Alireza Sanaee --- drivers/perf/arm_dsu_pmu.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c index cb4fb59fe04b..8f76bd94349c 100644 --- a/drivers/perf/arm_dsu_pmu.c +++ b/drivers/perf/arm_dsu_pmu.c @@ -591,17 +591,12 @@ static struct dsu_pmu *dsu_pmu_alloc(struct platform_= device *pdev) static int dsu_pmu_dt_get_cpus(struct device *dev, cpumask_t *mask) { int i =3D 0, n, cpu; - struct device_node *cpu_node; =20 n =3D of_count_phandle_with_args(dev->of_node, "cpus", NULL); if (n <=3D 0) return -ENODEV; for (; i < n; i++) { - cpu_node =3D of_parse_phandle(dev->of_node, "cpus", i); - if (!cpu_node) - break; - cpu =3D of_cpu_node_to_id(cpu_node); - of_node_put(cpu_node); + cpu =3D of_cpu_phandle_to_id(dev->of_node, NULL, i); /* * We have to ignore the failures here and continue scanning * the list to handle cases where the nr_cpus could be capped --=20 2.43.0