RE: [RFC PATCH 2/5] iommu/vt-d: Add generic IO page table support

From: Zhang, Tina
Date: Wed Nov 08 2023 - 19:11:14 EST


Hi Jason,

> -----Original Message-----
> From: Jason Gunthorpe <jgg@xxxxxxxx>
> Sent: Tuesday, November 7, 2023 3:32 AM
> To: Zhang, Tina <tina.zhang@xxxxxxxxx>
> Cc: Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx>; Tian, Kevin
> <kevin.tian@xxxxxxxxx>; Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>; joro@xxxxxxxxxx;
> will@xxxxxxxxxx; Liu, Yi L <yi.l.liu@xxxxxxxxx>; virtualization@lists.linux-
> foundation.org; iommu@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [RFC PATCH 2/5] iommu/vt-d: Add generic IO page table support
>
> On Mon, Nov 06, 2023 at 02:12:23AM -0500, Tina Zhang wrote:
> > Add basic hook up code to implement generic IO page table framework.
> >
> > Signed-off-by: Tina Zhang <tina.zhang@xxxxxxxxx>
> > ---
> > drivers/iommu/intel/Kconfig | 1 +
> > drivers/iommu/intel/iommu.c | 94
> > +++++++++++++++++++++++++++++++++++++
> > drivers/iommu/intel/iommu.h | 7 +++
> > drivers/iommu/io-pgtable.c | 3 ++
> > include/linux/io-pgtable.h | 2 +
> > 5 files changed, 107 insertions(+)
>
> If this is going to happen can we also convert vt-d to actually use the io page
> table stuff directly and shuffle the code around so it is structured like the rest of
> the io page table implementations?
Converting VT-d driver to use io page table involves much code change. I made a local version of it, and it didn't prove much benefit.

VT-d only supports one 1st-stage IO pgtable format and one 2nd-stage IO pgtable format. So, the current IO pgtable handling operations seems more efficient comparing to adding another layer callbacks in them.

We have a plan to add a new io_pgtable.c file under VT-d driver directory and use that file to collect IO pgtable related functions. But we want to hold on converting VT-d to use the IO page table directly unless we can see some benefits.

Regards,
-Tina
>
> Jason