On Tue, Mar 24, 2020 at 01:03:28PM +0000, Liu, Yi L wrote: > > From: Peter Xu <peterx@xxxxxxxxxx> > > Sent: Tuesday, March 24, 2020 5:40 AM > > To: Liu, Yi L <yi.l.liu@xxxxxxxxx> > > 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@xxxxxxxxx> > > > Cc: Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx> > > > Cc: Peter Xu <peterx@xxxxxxxxxx> > > > Cc: Eric Auger <eric.auger@xxxxxxxxxx> > > > Cc: Yi Sun <yi.y.sun@xxxxxxxxxxxxxxx> > > > Cc: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> > > > Cc: Alex Williamson <alex.williamson@xxxxxxxxxx> > > > Signed-off-by: Liu Yi L <yi.l.liu@xxxxxxxxx> > > > --- > > > 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. Thanks, -- Peter Xu