[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200203214357.09d01729@jacob-builder>
Date: Mon, 3 Feb 2020 21:43:57 -0800
From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
To: Lu Baolu <baolu.lu@...ux.intel.com>
Cc: iommu@...ts.linux-foundation.org,
LKML <linux-kernel@...r.kernel.org>,
Joerg Roedel <joro@...tes.org>,
David Woodhouse <dwmw2@...radead.org>,
Yi Liu <yi.l.liu@...el.com>,
"Tian, Kevin" <kevin.tian@...el.com>,
Raj Ashok <ashok.raj@...el.com>,
Alex Williamson <alex.williamson@...hat.com>,
Christoph Hellwig <hch@...radead.org>,
Jean-Philippe Brucker <jean-philippe@...aro.com>,
Jonathan Cameron <jic23@...nel.org>,
Eric Auger <eric.auger@...hat.com>,
jacob.jun.pan@...ux.intel.com
Subject: Re: [PATCH V9 10/10] iommu/vt-d: Report PASID format as domain
attribute
On Thu, 30 Jan 2020 15:54:44 +0800
Lu Baolu <baolu.lu@...ux.intel.com> wrote:
> Hi,
>
> On 2020/1/29 14:01, Jacob Pan wrote:
> > Report the domain attribute of PASID table format. As multiple
> > formats of PASID table entry are supported, it is important for the
> > guest to know which format to use in virtual IOMMU. The result will
> > be used for binding device with guest PASID.
> >
> > Signed-off-by: Liu Yi L <yi.l.liu@...el.com>
> > Signed-off-by: Jacob Pan <jacob.jun.pan@...ux.intel.com>
> > ---
> > drivers/iommu/intel-iommu.c | 22 ++++++++++++++++++++++
> > include/linux/iommu.h | 1 +
> > 2 files changed, 23 insertions(+)
> >
> > diff --git a/drivers/iommu/intel-iommu.c
> > b/drivers/iommu/intel-iommu.c index 2f0bf7cc70ce..b3778e86dc32
> > 100644 --- a/drivers/iommu/intel-iommu.c
> > +++ b/drivers/iommu/intel-iommu.c
> > @@ -6413,6 +6413,27 @@ intel_iommu_domain_set_attr(struct
> > iommu_domain *domain, return ret;
> > }
> >
> > +static int intel_iommu_domain_get_attr(struct iommu_domain *domain,
> > + enum iommu_attr attr, void
> > *data) +{
> > + /* Only used for guest */
> > + switch (domain->type) {
> > + case IOMMU_DOMAIN_DMA:
> > + return -ENODEV;
> > + case IOMMU_DOMAIN_UNMANAGED:
> > + switch (attr) {
> > + case DOMAIN_ATTR_PASID_FORMAT:
> > + *(int *)data =
> > IOMMU_PASID_FORMAT_INTEL_VTD;
> > + return 0;
> > + default:
> > + return -ENODEV;
> > + }
> > + break;
> > + default:
> > + return -EINVAL;
> > + }
> > +}
> > +
> > const struct iommu_ops intel_iommu_ops = {
> > .capable = intel_iommu_capable,
> > .domain_alloc = intel_iommu_domain_alloc,
> > @@ -6432,6 +6453,7 @@ const struct iommu_ops intel_iommu_ops = {
> > .put_resv_regions = intel_iommu_put_resv_regions,
> > .apply_resv_region = intel_iommu_apply_resv_region,
> > .device_group = pci_device_group,
> > + .domain_get_attr = intel_iommu_domain_get_attr,
> > .dev_has_feat = intel_iommu_dev_has_feat,
> > .dev_feat_enabled = intel_iommu_dev_feat_enabled,
> > .dev_enable_feat = intel_iommu_dev_enable_feat,
> > diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> > index f2223cbb5fd5..9718c109ea0a 100644
> > --- a/include/linux/iommu.h
> > +++ b/include/linux/iommu.h
> > @@ -126,6 +126,7 @@ enum iommu_attr {
> > DOMAIN_ATTR_FSL_PAMUV1,
> > DOMAIN_ATTR_NESTING, /* two stages of translation
> > */ DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE,
> > + DOMAIN_ATTR_PASID_FORMAT,
> > DOMAIN_ATTR_MAX,
> > };
>
> Need to separate the new domain attribution definition and the vt-d
> implementation.
>
In the current iommu uapi, VTD is the only format. However, PASID table
entry format is a generic attribute, not VT-d specific. It expected to
have more vendor format can be reported under this attribute.
struct iommu_gpasid_bind_data {
__u32 version;
#define IOMMU_PASID_FORMAT_INTEL_VTD 1
> Best regards,
> baolu
[Jacob Pan]
Powered by blists - more mailing lists