linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/PM: Set D3 power state only if the end device supports it.
@ 2017-05-31 11:33 Geetha sowjanya
  2017-05-31 12:43 ` Alex Williamson
  0 siblings, 1 reply; 4+ messages in thread
From: Geetha sowjanya @ 2017-05-31 11:33 UTC (permalink / raw)
  To: bhelgaas, linux-pci
  Cc: jcm, Geetha sowjanya, linux-kernel, geethasowjanya.akula,
	robert.richter, sgoutham, linux-arm-kernel

Pci driver doesn't check if the device supports D3hot/D3cold power states 
while setting these power states. The device that doesn't support these 
states will fail when a driver like vfio try to do D0->D3 power transition.

This patch adds a check that allows to set D3 power state only
for the supported devices.

Signed-off-by: Geetha sowjanya <gakula@caviumnetworks.com>
---
 drivers/pci/pci.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 563901c..cadd046 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -661,7 +661,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
 
 	/* check if this device supports the desired state */
 	if ((state == PCI_D1 && !dev->d1_support)
-	   || (state == PCI_D2 && !dev->d2_support))
+	   || (state == PCI_D2 && !dev->d2_support)
+	   || (state == PCI_D3hot && !pci_pme_capable(dev, state)))
 		return -EIO;
 
 	pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
-- 
1.7.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2017-06-05 22:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-31 11:33 [PATCH] PCI/PM: Set D3 power state only if the end device supports it Geetha sowjanya
2017-05-31 12:43 ` Alex Williamson
2017-06-02  5:44   ` Geetha Akula
2017-06-05 22:00     ` Alex Williamson

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).