The patch titled pci: disable msi mode in pci_disable_device() has been removed from the -mm tree. Its filename is pci-disable-msi-mode-in-pci_disable_device.patch This patch was probably dropped from -mm because it has now been merged into a subsystem tree or into Linus's tree, or because it was folded into its parent patch in the -mm tree. ------------------------------------------------------ Subject: pci: disable msi mode in pci_disable_device() From: Shaohua Li <shaohua.li@xxxxxxxxx> Brice said the pci_save_msi_state breaks his driver in his special usage (not in suspend/resume), as pci_save_msi_state will disable msi mode. In his usage, pci_save_state will be called at runtime, and later (after the device operates for some time and has an error) pci_restore_state will be called. On the other hand, suspend/resume needs disable msi mode, as device should stop working completely. This patch try to workaround this issue. Drivers are expected call pci_disable_device in suspend time after pci_save_state. It's inappropriate that pci_save_state() be altering the device's state in this manner. The patch changes things so that we record whether the device has msi or msix mode enabled, and disable those modes in pci_disable_device(). Signed-off-by: Shaohua Li <shaohua.li@xxxxxxxxx> Cc: Brice Goglin <brice@xxxxxxxx> Cc: Rajesh Shah <rajesh.shah@xxxxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/pci/msi.c | 6 ++++-- drivers/pci/pci.c | 9 ++++++++- include/linux/pci.h | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff -puN drivers/pci/msi.c~pci-disable-msi-mode-in-pci_disable_device drivers/pci/msi.c --- 25/drivers/pci/msi.c~pci-disable-msi-mode-in-pci_disable_device Fri May 26 16:41:05 2006 +++ 25-akpm/drivers/pci/msi.c Fri May 26 16:41:05 2006 @@ -453,9 +453,11 @@ static void enable_msi_mode(struct pci_d /* Set enabled bits to single MSI & enable MSI_enable bit */ msi_enable(control, 1); pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msi_enabled = 1; } else { msix_enable(control); pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msix_enabled = 1; } if (pci_find_capability(dev, PCI_CAP_ID_EXP)) { /* PCI Express Endpoint device detected */ @@ -472,9 +474,11 @@ void disable_msi_mode(struct pci_dev *de /* Set enabled bits to single MSI & enable MSI_enable bit */ msi_disable(control); pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msi_enabled = 0; } else { msix_disable(control); pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msix_enabled = 0; } if (pci_find_capability(dev, PCI_CAP_ID_EXP)) { /* PCI Express Endpoint device detected */ @@ -549,7 +553,6 @@ int pci_save_msi_state(struct pci_dev *d pci_read_config_dword(dev, pos + PCI_MSI_DATA_32, &cap[i++]); if (control & PCI_MSI_FLAGS_MASKBIT) pci_read_config_dword(dev, pos + PCI_MSI_MASK_BIT, &cap[i++]); - disable_msi_mode(dev, pos, PCI_CAP_ID_MSI); save_state->cap_nr = PCI_CAP_ID_MSI; pci_add_saved_cap(dev, save_state); return 0; @@ -639,7 +642,6 @@ int pci_save_msix_state(struct pci_dev * } dev->irq = temp; - disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); save_state->cap_nr = PCI_CAP_ID_MSIX; pci_add_saved_cap(dev, save_state); return 0; diff -puN drivers/pci/pci.c~pci-disable-msi-mode-in-pci_disable_device drivers/pci/pci.c --- 25/drivers/pci/pci.c~pci-disable-msi-mode-in-pci_disable_device Fri May 26 16:41:05 2006 +++ 25-akpm/drivers/pci/pci.c Fri May 26 16:41:05 2006 @@ -547,7 +547,14 @@ void pci_disable_device(struct pci_dev *dev) { u16 pci_command; - + + if (dev->msi_enabled) + disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI), + PCI_CAP_ID_MSI); + if (dev->msix_enabled) + disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI), + PCI_CAP_ID_MSIX); + pci_read_config_word(dev, PCI_COMMAND, &pci_command); if (pci_command & PCI_COMMAND_MASTER) { pci_command &= ~PCI_COMMAND_MASTER; diff -puN include/linux/pci.h~pci-disable-msi-mode-in-pci_disable_device include/linux/pci.h --- 25/include/linux/pci.h~pci-disable-msi-mode-in-pci_disable_device Fri May 26 16:41:05 2006 +++ 25-akpm/include/linux/pci.h Fri May 26 16:41:05 2006 @@ -162,6 +162,8 @@ struct pci_dev { unsigned int is_busmaster:1; /* device is busmaster */ unsigned int no_msi:1; /* device may not use msi */ unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ + unsigned int msi_enabled:1; + unsigned int msix_enabled:1; u32 saved_config_space[16]; /* config space saved at suspend time */ struct hlist_head saved_cap_space; _ Patches currently in -mm which might be from shaohua.li@xxxxxxxxx are git-acpi.patch x86-cpu_init-avoid-gfp_kernel-allocation-while-atomic.patch swsusp-add-architecture-special-saveable-pages-support.patch swsusp-i386-mark-special-saveable-unsaveable-pages.patch swsusp-x86_64-mark-special-saveable-unsaveable-pages.patch dont-use-flush_tlb_all-in-suspend-time.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html