All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Joerg Roedel <joro@8bytes.org>,
	"Jason Gunthorpe" <jgg@nvidia.com>,
	Christoph Hellwig <hch@infradead.org>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	"Pan, Jacob jun" <jacob.jun.pan@intel.com>,
	"Raj, Ashok" <ashok.raj@intel.com>,
	"Kumar, Sanjay K" <sanjay.k.kumar@intel.com>,
	"Jiang, Dave" <dave.jiang@intel.com>,
	"Luck, Tony" <tony.luck@intel.com>,
	"Zanussi, Tom" <tom.zanussi@intel.com>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	"Liu, Yi L" <yi.l.liu@intel.com>,
	jacob.jun.pan@linux.intel.com
Subject: Re: [PATCH v2 2/8] iommu: Add attach/detach_dev_pasid domain ops
Date: Tue, 15 Mar 2022 09:11:16 -0700	[thread overview]
Message-ID: <20220315091116.26e10b1b@jacob-builder> (raw)
In-Reply-To: <BN9PR11MB5276D5B88C05B509C2C790A98C109@BN9PR11MB5276.namprd11.prod.outlook.com>

Hi Kevin,

On Tue, 15 Mar 2022 11:49:57 +0000, "Tian, Kevin" <kevin.tian@intel.com>
wrote:

