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 v2 6/6] iommu/vt-d: Add debugfs support for Intel IOMMU Interrupt remapping Date: Wed, 22 Nov 2017 11:25:46 -0800 [thread overview] Message-ID: <1511378746-109275-7-git-send-email-sohil.mehta@intel.com> (raw) In-Reply-To: <1511378746-109275-1-git-send-email-sohil.mehta@intel.com> Debugfs extension for Intel IOMMU to dump Interrupt remapping table entries for Interrupt remapping and Interrupt posting. The file /sys/kernel/debug/intel_iommu/intel_iommu_interrupt_remap provides detailed information, such as Index, Source Id, Destination Id, Vector and the raw values for entries with the present bit set, in the format shown. Remapped Interrupt supported on IOMMU: dmar5 IR table address:ffff93e09d54c310 ----------------------------------------------------------- Index SID Dest_ID Vct Raw_value_high Raw_value_low 1 3a00 00000600 2c 0000000000043a00 00000600002c0009 111 4301 00000900 a2 0000000000044301 0000090000a20009 Posted Interrupt supported on IOMMU: dmar5 IR table address:ffff93e09d54c310 -------------------------------------------------------------------- Index SID PDA_high PDA_low Vct Raw_value_high Raw_value_low 4 4300 00000010 40c7c880 41 0000001000044300 40c7c88000418001 5 4300 00000010 40c7c880 51 0000001000044300 40c7c88000518001 Cc: Gayatri Kammela <gayatri.kammela@intel.com> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Ashok Raj <ashok.raj@intel.com> Signed-off-by: Sohil Mehta <sohil.mehta@intel.com> --- v2: Handle the case when IR is not enabled. Fix seq_printf formatting drivers/iommu/intel-iommu-debug.c | 123 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/drivers/iommu/intel-iommu-debug.c b/drivers/iommu/intel-iommu-debug.c index 22a0683..7fda862 100644 --- a/drivers/iommu/intel-iommu-debug.c +++ b/drivers/iommu/intel-iommu-debug.c @@ -12,6 +12,7 @@ * * Authors: Gayatri Kammela <gayatri.kammela@intel.com> * Jacob Pan <jacob.jun.pan@linux.intel.com> + * Sohil Mehta <sohil.mehta@intel.com> * */ @@ -280,6 +281,119 @@ static const struct file_operations intel_iommu_regs_fops = { .release = single_release, }; +#ifdef CONFIG_IRQ_REMAP +static void ir_tbl_remap_entry_show(struct seq_file *m, void *unused, + struct intel_iommu *iommu) +{ + int idx; + struct irte *ri_entry; + + /* Print the header only once */ + seq_printf(m, " Index SID Dest_ID Vct" + " Raw_value_high Raw_value_low\n"); + + for (idx = 0; idx < INTR_REMAP_TABLE_ENTRIES; idx++) { + ri_entry = &iommu->ir_table->base[idx]; + if (!ri_entry->present || ri_entry->p_pst) + continue; + seq_printf(m, + " %d\t%04x %08x %02x %016llx %016llx\n", + idx, ri_entry->sid, + ri_entry->dest_id, ri_entry->vector, + ri_entry->high, ri_entry->low); + } +} + +static void ir_tbl_posted_entry_show(struct seq_file *m, void *unused, + struct intel_iommu *iommu) +{ + int idx; + struct irte *pi_entry; + + /* Print the header only once */ + seq_printf(m, " Index SID PDA_high PDA_low Vct" + " Raw_value_high Raw_value_low\n"); + + for (idx = 0; idx < INTR_REMAP_TABLE_ENTRIES; idx++) { + pi_entry = &iommu->ir_table->base[idx]; + if (!pi_entry->present || !pi_entry->p_pst) + continue; + seq_printf(m, + " %d\t%04x %08x %08x %02x %016llx %016llx\n", + idx, pi_entry->sid, + pi_entry->pda_h, (pi_entry->pda_l)<<6, + pi_entry->vector, pi_entry->high, + pi_entry->low); + } +} + +/* + * For active IOMMUs go through the Interrupt remapping + * table and print valid entries in a table format for + * Remapped and Posted Interrupts. + */ +static int intel_iommu_ir_show(struct seq_file *m, void *unused) +{ + struct dmar_drhd_unit *drhd; + struct intel_iommu *iommu; + + rcu_read_lock(); + for_each_active_iommu(iommu, drhd) { + if (!iommu || !ecap_ir_support(iommu->ecap)) + continue; + + seq_printf(m, + "\nRemapped Interrupt supported on IOMMU: %s\n" + " IR table address:%p\n", + iommu->name, iommu->ir_table); + + seq_printf(m, "---------------------------------------" + "--------------------\n"); + + if (iommu->ir_table) + ir_tbl_remap_entry_show(m, unused, iommu); + else + seq_printf(m, "Interrupt Remapping is not enabled\n"); + } + + seq_printf(m, "\n****\t****\t****\t****\t****\t****\t****\t****\n"); + + for_each_active_iommu(iommu, drhd) { + if (!iommu || !cap_pi_support(iommu->cap)) + continue; + + seq_printf(m, + "\nPosted Interrupt supported on IOMMU: %s\n" + " IR table address:%p\n", + iommu->name, iommu->ir_table); + + seq_printf(m, "---------------------------------------" + "-----------------------------\n"); + + if (iommu->ir_table) + ir_tbl_posted_entry_show(m, unused, iommu); + else + seq_printf(m, "Interrupt Remapping is not enabled\n"); + } + rcu_read_unlock(); + + return 0; +} + +static int intel_iommu_ir_open(struct inode *inode, struct file *file) +{ + return single_open(file, intel_iommu_ir_show, inode->i_private); +} + +static const struct file_operations intel_iommu_ir_fops = { + .open = intel_iommu_ir_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + .owner = THIS_MODULE, +}; +#endif + void __init intel_iommu_debugfs_init(void) { struct dentry *iommu_debug_root; @@ -304,6 +418,15 @@ void __init intel_iommu_debugfs_init(void) goto err; } +#ifdef CONFIG_IRQ_REMAP + if (!debugfs_create_file("intel_iommu_interrupt_remap", S_IRUGO, + iommu_debug_root, NULL, + &intel_iommu_ir_fops)) { + pr_err("Can't create intel_iommu_interrupt_remap file\n"); + goto err; + } +#endif + return; err: -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Sohil Mehta <sohil.mehta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> To: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>, Alex Williamson <alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Cc: Ravi V Shankar <ravi.v.shankar-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>, Fenghua Yu <fenghua.yu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>, Gayatri Kammela <gayatri.kammela-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>, Andriy Shevchenko <andriy.shevchenko-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Subject: [PATCH v2 6/6] iommu/vt-d: Add debugfs support for Intel IOMMU Interrupt remapping Date: Wed, 22 Nov 2017 11:25:46 -0800 [thread overview] Message-ID: <1511378746-109275-7-git-send-email-sohil.mehta@intel.com> (raw) In-Reply-To: <1511378746-109275-1-git-send-email-sohil.mehta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Debugfs extension for Intel IOMMU to dump Interrupt remapping table entries for Interrupt remapping and Interrupt posting. The file /sys/kernel/debug/intel_iommu/intel_iommu_interrupt_remap provides detailed information, such as Index, Source Id, Destination Id, Vector and the raw values for entries with the present bit set, in the format shown. Remapped Interrupt supported on IOMMU: dmar5 IR table address:ffff93e09d54c310 ----------------------------------------------------------- Index SID Dest_ID Vct Raw_value_high Raw_value_low 1 3a00 00000600 2c 0000000000043a00 00000600002c0009 111 4301 00000900 a2 0000000000044301 0000090000a20009 Posted Interrupt supported on IOMMU: dmar5 IR table address:ffff93e09d54c310 -------------------------------------------------------------------- Index SID PDA_high PDA_low Vct Raw_value_high Raw_value_low 4 4300 00000010 40c7c880 41 0000001000044300 40c7c88000418001 5 4300 00000010 40c7c880 51 0000001000044300 40c7c88000518001 Cc: Gayatri Kammela <gayatri.kammela-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Cc: Jacob Pan <jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> Cc: Fenghua Yu <fenghua.yu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Cc: Ashok Raj <ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Signed-off-by: Sohil Mehta <sohil.mehta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> --- v2: Handle the case when IR is not enabled. Fix seq_printf formatting drivers/iommu/intel-iommu-debug.c | 123 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) diff --git a/drivers/iommu/intel-iommu-debug.c b/drivers/iommu/intel-iommu-debug.c index 22a0683..7fda862 100644 --- a/drivers/iommu/intel-iommu-debug.c +++ b/drivers/iommu/intel-iommu-debug.c @@ -12,6 +12,7 @@ * * Authors: Gayatri Kammela <gayatri.kammela-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> * Jacob Pan <jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> + * Sohil Mehta <sohil.mehta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> * */ @@ -280,6 +281,119 @@ static const struct file_operations intel_iommu_regs_fops = { .release = single_release, }; +#ifdef CONFIG_IRQ_REMAP +static void ir_tbl_remap_entry_show(struct seq_file *m, void *unused, + struct intel_iommu *iommu) +{ + int idx; + struct irte *ri_entry; + + /* Print the header only once */ + seq_printf(m, " Index SID Dest_ID Vct" + " Raw_value_high Raw_value_low\n"); + + for (idx = 0; idx < INTR_REMAP_TABLE_ENTRIES; idx++) { + ri_entry = &iommu->ir_table->base[idx]; + if (!ri_entry->present || ri_entry->p_pst) + continue; + seq_printf(m, + " %d\t%04x %08x %02x %016llx %016llx\n", + idx, ri_entry->sid, + ri_entry->dest_id, ri_entry->vector, + ri_entry->high, ri_entry->low); + } +} + +static void ir_tbl_posted_entry_show(struct seq_file *m, void *unused, + struct intel_iommu *iommu) +{ + int idx; + struct irte *pi_entry; + + /* Print the header only once */ + seq_printf(m, " Index SID PDA_high PDA_low Vct" + " Raw_value_high Raw_value_low\n"); + + for (idx = 0; idx < INTR_REMAP_TABLE_ENTRIES; idx++) { + pi_entry = &iommu->ir_table->base[idx]; + if (!pi_entry->present || !pi_entry->p_pst) + continue; + seq_printf(m, + " %d\t%04x %08x %08x %02x %016llx %016llx\n", + idx, pi_entry->sid, + pi_entry->pda_h, (pi_entry->pda_l)<<6, + pi_entry->vector, pi_entry->high, + pi_entry->low); + } +} + +/* + * For active IOMMUs go through the Interrupt remapping + * table and print valid entries in a table format for + * Remapped and Posted Interrupts. + */ +static int intel_iommu_ir_show(struct seq_file *m, void *unused) +{ + struct dmar_drhd_unit *drhd; + struct intel_iommu *iommu; + + rcu_read_lock(); + for_each_active_iommu(iommu, drhd) { + if (!iommu || !ecap_ir_support(iommu->ecap)) + continue; + + seq_printf(m, + "\nRemapped Interrupt supported on IOMMU: %s\n" + " IR table address:%p\n", + iommu->name, iommu->ir_table); + + seq_printf(m, "---------------------------------------" + "--------------------\n"); + + if (iommu->ir_table) + ir_tbl_remap_entry_show(m, unused, iommu); + else + seq_printf(m, "Interrupt Remapping is not enabled\n"); + } + + seq_printf(m, "\n****\t****\t****\t****\t****\t****\t****\t****\n"); + + for_each_active_iommu(iommu, drhd) { + if (!iommu || !cap_pi_support(iommu->cap)) + continue; + + seq_printf(m, + "\nPosted Interrupt supported on IOMMU: %s\n" + " IR table address:%p\n", + iommu->name, iommu->ir_table); + + seq_printf(m, "---------------------------------------" + "-----------------------------\n"); + + if (iommu->ir_table) + ir_tbl_posted_entry_show(m, unused, iommu); + else + seq_printf(m, "Interrupt Remapping is not enabled\n"); + } + rcu_read_unlock(); + + return 0; +} + +static int intel_iommu_ir_open(struct inode *inode, struct file *file) +{ + return single_open(file, intel_iommu_ir_show, inode->i_private); +} + +static const struct file_operations intel_iommu_ir_fops = { + .open = intel_iommu_ir_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + .owner = THIS_MODULE, +}; +#endif + void __init intel_iommu_debugfs_init(void) { struct dentry *iommu_debug_root; @@ -304,6 +418,15 @@ void __init intel_iommu_debugfs_init(void) goto err; } +#ifdef CONFIG_IRQ_REMAP + if (!debugfs_create_file("intel_iommu_interrupt_remap", S_IRUGO, + iommu_debug_root, NULL, + &intel_iommu_ir_fops)) { + pr_err("Can't create intel_iommu_interrupt_remap file\n"); + goto err; + } +#endif + return; err: -- 2.7.4
next prev parent reply other threads:[~2017-11-22 19:26 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-11-22 19:25 [PATCH v2 0/6] Intel IOMMU debugfs support Sohil Mehta 2017-11-22 18:47 ` Raj, Ashok 2017-11-22 18:47 ` Raj, Ashok 2017-11-22 19:25 ` [PATCH v2 1/6] iommu/vt-d: Add debugfs support for Intel IOMMU internals Sohil Mehta 2017-11-22 19:25 ` Sohil Mehta 2017-11-22 19:25 ` [PATCH v2 2/6] iommu/vt-d: Add Intel IOMMU debugfs to show context internals Sohil Mehta 2017-11-22 19:25 ` Sohil Mehta 2017-11-22 19:25 ` [PATCH v2 3/6] iommu/vt-d: Add Intel IOMMU debugfs to show extended " Sohil Mehta 2017-11-22 19:25 ` Sohil Mehta 2017-11-22 19:25 ` [PATCH v2 4/6] iommu/vt-d: Add debugfs extension to show register contents Sohil Mehta 2017-11-22 19:25 ` Sohil Mehta 2017-11-22 21:19 ` Andy Shevchenko 2017-11-22 21:19 ` Andy Shevchenko 2017-11-27 20:52 ` Kammela, Gayatri 2017-11-28 0:02 ` Mehta, Sohil 2017-11-28 0:02 ` Mehta, Sohil 2017-11-28 12:15 ` Andy Shevchenko 2017-11-28 13:55 ` Andy Shevchenko 2017-11-28 13:55 ` Andy Shevchenko 2017-11-22 19:25 ` [PATCH v2 5/6] iommu/vt-d: Add debugfs extension to show Pasid table contents Sohil Mehta 2017-11-22 19:25 ` Sohil Mehta 2017-11-22 19:25 ` Sohil Mehta [this message] 2017-11-22 19:25 ` [PATCH v2 6/6] iommu/vt-d: Add debugfs support for Intel IOMMU Interrupt remapping Sohil Mehta 2017-11-22 21:18 ` Andy Shevchenko 2017-11-22 21:18 ` Andy Shevchenko
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=1511378746-109275-7-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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.