* [PATCH v3] powernv/pci: Add PHB register dump debugfs handle
@ 2016-07-28 5:05 Russell Currey
2016-08-02 4:46 ` Gavin Shan
2016-09-25 3:00 ` [v3] " Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Russell Currey @ 2016-07-28 5:05 UTC (permalink / raw)
To: linuxppc-dev; +Cc: gwshan, Russell Currey
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@russell.cc>
---
V3 changes:
- use s64 instead of int for ret
- check val != 1ULL instead of 1
- return -ENODEV instead of -EFAULT
- check hose and phb in the same statement
- whitespace changes for DEFINE_SIMPLE_ATTRIBUTE
- rename handler to "dump_diag_regs"
- more debugfs handlers seemed to use _ instead of -
V2 changes:
- use a simple attribute instead of full fops thanks to mpe
- miscellanous fixes thanks to Gavin
- rename from "regdump" to "dump_regs"
---
arch/powerpc/platforms/powernv/pci-ioda.c | 39 ++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 891fc4a..2808fda 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 int pnv_pci_diag_data_set(void *data, u64 val)
+{
+ struct pci_controller *hose;
+ struct pnv_phb *phb;
+ s64 ret;
+
+ if (val != 1ULL)
+ return -EINVAL;
+
+ hose = (struct pci_controller *)data;
+ if (!hose || !hose->private_data)
+ return -ENODEV;
+
+ phb = hose->private_data;
+
+ /* Retrieve the diag data from firmware */
+ ret = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,
+ PNV_PCI_DIAG_BUF_SIZE);
+ if (ret != OPAL_SUCCESS)
+ return -EIO;
+
+ /* Print the diag data to the kernel log */
+ pnv_pci_dump_phb_diag_data(phb->hose, phb->diag.blob);
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(pnv_pci_diag_data_fops, NULL,
+ pnv_pci_diag_data_set, "%llu\n");
+
+#endif /* CONFIG_DEBUG_FS */
+
static void pnv_pci_ioda_create_dbgfs(void)
{
#ifdef CONFIG_DEBUG_FS
@@ -3033,9 +3065,14 @@ static void pnv_pci_ioda_create_dbgfs(void)
sprintf(name, "PCI%04x", hose->global_number);
phb->dbgfs = debugfs_create_dir(name, powerpc_debugfs_root);
- if (!phb->dbgfs)
+ if (!phb->dbgfs) {
pr_warning("%s: Error on creating debugfs on PHB#%x\n",
__func__, hose->global_number);
+ continue;
+ }
+
+ debugfs_create_file("dump_diag_regs", 0200, phb->dbgfs, hose,
+ &pnv_pci_diag_data_fops);
}
#endif /* CONFIG_DEBUG_FS */
}
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] powernv/pci: Add PHB register dump debugfs handle
2016-07-28 5:05 [PATCH v3] powernv/pci: Add PHB register dump debugfs handle Russell Currey
@ 2016-08-02 4:46 ` Gavin Shan
2016-09-25 3:00 ` [v3] " Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Gavin Shan @ 2016-08-02 4:46 UTC (permalink / raw)
To: Russell Currey; +Cc: linuxppc-dev, gwshan
On Thu, Jul 28, 2016 at 03:05:03PM +1000, Russell Currey wrote:
>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@russell.cc>
>---
Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [v3] powernv/pci: Add PHB register dump debugfs handle
2016-07-28 5:05 [PATCH v3] powernv/pci: Add PHB register dump debugfs handle Russell Currey
2016-08-02 4:46 ` Gavin Shan
@ 2016-09-25 3:00 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2016-09-25 3:00 UTC (permalink / raw)
To: Russell Currey, linuxppc-dev; +Cc: gwshan, Russell Currey
On Thu, 2016-28-07 at 05:05:03 UTC, Russell Currey wrote:
> 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@russell.cc>
> Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/98b665da5751b10f3f5f3ce3ba
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-25 3:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-28 5:05 [PATCH v3] powernv/pci: Add PHB register dump debugfs handle Russell Currey
2016-08-02 4:46 ` Gavin Shan
2016-09-25 3:00 ` [v3] " Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.