linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] PCI/PM: Fix D2 transition delay
@ 2020-09-29 19:47 Bjorn Helgaas
  2020-09-29 19:47 ` [PATCH 1/2] PCI/PM: Remove unused PCI_PM_BUS_WAIT Bjorn Helgaas
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2020-09-29 19:47 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-kernel, Rafael J . Wysocki, Krzysztof Wilczyński,
	Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Remove an unused #define.

Fix the D2 transition delay.  I changed this a year ago to conform to the
PCIe r5.0 spec, but I think the number I relied on is a typo in the spec.
I asked the PCI-SIG to fix the typo.  Hopefully I'll get a response before
the merge window.

Bjorn Helgaas (2):
  PCI/PM: Remove unused PCI_PM_BUS_WAIT
  PCI/PM: Revert "PCI/PM: Apply D2 delay as milliseconds, not
    microseconds"

 drivers/pci/pci.c | 2 +-
 drivers/pci/pci.h | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] PCI/PM: Remove unused PCI_PM_BUS_WAIT
  2020-09-29 19:47 [PATCH 0/2] PCI/PM: Fix D2 transition delay Bjorn Helgaas
@ 2020-09-29 19:47 ` Bjorn Helgaas
  2020-09-29 19:47 ` [PATCH 2/2] PCI/PM: Revert "PCI/PM: Apply D2 delay as milliseconds, not microseconds" Bjorn Helgaas
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2020-09-29 19:47 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-kernel, Rafael J . Wysocki, Krzysztof Wilczyński,
	Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

476e7faefc43 ("PCI PM: Do not wait for buses in B2 or B3 during resume")
removed the last use of PCI_PM_BUS_WAIT.  Remove the definition as well.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 8d492669ecfd..f0a9cbe01bc7 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -46,7 +46,6 @@ int pci_bus_error_reset(struct pci_dev *dev);
 #define PCI_PM_D2_DELAY         200
 #define PCI_PM_D3HOT_WAIT       10
 #define PCI_PM_D3COLD_WAIT      100
-#define PCI_PM_BUS_WAIT         50
 
 /**
  * struct pci_platform_pm_ops - Firmware PM callbacks
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] PCI/PM: Revert "PCI/PM: Apply D2 delay as milliseconds, not microseconds"
  2020-09-29 19:47 [PATCH 0/2] PCI/PM: Fix D2 transition delay Bjorn Helgaas
  2020-09-29 19:47 ` [PATCH 1/2] PCI/PM: Remove unused PCI_PM_BUS_WAIT Bjorn Helgaas
