diff options
author | Gavin Shan <shangw@linux.vnet.ibm.com> | 2012-09-07 18:44:06 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-09-09 19:35:30 -0400 |
commit | 646a8499403e049845dda3141ec1ac021f029f11 (patch) | |
tree | 3b01074605b136f9e3153a533df58af5787c4017 /arch/powerpc | |
parent | 968f968f9b9aaa6ff92c20090c600fc7c112af55 (diff) |
powerpc/eeh: Introduce global mutex
The patch introduces global mutex for EEH so that the core data
structures can be protected by that. Also, 2 inline functions
are exported for that: eeh_lock() and eeh_unlock().
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/eeh.h | 15 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh.c | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index f77b6d747f6f..248b3d99112f 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h | |||
@@ -146,6 +146,17 @@ struct eeh_ops { | |||
146 | 146 | ||
147 | extern struct eeh_ops *eeh_ops; | 147 | extern struct eeh_ops *eeh_ops; |
148 | extern int eeh_subsystem_enabled; | 148 | extern int eeh_subsystem_enabled; |
149 | extern struct mutex eeh_mutex; | ||
150 | |||
151 | static inline void eeh_lock(void) | ||
152 | { | ||
153 | mutex_lock(&eeh_mutex); | ||
154 | } | ||
155 | |||
156 | static inline void eeh_unlock(void) | ||
157 | { | ||
158 | mutex_unlock(&eeh_mutex); | ||
159 | } | ||
149 | 160 | ||
150 | /* | 161 | /* |
151 | * Max number of EEH freezes allowed before we consider the device | 162 | * Max number of EEH freezes allowed before we consider the device |
@@ -206,6 +217,10 @@ static inline void eeh_add_device_tree_early(struct device_node *dn) { } | |||
206 | static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } | 217 | static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } |
207 | 218 | ||
208 | static inline void eeh_remove_bus_device(struct pci_dev *dev) { } | 219 | static inline void eeh_remove_bus_device(struct pci_dev *dev) { } |
220 | |||
221 | static inline void eeh_lock(void) { } | ||
222 | static inline void eeh_unlock(void) { } | ||
223 | |||
209 | #define EEH_POSSIBLE_ERROR(val, type) (0) | 224 | #define EEH_POSSIBLE_ERROR(val, type) (0) |
210 | #define EEH_IO_ERROR_VALUE(size) (-1UL) | 225 | #define EEH_IO_ERROR_VALUE(size) (-1UL) |
211 | #endif /* CONFIG_EEH */ | 226 | #endif /* CONFIG_EEH */ |
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index e819448ea3a7..0ba7e3b84672 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -92,6 +92,9 @@ struct eeh_ops *eeh_ops = NULL; | |||
92 | int eeh_subsystem_enabled; | 92 | int eeh_subsystem_enabled; |
93 | EXPORT_SYMBOL(eeh_subsystem_enabled); | 93 | EXPORT_SYMBOL(eeh_subsystem_enabled); |
94 | 94 | ||
95 | /* Global EEH mutex */ | ||
96 | DEFINE_MUTEX(eeh_mutex); | ||
97 | |||
95 | /* Lock to avoid races due to multiple reports of an error */ | 98 | /* Lock to avoid races due to multiple reports of an error */ |
96 | static DEFINE_RAW_SPINLOCK(confirm_error_lock); | 99 | static DEFINE_RAW_SPINLOCK(confirm_error_lock); |
97 | 100 | ||