> > From: Jean-Philippe Brucker <jean-philippe@linaro.org>
> > Sent: Tuesday, March 15, 2022 7:27 PM
> > 
> > On Mon, Mar 14, 2022 at 10:07:06PM -0700, Jacob Pan wrote:  
> > > From: Lu Baolu <baolu.lu@linux.intel.com>
> > >
> > > An IOMMU domain represents an address space which can be attached by
> > > devices that perform DMA within a domain. However, for platforms with
> > > PASID capability the domain attachment needs be handled at
> > > device+PASID level. There can be multiple PASIDs within a device and
> > > multiple devices attached to a given domain.
> > > This patch introduces a new IOMMU op which support device, PASID, and
> > > IOMMU domain attachment. The immediate use case is for PASID capable
> > > devices to perform DMA under DMA APIs.
> > >
> > > Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> > > Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> > > ---
> > >  include/linux/iommu.h | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> > > index 369f05c2a4e2..fde5b933dbe3 100644
> > > --- a/include/linux/iommu.h
> > > +++ b/include/linux/iommu.h
> > > @@ -227,6 +227,8 @@ struct iommu_iotlb_gather {
> > >   * @aux_get_pasid: get the pasid given an aux-domain
> > >   * @sva_bind: Bind process address space to device
> > >   * @sva_unbind: Unbind process address space from device
> > > + * @attach_dev_pasid: attach an iommu domain to a pasid of device
> > > + * @detach_dev_pasid: detach an iommu domain from a pasid of device  
> > 
> > Isn't that operation "assign a PASID to a domain" instead?  In patch 5,
> > the domain is already attached to the device, so set_domain_pasid()
> > might be clearer and to the point. If the IOMMU driver did the
> > allocation we could also avoid patch 1.
I agree, we could let vendor driver do the allocation inside this op. On
the other side, we could also keep the flexibility such that this op can be
used for guest PASID bind, with a SVA domain.
> 
> iiuc this API can also work for future SIOV usage where each mdev attached
> to the domain has its own pasid. "assigning a PASID to a domain" sounds
> like going back to the previous aux domain approach which has one PASID
> per domain and that PASID is used on all devices attached to the aux
> domain...
> 
yes, that is the intention. I plan to lift the requirement in patch 5 such
that device attachment will not be a prerequisite. That would be after mdev
adoption.

> > 
> > If I understand correctly this series is not about a generic PASID API
> > that allows drivers to manage multiple DMA address spaces, because there
> > still doesn't seem to be any interest in that. It's about the specific
> > IDXD use-case, so let's focus on that. We can introduce a specialized
> > call such as (iommu|dma)_set_device_pasid(), which will be easy to
> > consolidate later into a more generic "dma_enable_pasid()" API if that
> > ever seems useful.
> > 
Right, at the moment it is still a single address space. i.e. the current
domain of the device/group.

But this limitation is at the driver facing API layer not limited in the
IOMMU ops.

> > Thanks,
> > Jean
> >   
> > >   * @sva_get_pasid: Get PASID associated to a SVA handle
> > >   * @page_response: handle page request response
> > >   * @cache_invalidate: invalidate translation caches
> > > @@ -296,6 +298,10 @@ struct iommu_ops {
> > >  	struct iommu_sva *(*sva_bind)(struct device *dev, struct
> > > mm_struct  
> > *mm,  
> > >  				      void *drvdata);
> > >  	void (*sva_unbind)(struct iommu_sva *handle);
> > > +	int (*attach_dev_pasid)(struct iommu_domain *domain,
> > > +				struct device *dev, ioasid_t id);
> > > +	void (*detach_dev_pasid)(struct iommu_domain *domain,
> > > +				 struct device *dev, ioasid_t id);
> > >  	u32 (*sva_get_pasid)(struct iommu_sva *handle);
> > >
> > >  	int (*page_response)(struct device *dev,
> > > --
> > > 2.25.1
> > >  


Thanks,

Jacob

WARNING: multiple messages have this Message-ID (diff)
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	"Luck, Tony" <tony.luck@intel.com>,
	"Jiang, Dave" <dave.jiang@intel.com>,
	"Raj, Ashok" <ashok.raj@intel.com>,
	"Zanussi, Tom" <tom.zanussi@intel.com>,
	"Kumar, Sanjay K" <sanjay.k.kumar@intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"Pan, Jacob jun" <jacob.jun.pan@intel.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	"Williams, Dan J" <dan.j.williams@intel.com>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>
Subject: Re: [PATCH v2 2/8] iommu: Add attach/detach_dev_pasid domain ops
Date: Tue, 15 Mar 2022 09:11:16 -0700	[thread overview]
Message-ID: <20220315091116.26e10b1b@jacob-builder> (raw)
In-Reply-To: <BN9PR11MB5276D5B88C05B509C2C790A98C109@BN9PR11MB5276.namprd11.prod.outlook.com>

Hi Kevin,

On Tue, 15 Mar 2022 11:49:57 +0000, "Tian, Kevin" <kevin.tian@intel.com>
wrote:

> > From: Jean-Philippe Brucker <jean-philippe@linaro.org>
> > Sent: Tuesday, March 15, 2022 7:27 PM
> > 
> > On Mon, Mar 14, 2022 at 10:07:06PM -0700, Jacob Pan wrote:  
> > > From: Lu Baolu <baolu.lu@linux.intel.com>
> > >
> > > An IOMMU domain represents an address space which can be attached by
> > > devices that perform DMA within a domain. However, for platforms with
> > > PASID capability the domain attachment needs be handled at
> > > device+PASID level. There can be multiple PASIDs within a device and
> > > multiple devices attached to a given domain.
> > > This patch introduces a new IOMMU op which support device, PASID, and
> > > IOMMU domain attachment. The immediate use case is for PASID capable
> > > devices to perform DMA under DMA APIs.
> > >
> > > Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> > > Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> > > ---
> > >  include/linux/iommu.h | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> > > index 369f05c2a4e2..fde5b933dbe3 100644
> > > --- a/include/linux/iommu.h
> > > +++ b/include/linux/iommu.h
> > > @@ -227,6 +227,8 @@ struct iommu_iotlb_gather {
> > >   * @aux_get_pasid: get the pasid given an aux-domain
> > >   * @sva_bind: Bind process address space to device
> > >   * @sva_unbind: Unbind process address space from device
> > > + * @attach_dev_pasid: attach an iommu domain to a pasid of device
> > > + * @detach_dev_pasid: detach an iommu domain from a pasid of device  
> > 
> > Isn't that operation "assign a PASID to a domain" instead?  In patch 5,
> > the domain is already attached to the device, so set_domain_pasid()
> > might be clearer and to the point. If the IOMMU driver did the
> > allocation we could also avoid patch 1.
I agree, we could let vendor driver do the allocation inside this op. On
the other side, we could also keep the flexibility such that this op can be
used for guest PASID bind, with a SVA domain.
> 
> iiuc this API can also work for future SIOV usage where each mdev attached
> to the domain has its own pasid. "assigning a PASID to a domain" sounds
> like going back to the previous aux domain approach which has one PASID
> per domain and that PASID is used on all devices attached to the aux
> domain...
> 
yes, that is the intention. I plan to lift the requirement in patch 5 such
that device attachment will not be a prerequisite. That would be after mdev
adoption.

> > 
> > If I understand correctly this series is not about a generic PASID API
> > that allows drivers to manage multiple DMA address spaces, because there
> > still doesn't seem to be any interest in that. It's about the specific
> > IDXD use-case, so let's focus on that. We can introduce a specialized
> > call such as (iommu|dma)_set_device_pasid(), which will be easy to
> > consolidate later into a more generic "dma_enable_pasid()" API if that
> > ever seems useful.
> > 
Right, at the moment it is still a single address space. i.e. the current
domain of the device/group.

But this limitation is at the driver facing API layer not limited in the
IOMMU ops.

> > Thanks,
> > Jean
> >   
> > >   * @sva_get_pasid: Get PASID associated to a SVA handle
> > >   * @page_response: handle page request response
> > >   * @cache_invalidate: invalidate translation caches
> > > @@ -296,6 +298,10 @@ struct iommu_ops {
> > >  	struct iommu_sva *(*sva_bind)(struct device *dev, struct
> > > mm_struct  
> > *mm,  
> > >  				      void *drvdata);
> > >  	void (*sva_unbind)(struct iommu_sva *handle);
> > > +	int (*attach_dev_pasid)(struct iommu_domain *domain,
> > > +				struct device *dev, ioasid_t id);
> > > +	void (*detach_dev_pasid)(struct iommu_domain *domain,
> > > +				 struct device *dev, ioasid_t id);
> > >  	u32 (*sva_get_pasid)(struct iommu_sva *handle);
> > >
> > >  	int (*page_response)(struct device *dev,
> > > --
> > > 2.25.1
> > >  


Thanks,

Jacob
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2022-03-15 16:09 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15  5:07 [PATCH v2 0/8] Enable PASID for DMA API users Jacob Pan
2022-03-15  5:07 ` Jacob Pan
2022-03-15  5:07 ` [PATCH v2 1/8] iommu: Assign per device max PASID Jacob Pan
2022-03-15  5:07   ` Jacob Pan
2022-03-15  5:07 ` [PATCH v2 2/8] iommu: Add attach/detach_dev_pasid domain ops Jacob Pan
2022-03-15  5:07   ` Jacob Pan
2022-03-15 10:24   ` Tian, Kevin
2022-03-15 10:24     ` Tian, Kevin
2022-03-15 11:26   ` Jean-Philippe Brucker
2022-03-15 11:26     ` Jean-Philippe Brucker
2022-03-15 11:49     ` Tian, Kevin
2022-03-15 11:49       ` Tian, Kevin
2022-03-15 16:11       ` Jacob Pan [this message]
2022-03-15 16:11         ` Jacob Pan
2022-03-18 12:01       ` Lu Baolu
2022-03-18 12:01         ` Lu Baolu
2022-03-18 13:50         ` Jason Gunthorpe
2022-03-18 13:50           ` Jason Gunthorpe via iommu
2022-03-18 11:52   ` Lu Baolu
2022-03-18 11:52     ` Lu Baolu
2022-03-18 13:48     ` Jason Gunthorpe
2022-03-18 13:48       ` Jason Gunthorpe via iommu
2022-03-15  5:07 ` [PATCH v2 3/8] iommu/vt-d: Implement device_pasid domain attach ops Jacob Pan
2022-03-15  5:07   ` Jacob Pan
2022-03-15 10:33   ` Tian, Kevin
2022-03-15 10:33     ` Tian, Kevin
2022-03-15 22:23     ` Jacob Pan
2022-03-15 22:23       ` Jacob Pan
2022-03-15 14:33   ` Jason Gunthorpe
2022-03-15 14:33     ` Jason Gunthorpe via iommu
2022-03-15 22:36     ` Jacob Pan
2022-03-15 22:36       ` Jacob Pan
2022-03-15 23:04       ` Jason Gunthorpe
2022-03-15 23:04         ` Jason Gunthorpe via iommu
2022-03-16 20:50         ` Jacob Pan
2022-03-16 20:50           ` Jacob Pan
2022-03-16 22:15           ` Jason Gunthorpe
2022-03-16 22:15             ` Jason Gunthorpe via iommu
2022-03-16 22:23             ` Luck, Tony
2022-03-16 22:23               ` Luck, Tony
2022-03-17  0:04               ` Jason Gunthorpe
2022-03-17  0:04                 ` Jason Gunthorpe via iommu
2022-03-18  5:47                 ` Tian, Kevin
2022-03-18  5:47                   ` Tian, Kevin
2022-03-18 13:47                   ` Jason Gunthorpe
2022-03-18 13:47                     ` Jason Gunthorpe via iommu
2022-03-17  0:49             ` Jacob Pan
2022-03-17  0:49               ` Jacob Pan
2022-03-17 13:23               ` Jason Gunthorpe
2022-03-17 13:23                 ` Jason Gunthorpe via iommu
2022-03-17 18:23                 ` Jacob Pan
2022-03-17 18:23                   ` Jacob Pan
2022-03-16  7:41     ` Tian, Kevin
2022-03-16  7:41       ` Tian, Kevin
2022-03-16 21:01       ` Jacob Pan
2022-03-16 21:01         ` Jacob Pan
2022-03-18  5:33         ` Tian, Kevin
2022-03-18  5:33           ` Tian, Kevin
2022-03-28 21:41           ` Jacob Pan
2022-03-28 21:41             ` Jacob Pan
2022-03-16  7:39   ` Tian, Kevin
2022-03-16  7:39     ` Tian, Kevin
2022-03-16 20:51     ` Jacob Pan
2022-03-16 20:51       ` Jacob Pan
2022-03-15  5:07 ` [PATCH v2 4/8] iommu/vt-d: Use device_pasid attach op for RID2PASID Jacob Pan
2022-03-15  5:07   ` Jacob Pan
2022-03-16  7:54   ` Tian, Kevin
2022-03-16  7:54     ` Tian, Kevin
2022-03-17 20:45     ` Jacob Pan
2022-03-17 20:45       ` Jacob Pan
2022-03-15  5:07 ` [PATCH v2 5/8] iommu: Add PASID support for DMA mapping API users Jacob Pan
2022-03-15  5:07   ` Jacob Pan
2022-03-15 11:16   ` Robin Murphy
2022-03-15 11:16     ` Robin Murphy
2022-03-15 14:22     ` Jason Gunthorpe
2022-03-15 14:22       ` Jason Gunthorpe via iommu
2022-03-15 16:31       ` Jacob Pan
2022-03-15 16:31         ` Jacob Pan
2022-03-15 17:05         ` Jason Gunthorpe
2022-03-15 17:05           ` Jason Gunthorpe via iommu
2022-03-15 21:24           ` Jacob Pan
2022-03-15 21:24             ` Jacob Pan
2022-03-16 10:32             ` Tian, Kevin
2022-03-16 10:32               ` Tian, Kevin
2022-03-16  8:41       ` Tian, Kevin
2022-03-16  8:41         ` Tian, Kevin
2022-03-16 14:07         ` Jason Gunthorpe
2022-03-16 14:07           ` Jason Gunthorpe via iommu
2022-03-15 14:35   ` Jason Gunthorpe
2022-03-15 14:35     ` Jason Gunthorpe via iommu
2022-03-15 16:38     ` Jacob Pan
2022-03-15 16:38       ` Jacob Pan
2022-03-15 23:05       ` Jason Gunthorpe
2022-03-15 23:05         ` Jason Gunthorpe via iommu
2022-03-18 12:43   ` Lu Baolu
2022-03-18 12:43     ` Lu Baolu
2022-03-28 21:44     ` Jacob Pan
2022-03-28 21:44       ` Jacob Pan
2022-03-15  5:07 ` [PATCH v2 6/8] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID Jacob Pan
2022-03-15  5:07   ` Jacob Pan
2022-03-18  6:10   ` Tian, Kevin
2022-03-18  6:10     ` Tian, Kevin
2022-03-29 17:39     ` Jacob Pan
2022-03-29 17:39       ` Jacob Pan
2022-03-15  5:07 ` [PATCH v2 7/8] iommu/vt-d: Delete supervisor/kernel SVA Jacob Pan
2022-03-15  5:07   ` Jacob Pan
2022-03-18  6:16   ` Tian, Kevin
2022-03-18  6:16     ` Tian, Kevin
2022-03-29 17:42     ` Jacob Pan
2022-03-29 17:42       ` Jacob Pan
2022-03-15  5:07 ` [PATCH v2 8/8] iommu: Remove unused driver data in sva_bind_device Jacob Pan
2022-03-15  5:07   ` Jacob Pan
2022-03-15 11:37   ` Jean-Philippe Brucker
2022-03-15 11:37     ` Jean-Philippe Brucker
2022-03-15  5:07 ` [PATCH v2 9/9] dmaengine: idxd: separate user and kernel pasid enabling Jacob Pan
2022-03-15  5:07   ` Jacob Pan
2022-03-18  6:28   ` Tian, Kevin
2022-03-18  6:28     ` Tian, Kevin
2022-03-15  8:16 ` [PATCH v2 0/8] Enable PASID for DMA API users Tian, Kevin
2022-03-15  8:16   ` Tian, Kevin
2022-03-15 15:49   ` Jacob Pan
2022-03-15 15:49     ` Jacob Pan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220315091116.26e10b1b@jacob-builder \
    --to=jacob.jun.pan@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@intel.com \
    --cc=jean-philippe@linaro.com \
    --cc=jean-philippe@linaro.org \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sanjay.k.kumar@intel.com \
    --cc=tom.zanussi@intel.com \
    --cc=tony.luck@intel.com \
    --cc=yi.l.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.