From: Timothy Pearson <tpearson@raptorengineering.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>
Subject: [PATCH 3/7] powerpc/powernv/pci: Track DMA and TCE tables in debugfs
Date: Sat, 23 Jun 2018 18:53:28 -0500 (CDT) [thread overview]
Message-ID: <1820986268.2569250.1529798008396.JavaMail.zimbra@raptorengineeringinc.com> (raw)
Add a new debugfs entry to trigger dumping out the tracking table and
TCEs for a given PE, for example PE 0x4 of PHB 2:
echo 0x4 > /sys/kernel/debug/powerpc/PCI0002/sketchy
This will result in the table being dumped out in dmesg.
Signed-off-by: Russell Currey <ruscur@russell.cc>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 43 +++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 7ecc186493ca..55f0f7b885bc 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -3342,6 +3342,47 @@ static int pnv_pci_diag_data_set(void *data, u64 val)
DEFINE_SIMPLE_ATTRIBUTE(pnv_pci_diag_data_fops, NULL,
pnv_pci_diag_data_set, "%llu\n");
+static int pnv_pci_sketchy_set(void *data, u64 val)
+{
+ struct pci_controller *hose;
+ struct pnv_ioda_pe *pe;
+ struct pnv_phb *phb;
+ u64 entry1, entry2;
+ int i;
+
+ hose = (struct pci_controller *)data;
+ if (!hose || !hose->private_data)
+ return -ENODEV;
+
+ phb = hose->private_data;
+ pe = &phb->ioda.pe_array[val];
+
+ if (!pe)
+ return -EINVAL;
+
+ if (!pe->tces || !pe->tce_tracker)
+ return -EIO;
+
+ for (i = 0; i < pe->tce_count; i++) {
+ if (i > 16 && pe->tces[i] == 0)
+ break;
+ pr_info("%3d: %016llx\n", i, be64_to_cpu(pe->tces[i]));
+ }
+
+ for (i = 0; i < pe->tce_count; i++) {
+ entry1 = pe->tce_tracker[i * 2];
+ entry2 = pe->tce_tracker[i * 2 + 1];
+ if (!entry1)
+ break;
+ pr_info("%3d: %016llx %016llx\n", i, entry1, entry2);
+ }
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(pnv_pci_sketchy_fops, NULL,
+ pnv_pci_sketchy_set, "%llu\n");
+
+
#endif /* CONFIG_DEBUG_FS */
static void pnv_pci_ioda_create_dbgfs(void)
@@ -3367,6 +3408,8 @@ static void pnv_pci_ioda_create_dbgfs(void)
debugfs_create_file("dump_diag_regs", 0200, phb->dbgfs, hose,
&pnv_pci_diag_data_fops);
+ debugfs_create_file("sketchy", 0200, phb->dbgfs, hose,
+ &pnv_pci_sketchy_fops);
}
#endif /* CONFIG_DEBUG_FS */
}
--
2.17.1
reply other threads:[~2018-06-24 0:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1820986268.2569250.1529798008396.JavaMail.zimbra@raptorengineeringinc.com \
--to=tpearson@raptorengineering.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).