From: Joonwon Kang <joonwonkang@google.com>
To: jgg@ziepe.ca
Cc: Alexander.Grest@microsoft.com,
alexander.shishkin@linux.intel.com, amhetre@nvidia.com,
baolu.lu@linux.intel.com, bp@alien8.de,
dave.hansen@linux.intel.com,
easwar.hariharan@linux.microsoft.com, hpa@zytor.com,
iommu@lists.linux.dev, jacob.jun.pan@linux.intel.com,
joonwonkang@google.com, joro@8bytes.org, jpb@kernel.org,
kas@kernel.org, kees@kernel.org, kevin.tian@intel.com,
kirill.shutemov@linux.intel.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, mingo@redhat.com,
nicolinc@nvidia.com, peterz@infradead.org, praan@google.com,
robin.murphy@arm.com, ryasuoka@redhat.com, smostafa@google.com,
sohil.mehta@intel.com, tglx@kernel.org, will@kernel.org,
x86@kernel.org, xin@zytor.com
Subject: Re: [PATCH] iommu: Allow device driver to use its own PASID space for SVA
Date: Tue, 19 May 2026 08:11:47 +0000 [thread overview]
Message-ID: <20260519081148.1301245-1-joonwonkang@google.com> (raw)
In-Reply-To: <20260518175249.GS7702@ziepe.ca>
> On Mon, May 18, 2026 at 09:06:54AM +0000, Joonwon Kang wrote:
> > > On Fri, May 15, 2026 at 09:46:05AM +0000, Joonwon Kang wrote:
> > > > diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> > > > index 0ca3912ecb7f..61e2e52105e5 100644
> > > > --- a/arch/x86/kernel/traps.c
> > > > +++ b/arch/x86/kernel/traps.c
> > > > @@ -864,6 +864,8 @@ static bool try_fixup_enqcmd_gp(void)
> > > > return false;
> > > >
> > > > pasid = mm_get_enqcmd_pasid(current->mm);
> > > > + if (pasid == IOMMU_PASID_INVALID)
> > > > + return false;
> > >
> > > If you do this then probably you should get rid of mm_valid_pasid(),
> > > mm_get_enqcmd_pasid() already has the NULL check so the two functions
> > > are kind of pointless.
> > >
> > > You also missed the other place calling mm_valid_pasid() that should
> > > really be sensitive to this as well:
> > >
> > > static int prctl_enable_tagged_addr(struct mm_struct *mm, unsigned long nr_bits)
> > > {
> > > [..]
> > > if (mm_valid_pasid(mm) &&
> > > !test_bit(MM_CONTEXT_FORCE_TAGGED_SVA, &mm->context.flags))
> > > return -EINVAL;
> > >
> > > Make that removal a prep patch
> > >
> >
> > Thanks for pointing this out. I think mm_valid_pasid() is to check if SVA
> > is currently in action while mm_get_enqcmd_pasid() is to get the PASID for
> > "ENQCMD instruction execution".
>
> > Since it is now possible with this patch to activate SVA without involving
> > EL0(for ENQCMD-like instructions),
>
> I see, this thing about which is about LAM should remain, yes
>
> But all the "EL0" machinery about trapping and enabling ENQCMD should
> be moved over to mm_get_enqcmd_pasid() and never call mm_valid_pasid()
Yes, it makes sense. Let me fix that in the next version.
Thanks,
Joonwon Kang
prev parent reply other threads:[~2026-05-19 8:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 9:46 [PATCH] iommu: Allow device driver to use its own PASID space for SVA Joonwon Kang
2026-05-15 23:18 ` Jason Gunthorpe
2026-05-18 9:06 ` Joonwon Kang
2026-05-18 17:52 ` Jason Gunthorpe
2026-05-19 8:11 ` Joonwon Kang [this message]
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=20260519081148.1301245-1-joonwonkang@google.com \
--to=joonwonkang@google.com \
--cc=Alexander.Grest@microsoft.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=amhetre@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=easwar.hariharan@linux.microsoft.com \
--cc=hpa@zytor.com \
--cc=iommu@lists.linux.dev \
--cc=jacob.jun.pan@linux.intel.com \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=jpb@kernel.org \
--cc=kas@kernel.org \
--cc=kees@kernel.org \
--cc=kevin.tian@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nicolinc@nvidia.com \
--cc=peterz@infradead.org \
--cc=praan@google.com \
--cc=robin.murphy@arm.com \
--cc=ryasuoka@redhat.com \
--cc=smostafa@google.com \
--cc=sohil.mehta@intel.com \
--cc=tglx@kernel.org \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=xin@zytor.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