PCI: sysfs: Resume to D0 on function reset
authorLukas Wunner <[email protected]>
Thu, 19 Jul 2018 22:27:58 +0000 (17:27 -0500)
committerBjorn Helgaas <[email protected]>
Tue, 31 Jul 2018 16:09:36 +0000 (11:09 -0500)
When performing a function reset via sysfs, the device's config space is
accessed in places such as pcie_flr() and its MMIO space is accessed e.g.
in reset_ivb_igd(), so ensure accessibility by resuming the device to D0.

Signed-off-by: Lukas Wunner <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Mika Westerberg <[email protected]>
Cc: Ashok Raj <[email protected]>
Cc: Keith Busch <[email protected]>
Cc: Yinghai Lu <[email protected]>
drivers/pci/pci-sysfs.c

index 0c4653c1d2cec6f743a0bd650ead5c029ef299bc..a3df6b57df0fff87e2c6adbc04a08cf5e14a9a4e 100644 (file)
@@ -1449,7 +1449,9 @@ static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
        if (val != 1)
                return -EINVAL;
 
+       pm_runtime_get_sync(dev);
        result = pci_reset_function(pdev);
+       pm_runtime_put(dev);
        if (result < 0)
                return result;