From nobody Tue Oct 7 18:27:28 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 8B7062E1749; Mon, 7 Jul 2025 15:04:53 +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=1751900695; cv=none; b=JAzs2wNB7nKTOGkRQB465tlJFJIeTRO6Guz9G0NzUlDBT57+WDcijlcn5a8b61fZ+1Bvd4lI5xatnQ9C6X+5x5srjdxnYPH9TdcL48NSq9d7G1Ceg1lFNjTjJP14jwQBVbBjcOxlnwtts1cumbxqONIJ6ymWplkuiuSqvP/sKtw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751900695; c=relaxed/simple; bh=qW6c4cXBpy27pTzjlV7fPFCXJDDh+QL/T7HwntT+BCM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ik2Ifjh3tRkN6m1frIbTfcRAj4dhIO2kFzf5tpxe+gO5LWnTfOEGDTpC5rp4QHPSz/k5A5fWqzVXJ1BsjaLwnPL8LM+o3l5y5z2bLowflD87XM+drB0kgIP3onDRSqh0Lh9IoGR2q6Rf75+zUbdE36nc6fO9pIJhPf/+Lbi4Yj8= 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 4bbSBG4Nw9z6L5PX; Mon, 7 Jul 2025 23:01:42 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id 9A5AC1402EE; Mon, 7 Jul 2025 23:04:49 +0800 (CST) Received: from a2303103017.china.huawei.com (10.45.147.207) 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; Mon, 7 Jul 2025 17:04:48 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , , Subject: [PATCH 1/5] of: add infra for finding CPU id from phandle Date: Mon, 7 Jul 2025 16:04:10 +0100 Message-ID: <20250707150414.620-2-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250707150414.620-1-alireza.sanaee@huawei.com> References: <20250707150414.620-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: lhrpeml100004.china.huawei.com (7.191.162.219) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Get CPU id from phandle. Many drivers get do this by getting hold of CPU node first through a phandle and then find the CPU ID using the relevant function. This commit encapsulates cpu node finding and improves readability. The API interface requires two parameters, 1) node, 2) pointer to CPU node. API sets the pointer to the CPU node and allows the driver to play with the CPU itself, for logging purposes for instance. Signed-off-by: Alireza Sanaee --- drivers/of/cpu.c | 29 +++++++++++++++++++++++++++++ include/linux/of.h | 9 +++++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/of/cpu.c b/drivers/of/cpu.c index 5214dc3d05ae..fba17994fc20 100644 --- a/drivers/of/cpu.c +++ b/drivers/of/cpu.c @@ -173,6 +173,35 @@ 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. + * + * Return: The logical CPU number of the given CPU device_node or -ENODEV = if + * the CPU is not found, or if the node is NULL, it returns -1. On success, + * cpu_np will always point to the retrieved CPU device_node with refcount + * incremented, use of_node_put() on it when done. + */ +int of_cpu_phandle_to_id(const struct device_node *node, + struct device_node **cpu_np, + uint8_t cpu_idx) +{ + if (!node) + return -1; + + *cpu_np =3D of_parse_phandle(node, "cpu", 0); + if (!*cpu_np) + *cpu_np =3D of_parse_phandle(node, "cpus", cpu_idx); + if (!*cpu_np) + return -ENODEV; + + return of_cpu_node_to_id(*cpu_np); +} +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 eaf0e2a2b75c..194f1cb0f6c6 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -360,6 +360,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); @@ -662,6 +664,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 Tue Oct 7 18:27:28 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 3B1372E1C4B; Mon, 7 Jul 2025 15:05:23 +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=1751900725; cv=none; b=mGzi9XDhFs3GKXfZp+iGaNt5aJmn09AVxJEtT72GO02COdbWMUyVR9sGQuoehqDz/bpUUaWTqZKeArnyaBiJV36UAce/UNeglRZXhx/YMKfFnCQ1TJ8hx2ZD2oc091sTTPlMm/R/4hBWRTnDTa1tAg6uoKIMGUX5/jWg4PwfsOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751900725; c=relaxed/simple; bh=s59jpVjk6bCYLsdjwErbMXBke/9ifSwvoQ4+TdLuE0g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WL1M4RElf8p2yV4AVH1NpnoncWt1o7nJRAC86oCKG7Lv3m2YxRR6PtuUQ9dAebY3iwMRIJjEnSQ5EUXJIRoIVJFcZQB17QdYDTWDSqCpwNMfHi+Af6mEuFDRTenqV3iCii90XWmxOaCmJiWPBZ+yOts2cBqpjZPdk1Xa7AtHxX8= 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 4bbSFH2yw5z6M4Th; Mon, 7 Jul 2025 23:04:19 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id 0B2051402EB; Mon, 7 Jul 2025 23:05:22 +0800 (CST) Received: from a2303103017.china.huawei.com (10.45.147.207) 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; Mon, 7 Jul 2025 17:05:20 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , , Subject: [PATCH 2/5] arch_topology: update CPU map to use the new API Date: Mon, 7 Jul 2025 16:04:11 +0100 Message-ID: <20250707150414.620-3-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250707150414.620-1-alireza.sanaee@huawei.com> References: <20250707150414.620-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: lhrpeml100004.china.huawei.com (7.191.162.219) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Cleans up the cpu-map generation using the created API. Signed-off-by: Alireza Sanaee --- drivers/base/arch_topology.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 3ebe77566788..88970f13f684 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -518,23 +518,23 @@ core_initcall(free_raw_capacity); */ static int __init get_cpu_for_node(struct device_node *node) { + struct device_node *cpu_node __free(device_node) =3D NULL; int cpu; - struct device_node *cpu_node __free(device_node) =3D - of_parse_phandle(node, "cpu", 0); =20 - if (!cpu_node) - return -1; + cpu =3D of_cpu_phandle_to_id(node, &cpu_node, 0); =20 - cpu =3D of_cpu_node_to_id(cpu_node); if (cpu >=3D 0) topology_parse_cpu_capacity(cpu_node, cpu); - else + else if (cpu =3D=3D -ENODEV) pr_info("CPU node for %pOF exist but the possible cpu range is :%*pbl\n", cpu_node, cpumask_pr_args(cpu_possible_mask)); + else + return -1; =20 return cpu; } =20 + static int __init parse_core(struct device_node *core, int package_id, int cluster_id, int core_id) { --=20 2.43.0 From nobody Tue Oct 7 18:27:28 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 871712BE028; Mon, 7 Jul 2025 15:05:56 +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=1751900758; cv=none; b=fwNf2SWvtoeEKwo2z5MSCyROJZObOmnl8dBSWZCZAoT5NwKD44gYIj5nOWpIX1p4A/Sr7V1bIfylGk2OSY9dG+M5sJud4dKY+X5gUguWd+ZT+BEAC6zsDU1H21P0tcVfzzWjedYPY51lc1mvDZ6rWJwFlKgBneXeopdS99zaN1w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751900758; c=relaxed/simple; bh=iDwkRX2eP1hRCtLn7y1aGD0KGq4pnNUc5ZgEOOJmnAM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h202iaBuk3gfvpet08KNJmD8J9AeF2txfbSULe5A/lkvObGtLftlfwS7IaHFqztluVkHNjKGf55abwQVfmriFUxBLgWaBaYZbZmoZ1872qJ1+XuDccrbQSKz/YRBKIJ5jlGI6j78rMyonoTRjlKsMIGyHnG9Hgc78HMtExAXsfM= 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 4bbSCW3kptz6L5PT; Mon, 7 Jul 2025 23:02:47 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id 815AB1402EB; Mon, 7 Jul 2025 23:05:54 +0800 (CST) Received: from a2303103017.china.huawei.com (10.45.147.207) 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; Mon, 7 Jul 2025 17:05:53 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , , Subject: [PATCH 3/5] coresight: cti: Use of_cpu_phandle_to_id for grabbing CPU id Date: Mon, 7 Jul 2025 16:04:12 +0100 Message-ID: <20250707150414.620-4-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250707150414.620-1-alireza.sanaee@huawei.com> References: <20250707150414.620-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: lhrpeml100004.china.huawei.com (7.191.162.219) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Use the newly created API to grab CPU id. Signed-off-by: Alireza Sanaee --- .../hwtracing/coresight/coresight-cti-platform.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-cti-platform.c b/drivers= /hwtracing/coresight/coresight-cti-platform.c index d0ae10bf6128..cd821e926792 100644 --- a/drivers/hwtracing/coresight/coresight-cti-platform.c +++ b/drivers/hwtracing/coresight/coresight-cti-platform.c @@ -41,21 +41,12 @@ */ static int of_cti_get_cpu_at_node(const struct device_node *node) { + struct device_node *dn =3D NULL; int cpu; - struct device_node *dn; =20 - 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); + cpu =3D of_cpu_phandle_to_id(node, &dn, 0); of_node_put(dn); - - /* No Affinity if no cpu nodes are found */ - return (cpu < 0) ? -1 : cpu; + return cpu; } =20 #else --=20 2.43.0 From nobody Tue Oct 7 18:27:28 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 224392E1C7A; Mon, 7 Jul 2025 15:06:28 +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=1751900790; cv=none; b=JSxFUsp7JyvhT7m68klNqka+fVqWs1HzeGIy6VUP9nYkt5rkQXphZAHGvBZDcg8+6mckuHyJiYUzUiAqBwUrsw7nQxlq9CqgQfczaonazMJKvA5kdFVApiHn6kfwRyAOBYWC16sIe8uONhsXwDm/3180+2cbvnIOEl+lpP7j2F4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751900790; c=relaxed/simple; bh=rlDNHVyVjrqIUDiW73UeFuBXyf2zoFO3tJzsYIf1cBg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=X0y5uytLKx1gLd4izKo7ySo/r67DFwfFKiVzgJA7qcceXsOKRZcUFhiGxZ9KR5lzL2CKzTAVlHyIGxbZGhbWJsrnCcMq1E4cXzBdpARB+LxHQjLTo45gj32N6iWIs4s2j7hCqz2BUXxowAMi+CBY5PhKbA18g+d+BENsoTvm2dk= 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 4bbSGX3km3z6M4qT; Mon, 7 Jul 2025 23:05:24 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id 24F9F1402EB; Mon, 7 Jul 2025 23:06:27 +0800 (CST) Received: from a2303103017.china.huawei.com (10.45.147.207) 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; Mon, 7 Jul 2025 17:06:25 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , , Subject: [PATCH 4/5] coresight: Use of_cpu_phandle_to_id for grabbing CPU id Date: Mon, 7 Jul 2025 16:04:13 +0100 Message-ID: <20250707150414.620-5-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250707150414.620-1-alireza.sanaee@huawei.com> References: <20250707150414.620-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: lhrpeml100004.china.huawei.com (7.191.162.219) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Use the newly created API to grab CPU id. Signed-off-by: Alireza Sanaee --- drivers/hwtracing/coresight/coresight-platform.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwt= racing/coresight/coresight-platform.c index 8192ba3279f0..f032fdbe959b 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -167,19 +167,9 @@ 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); + struct device_node *dn =3D NULL; + int cpu =3D of_cpu_phandle_to_id(dev->of_node, &dn, 0); of_node_put(dn); - return cpu; } =20 --=20 2.43.0 From nobody Tue Oct 7 18:27:28 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 4000D28A719; Mon, 7 Jul 2025 15:07:01 +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=1751900822; cv=none; b=mH3c/5Je2+qa8/UlXejvo4R+Wlqj9/Q746Kc1AW6p2zm81unai24okeVRbZ8hQ6zF+UgO51cjVu7fezeaBmim177t3Mtil/+Za0FvugYHvxwwDjyUTxqf5Y0nTcYr5bkZKdWxGQoptScBtnulzVX2sSLIchLw5MffvkRALWNfAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751900822; c=relaxed/simple; bh=a3tFfaUC5nwZzL3kNsozkXk8L0sG9BajuGncdWLpSW0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VOpkWYsthrXMbLv88iNrJP3772U7xYTXKHbAM2uBePBpVjv7C3/ysD39IRt1P4PMUKgD4YvK0g4uxVP8tG+NwlSmPMbh5Vw1drjY0inbfy2+gItjfE08j9FgrwvCbPjwAg3lzX7P1W+T3rbrb6MUUheojx8+WTrhw430a7Jbvbc= 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 4bbSHX6MYYz6G93x; Mon, 7 Jul 2025 23:06:16 +0800 (CST) Received: from frapeml500003.china.huawei.com (unknown [7.182.85.28]) by mail.maildlp.com (Postfix) with ESMTPS id 57F551402EE; Mon, 7 Jul 2025 23:06:59 +0800 (CST) Received: from a2303103017.china.huawei.com (10.45.147.207) 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; Mon, 7 Jul 2025 17:06:57 +0200 From: Alireza Sanaee To: , CC: , , , , , , , , , , , , , , Subject: [PATCH 5/5] perf/arm-dsu: refactor cpu id retrieval via new API of_cpu_phandle_to_id Date: Mon, 7 Jul 2025 16:04:14 +0100 Message-ID: <20250707150414.620-6-alireza.sanaee@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250707150414.620-1-alireza.sanaee@huawei.com> References: <20250707150414.620-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: lhrpeml100004.china.huawei.com (7.191.162.219) To frapeml500003.china.huawei.com (7.182.85.28) Content-Type: text/plain; charset="utf-8" Update arm-dsu to use the new API, where both "cpus" and "cpu" properties are supported. Signed-off-by: Alireza Sanaee --- drivers/perf/arm_dsu_pmu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c index cb4fb59fe04b..7ef204d39173 100644 --- a/drivers/perf/arm_dsu_pmu.c +++ b/drivers/perf/arm_dsu_pmu.c @@ -596,11 +596,9 @@ static int dsu_pmu_dt_get_cpus(struct device *dev, cpu= mask_t *mask) 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); + cpu =3D of_cpu_phandle_to_id(dev->of_node, &cpu_node, i); of_node_put(cpu_node); /* * We have to ignore the failures here and continue scanning --=20 2.43.0