[RFC v2 2/3] powerpc/eeh: Introduce function eeh_pe_reset_freeze_counter()
Vaibhav Jain
vaibhav at linux.vnet.ibm.com
Wed Mar 1 22:08:35 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>
---
Change-log:
v1 -> v2
* Changes as suggested by Russell Currey:
- Suffixed function names with '()'
- Rephrased the description comment for functon eeh_pe_reset_freeze_counter()
- Inserted logging for PHB and PE number inside eeh_pe_reset_freeze_counter()
* Moved definition of eeh_pe_reset_freeze_counter() from eeh.h to eeh_pe.c to
avoid adding a header dependency to 'pci-bridge.h'. The function is
now marked as an exported gpl symbol.
---
arch/powerpc/include/asm/eeh.h | 5 +++++
arch/powerpc/kernel/eeh_pe.c | 17 +++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 68806be..8dcfb88 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -266,6 +266,9 @@ 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);
+
+void eeh_pe_reset_freeze_counter(struct eeh_pe *pe);
+
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 +342,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) { }
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index d367c16..75c781f 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -504,6 +504,23 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev)
}
/**
+ * eeh_pe_reset_freeze_counter - Resets the PE freeze counter
+ * @pe: EEH PE
+ *
+ * This function is useful while re-configuring an FPGA adapter
+ * as its about to acquire new a personality and you don't want
+ * freeze count to be carry forwarded. As such calling this function
+ * for regular pci devices might be a bad idea.
+ */
+void eeh_pe_reset_freeze_counter(struct eeh_pe *pe)
+{
+ pr_info("Resetting freeze count for PHB#%x-PE#%x\n",
+ pe->phb->global_number, pe->addr);
+ pe->freeze_count = 0;
+}
+EXPORT_SYMBOL_GPL(eeh_pe_reset_freeze_counter);
+
+/**
* eeh_pe_update_freeze_counter - Update PE's frozen time stamp
* and freeze counter
* @pe: EEH PE
--
2.9.3
More information about the Linuxppc-dev
mailing list