From: Geetha sowjanya <gakula@caviumnetworks.com>
To: bhelgaas@google.com, linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, jcm@redhat.com,
sgoutham@cavium.com, geethasowjanya.akula@gmail.com,
robert.richter@cavium.com, linux-arm-kernel@lists.infradead.org,
Geetha sowjanya <gakula@caviumnetworks.com>
Subject: [PATCH] PCI/PM: Set D3 power state only if the end device supports it.
Date: Wed, 31 May 2017 17:03:32 +0530 [thread overview]
Message-ID: <1496230412-19028-1-git-send-email-gakula@caviumnetworks.com> (raw)
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
next reply other threads:[~2017-05-31 11:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 11:33 Geetha sowjanya [this message]
2017-05-31 12:43 ` Alex Williamson
2017-06-02 5:44 ` Geetha Akula
2017-06-05 22:00 ` Alex Williamson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1496230412-19028-1-git-send-email-gakula@caviumnetworks.com \
--to=gakula@caviumnetworks.com \
--cc=bhelgaas@google.com \
--cc=geethasowjanya.akula@gmail.com \
--cc=jcm@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=robert.richter@cavium.com \
--cc=sgoutham@cavium.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®