public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	iommu@lists.linux.dev, Lu Baolu <baolu.lu@linux.intel.com>,
	Joerg Roedel <joro@8bytes.org>,
	Jean-Philippe Brucker <jean-philippe@linaro.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>,
	"Tian, Kevin" <kevin.tian@intel.com>, Yi Liu <yi.l.liu@intel.com>,
	"Yu, Fenghua" <fenghua.yu@intel.com>,
	Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH v12 2/8] iommu: Move global PASID allocation from SVA to core
Date: Fri, 4 Aug 2023 10:51:46 -0300	[thread overview]
Message-ID: <ZM0CclrqXGYBKLjI@nvidia.com> (raw)
In-Reply-To: <20230802212427.1497170-3-jacob.jun.pan@linux.intel.com>

On Wed, Aug 02, 2023 at 02:24:21PM -0700, Jacob Pan wrote:
> Intel ENQCMD requires a single PASID to be shared between multiple
> devices, as the PASID is stored in a single MSR register per-process
> and userspace can use only that one PASID.
> 
> This means that the PASID allocation for any ENQCMD using device driver
> must always come from a shared global pool, regardless of what kind of
> domain the PASID will be used with.
> 
> Split the code for the global PASID allocator into
> iommu_alloc/free_global_pasid() so that drivers can attach non-SVA
> domains to PASIDs as well.
> 
> This patch moves global PASID allocation APIs from SVA to IOMMU APIs.
> Reserved PASIDs, currently only RID_PASID, are excluded from the global
> PASID allocation.
> 
> It is expected that device drivers will use the allocated PASIDs to
> attach to appropriate IOMMU domains for use.
> 
> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> ---
> v8: fix off-by-one in max_pasid check
> v7: simplify range check (Baolu)
> v6: explicitly exclude reserved a range from SVA PASID allocation
>     check mm PASID compatibility with device
> v5: move PASID range check inside API so that device drivers only pass
>     in struct device* (Kevin)
> v4: move dummy functions outside ifdef CONFIG_IOMMU_SVA (Baolu)
> ---
>  drivers/iommu/iommu-sva.c | 29 ++++++++++-------------------
>  drivers/iommu/iommu.c     | 28 ++++++++++++++++++++++++++++
>  include/linux/iommu.h     | 10 ++++++++++
>  3 files changed, 48 insertions(+), 19 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

  reply	other threads:[~2023-08-04 13:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 21:24 [PATCH v12 0/8] Re-enable IDXD kernel workqueue under DMA API Jacob Pan
2023-08-02 21:24 ` [PATCH v12 1/8] iommu: Generalize PASID 0 for normal DMA w/o PASID Jacob Pan
2023-08-04 13:51   ` Jason Gunthorpe
2023-08-02 21:24 ` [PATCH v12 2/8] iommu: Move global PASID allocation from SVA to core Jacob Pan
2023-08-04 13:51   ` Jason Gunthorpe [this message]
2023-08-02 21:24 ` [PATCH v12 3/8] iommu/vt-d: Add domain_flush_pasid_iotlb() Jacob Pan
2023-08-02 21:24 ` [PATCH v12 4/8] iommu/vt-d: Remove pasid_mutex Jacob Pan
2023-08-02 21:24 ` [PATCH v12 5/8] iommu/vt-d: Make prq draining code generic Jacob Pan
2023-08-02 21:24 ` [PATCH v12 6/8] iommu/vt-d: Prepare for set_dev_pasid callback Jacob Pan
2023-08-02 21:24 ` [PATCH v12 7/8] iommu/vt-d: Add set_dev_pasid callback for dma domain Jacob Pan
2023-08-02 21:24 ` [PATCH v12 8/8] dmaengine/idxd: Re-enable kernel workqueue under DMA API Jacob Pan
2023-08-08 16:51 ` [PATCH v12 0/8] Re-enable IDXD " Jacob Pan
2023-08-08 23:29   ` Baolu Lu

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=ZM0CclrqXGYBKLjI@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=jean-philippe@linaro.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=tony.luck@intel.com \
    --cc=will@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox