linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Russell Currey <ruscur@russell.cc>
To: linuxppc-dev@lists.ozlabs.org
Cc: benh@kernel.crashing.org, alistair@popple.id.au, aik@ozlabs.ru,
	tpearson@raptorengineering.com,
	Russell Currey <ruscur@russell.cc>
Subject: [PATCH 3/3] powerpc/powernv/pci: Track TCE tables in debugfs
Date: Fri, 29 Jun 2018 17:34:37 +1000	[thread overview]
Message-ID: <20180629073437.4060-4-ruscur@russell.cc> (raw)
In-Reply-To: <20180629073437.4060-1-ruscur@russell.cc>

Add a new debugfs entry to trigger dumping out the TCEs for a
given PE using pseudo-bypass, for example PE 0x4 of PHB 2:

echo 0x4 > /sys/kernel/debug/powerpc/PCI0002/dump_tces

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 | 34 +++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index d2ca214610fd..91316d3c26dc 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -3314,6 +3314,38 @@ 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_dump_tces_set(void *data, u64 val)
+{
+	struct pci_controller *hose;
+	struct pnv_ioda_pe *pe;
+	struct pnv_phb *phb;
+	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)
+		return -EIO;
+
+	for (i = 0; i < pe->tce_count; i++) {
+		if (i > 16 && pe->tces[i] == 0)
+			break;
+		pr_info("TCE %3d: %016llx\n", i, be64_to_cpu(pe->tces[i]));
+	}
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(pnv_pci_dump_tces_fops, NULL,
+			pnv_pci_dump_tces_set, "%llu\n");
+
+
 #endif /* CONFIG_DEBUG_FS */
 
 static void pnv_pci_ioda_create_dbgfs(void)
@@ -3339,6 +3371,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("dump_tces", 0200, phb->dbgfs, hose,
+				    &pnv_pci_dump_tces_fops);
 	}
 #endif /* CONFIG_DEBUG_FS */
 }
-- 
2.17.1

      parent reply	other threads:[~2018-06-29  7:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  7:34 [PATCH 0/3] PCI DMA pseudo-bypass for powernv Russell Currey
2018-06-29  7:34 ` [PATCH 1/3] powerpc/powernv/pci: Track largest available TCE order per PHB Russell Currey
2018-07-02  7:32   ` Alexey Kardashevskiy
2018-07-02  7:34     ` Alexey Kardashevskiy
2018-07-03  5:49       ` Russell Currey
2018-06-29  7:34 ` [PATCH 2/3] powerpc/powernv: DMA operations for discontiguous allocation Russell Currey
2018-06-30  2:52   ` Benjamin Herrenschmidt
2018-07-02  8:47   ` Alexey Kardashevskiy
2018-07-03  6:09     ` Russell Currey
2018-07-04  6:12   ` Russell Currey
2018-06-29  7:34 ` Russell Currey [this message]

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=20180629073437.4060-4-ruscur@russell.cc \
    --to=ruscur@russell.cc \
    --cc=aik@ozlabs.ru \
    --cc=alistair@popple.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=tpearson@raptorengineering.com \
    /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).