aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-03-08 15:04:57 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-12 19:31:50 -0400
commit392ee1e6dd901db6c4504617476f6442ed91f72d (patch)
tree591658a0197244782973674f240cf61895ef498e /drivers/pci/pci.h
parent529284a0b649499351495949d05fa3359121cbae (diff)
[PATCH] msi: Safer state caching.
There are two ways pci_save_state and pci_restore_state are used. As helper functions during suspend/resume, and as helper functions around a hardware reset event. When used as helper functions around a hardware reset event there is no reason to believe the calls will be paired, nor is there a good reason to believe that if we restore the msi state from before the reset that it will match the current msi state. Since arch code may change the msi message without going through the driver, drivers currently do not have enough information to even know when to call pci_save_state to ensure they will have msi state in sync with the other kernel irq reception data structures. It turns out the solution is straight forward, cache the state in the existing msi data structures (not the magic pci saved things) and have the msi code update the cached state each time we write to the hardware. This means we never need to read the hardware to figure out what the hardware state should be. By modifying the caching in this manner we get to remove our save_state routines and only need to provide restore_state routines. The only fields that were at all tricky to regenerate were the msi and msi-x control registers and the way we regenerate them currently is a bit dependent upon assumptions on how we use the allow msi registers to be configured and used making the code a little bit brittle. If we ever change what cases we allow or how we configure the msi bits we can address the fragility then. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pci/pci.h')
-rw-r--r--drivers/pci/pci.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index ae7a975995a5..62ea04c8af64 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -52,10 +52,8 @@ static inline void pci_no_msi(void) { }
52#endif 52#endif
53 53
54#if defined(CONFIG_PCI_MSI) && defined(CONFIG_PM) 54#if defined(CONFIG_PCI_MSI) && defined(CONFIG_PM)
55int pci_save_msi_state(struct pci_dev *dev);
56void pci_restore_msi_state(struct pci_dev *dev); 55void pci_restore_msi_state(struct pci_dev *dev);
57#else 56#else
58static inline int pci_save_msi_state(struct pci_dev *dev) { return 0; }
59static inline void pci_restore_msi_state(struct pci_dev *dev) {} 57static inline void pci_restore_msi_state(struct pci_dev *dev) {}
60#endif 58#endif
61 59