[RFC 2/3] powerpc/eeh: Introduce function eeh_pe_reset_freeze_counter

Vaibhav Jain vaibhav at linux.vnet.ibm.com
Tue Feb 28 18:02:21 AEDT 2017

This patch introduces function eeh_pe_reset_freeze_counter which can
be used to reset the PE's freeze count variable outside eeh code. This
is useful for devices that can acquire a different personality after
a PERST event (e.g FPGA Adapters). Presently an existing freeze
count for an adapter with personality N will be taken into account
when the adapter acquired personality N+1.

By calling eeh_pe_reset_freeze_counter drivers can reset the freeze
counter for an adapter once it has acquired a new personality and
ideally wont be plagued by the failures similar to the one before.

Signed-off-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
 arch/powerpc/include/asm/eeh.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 68806be..19ac6d0 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -266,6 +266,13 @@ struct eeh_pe *eeh_pe_get(struct eeh_dev *edev);
 int eeh_add_to_parent_pe(struct eeh_dev *edev);
 int eeh_rmv_from_parent_pe(struct eeh_dev *edev);
 int eeh_pe_update_freeze_counter(struct eeh_pe *pe);
+/* Reset the PE freeze counter */
+static inline void eeh_pe_reset_freeze_counter(struct eeh_pe *pe)
+	pe->freeze_count = 0;
 void *eeh_pe_traverse(struct eeh_pe *root,
 		eeh_traverse_func fn, void *flag);
 void *eeh_pe_dev_traverse(struct eeh_pe *root,
@@ -339,6 +346,8 @@ static inline int eeh_check_failure(const volatile void __iomem *token)
 	return 0;
+static inline void eeh_pe_reset_freeze_counter(struct eeh_pe *pe) { }
 #define eeh_dev_check_failure(x) (0)
 static inline void eeh_addr_cache_build(void) { }

More information about the Linuxppc-dev mailing list