[RESEND-RFC v2 3/3] cxl: Reset freeze counters before adapter PERST for flashing new image
Vaibhav Jain
vaibhav at linux.vnet.ibm.com
Wed Mar 1 22:24:52 AEDT 2017
The patch resets the freeze counter on eeh_pe struct for PHB
associated with the cxl pci adapter. This would enable re-flashing of
the cxl-adapter beyond the default limit of 5.
Signed-off-by: Vaibhav Jain <vaibhav at linux.vnet.ibm.com>
---
Change-log:
v1 -> v2
Changes as suggested by Russell Currey:
- Changed new variable names inline with eeh code nomenclature.
- Removed the dev_info logging the PHB being reset. The log message is now
moved to eeh_handle_normal_event()
---
drivers/misc/cxl/pci.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index ce54dab..7960fd64 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -22,6 +22,7 @@
#include <asm/pnv-pci.h>
#include <asm/io.h>
#include <asm/reg.h>
+#include <asm/eeh.h>
#include "cxl.h"
#include <misc/cxl.h>
@@ -1231,6 +1232,8 @@ static void cxl_pci_remove_afu(struct cxl_afu *afu)
int cxl_pci_reset(struct cxl *adapter)
{
struct pci_dev *dev = to_pci_dev(adapter->dev.parent);
+ struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
+ struct eeh_pe *pe = eeh_dev_to_pe(edev);
int rc;
if (adapter->perst_same_image) {
@@ -1244,6 +1247,17 @@ int cxl_pci_reset(struct cxl *adapter)
/* the adapter is about to be reset, so ignore errors */
cxl_data_cache_flush(adapter);
+ /* If loading a new image, reset freeze counters for the PHB
+ * associated with the adapter.
+ */
+ if (pe && adapter->perst_loads_image) {
+ /* Find the pe associated with the device PHB */
+ while (pe->parent != NULL && (pe->type & EEH_PE_PHB) == 0)
+ pe = pe->parent;
+
+ eeh_pe_reset_freeze_counter(pe);
+ }
+
/* pcie_warm_reset requests a fundamental pci reset which includes a
* PERST assert/deassert. PERST triggers a loading of the image
* if "user" or "factory" is selected in sysfs */
--
2.9.3
More information about the Linuxppc-dev
mailing list