Re: [PATCH v6 4/5] iommu/vt-d: Add debugfs support to show Pasid table contents

From: Andy Shevchenko
Date: Wed Jan 10 2018 - 08:43:48 EST


On Tue, 2018-01-09 at 19:48 -0800, Sohil Mehta wrote:

> Debugfs extension to dump the internals such as pasid table entries
> for
> each IOMMU to the userspace.
>
> Example of such dump in Kabylake:
>
> root@OTC-KBLH-01:~# cat
> /sys/kernel/debug/intel_iommu/dmar_translation_struct
>
> IOMMU dmar0: Extended Root Table Addr:402b9e800
> Extended Root table entries:
> Bus 0 L: 402150001 H: 0
> Lower Context table entries for Bus: 0
> [entry] DID :B :D .F Low High
> [80] 0000:00:0a.00 40214fa05 102
> Higher Context table entries for Bus: 0
> [80] 0000:00:0a.00 40260000c 0
> Pasid Table Addr : ffff8e2d42600000
> Pasid table entries for domain 0:
> [Entry] Contents
> [0] 12c409801
>

> +#ifdef CONFIG_INTEL_IOMMU_SVM
> +static void pasid_tbl_entry_show(struct seq_file *m, struct
> intel_iommu *iommu)
> +{
> + int pasid_size = 0, i;
> +

> + if (ecap_pasid(iommu->ecap)) {

A nit:
if you use negative condition you can reduce indentation level below.

if (!...)
return;

pasid_size = ...;
...

> + pasid_size = intel_iommu_get_pts(iommu);
> +

> + }
> +}
> +#else /* CONFIG_INTEL_IOMMU_SVM */

> +static void pasid_tbl_entry_show(struct seq_file *m, struct
> intel_iommu *iommu)
> +{
> +}

I think is not a big deal if you put all in one line like
static ... {}

> +#endif /* CONFIG_INTEL_IOMMU_SVM */

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy