> -----Original Message-----
> From: Woods, Brian [mailto:[email protected]]
> Sent: 04 December 2018 21:47
> To: [email protected]
> Cc: Suthikulpanit, Suravee <[email protected]>; Woods, Brian
> <[email protected]>; Paul Durrant <[email protected]>; Roger Pau
> Monne <[email protected]>
> Subject: [PATCH] AMD IOMMU: fix debug console IOMMU intremap output
>
> 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 <[email protected]>
> ---
> CC: Paul Durrant <[email protected]>
> CC: Roger Pau Monne <[email protected]>
>
> 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;
s/u32/uint32_t in both cases above.
> +
> + if ( !table )
> + return true;
> +
> + for ( count = 0; count < INTREMAP_ENTRIES; count++ )
> + {
Unnecessary braces.
> + 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) ) {
Style. The open brace should be on the line below.
The functionality looks fine though, so with those fixed...
Reviewed-by: Paul Durrant <[email protected]>
> + 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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel