[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] AMD IOMMU: fix debug console IOMMU intremap output



> -----Original Message-----
> From: Woods, Brian [mailto:Brian.Woods@xxxxxxx]
> Sent: 04 December 2018 21:47
> To: xen-devel@xxxxxxxxxxxxx
> Cc: Suthikulpanit, Suravee <Suravee.Suthikulpanit@xxxxxxx>; Woods, Brian
> <Brian.Woods@xxxxxxx>; Paul Durrant <Paul.Durrant@xxxxxxxxxx>; Roger Pau
> Monne <roger.pau@xxxxxxxxxx>
> 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 <brian.woods@xxxxxxx>
> ---
> CC: Paul Durrant <paul.durrant@xxxxxxxxxx>
> CC: Roger Pau Monne <roger.pau@xxxxxxxxxx>
> 
>  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 <paul.durrant@xxxxxxxxxx>


> +        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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.