RE: [PATCH v1 08/22] vfio: init HostIOMMUContext per-container

Liu, Yi L
2020-03-25T09:30:59Z

> From: Peter Xu <peterx@redhat.com>
> Sent: Tuesday, March 24, 2020 10:46 PM
> To: Liu, Yi L <yi.l.liu@intel.com>
> Subject: Re: [PATCH v1 08/22] vfio: init HostIOMMUContext per-container
>
> On Tue, Mar 24, 2020 at 01:03:28PM +0000, Liu, Yi L wrote:
> > > From: Peter Xu <peterx@redhat.com>
> > > Sent: Tuesday, March 24, 2020 5:40 AM
> > > To: Liu, Yi L <yi.l.liu@intel.com>
> > > Subject: Re: [PATCH v1 08/22] vfio: init HostIOMMUContext
> > > per-container
> > >
> > > On Sun, Mar 22, 2020 at 05:36:05AM -0700, Liu Yi L wrote:
> > > > After confirming dual stage DMA translation support with kernel by
> > > > checking VFIO_TYPE1_NESTING_IOMMU, VFIO inits HostIOMMUContet
> > > > instance and exposes it to PCI layer. Thus vIOMMU emualtors may
> > > > make use of such capability by leveraging the methods provided by
> HostIOMMUContext.
> > > >
> > > > Cc: Kevin Tian <kevin.tian@intel.com>
> > > > Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> > > > Cc: Peter Xu <peterx@redhat.com>
> > > > Cc: Eric Auger <eric.auger@redhat.com>
> > > > Cc: Yi Sun <yi.y.sun@linux.intel.com>
> > > > Cc: David Gibson <david@gibson.dropbear.id.au>
> > > > Cc: Alex Williamson <alex.williamson@redhat.com>
> > > > Signed-off-by: Liu Yi L <yi.l.liu@intel.com>
> > > > ---
> > > > hw/vfio/common.c | 80
> +++++++++++++++++++++++++++++++++++
> > > > hw/vfio/pci.c | 13 ++++++
> > > > include/hw/iommu/host_iommu_context.h | 3 ++
> > > > include/hw/vfio/vfio-common.h | 4 ++
> > > > 4 files changed, 100 insertions(+)
> > > >
> > > > diff --git a/hw/vfio/common.c b/hw/vfio/common.c index
> > > > c276732..e4f5f10 100644
> > > > --- a/hw/vfio/common.c
> > > > +++ b/hw/vfio/common.c
> > > > @@ -1179,10 +1179,55 @@ static int
> > > > vfio_get_iommu_type(VFIOContainer
> > > *container,
> > > > return -EINVAL;
> > > > }
> > > >
> > > > +static int vfio_host_icx_pasid_alloc(HostIOMMUContext *host_icx,
> > >
> > > I'm not sure about Alex, but ... icx is confusing to me. Maybe "ctx"
> > > as you always used?
> >
> > At first I used vfio_host_iommu_ctx_pasid_alloc(), found it is long,
> > so I switched to "icx" which means iommu_context. Maybe the former one
> > looks better as it gives more precise info.
>
> vfio_host_iommu_ctx_pasid_alloc() isn't that bad imho. I'll omit the "ctx" if I want
> to make it even shorter, but "icx" might be ambiguous.

Got it. let me modify the prefix.

Regards,
Yi Liu