[PATCH] powernv/pci: Add PHB register dump debugfs handle
Russell Currey
ruscur at russell.cc
Fri Jul 22 15:23:36 AEST 2016
On EEH events the kernel will print a dump of relevant registers.
If EEH is unavailable (i.e. CONFIG_EEH is disabled, a new platform
doesn't have EEH support, etc) this information isn't readily available.
Add a new debugfs handler to trigger a PHB register dump, so that this
information can be made available on demand.
Signed-off-by: Russell Currey <ruscur at russell.cc>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 35 +++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 891fc4a..ada2f3c 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -3018,6 +3018,38 @@ static void pnv_ioda_setup_pe_seg(struct pnv_ioda_pe *pe)
}
}
+#ifdef CONFIG_DEBUG_FS
+static ssize_t pnv_pci_debug_write(struct file *filp,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct pci_controller *hose = filp->private_data;
+ struct pnv_phb *phb;
+ int ret = 0;
+
+ if (!hose)
+ return -EFAULT;
+
+ phb = hose->private_data;
+ if (!phb)
+ return -EFAULT;
+
+ ret = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,
+ PNV_PCI_DIAG_BUF_SIZE);
+
+ if (!ret)
+ pnv_pci_dump_phb_diag_data(phb->hose, phb->diag.blob);
+
+ return ret < 0 ? ret : count;
+}
+
+static const struct file_operations pnv_pci_debug_ops = {
+ .open = simple_open,
+ .llseek = no_llseek,
+ .write = pnv_pci_debug_write,
+};
+#endif /* CONFIG_DEBUG_FS */
+
static void pnv_pci_ioda_create_dbgfs(void)
{
#ifdef CONFIG_DEBUG_FS
@@ -3036,6 +3068,9 @@ static void pnv_pci_ioda_create_dbgfs(void)
if (!phb->dbgfs)
pr_warning("%s: Error on creating debugfs on PHB#%x\n",
__func__, hose->global_number);
+
+ debugfs_create_file("regdump", 0200, phb->dbgfs, hose,
+ &pnv_pci_debug_ops);
}
#endif /* CONFIG_DEBUG_FS */
}
--
2.9.0
More information about the Linuxppc-dev
mailing list