All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] AMD IOMMU: fix debug console IOMMU intremap output
@ 2018-12-04 21:47 Woods, Brian
  2018-12-05  8:50 ` Paul Durrant
  2018-12-05  9:00 ` Jan Beulich
  0 siblings, 2 replies; 4+ messages in thread
From: Woods, Brian @ 2018-12-04 21:47 UTC (permalink / raw)
  To: xen-devel@lists.xen.org
  Cc: Paul Durrant, Woods, Brian, Suthikulpanit, Suravee,
	Roger Pau Monne

When using the Xen debug console and printing the IOMMU intremap tables,
it prints everything in the IVRS range regardless if it has an intr
remap or not.  Add some logic to cause an entry to only be printed if
the intr remap table isn't empty.

Signed-off-by: Brian Woods <brian.woods@amd.com>
---
CC: Paul Durrant <paul.durrant@citrix.com>
CC: Roger Pau Monne <roger.pau@citrix.com>

 xen/drivers/passthrough/amd/iommu_intr.c | 34 ++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c
index dad2d1e5ab..e86300b57f 100644
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -665,6 +665,24 @@ int __init amd_setup_hpet_msi(struct msi_desc *msi_desc)
     return rc;
 }
 
+
+static bool intremap_table_empty(const u32 *table)
+{
+    u32 count;
+
+    if ( !table )
+        return true;
+
+    for ( count = 0; count < INTREMAP_ENTRIES; count++ )
+    {
+        if ( table[count] )
+            return false;
+    }
+    return true;
+}
+
+
+
 static void dump_intremap_table(const u32 *table)
 {
     u32 count;
@@ -687,13 +705,17 @@ static int dump_intremap_mapping(u16 seg, struct ivrs_mappings *ivrs_mapping)
     if ( !ivrs_mapping )
         return 0;
 
-    printk("  %04x:%02x:%02x:%u:\n", seg,
-           PCI_BUS(ivrs_mapping->dte_requestor_id),
-           PCI_SLOT(ivrs_mapping->dte_requestor_id),
-           PCI_FUNC(ivrs_mapping->dte_requestor_id));
-
     spin_lock_irqsave(&(ivrs_mapping->intremap_lock), flags);
-    dump_intremap_table(ivrs_mapping->intremap_table);
+
+    if ( !intremap_table_empty(ivrs_mapping->intremap_table) ) {
+        printk("  %04x:%02x:%02x:%u:\n", seg,
+               PCI_BUS(ivrs_mapping->dte_requestor_id),
+               PCI_SLOT(ivrs_mapping->dte_requestor_id),
+               PCI_FUNC(ivrs_mapping->dte_requestor_id));
+
+        dump_intremap_table(ivrs_mapping->intremap_table);
+    }
+
     spin_unlock_irqrestore(&(ivrs_mapping->intremap_lock), flags);
 
     return 0;
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-05 19:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-04 21:47 [PATCH] AMD IOMMU: fix debug console IOMMU intremap output Woods, Brian
2018-12-05  8:50 ` Paul Durrant
2018-12-05  9:00 ` Jan Beulich
2018-12-05 19:56   ` Woods, Brian

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.