diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-03-08 15:04:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-12 19:31:50 -0400 |
commit | 392ee1e6dd901db6c4504617476f6442ed91f72d (patch) | |
tree | 591658a0197244782973674f240cf61895ef498e /include/linux/msi.h | |
parent | 529284a0b649499351495949d05fa3359121cbae (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 'include/linux/msi.h')
-rw-r--r-- | include/linux/msi.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/include/linux/msi.h b/include/linux/msi.h index 74c8a2ecc9dd..e38fe6822cb4 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h | |||
@@ -17,7 +17,7 @@ struct msi_desc { | |||
17 | struct { | 17 | struct { |
18 | __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */ | 18 | __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */ |
19 | __u8 maskbit : 1; /* mask-pending bit supported ? */ | 19 | __u8 maskbit : 1; /* mask-pending bit supported ? */ |
20 | __u8 unused : 1; | 20 | __u8 masked : 1; |
21 | __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ | 21 | __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ |
22 | __u8 pos; /* Location of the msi capability */ | 22 | __u8 pos; /* Location of the msi capability */ |
23 | __u16 entry_nr; /* specific enabled entry */ | 23 | __u16 entry_nr; /* specific enabled entry */ |
@@ -32,10 +32,8 @@ struct msi_desc { | |||
32 | void __iomem *mask_base; | 32 | void __iomem *mask_base; |
33 | struct pci_dev *dev; | 33 | struct pci_dev *dev; |
34 | 34 | ||
35 | #ifdef CONFIG_PM | 35 | /* Last set MSI message */ |
36 | /* PM save area for MSIX address/data */ | 36 | struct msi_msg msg; |
37 | struct msi_msg msg_save; | ||
38 | #endif | ||
39 | }; | 37 | }; |
40 | 38 | ||
41 | /* | 39 | /* |