kernel-ark/drivers/pci
Hidetoshi Seto 12abb8ba84 PCI MSI: Fix restoration of MSI/MSI-X mask states in suspend/resume
There are 2 problems on mask states in suspend/resume.

[1]:
It is better to restore the mask states of MSI/MSI-X to initial states
(MSI is unmasked, MSI-X is masked) when we release the device.
The pci_msi_shutdown() does the restoration of mask states for MSI,
while the msi_free_irqs() does it for MSI-X.  In other words, in the
"disable" path both of MSI and MSI-X are handled, but in the "shutdown"
path only MSI is handled.

MSI:
   pci_disable_msi()
      => pci_msi_shutdown()
         [ mask states for MSI restored ]
         => msi_set_enable(dev, pos, 0);
      => msi_free_irqs()

MSI-X:
   pci_disable_msix()
      => pci_msix_shutdown()
         => msix_set_enable(dev, 0);
      => msix_free_all_irqs
         => msi_free_irqs()
            [ mask states for MSI-X restored ]

This patch moves the masking for MSI-X from msi_free_irqs() to
pci_msix_shutdown().

This change has some positive side effects:
 - It prevents OS from touching mask states before reading preserved
   bits in the register, which can be happen if msi_free_irqs() is
   called from error path in msix_capability_init().
 - It also prevents touching the register after turning off MSI-X in
   "disable" path, which can be a problem on some devices.

[2]:
We have cache of the mask state in msi_desc, which is automatically
updated when msi/msix_mask_irq() is called.  This cached states are
used for the resume.

But since what need to be restored in the resume is the states before
the shutdown on the suspend, calling msi/msix_mask_irq() from
pci_msi/msix_shutdown() is not appropriate.

This patch introduces __msi/msix_mask_irq() that do mask as same
as msi/msix_mask_irq() but does not update cached state, for use
in pci_msi/msix_shutdown().

[updated: get rid of msi/msix_mask_irq_nocache() (proposed by Matthew Wilcox)]

Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-06-29 12:18:13 -07:00
..
hotplug PCI: fix kernel-doc warnings 2009-06-29 12:13:56 -07:00
pcie PCI ECRC: Remove unnecessary semicolons 2009-06-29 12:10:35 -07:00
.gitignore
access.c PCI: Add pci_bus_set_ops 2009-06-16 14:29:33 -07:00
bus.c PCI AER: support Multiple Error Received and no error source id 2009-06-16 14:30:13 -07:00
dmar.c VT-d: add device IOTLB invalidation support 2009-05-18 14:45:13 +01:00
hotplug-pci.c
hotplug.c
htirq.c Merge branch 'x86/apic' into irq/numa 2009-05-12 12:17:36 +02:00
intel-iommu.c intel-iommu: fix Identity Mapping to be arch independent 2009-06-26 11:26:27 +01:00
intr_remapping.c Intel-IOMMU, intr-remap: source-id checking 2009-06-23 22:09:17 +01:00
intr_remapping.h Intel-IOMMU, intr-remap: source-id checking 2009-06-23 22:09:17 +01:00
iov.c Merge git://git.infradead.org/~dwmw2/iommu-2.6.31 2009-06-22 21:38:22 -07:00
iova.c
irq.c
Kconfig
Makefile Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2009-06-22 11:59:51 -07:00
msi.c PCI MSI: Fix restoration of MSI/MSI-X mask states in suspend/resume 2009-06-29 12:18:13 -07:00
msi.h PCI MSI: shorten PCI_MSIX_ENTRY_* symbol names 2009-06-29 12:15:19 -07:00
pci-acpi.c
pci-driver.c
pci-stub.c
pci-sysfs.c
pci.c PCI: check if bus has a proper bridge device before triggering SBR 2009-06-29 12:13:13 -07:00
pci.h PCI: handle Virtual Function ATS enabling 2009-05-18 11:25:58 +01:00
probe.c PCI: use pci_is_root_bus() in pci_read_bridge_bases() 2009-06-16 14:29:31 -07:00
proc.c
quirks.c PCI: More PATA quirks for not entering D3 2009-06-29 12:14:04 -07:00
remove.c PCI: eliminate redundant pci_stop_dev() call from pci_destroy_dev() 2009-06-11 12:04:19 -07:00
rom.c
search.c PCI: use pci_is_root_bus() in pci_find_upstream_pcie_bridge() 2009-06-16 14:29:30 -07:00
setup-bus.c PCI: improve resource allocation under transparent bridges 2009-06-11 12:04:07 -07:00
setup-irq.c
setup-res.c Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2009-06-22 11:59:51 -07:00
slot.c PCI: fix kernel-doc warnings 2009-06-29 12:13:56 -07:00
syscall.c