public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe•ca>
To: Joonwon Kang <joonwonkang@google•com>
Cc: will@kernel•org, robin.murphy@arm•com, joro@8bytes•org,
	jpb@kernel•org, Alexander.Grest@microsoft•com,
	amhetre@nvidia•com, baolu.lu@linux•intel.com,
	easwar.hariharan@linux•microsoft.com,
	jacob.jun.pan@linux•intel.com, kees@kernel•org,
	kevin.tian@intel•com, nicolinc@nvidia•com, praan@google•com,
	smostafa@google•com, tglx@kernel•org, mingo@redhat•com,
	bp@alien8•de, dave.hansen@linux•intel.com, x86@kernel•org,
	hpa@zytor•com, peterz@infradead•org, sohil.mehta@intel•com,
	kas@kernel•org, alexander.shishkin@linux•intel.com,
	ryasuoka@redhat•com, xin@zytor•com, linux-kernel@vger•kernel.org,
	iommu@lists•linux.dev, linux-arm-kernel@lists•infradead.org
Subject: Re: [PATCH] iommu: Allow device driver to use its own PASID space for SVA
Date: Fri, 15 May 2026 20:18:08 -0300	[thread overview]
Message-ID: <20260515231808.GQ7702@ziepe.ca> (raw)
In-Reply-To: <20260515094605.3195841-1-joonwonkang@google.com>

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

I didn't try to check the rest closely but the approach looked sane to
me

Jason


  reply	other threads:[~2026-05-15 23:18 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 [this message]
2026-05-18  9:06   ` Joonwon Kang
2026-05-18 17:52     ` Jason Gunthorpe
2026-05-19  8:11       ` 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=20260515231808.GQ7702@ziepe.ca \
    --to=jgg@ziepe$(echo .)ca \
    --cc=Alexander.Grest@microsoft$(echo .)com \
    --cc=alexander.shishkin@linux$(echo .)intel.com \
    --cc=amhetre@nvidia$(echo .)com \
    --cc=baolu.lu@linux$(echo .)intel.com \
    --cc=bp@alien8$(echo .)de \
    --cc=dave.hansen@linux$(echo .)intel.com \
    --cc=easwar.hariharan@linux$(echo .)microsoft.com \
    --cc=hpa@zytor$(echo .)com \
    --cc=iommu@lists$(echo .)linux.dev \
    --cc=jacob.jun.pan@linux$(echo .)intel.com \
    --cc=joonwonkang@google$(echo .)com \
    --cc=joro@8bytes$(echo .)org \
    --cc=jpb@kernel$(echo .)org \
    --cc=kas@kernel$(echo .)org \
    --cc=kees@kernel$(echo .)org \
    --cc=kevin.tian@intel$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=mingo@redhat$(echo .)com \
    --cc=nicolinc@nvidia$(echo .)com \
    --cc=peterz@infradead$(echo .)org \
    --cc=praan@google$(echo .)com \
    --cc=robin.murphy@arm$(echo .)com \
    --cc=ryasuoka@redhat$(echo .)com \
    --cc=smostafa@google$(echo .)com \
    --cc=sohil.mehta@intel$(echo .)com \
    --cc=tglx@kernel$(echo .)org \
    --cc=will@kernel$(echo .)org \
    --cc=x86@kernel$(echo .)org \
    --cc=xin@zytor$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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