DMA Engine development
 help / color / mirror / Atom feed
From: Fenghua Yu <fenghua.yu@intel.com>
To: Jerry Snitselaar <jsnitsel@redhat.com>
Cc: Baolu Lu <baolu.lu@linux.intel.com>,
	iommu@lists.linux-foundation.org,
	Dave Jiang <dave.jiang@intel.com>,
	dmaengine@vger.kernel.org
Subject: Re: iommu_sva_bind_device question
Date: Sat, 25 Jun 2022 12:52:27 -0700	[thread overview]
Message-ID: <Yrdne20Eq+5KwF5h@fyu1.sc.intel.com> (raw)
In-Reply-To: <20220624144730.a6ork4dbjixnfhbf@cantor>

Hi, Jerry and Baolu,

On Fri, Jun 24, 2022 at 07:47:30AM -0700, Jerry Snitselaar wrote:
> > > > > > Hi Baolu & Dave,
> > > > fails.
> > > > 
> > > > You also will get the following warning if you don't have scalable
> > > > mode enabled (either not enabled by default, or if enabled by default
> > > > and passed intel_iommu=on,sm_off):
> > > 
> > > If scalable mode is disabled, iommu_dev_enable_feature(IOMMU_SVA) will
> > > return failure, hence driver should not call iommu_sva_bind_device().
> > > I guess below will disappear if above is fixed in the idxd driver.

Yes, Jerry's patch fixes the WARNING as well.

> > > 
> > > Best regards,
> > > baolu
> > >
> > 
> > It looks like there was a recent maintainer change, and Fenghua is now
> > the maintainer. Fenghua thoughts on this? With 42a1b73852c4
> > ("dmaengine: idxd: Separate user and kernel pasid enabling") the code
> > no longer depends on iommu_dev_feature_enable succeeding. Testing with
> > something like this works (ran dmatest without sm_on, and
> > dsa_user_test_runner.sh with sm_on, plus booting with various
> > intel_iommu= combinations):
> > 
> > diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
> > index 355fb3ef4cbf..5b49fd5c1e25 100644
> > --- a/drivers/dma/idxd/init.c
> > +++ b/drivers/dma/idxd/init.c
> > @@ -514,13 +514,14 @@ static int idxd_probe(struct idxd_device *idxd)
> >         if (IS_ENABLED(CONFIG_INTEL_IDXD_SVM) && sva) {
> >                 if (iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_SVA))
> >                         dev_warn(dev, "Unable to turn on user SVA feature.\n");
> > -               else
> > +               else {
> >                         set_bit(IDXD_FLAG_USER_PASID_ENABLED, &idxd->flags);
> > 
> > -               if (idxd_enable_system_pasid(idxd))

Please add "{" after this if.

> > -                       dev_warn(dev, "No in-kernel DMA with PASID.\n");
> > -               else
then "}" before this else.

> > -                       set_bit(IDXD_FLAG_PASID_ENABLED, &idxd->flags);
> > +                       if (idxd_enable_system_pasid(idxd))
> > +                               dev_warn(dev, "No in-kernel DMA with PASID.\n");
> > +                       else
> > +                               set_bit(IDXD_FLAG_PASID_ENABLED, &idxd->flags);
> > +               }
> >         } else if (!sva) {
> >                 dev_warn(dev, "User forced SVA off via module param.\n");
> >         }

The patch was copied/pasted here. So the tabs are lost at beginning of each
line. So it cannot be applied. Please change the tabs back.

Could you please send this patch in a separate email so that it has a
right patch format and description and ready to be picked up?

> > 
> > The commit description is a bit confusing, because it talks about there
> > being no dependency, but ties user pasid to enabling/disabling the SVA
> > feature, which system pasid would depend on as well.
> > 
> > Regards,
> > Jerry
> 
> Things like that warning message "Unable to turn on user SVA feature" when
> iommu_dev_enable_feature fails though seems to be misleading with user
> inserted in there. I'll leave it to the idxd folks to figure out.

How about removing "user" from the warning message? So the message will
be "Unable to turn on SVA feature"?

Thanks.

-Fenghua

  reply	other threads:[~2022-06-25 19:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 17:02 iommu_sva_bind_device question Jerry Snitselaar
2022-06-24  0:55 ` Baolu Lu
2022-06-24  1:14   ` Jerry Snitselaar
2022-06-24  1:43     ` Baolu Lu
2022-06-24 13:41       ` Jerry Snitselaar
2022-06-24 14:47         ` Jerry Snitselaar
2022-06-25 19:52           ` Fenghua Yu [this message]
2022-06-25 21:33             ` Jerry Snitselaar

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=Yrdne20Eq+5KwF5h@fyu1.sc.intel.com \
    --to=fenghua.yu@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jsnitsel@redhat.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