lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200403112807.30a56c48@w520.home>
Date:   Fri, 3 Apr 2020 11:28:07 -0600
From:   Alex Williamson <alex.williamson@...hat.com>
To:     "Liu, Yi L" <yi.l.liu@...el.com>
Cc:     "eric.auger@...hat.com" <eric.auger@...hat.com>,
        "Tian, Kevin" <kevin.tian@...el.com>,
        "jacob.jun.pan@...ux.intel.com" <jacob.jun.pan@...ux.intel.com>,
        "joro@...tes.org" <joro@...tes.org>,
        "Raj, Ashok" <ashok.raj@...el.com>,
        "Tian, Jun J" <jun.j.tian@...el.com>,
        "Sun, Yi Y" <yi.y.sun@...el.com>,
        "jean-philippe@...aro.org" <jean-philippe@...aro.org>,
        "peterx@...hat.com" <peterx@...hat.com>,
        "iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Wu, Hao" <hao.wu@...el.com>
Subject: Re: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to
 userspace

On Fri, 3 Apr 2020 08:17:44 +0000
"Liu, Yi L" <yi.l.liu@...el.com> wrote:

> > From: Alex Williamson < alex.williamson@...hat.com >
> > Sent: Friday, April 3, 2020 2:01 AM
> > To: Liu, Yi L <yi.l.liu@...el.com>
> > Subject: Re: [PATCH v1 3/8] vfio/type1: Report PASID alloc/free support to
> > userspace
> > 
> > On Sun, 22 Mar 2020 05:32:00 -0700
> > "Liu, Yi L" <yi.l.liu@...el.com> wrote:
> >   
> > > From: Liu Yi L <yi.l.liu@...el.com>
> > >
> > > This patch reports PASID alloc/free availability to userspace (e.g.
> > > QEMU) thus userspace could do a pre-check before utilizing this feature.
> > >
> > > Cc: Kevin Tian <kevin.tian@...el.com>
> > > CC: Jacob Pan <jacob.jun.pan@...ux.intel.com>
> > > Cc: Alex Williamson <alex.williamson@...hat.com>
> > > Cc: Eric Auger <eric.auger@...hat.com>
> > > Cc: Jean-Philippe Brucker <jean-philippe@...aro.org>
> > > Signed-off-by: Liu Yi L <yi.l.liu@...el.com>
> > > ---
> > >  drivers/vfio/vfio_iommu_type1.c | 28 ++++++++++++++++++++++++++++
> > >  include/uapi/linux/vfio.h       |  8 ++++++++
> > >  2 files changed, 36 insertions(+)
> > >
> > > diff --git a/drivers/vfio/vfio_iommu_type1.c
> > > b/drivers/vfio/vfio_iommu_type1.c index e40afc0..ddd1ffe 100644
> > > --- a/drivers/vfio/vfio_iommu_type1.c
> > > +++ b/drivers/vfio/vfio_iommu_type1.c
> > > @@ -2234,6 +2234,30 @@ static int vfio_iommu_type1_pasid_free(struct  
> > vfio_iommu *iommu,  
> > >  	return ret;
> > >  }
> > >
> > > +static int vfio_iommu_info_add_nesting_cap(struct vfio_iommu *iommu,
> > > +					 struct vfio_info_cap *caps)
> > > +{
> > > +	struct vfio_info_cap_header *header;
> > > +	struct vfio_iommu_type1_info_cap_nesting *nesting_cap;
> > > +
> > > +	header = vfio_info_cap_add(caps, sizeof(*nesting_cap),
> > > +				   VFIO_IOMMU_TYPE1_INFO_CAP_NESTING, 1);
> > > +	if (IS_ERR(header))
> > > +		return PTR_ERR(header);
> > > +
> > > +	nesting_cap = container_of(header,
> > > +				struct vfio_iommu_type1_info_cap_nesting,
> > > +				header);
> > > +
> > > +	nesting_cap->nesting_capabilities = 0;
> > > +	if (iommu->nesting) {
> > > +		/* nesting iommu type supports PASID requests (alloc/free) */
> > > +		nesting_cap->nesting_capabilities |= VFIO_IOMMU_PASID_REQS;
> > > +	}
> > > +
> > > +	return 0;
> > > +}
> > > +
> > >  static long vfio_iommu_type1_ioctl(void *iommu_data,
> > >  				   unsigned int cmd, unsigned long arg)  { @@ -  
> > 2283,6 +2307,10 @@  
> > > static long vfio_iommu_type1_ioctl(void *iommu_data,
> > >  		if (ret)
> > >  			return ret;
> > >
> > > +		ret = vfio_iommu_info_add_nesting_cap(iommu, &caps);
> > > +		if (ret)
> > > +			return ret;
> > > +
> > >  		if (caps.size) {
> > >  			info.flags |= VFIO_IOMMU_INFO_CAPS;
> > >
> > > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
> > > index 298ac80..8837219 100644
> > > --- a/include/uapi/linux/vfio.h
> > > +++ b/include/uapi/linux/vfio.h
> > > @@ -748,6 +748,14 @@ struct vfio_iommu_type1_info_cap_iova_range {
> > >  	struct	vfio_iova_range iova_ranges[];
> > >  };
> > >
> > > +#define VFIO_IOMMU_TYPE1_INFO_CAP_NESTING  2
> > > +
> > > +struct vfio_iommu_type1_info_cap_nesting {
> > > +	struct	vfio_info_cap_header header;
> > > +#define VFIO_IOMMU_PASID_REQS	(1 << 0)
> > > +	__u32	nesting_capabilities;
> > > +};
> > > +
> > >  #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
> > >
> > >  /**  
> > 
> > I think this answers my PROBE question on patch 1/.   
> yep.
> > Should the quota/usage be exposed to the user here?  Thanks,  
> 
> Do you mean report the quota available for this user in this cap info as well?

Yes.  Would it be useful?

> For usage, do you mean the alloc and free or others?

I mean how many of the quota are currently in allocated, or
alternatively, how many remain.  Thanks,

Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