Re: Machine crashes right *after* ~successful resume

From: Yinghai Lu
Date: Thu Oct 30 2014 - 22:13:18 EST


On Thu, Oct 30, 2014 at 5:43 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote:
> On Thu, Oct 30, 2014 at 4:24 PM, Wilmer van der Gaast <wilmer@xxxxxxxxx> wrote:
>>
>>
>> Same problem like this morning: Failure after the second resume already. :-(
>>
> can not find out any magic line in pci_enable_bridge that could cause
> the difference.
>
> so either use attached pcie_enable_bridge_ite.patch or just revert the
> commit 928bea9?

Last try:

Please check attached patch that will keep state consistent.

Thanks

Yinghai
---
drivers/pci/pci.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

Index: linux-2.6/drivers/pci/pci.c
===================================================================
--- linux-2.6.orig/drivers/pci/pci.c
+++ linux-2.6/drivers/pci/pci.c
@@ -1264,6 +1264,26 @@ static void pci_enable_bridge(struct pci
pci_set_master(dev);
}

+static void pci_enable_ite(struct pci_dev *dev)
+{
+ u16 cmd;
+
+ /*
+ * FW enable the bridge already, so keep enable_cnt consistent,
+ * then later we can go through pci_pm_resume/pci_pm_reenable_device
+ * to enable it again.
+ * --- for pci bridge without driver case.
+ */
+ if (cmd & PCI_COMMAND_MASTER)
+ dev->is_busmaster = true;
+
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
+ if (cmd & (PCI_COMMAND_IO || PCI_COMMAND_MEMORY))
+ atomic_inc(&dev->enable_cnt);
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x244e, pci_enable_ite);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ITE, 0x8892, pci_enable_ite);
+
static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
{
struct pci_dev *bridge;