Message ID | 20240227062648.16579-1-raag.jadav@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-82744-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2563711dyb; Tue, 27 Feb 2024 00:31:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHsWzrMh0BZHMMdTkq+0p5uTPjazMEzmx2BcVQWYIVE1pfrM3wFj58DnE6B2nzKJvZRY9n1YwtoDZS6NbyztRk7d05+g== X-Google-Smtp-Source: AGHT+IGc+LYmM+rWCs62bABE/6AlGEuz18QNpB8y52wmgYTKRfau4umjMJawT+RPyoYcVcD6lV/Y X-Received: by 2002:a17:90a:eb04:b0:299:6c4a:c6dc with SMTP id j4-20020a17090aeb0400b002996c4ac6dcmr6912945pjz.27.1709022700119; Tue, 27 Feb 2024 00:31:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709022700; cv=pass; d=google.com; s=arc-20160816; b=ClsVPlIYTFJuuRC3cA2A8IFhFhbp/q+Z3cZvSo0j9UZhWpO1a2wE7Q75RdPUkaVCOm 2oN1CDSSKAGwRsA76EB1RacFzLdCZn+ughA3aFQnjDS0Fove8sRbpJJfdXcMmahPF5Mn /2sdQXZh8UhsVizC7W8gNwWp55V5iZRje1XFIigBk/oofqsnyDpXlgHqpVB4T6tn3l7Q j/bl1BvIwwFgD0Q+RE0sM31I7t8OQ5/EiAHge+fQPyYJgO8Vt/LKs4+yQXn+PrnFuKg2 u6P2dfHOAhbsVs6Pz89KL/71kWTBrj9hZl87QiyyIWAhJ/JUYEHy7n/x6HO1Rw12myjW h2vQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ePgoye2IrxAXdjsOMEZMvWqfczNLl/wjxRwVKXixIFs=; fh=x3WS+Q6X/QludSOZrJXyBe4LoWQAOYHjrtb9uL+RP3E=; b=f03B68dYBRZI0RQ99PfPcTy213h0KxGi3dT5CDnvAmafiUhCtcKDy7lvC/F1txPSMM k/x1LPf3Xbg69zBYHhqQX8RWanNMAAE2Fm1d+FJAyhO7bnCyyiVJF1371HhrCFtp37Qg LzvlDE1Y2euyclURG3dc4qQs5Upkyc0YQ++oqI7D72MAhuAWevKLfCdATSFPKZHlFcot wB1KpUvYoLGm0Q3BCwdLXE4AylinxDcZeLcb0+GvJfvSAlNAjF1SkJFJhi1WMo8EBvYB Dy30JqczPJVxLZH/RjKMe1MwinQHWqkc0/RsQn38/rV7VtuiReY0fDihNExUiFOEOaHL wtLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=A31c+58X; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82744-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82744-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id pg8-20020a17090b1e0800b0029aa7be81b1si4567893pjb.78.2024.02.27.00.31.39 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 00:31:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82744-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=A31c+58X; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82744-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82744-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B5BEDB23388 for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 06:27:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 625D5535A2; Tue, 27 Feb 2024 06:27:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="A31c+58X" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 EFC9C5336E; Tue, 27 Feb 2024 06:26:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709015219; cv=none; b=h6NWbzQWkHCfJPr+qUbi838oejYdg1PRXG7/FN2BMX2xpoMXri89mDdVrYmEv6Nkgu5cPSNPORx8qewq2ltz6Gl4mjdbTfOyR/JcmoUV3FJiZq97sbEX+cxg9I1Zn7wOiQT0QOvYDaRLPrtCG6iQ1SXeR3JPpwuGstb9RaWnZME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709015219; c=relaxed/simple; bh=l5lw8RkSxjpG2Io4jclpM5Y8NRE451hzHP+TAbY4jv8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ktBLrGR+ZMCK1FZbpDxncmYXiAGvbnLjIII1VAlu7GzavhLA5YQt/LDNb7skl7INaw9JRI0itQGsfn26Qm6EQDDlTe9LASaZglXo2QOYTCxhwvXi5rk+/pvDdxg7tPzARtBxM5mZ2T/a28/djFuhmQpy2JhuCv8kLf2Ot5TtYpI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=none smtp.mailfrom=ecsmtp.iind.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=A31c+58X; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ecsmtp.iind.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709015218; x=1740551218; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=l5lw8RkSxjpG2Io4jclpM5Y8NRE451hzHP+TAbY4jv8=; b=A31c+58X0uXKC9ygw6qcIVLetRr3AleUW9pFhimj0DzVzGP4nuDMlBJ7 ThIGzJDJTDfO7+oH1Uxh/hqzJwYKNLkXP8H9uYUQvDoYp3LpzxwYmx2La PETsnJ9jt/LOu/8o++Tp3pfnV+nxXZ/4u0LQxiQ4eQ6vxxAdpgmUQgDJv w6lyQiKy23SST8egem2wbYwpHZGZK7Izwt6xv1x3Ewz8uOumJMn29CI6n 0fYe9gDQSZInYcJLS6VaruP+/Rjd5P3nqz9HTwKiOjJj3o5hM7egsKSVL 9SOYkznoYDuIEAdHUS0KLLSmeSFK1MlXMKYTRlM5VyAkmBvfE4GPso/XT A==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="20785774" X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; d="scan'208";a="20785774" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 22:26:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; d="scan'208";a="37959670" Received: from inesxmail01.iind.intel.com ([10.223.57.40]) by fmviesa001.fm.intel.com with ESMTP; 26 Feb 2024 22:26:54 -0800 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 446AA1FCEF; Tue, 27 Feb 2024 11:56:53 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 3F0871600101; Tue, 27 Feb 2024 11:56:53 +0530 (IST) From: Raag Jadav <raag.jadav@intel.com> To: bhelgaas@google.com, jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com, stanislaw.gruszka@linux.intel.com, lukas@wunner.de, rafael@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, sashal@kernel.org, Raag Jadav <raag.jadav@intel.com> Subject: [PATCH v2] PCI / PM: Really allow runtime PM without callback functions Date: Tue, 27 Feb 2024 11:56:48 +0530 Message-Id: <20240227062648.16579-1-raag.jadav@intel.com> X-Mailer: git-send-email 2.35.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792040187191787451 X-GMAIL-MSGID: 1792040187191787451 |
Series |
[v2] PCI / PM: Really allow runtime PM without callback functions
|
|
Commit Message
Raag Jadav
Feb. 27, 2024, 6:26 a.m. UTC
Commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions") tried to eliminate the need for runtime PM callbacks by modifying pci_pm_runtime_suspend() and pci_pm_runtime_resume(), but didn't modify pci_pm_runtime_idle() with relevant changes, which still returns -ENOSYS if the driver supplies no runtime PM callbacks. Modify pci_pm_runtime_idle() such that it allows PCI device power state transitions without runtime PM callbacks and complete the original intention of commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions"). Signed-off-by: Raag Jadav <raag.jadav@intel.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> --- This is not marked for linux-stable for the need of extensive testing and can be backported after a few releases if no issues are reported. Changes since v1: - Update commit message and tags drivers/pci/pci-driver.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Comments
On Tue, Feb 27, 2024 at 11:56:48AM +0530, Raag Jadav wrote: > Commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback > functions") tried to eliminate the need for runtime PM callbacks by > modifying pci_pm_runtime_suspend() and pci_pm_runtime_resume(), but > didn't modify pci_pm_runtime_idle() with relevant changes, which still > returns -ENOSYS if the driver supplies no runtime PM callbacks. > > Modify pci_pm_runtime_idle() such that it allows PCI device power state > transitions without runtime PM callbacks and complete the original > intention of commit c5eb1190074c ("PCI / PM: Allow runtime PM without > callback functions"). > > Signed-off-by: Raag Jadav <raag.jadav@intel.com> > Acked-by: Rafael J. Wysocki <rafael@kernel.org> > Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Applied to pci/pm for v6.9, thanks! I updated the commit log to try to clarify which drivers would be affected. Now that I worked through those details, I see that it was all there from the beginning and it just took a long time to sink into my head: PCI/PM: Allow runtime PM with no PM callbacks at all Commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions") eliminated the need for PM callbacks in pci_pm_runtime_suspend() and pci_pm_runtime_resume(), but didn't do the same for pci_pm_runtime_idle(). Therefore, runtime suspend worked as long as the driver implemented at least one PM callback. But if the driver doesn't implement any PM callbacks at all (driver->pm is NULL), pci_pm_runtime_idle() returned -ENOSYS, which prevented runtime suspend. Modify pci_pm_runtime_idle() to allow PCI device power state transitions without runtime PM callbacks and complete the original intention of commit c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions"). Bjorn > --- > > This is not marked for linux-stable for the need of extensive testing > and can be backported after a few releases if no issues are reported. > > Changes since v1: > - Update commit message and tags > > drivers/pci/pci-driver.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c > index 51ec9e7e784f..bb7f6775b350 100644 > --- a/drivers/pci/pci-driver.c > +++ b/drivers/pci/pci-driver.c > @@ -1382,10 +1382,7 @@ static int pci_pm_runtime_idle(struct device *dev) > if (!pci_dev->driver) > return 0; > > - if (!pm) > - return -ENOSYS; > - > - if (pm->runtime_idle) > + if (pm && pm->runtime_idle) > return pm->runtime_idle(dev); > > return 0; > -- > 2.35.3 >
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 51ec9e7e784f..bb7f6775b350 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1382,10 +1382,7 @@ static int pci_pm_runtime_idle(struct device *dev) if (!pci_dev->driver) return 0; - if (!pm) - return -ENOSYS; - - if (pm->runtime_idle) + if (pm && pm->runtime_idle) return pm->runtime_idle(dev); return 0;