@ 2020-09-29 19:47 ` Bjorn Helgaas
  2020-09-30 13:42 ` [PATCH 0/2] PCI/PM: Fix D2 transition delay Rafael J. Wysocki
  2020-09-30 23:15 ` Bjorn Helgaas
  3 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2020-09-29 19:47 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-kernel, Rafael J . Wysocki, Krzysztof Wilczyński,
	Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

This reverts commit 7e24bc347e57992d532bc2ed700209b0fc0a4bf5.

7e24bc347e57 was based on PCIe r5.0, sec 5.9, which claims we need a 200 ms
delay when transitioning to or from D2.  However, sec 5.3.1.3 states the
delay as 200 μs (microseconds), as does the table in PCIe r4.0, sec 5.9.1.

This looks like a typo in the r5.0 spec, so revert back to a 200 μs delay
instead of a 200 ms delay.

Fixes: 7e24bc347e57 ("PCI/PM: Apply D2 delay as milliseconds, not microseconds")
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci.c | 2 +-
 drivers/pci/pci.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c4a26532a447..d69578ad44a0 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1065,7 +1065,7 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
 	if (state == PCI_D3hot || dev->current_state == PCI_D3hot)
 		pci_dev_d3_sleep(dev);
 	else if (state == PCI_D2 || dev->current_state == PCI_D2)
-		msleep(PCI_PM_D2_DELAY);
+		udelay(PCI_PM_D2_DELAY);
 
 	pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
 	dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index f0a9cbe01bc7..f86cae9aa1f4 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -43,9 +43,9 @@ int pci_probe_reset_function(struct pci_dev *dev);
 int pci_bridge_secondary_bus_reset(struct pci_dev *dev);
 int pci_bus_error_reset(struct pci_dev *dev);
 
-#define PCI_PM_D2_DELAY         200
-#define PCI_PM_D3HOT_WAIT       10
-#define PCI_PM_D3COLD_WAIT      100
+#define PCI_PM_D2_DELAY         200	/* usec; see PCIe r4.0, sec 5.9.1 */
+#define PCI_PM_D3HOT_WAIT       10	/* msec */
+#define PCI_PM_D3COLD_WAIT      100	/* msec */
 
 /**
  * struct pci_platform_pm_ops - Firmware PM callbacks
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] PCI/PM: Fix D2 transition delay
  2020-09-29 19:47 [PATCH 0/2] PCI/PM: Fix D2 transition delay Bjorn Helgaas
  2020-09-29 19:47 ` [PATCH 1/2] PCI/PM: Remove unused PCI_PM_BUS_WAIT Bjorn Helgaas
  2020-09-29 19:47 ` [PATCH 2/2] PCI/PM: Revert "PCI/PM: Apply D2 delay as milliseconds, not microseconds" Bjorn Helgaas
@ 2020-09-30 13:42 ` Rafael J. Wysocki
  2020-09-30 23:15 ` Bjorn Helgaas
  3 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2020-09-30 13:42 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci
  Cc: linux-kernel, Krzysztof Wilczyński, Bjorn Helgaas

On 9/29/2020 9:47 PM, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Remove an unused #define.
>
> Fix the D2 transition delay.  I changed this a year ago to conform to the
> PCIe r5.0 spec, but I think the number I relied on is a typo in the spec.
> I asked the PCI-SIG to fix the typo.  Hopefully I'll get a response before
> the merge window.
>
> Bjorn Helgaas (2):
>    PCI/PM: Remove unused PCI_PM_BUS_WAIT
>    PCI/PM: Revert "PCI/PM: Apply D2 delay as milliseconds, not
>      microseconds"
>
>   drivers/pci/pci.c | 2 +-
>   drivers/pci/pci.h | 7 +++----
>   2 files changed, 4 insertions(+), 5 deletions(-)
>
Please add

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

to both patches.

Cheers!



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] PCI/PM: Fix D2 transition delay
  2020-09-29 19:47 [PATCH 0/2] PCI/PM: Fix D2 transition delay Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2020-09-30 13:42 ` [PATCH 0/2] PCI/PM: Fix D2 transition delay Rafael J. Wysocki
@ 2020-09-30 23:15 ` Bjorn Helgaas
  3 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2020-09-30 23:15 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-kernel, Rafael J . Wysocki, Krzysztof Wilczyński,
	Bjorn Helgaas

On Tue, Sep 29, 2020 at 02:47:46PM -0500, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Remove an unused #define.
> 
> Fix the D2 transition delay.  I changed this a year ago to conform to the
> PCIe r5.0 spec, but I think the number I relied on is a typo in the spec.
> I asked the PCI-SIG to fix the typo.  Hopefully I'll get a response before
> the merge window.
> 
> Bjorn Helgaas (2):
>   PCI/PM: Remove unused PCI_PM_BUS_WAIT
>   PCI/PM: Revert "PCI/PM: Apply D2 delay as milliseconds, not
>     microseconds"
> 
>  drivers/pci/pci.c | 2 +-
>  drivers/pci/pci.h | 7 +++----
>  2 files changed, 4 insertions(+), 5 deletions(-)

Applied with Rafael's reviewed-by to pci/pm for v5.10.  Subject to
revision based on feedback from the PCI-SIG, of course.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-30 23:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 19:47 [PATCH 0/2] PCI/PM: Fix D2 transition delay Bjorn Helgaas
2020-09-29 19:47 ` [PATCH 1/2] PCI/PM: Remove unused PCI_PM_BUS_WAIT Bjorn Helgaas
2020-09-29 19:47 ` [PATCH 2/2] PCI/PM: Revert "PCI/PM: Apply D2 delay as milliseconds, not microseconds" Bjorn Helgaas
2020-09-30 13:42 ` [PATCH 0/2] PCI/PM: Fix D2 transition delay Rafael J. Wysocki
2020-09-30 23:15 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).