Skip to content

Instantly share code, notes, and snippets.

@karolherbst
Last active July 27, 2018 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karolherbst/3cde7028a6b885ca42863b6f6320658c to your computer and use it in GitHub Desktop.
Save karolherbst/3cde7028a6b885ca42863b6f6320658c to your computer and use it in GitHub Desktop.
From 1c396bbc7c35c0d421f3a02675e4819aa93bd5e4 Mon Sep 17 00:00:00 2001
From: Karol Herbst <kherbst@redhat.com>
Date: Fri, 27 Jul 2018 15:07:13 +0200
Subject: [PATCH] workaround nouveau runpm issues
---
drivers/pci/pci.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index dbfe7c4f37768..864c28cd82670 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -689,7 +689,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
}
/* enter specified state */
- pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr);
+ if (dev->vendor != 0x10de)
+ pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr);
/* Mandatory power management transition delays */
/* see PCI PM 1.1 5.6.1 table 18 */
@@ -698,7 +699,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
else if (state == PCI_D2 || dev->current_state == PCI_D2)
udelay(PCI_PM_D2_DELAY);
- pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
+ if (dev->vendor != 0x10de)
+ pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
if (dev->current_state != state && printk_ratelimit())
pci_info(dev, "Refused to change power state, currently in D%d\n",
@@ -743,7 +745,7 @@ void pci_update_current_state(struct pci_dev *dev, pci_power_t state)
if (platform_pci_get_power_state(dev) == PCI_D3cold ||
!pci_device_is_present(dev)) {
dev->current_state = PCI_D3cold;
- } else if (dev->pm_cap) {
+ } else if (dev->pm_cap && dev->vendor != 0x10de) {
u16 pmcsr;
pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment