{"id":2225642,"url":"http://patchwork.ozlabs.org/api/patches/2225642/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260421104102.12322-1-manivannan.sadhasivam@oss.qualcomm.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260421104102.12322-1-manivannan.sadhasivam@oss.qualcomm.com>","list_archive_url":null,"date":"2026-04-21T10:41:01","name":"PCI/pwrctrl: Do not try to power on/off devices that don't need pwrctrl","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"89e2a4efed238f8a3b7b0226e943b4b4bc38981f","submitter":{"id":91273,"url":"http://patchwork.ozlabs.org/api/people/91273/?format=json","name":"Manivannan Sadhasivam","email":"manivannan.sadhasivam@oss.qualcomm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260421104102.12322-1-manivannan.sadhasivam@oss.qualcomm.com/mbox/","series":[{"id":500777,"url":"http://patchwork.ozlabs.org/api/series/500777/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=500777","date":"2026-04-21T10:41:01","name":"PCI/pwrctrl: Do not try to power on/off devices that don't need pwrctrl","version":1,"mbox":"http://patchwork.ozlabs.org/series/500777/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2225642/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2225642/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-52832-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=jHMQysYi;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=RFjjlVLp;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-52832-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com\n header.b=\"jHMQysYi\";\n\tdkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.b=\"RFjjlVLp\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=205.220.180.131","smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=oss.qualcomm.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0JpW2Y5Jz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 20:42:43 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id C4BD23026AB3\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 10:41:16 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 0F4033BD226;\n\tTue, 21 Apr 2026 10:41:16 +0000 (UTC)","from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com\n [205.220.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 672493BAD9A\n\tfor <linux-pci@vger.kernel.org>; Tue, 21 Apr 2026 10:41:13 +0000 (UTC)","from pps.filterd (m0279870.ppops.net [127.0.0.1])\n\tby mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63L9Xa113164809\n\tfor <linux-pci@vger.kernel.org>; Tue, 21 Apr 2026 10:41:11 GMT","from mail-pl1-f200.google.com (mail-pl1-f200.google.com\n [209.85.214.200])\n\tby mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dp6q807sc-1\n\t(version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n\tfor <linux-pci@vger.kernel.org>; Tue, 21 Apr 2026 10:41:11 +0000 (GMT)","by mail-pl1-f200.google.com with SMTP id\n d9443c01a7336-2b24e9b4d82so45584625ad.1\n        for <linux-pci@vger.kernel.org>; Tue, 21 Apr 2026 03:41:11 -0700 (PDT)","from work ([2401:4900:88dd:5c65:716c:532d:3c:8f17])\n        by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b5faa16e72sm130773195ad.19.2026.04.21.03.41.06\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Tue, 21 Apr 2026 03:41:09 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776768075; cv=none;\n b=oiGXPejzKFfih3h6JnT0kc+mnmIONh0URACgX1/Q1B7E5Zdltsk7T1g604Wsov4yJ2AMJbx/uwQSvaf+8r8FyxZqEBcnbHSX2T+kRQNNHT+UMOEhAeJ4cuyftDNzi+BPLnsCm4zHe+YGRXqsqeOJv2Y6wewChGzHFm/5kAap8xI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776768075; c=relaxed/simple;\n\tbh=3T6+QI78/DD1AJxoS8WlDilNMixKlSD+OZgss0C6ukc=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=OWdnVyxDUVRAzITQRpwnl4HFIplErFjI9XYNiQL8iEeqN3wZTW04EB7mbie2qfHRhC/Tv/0bkfp75nTQcXGKu0p+mxc8MyPNUvNAxUxKszP401Aj/aX/ZByrGBge5o36FGDpf8wO421bCkzluRU8wASEurpWeltUN/fujv+SRKw=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com;\n spf=pass smtp.mailfrom=oss.qualcomm.com;\n dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com\n header.b=jHMQysYi;\n dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.b=RFjjlVLp; arc=none smtp.client-ip=205.220.180.131","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=\n\tcc:content-transfer-encoding:date:from:message-id:mime-version\n\t:subject:to; s=qcppdkim1; bh=epLO+YivtnmARNN/OXhc4OMjCefXGyiYVQ3\n\tB/j6RVzg=; b=jHMQysYifGiWQm2BMelg3xYXANfkEa6oY9PC0AgmclPGZinCMvx\n\t+ruZr0YGUuKpkej9AllSFlTUeg2iBG5Hyak+VA9RqZZYuGYlOs8UiXSFOdseVL+B\n\tsycBJqSFiwEc3cpCp8JCGA2grRLTow5pd0BegmaKIvJAUdIrWgtfzVmry/ag3Idb\n\tDtgwrRYYlWK0yj8XC4mRYeNMDByTBqVnaYUj4a5QMYpQfwJ8BBK5W2CTYaoz5FS5\n\tZc0FmZ6px08xvYeKfm7lJLEldb7mUz9IVimP5GwWJ+pRVt3GSu4oTiAbURUkXpuT\n\tNDhXAwnwbb7gOaGyR6fFB+BRq3MgJWj0u4g==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=oss.qualcomm.com; s=google; t=1776768071; x=1777372871;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=epLO+YivtnmARNN/OXhc4OMjCefXGyiYVQ3B/j6RVzg=;\n        b=RFjjlVLp6t2ocRLitOpkO0PL1/+cd6506reI1sf/43klF+6yUsNuAGD9KXC3yBnXPb\n         uA1gTmfR31eXtN9Guc9KvCV5nzqrugZzVxfSVzLwsxVhnLviyjiZ7HysRr+yPeoJ+cl2\n         4LwRud4jCOeM2zexyGzPC08yyT5w0ywuc5cR5m4TTTGtTbDdH8kQcJXFhPY94evFmb6H\n         8/3EjvW6oqHUsE3m6bX8enMDE+Q7REfEH3y2ldHwlXYG/ZbKQ+xwk1gJrNGA+nv4PPQj\n         PNiuicSUkjm31uIzM7BMzkDTCxLwycOAhlQmE+y6aHdVLWSGv1KXyifnsAP72LI4JP7C\n         6goQ=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1776768071; x=1777372871;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=epLO+YivtnmARNN/OXhc4OMjCefXGyiYVQ3B/j6RVzg=;\n        b=N3qVM1hBrVtTTS7NAQy6DAcuGVK14pjX2mfnQCinWfcav7/PWS1KBImHWmC1zrllKm\n         p6xRcKREAMacHcxBJKxdT42s1n/QoAnDxC2xIQvagW+wSKDuDqLYkg0Bpnha6NfyYA5Z\n         hyHiVH59l0sF3EEvyOxZTAXFxvJF5tVBvzwpdIbi3TdbAa7P8jRG60SaUfjkNa5YMYkK\n         9fwLsDLRnC3FTOiQhxLQuVqp9ZUau+DjFpEPS9c96CeXf7i7HewMAJiHqnfEp9QVb0BW\n         k5ZXC38QZfqdCgTyBWbP8/RA4iyysiKeiu/jMa1qMVJyHiYf8MMVjGJIHWdsXqEywVJJ\n         twlA==","X-Gm-Message-State":"AOJu0Yw5FdjLHpo3TMRTRI3QprmYRvI2RCHbfzts5xJnrnyG/ebo4hWm\n\taZuykNCHA9ldjgZRwq2LZXViJOrspLhPqpyc0OGyLgm7YEM5NIzadN2ySsvdN+dXfrhyTqGTX1T\n\t5JAiTQvzryXbdQ4/0SdTuV0RzGvkLmle18JzbhwQGuWEFXj1zqUEsBuc5vwm90f4=","X-Gm-Gg":"AeBDievx79abNCkN83bOXpdMOs/eY9DqVOdlRpjvbBHWa9AmcyadhzTXLwbBMSB1XoR\n\tpWuhZZFRhHT/bB0g6R02b5IVb8iB1qgCdOoef0qPFtTl3C+d+6qyqakW9IEY5/mI+T9dTJlrcyh\n\tTxtPPCddC73YuJTyKqyfA9oKNM2ReA8GkY5n/BXfAFtIw6jrPoXoUdELz5kAp2TjoOoRpt73Bw2\n\tbnb7Uw2GilumTBmNqrHRLtBzkBZmNfnCAS0XtuNmhT3ij/aKjhinx4NmAj+becSJ7oZw7L+ZENf\n\tiiFpsHWjW7AG/a6s6u8l0lQ/91Qkxs0PWEDo5Mc40W1Q0/IZFno+I5CR6ixfKYXFmpvPVfQ28iQ\n\tOSH/+9wcUoWIvoj1Pnvw/qsvYUnfHX1vPDjgbRes4ar9wTNiHBw==","X-Received":["by 2002:a17:903:a4f:b0:2aa:e47d:e3b with SMTP id\n d9443c01a7336-2b5f9cb21dbmr106336065ad.0.1776768070546;\n        Tue, 21 Apr 2026 03:41:10 -0700 (PDT)","by 2002:a17:903:a4f:b0:2aa:e47d:e3b with SMTP id\n d9443c01a7336-2b5f9cb21dbmr106335835ad.0.1776768069969;\n        Tue, 21 Apr 2026 03:41:09 -0700 (PDT)"],"From":"Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>","To":"brgl@kernel.org, bhelgaas@google.com","Cc":"linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,\n        Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,\n        Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>","Subject":"[PATCH] PCI/pwrctrl: Do not try to power on/off devices that don't\n need pwrctrl","Date":"Tue, 21 Apr 2026 16:11:01 +0530","Message-ID":"<20260421104102.12322-1-manivannan.sadhasivam@oss.qualcomm.com>","X-Mailer":"git-send-email 2.51.0","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Proofpoint-Spam-Details-Enc":"AW1haW4tMjYwNDIxMDEwNSBTYWx0ZWRfX4sj8h1jWxino\n npXVEnl9JQWIjW3RbqIuXxMPQnb9d2AN2ov+7r0u21f/dSl8e8+GgXYpoCEt5gcYjGWnjqmeBfY\n h4D8f/XaJuUA6eqVm03VE8GEM7RM1XuoPsaxl0bIYZSZILayHpr1fFk/vj0XiehqY4kEsya6Hyt\n 475FEbLeGz1JRQNbBMbo5Bws6V2QTYEM55yitgP/YFgmmIM0Lp1XBPEli0oRQHLp8XVIY9sdGsD\n wwG9laKmOq0OvSc4SMqjGWIcZLap11UnxoC5kzh6Zj+LAlmYDTb0SbXdf85tyDiQz+nC0DxI9ii\n DXEgSsV9PH1UH5+0ZCpSY4VJdOSYoOuKqTuUHgt36QRtuodf5PRNS5ESDoU9ERjMAztC3ulT2yt\n hQ+VTDiKAedXpvZRYCiD/Dhy48J2ew2cBFnN8Mz69QUD4yxqiD4BS9ZmPxxsQ5hjlCWjkwAACA/\n e6C44bSVlSc3FJX1prQ==","X-Proofpoint-ORIG-GUID":"cph2Ulaxybd99y2jHIzyvafCIDsl9Add","X-Authority-Analysis":"v=2.4 cv=eOYjSnp1 c=1 sm=1 tr=0 ts=69e75447 cx=c_pps\n a=IZJwPbhc+fLeJZngyXXI0A==:117 a=AWw1AI1ujJ3qdC1c:21 a=xqWC_Br6kY4A:10\n a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22\n a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8\n a=CVC7yXooD7wFAggVErgA:9 a=uG9DUKGECoFWVXl0Dc02:22","X-Proofpoint-GUID":"cph2Ulaxybd99y2jHIzyvafCIDsl9Add","X-Proofpoint-Virus-Version":"vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-21_02,2026-04-20_02,2025-10-01_01","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n priorityscore=1501 spamscore=0 phishscore=0 impostorscore=0 malwarescore=0\n bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604210105"},"content":"pci_pwrctrl_is_required() is used to detect whether a device really\nneeds the PCI pwrctrl support or not. It is currently used in\npci_pwrctrl_create_device(), but not in pci_pwrctrl_power_{on/off}_device()\nAPIs. This leads to pwrctrl core trying to power on/off the incompatible\ndevices like USB hub downstream ports defined in DT.\n\nHence, add this check to prevent pwrctrl core from poking at wrong\ndevices. For this purpose, move the pci_pwrctrl_is_required() helper\ndefinition to the top.\n\nFixes: b35cf3b6aa1e (\"PCI/pwrctrl: Add APIs to power on/off pwrctrl devices\")\nReported-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>\nSigned-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>\n---\n drivers/pci/pwrctrl/core.c | 90 ++++++++++++++++++++------------------\n 1 file changed, 48 insertions(+), 42 deletions(-)","diff":"diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c\nindex 97cff5b8ca88..b5a0a14d316e 100644\n--- a/drivers/pci/pwrctrl/core.c\n+++ b/drivers/pci/pwrctrl/core.c\n@@ -139,6 +139,48 @@ int devm_pci_pwrctrl_device_set_ready(struct device *dev,\n }\n EXPORT_SYMBOL_GPL(devm_pci_pwrctrl_device_set_ready);\n \n+/*\n+ * Check whether the pwrctrl device really needs to be created or not. The\n+ * pwrctrl device will only be created if the node satisfies below requirements:\n+ *\n+ * 1. Presence of compatible property with \"pci\" prefix to match against the\n+ *    pwrctrl driver (AND)\n+ * 2. At least one of the power supplies defined in the devicetree node of the\n+ *    device (OR) in the remote endpoint parent node to indicate pwrctrl\n+ *    requirement.\n+ */\n+static bool pci_pwrctrl_is_required(struct device_node *np)\n+{\n+\tstruct device_node *endpoint;\n+\tconst char *compat;\n+\tint ret;\n+\n+\tret = of_property_read_string(np, \"compatible\", &compat);\n+\tif (ret < 0)\n+\t\treturn false;\n+\n+\tif (!strstarts(compat, \"pci\"))\n+\t\treturn false;\n+\n+\tif (of_pci_supply_present(np))\n+\t\treturn true;\n+\n+\tif (of_graph_is_present(np)) {\n+\t\tfor_each_endpoint_of_node(np, endpoint) {\n+\t\t\tstruct device_node *remote __free(device_node) =\n+\t\t\t\tof_graph_get_remote_port_parent(endpoint);\n+\t\t\tif (remote) {\n+\t\t\t\tif (of_pci_supply_present(remote)) {\n+\t\t\t\t\tof_node_put(endpoint);\n+\t\t\t\t\treturn true;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\treturn false;\n+}\n+\n static int __pci_pwrctrl_power_off_device(struct device *dev)\n {\n \tstruct pci_pwrctrl *pwrctrl = dev_get_drvdata(dev);\n@@ -157,6 +199,9 @@ static void pci_pwrctrl_power_off_device(struct device_node *np)\n \tfor_each_available_child_of_node_scoped(np, child)\n \t\tpci_pwrctrl_power_off_device(child);\n \n+\tif (!pci_pwrctrl_is_required(np))\n+\t\treturn;\n+\n \tpdev = of_find_device_by_node(np);\n \tif (!pdev)\n \t\treturn;\n@@ -213,6 +258,9 @@ static int pci_pwrctrl_power_on_device(struct device_node *np)\n \t\t\treturn ret;\n \t}\n \n+\tif (!pci_pwrctrl_is_required(np))\n+\t\treturn 0;\n+\n \tpdev = of_find_device_by_node(np);\n \tif (!pdev)\n \t\treturn 0;\n@@ -268,48 +316,6 @@ int pci_pwrctrl_power_on_devices(struct device *parent)\n }\n EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices);\n \n-/*\n- * Check whether the pwrctrl device really needs to be created or not. The\n- * pwrctrl device will only be created if the node satisfies below requirements:\n- *\n- * 1. Presence of compatible property with \"pci\" prefix to match against the\n- *    pwrctrl driver (AND)\n- * 2. At least one of the power supplies defined in the devicetree node of the\n- *    device (OR) in the remote endpoint parent node to indicate pwrctrl\n- *    requirement.\n- */\n-static bool pci_pwrctrl_is_required(struct device_node *np)\n-{\n-\tstruct device_node *endpoint;\n-\tconst char *compat;\n-\tint ret;\n-\n-\tret = of_property_read_string(np, \"compatible\", &compat);\n-\tif (ret < 0)\n-\t\treturn false;\n-\n-\tif (!strstarts(compat, \"pci\"))\n-\t\treturn false;\n-\n-\tif (of_pci_supply_present(np))\n-\t\treturn true;\n-\n-\tif (of_graph_is_present(np)) {\n-\t\tfor_each_endpoint_of_node(np, endpoint) {\n-\t\t\tstruct device_node *remote __free(device_node) =\n-\t\t\t\tof_graph_get_remote_port_parent(endpoint);\n-\t\t\tif (remote) {\n-\t\t\t\tif (of_pci_supply_present(remote)) {\n-\t\t\t\t\tof_node_put(endpoint);\n-\t\t\t\t\treturn true;\n-\t\t\t\t}\n-\t\t\t}\n-\t\t}\n-\t}\n-\n-\treturn false;\n-}\n-\n static int pci_pwrctrl_create_device(struct device_node *np,\n \t\t\t\t     struct device *parent)\n {\n","prefixes":[]}