Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Joonwon Kang <joonwonkang@google.com>
Cc: Alexander.Grest@microsoft.com, amhetre@nvidia.com,
	baolu.lu@linux.intel.com, easwar.hariharan@linux.microsoft.com,
	iommu@lists.linux.dev, jacob.jun.pan@linux.intel.com,
	joro@8bytes.org, jpb@kernel.org, kees@kernel.org,
	kevin.tian@intel.com, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, nicolinc@nvidia.com,
	praan@google.com, robin.murphy@arm.com, smostafa@google.com,
	will@kernel.org
Subject: Re: [PATCH RFC] iommu: Enable per-device SSID space for SVA
Date: Wed, 13 May 2026 14:10:59 -0300	[thread overview]
Message-ID: <20260513171059.GP7702@ziepe.ca> (raw)
In-Reply-To: <20260513170333.1235601-1-joonwonkang@google.com>

On Wed, May 13, 2026 at 05:03:33PM +0000, Joonwon Kang wrote:
> > On Tue, May 12, 2026 at 02:51:38PM +0000, Joonwon Kang wrote:
> > 
> > > Appreciate all your clarifications here. So, my understanding is that if
> > > our system does not support ST64BV and ST64BV0 or if our device does not
> > > distinguish between the posted write and the non-posted write regarding
> > > PASID, then we can lift the use of the global PASID space. Can I say this?
> > 
> > You should do what Robin said - just have your driver use a per-device
> > PASID that it allocates and never use the global pasid allocator.
> > 
> > To do this lightly re-organize the SVA code so the driver can supply
> > its own PASID, and in this mode we wouldn't activate the ENQCMD
> > features in the mm.
> 
> Ah, we could actively disallow EL0 to execute ENQCMD-like instructions
> when the device driver explicitly shows the intention via a new API like
> `iommu_sva_bind_device_pasid()` that Tian mentioned earlier. 

You shouldn't need to do anything like this. 

All you need is to ensure that mm_get_enqcmd_pasid() returns
IOMMU_PASID_INVALID so long as a the normal iommu_sva_bind_device()
hasn't been called. Once it is called it is fine to allow the ENQCMD.

Your new iommu_sva_bind_device_pasid() needs to establish the SVA and
attach it without triggering mm_get_enqcmd_pasid().

The arch code is required to block the ENQCMD like instructions when
IOMMU_PASID_INVALID.

Devices that can mmap an ENQCMD sensitive BAR region must not do so
unless iommu_sva_bind_device() has been called.

> To allocate a per-device PASID, I think we should do it using
> `dev->iommu_group->pasid_array` instead of making the device driver

No, make the driver manage this, don't mess with the core code. PASID
isn't supported with multi-device groups already.

Jason


  reply	other threads:[~2026-05-13 17:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24  8:53 [PATCH RFC] iommu: Enable per-device SSID space for SVA Joonwon Kang
2026-04-24 13:39 ` Jason Gunthorpe
2026-05-07  8:15   ` Tian, Kevin
2026-05-09 17:03     ` Jason Gunthorpe
2026-05-07  9:58   ` Joonwon Kang
2026-05-09 17:10     ` Jason Gunthorpe
2026-05-11 12:39       ` Robin Murphy
2026-05-11 13:21         ` Jason Gunthorpe
2026-05-12  9:57           ` Joonwon Kang
2026-05-12 12:40             ` Jason Gunthorpe
2026-05-12 13:53               ` Robin Murphy
2026-05-12 14:51                 ` Joonwon Kang
2026-05-12 15:11                   ` Jason Gunthorpe
2026-05-13 17:03                     ` Joonwon Kang
2026-05-13 17:10                       ` Jason Gunthorpe [this message]
2026-05-12 10:07       ` Joonwon Kang
2026-04-28 17:38 ` Easwar Hariharan
2026-04-28 17:44   ` Jason Gunthorpe
  -- strict thread matches above, loose matches on Subject: below --
2026-04-24  8:50 Joonwon Kang
2026-04-24  8:57 ` Joonwon Kang

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=20260513171059.GP7702@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=Alexander.Grest@microsoft.com \
    --cc=amhetre@nvidia.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=easwar.hariharan@linux.microsoft.com \
    --cc=iommu@lists.linux.dev \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=joonwonkang@google.com \
    --cc=joro@8bytes.org \
    --cc=jpb@kernel.org \
    --cc=kees@kernel.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolinc@nvidia.com \
    --cc=praan@google.com \
    --cc=robin.murphy@arm.com \
    --cc=smostafa@google.com \
    --cc=will@kernel.org \
    /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