[PATCH 8/9] powerpc/powernv: Add /proc/powerpc/eeh_inf_err

Gavin Shan shangw at linux.vnet.ibm.com
Tue Feb 25 16:37:49 EST 2014


The patch adds /proc/powerpc/eeh_inf_err to count the INF errors
happened on PHBs as Ben suggested.

Signed-off-by: Gavin Shan <shangw at linux.vnet.ibm.com>
---
 arch/powerpc/platforms/powernv/eeh-ioda.c |   51 +++++++++++++++++++++++++++++
 arch/powerpc/platforms/powernv/pci.h      |    1 +
 2 files changed, 52 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index cd06c52..3ddd706 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -20,6 +20,7 @@
 #include <linux/msi.h>
 #include <linux/notifier.h>
 #include <linux/pci.h>
+#include <linux/proc_fs.h>
 #include <linux/string.h>
 
 #include <asm/eeh.h>
@@ -35,6 +36,8 @@
 #include "powernv.h"
 #include "pci.h"
 
+static u64 ioda_eeh_ioc_inf_err = 0;
+static int ioda_eeh_proc_init = 0;
 static int ioda_eeh_nb_init = 0;
 
 static int ioda_eeh_event(struct notifier_block *nb,
@@ -114,6 +117,44 @@ DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbB_dbgfs_ops, ioda_eeh_inbB_dbgfs_get,
 			ioda_eeh_inbB_dbgfs_set, "0x%llx\n");
 #endif /* CONFIG_DEBUG_FS */
 
+#ifdef CONFIG_PROC_FS
+static int ioda_eeh_proc_show(struct seq_file *m, void *v)
+{
+	struct pci_controller *hose;
+	struct pnv_phb *phb;
+
+	if (!eeh_enabled()) {
+                seq_printf(m, "EEH Subsystem disabled\n");
+		return 0;
+	}
+
+	seq_printf(m, "EEH Subsystem enabled\n");
+	if (ioda_eeh_ioc_inf_err > 0)
+		seq_printf(m, "\nIOC INF Errors: %llu\n\n",
+			   ioda_eeh_ioc_inf_err);
+
+	list_for_each_entry(hose, &hose_list, list_node) {
+		phb = hose->private_data;
+		seq_printf(m, "PHB#%d INF Errors: %llu\n",
+			   hose->global_number, phb->inf_err);
+	}
+
+	return 0;
+}
+
+static int ioda_eeh_proc_open(struct inode *inode, struct file *file)
+{
+        return single_open(file, ioda_eeh_proc_show, NULL);
+}
+
+static const struct file_operations ioda_eeh_proc_ops = {
+	.open		= ioda_eeh_proc_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
+#endif /* CONFIG_PROC_FS */
+
 static void ioda_eeh_phb_diag(struct pci_controller *hose, char *buf)
 {
 	struct pnv_phb *phb = hose->private_data;
@@ -170,6 +211,14 @@ static int ioda_eeh_post_init(struct pci_controller *hose)
 	}
 #endif
 
+#ifdef CONFIG_PROC_FS
+	if (!ioda_eeh_proc_init) {
+		ioda_eeh_proc_init = 1;
+		proc_create("powerpc/eeh_inf_err", 0,
+			    NULL, &ioda_eeh_proc_ops);
+	}
+#endif
+
 	phb->flags |= PNV_PHB_FLAG_EEH;
 
 	return 0;
@@ -755,6 +804,7 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
 			} else if (severity == OPAL_EEH_SEV_INF) {
 				pr_info("EEH: IOC informative error "
 					"detected\n");
+				ioda_eeh_ioc_inf_err++;
 				ioda_eeh_hub_diag(hose);
 				ret = EEH_NEXT_ERR_NONE;
 			}
@@ -775,6 +825,7 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
 				pr_info("EEH: PHB#%x informative error "
 					"detected\n",
 					hose->global_number);
+				phb->inf_err++;
 				ioda_eeh_phb_diag(hose, phb->diag.blob);
 				ret = EEH_NEXT_ERR_NONE;
 			}
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 3645fc4..64ca719 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -97,6 +97,7 @@ struct pnv_phb {
 	spinlock_t		lock;
 
 #ifdef CONFIG_EEH
+	u64			inf_err;
 	struct pnv_eeh_ops	*eeh_ops;
 #endif
 
-- 
1.7.10.4



More information about the Linuxppc-dev mailing list