From: Sohil Mehta <sohil.mehta@intel.com>
To: Joerg Roedel <joro@8bytes.org>,
Alex Williamson <alex.williamson@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
Ashok Raj <ashok.raj@intel.com>,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
Jacob Pan <jacob.jun.pan@linux.intel.com>,
Gayatri Kammela <gayatri.kammela@intel.com>,
Sohil Mehta <sohil.mehta@intel.com>,
Ravi V Shankar <ravi.v.shankar@intel.com>,
Andriy Shevchenko <andriy.shevchenko@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>
Subject: [PATCH v3 3/6] iommu/vt-d: Add Intel IOMMU debugfs to show extended context internals
Date: Tue, 5 Dec 2017 19:43:24 -0800 [thread overview]
Message-ID: <1512531807-24268-4-git-send-email-sohil.mehta@intel.com> (raw)
In-Reply-To: <1512531807-24268-1-git-send-email-sohil.mehta@intel.com>
From: Gayatri Kammela <gayatri.kammela@intel.com>
Debugfs extension to dump internals such as extended context table
entries for each IOMMU to the userspace.
root@OTC-KBLH-01:~# cat
/sys/kernel/debug/intel_iommu/dmar_translation_struct
IOMMU dmar1: Extended Root Table Addr:4558a1800
Extended Root tbl entries:
Bus 0 L: 4558a6001 H: 0
Lower Context table entries for Bus: 0
[entry] DID :B :D .F Low High
[16] 0000:00:02.00 4558a5005 102
Higher Context tbl entries for Bus: 0
[16] 0000:00:02.00 401b0000c 401400000
IOMMU dmar0: Extended Root Table Addr:4558a2800
Extended Root tbl entries:
Bus 0 L: 4016f4001 H: 0
Lower Context table entries for Bus: 0
[entry] DID :B :D .F Low High
[80] 0000:00:0a.00 4016f3a05 102
Higher Context tbl entries for Bus: 0
[80] 0000:00:0a.00 40150000c 671b80000000
Cc: Sohil Mehta <sohil.mehta@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Gayatri Kammela <gayatri.kammela@intel.com>
---
v3: No change
v2: No change
drivers/iommu/intel-iommu-debug.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/iommu/intel-iommu-debug.c b/drivers/iommu/intel-iommu-debug.c
index 8ae0c4d..8e7f5d2 100644
--- a/drivers/iommu/intel-iommu-debug.c
+++ b/drivers/iommu/intel-iommu-debug.c
@@ -46,6 +46,38 @@ static const struct file_operations __name ## _fops = \
.owner = THIS_MODULE, \
}
+#ifdef CONFIG_INTEL_IOMMU_SVM
+static void ext_ctx_tbl_entry_show(struct seq_file *m, void *unused,
+ struct intel_iommu *iommu, int bus, int ctx,
+ struct context_entry *context, bool new_ext)
+{
+ u64 ctx_lo;
+
+ if (new_ext) {
+ seq_printf(m, "Higher Context tbl entries for Bus: %d\n", bus);
+ ctx_lo = context[0].lo;
+
+ if (!(ctx_lo & CONTEXT_PASIDE)) {
+ context[1].hi = (u64)virt_to_phys(
+ iommu->pasid_state_table);
+ context[1].lo = (u64)virt_to_phys(iommu->pasid_table) |
+ intel_iommu_get_pts(iommu);
+ }
+
+ seq_printf(m, "[%d]\t%04x:%02x:%02x.%02x\t%llx\t%llx\n", ctx,
+ iommu->segment, bus, PCI_SLOT(ctx), PCI_FUNC(ctx),
+ context[1].lo, context[1].hi);
+ }
+}
+#else /* CONFIG_INTEL_IOMMU_SVM */
+static void ext_ctx_tbl_entry_show(struct seq_file *m, void *unused,
+ struct intel_iommu *iommu, int bus, int ctx,
+ struct context_entry *context, bool new_ext)
+{
+ return;
+}
+#endif /* CONFIG_INTEL_IOMMU_SVM */
+
static void ctx_tbl_entry_show(struct seq_file *m, void *unused,
struct intel_iommu *iommu, int bus, bool ext,
bool new_ext)
@@ -69,6 +101,9 @@ static void ctx_tbl_entry_show(struct seq_file *m, void *unused,
seq_printf(m, "[%d]\t%04x:%02x:%02x.%02x\t%llx\t%llx\n",
ctx, iommu->segment, bus, PCI_SLOT(ctx),
PCI_FUNC(ctx), context[0].lo, context[0].hi);
+
+ ext_ctx_tbl_entry_show(m, unused, iommu, bus, ctx,
+ context, new_ext);
}
}
out:
--
2.7.4
next prev parent reply other threads:[~2017-12-06 3:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-06 3:43 [PATCH v3 0/6] Intel IOMMU debugfs support Sohil Mehta
2017-12-06 3:43 ` [PATCH v3 1/6] iommu/vt-d: Add debugfs support for Intel IOMMU internals Sohil Mehta
2017-12-06 3:43 ` [PATCH v3 2/6] iommu/vt-d: Add Intel IOMMU debugfs to show context internals Sohil Mehta
2017-12-06 8:16 ` Lu Baolu
[not found] ` <5A27A74C.9070201-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-12-07 20:19 ` Mehta, Sohil
[not found] ` <1512678006.120652.17.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-12-13 2:28 ` Lu Baolu
[not found] ` <5A30905D.9000303-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-12-13 4:30 ` Mehta, Sohil
2017-12-06 3:43 ` Sohil Mehta [this message]
2017-12-06 8:17 ` [PATCH v3 3/6] iommu/vt-d: Add Intel IOMMU debugfs to show extended " Lu Baolu
[not found] ` <5A27A787.2060307-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-12-07 20:30 ` Mehta, Sohil
2017-12-06 8:17 ` Lu Baolu
2017-12-06 3:43 ` [PATCH v3 4/6] iommu/vt-d: Add debugfs extension to show register contents Sohil Mehta
2017-12-06 3:43 ` [PATCH v3 5/6] iommu/vt-d: Add debugfs extension to show Pasid table contents Sohil Mehta
2017-12-06 3:43 ` [PATCH v3 6/6] iommu/vt-d: Add debugfs support for Intel IOMMU Interrupt remapping Sohil Mehta
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=1512531807-24268-4-git-send-email-sohil.mehta@intel.com \
--to=sohil.mehta@intel.com \
--cc=alex.williamson@redhat.com \
--cc=andriy.shevchenko@intel.com \
--cc=ashok.raj@intel.com \
--cc=dwmw2@infradead.org \
--cc=fenghua.yu@intel.com \
--cc=gayatri.kammela@intel.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jacob.jun.pan@linux.intel.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ravi.v.shankar@intel.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).