Hi Kevin,

On Fri, 18 Mar 2022 06:16:58 +0000, "Tian, Kevin" <kevin.t...@intel.com>
wrote:

> > From: Jacob Pan <jacob.jun....@linux.intel.com>
> > Sent: Tuesday, March 15, 2022 1:07 PM
> > 
> > In-kernel DMA with PASID should use DMA API now, remove supervisor
> > PASID
> > SVA support. Remove special cases in bind mm and page request service.
> > 
> > Signed-off-by: Jacob Pan <jacob.jun....@linux.intel.com>  
> 
> so you removed all the references to SVM_FLAG_SUPERVISOR_MODE
> but the definition is still kept in include/linux/intel-svm.h...
> 
Good catch, will remove.

> > ---
> >  drivers/iommu/intel/svm.c | 42 ++++++++-------------------------------
> >  1 file changed, 8 insertions(+), 34 deletions(-)
> > 
> > diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
> > index 2c53689da461..37d6218f173b 100644
> > --- a/drivers/iommu/intel/svm.c
> > +++ b/drivers/iommu/intel/svm.c
> > @@ -516,11 +516,10 @@ static void intel_svm_free_pasid(struct mm_struct
> > *mm)
> > 
> >  static struct iommu_sva *intel_svm_bind_mm(struct intel_iommu *iommu,
> >                                        struct device *dev,
> > -                                      struct mm_struct *mm,
> > -                                      unsigned int flags)
> > +                                      struct mm_struct *mm)
> >  {
> >     struct device_domain_info *info = get_domain_info(dev);
> > -   unsigned long iflags, sflags;
> > +   unsigned long iflags, sflags = 0;
> >     struct intel_svm_dev *sdev;
> >     struct intel_svm *svm;
> >     int ret = 0;
> > @@ -533,16 +532,13 @@ static struct iommu_sva
> > *intel_svm_bind_mm(struct intel_iommu *iommu,
> > 
> >             svm->pasid = mm->pasid;
> >             svm->mm = mm;
> > -           svm->flags = flags;
> >             INIT_LIST_HEAD_RCU(&svm->devs);
> > 
> > -           if (!(flags & SVM_FLAG_SUPERVISOR_MODE)) {
> > -                   svm->notifier.ops = &intel_mmuops;
> > -                   ret = mmu_notifier_register(&svm->notifier,
> > mm);
> > -                   if (ret) {
> > -                           kfree(svm);
> > -                           return ERR_PTR(ret);
> > -                   }
> > +           svm->notifier.ops = &intel_mmuops;
> > +           ret = mmu_notifier_register(&svm->notifier, mm);
> > +           if (ret) {
> > +                   kfree(svm);
> > +                   return ERR_PTR(ret);
> >             }
> > 
> >             ret = pasid_private_add(svm->pasid, svm);
> > @@ -583,8 +579,6 @@ static struct iommu_sva *intel_svm_bind_mm(struct
> > intel_iommu *iommu,
> >     }
> > 
> >     /* Setup the pasid table: */
> > -   sflags = (flags & SVM_FLAG_SUPERVISOR_MODE) ?
> > -                   PASID_FLAG_SUPERVISOR_MODE : 0;
> >     sflags |= cpu_feature_enabled(X86_FEATURE_LA57) ?
> > PASID_FLAG_FL5LP : 0;
> >     spin_lock_irqsave(&iommu->lock, iflags);
> >     ret = intel_pasid_setup_first_level(iommu, dev, mm->pgd, mm-  
> > >pasid,  
> > @@ -957,7 +951,7 @@ static irqreturn_t prq_event_thread(int irq, void
> > *d)
> >                      * to unbind the mm while any page faults are
> > outstanding.
> >                      */
> >                     svm = pasid_private_find(req->pasid);
> > -                   if (IS_ERR_OR_NULL(svm) || (svm->flags &
> > SVM_FLAG_SUPERVISOR_MODE))
> > +                   if (IS_ERR_OR_NULL(svm))
> >                             goto bad_req;
> >             }
> > 
> > @@ -1011,29 +1005,9 @@ static irqreturn_t prq_event_thread(int irq, void
> > *d)
> >  struct iommu_sva *intel_svm_bind(struct device *dev, struct mm_struct
> > *mm, void *drvdata)
> >  {
> >     struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
> > -   unsigned int flags = 0;
> >     struct iommu_sva *sva;
> >     int ret;
> > 
> > -   if (drvdata)
> > -           flags = *(unsigned int *)drvdata;
> > -
> > -   if (flags & SVM_FLAG_SUPERVISOR_MODE) {
> > -           if (!ecap_srs(iommu->ecap)) {
> > -                   dev_err(dev, "%s: Supervisor PASID not
> > supported\n",
> > -                           iommu->name);
> > -                   return ERR_PTR(-EOPNOTSUPP);
> > -           }
> > -
> > -           if (mm) {
> > -                   dev_err(dev, "%s: Supervisor PASID with user
> > provided mm\n",
> > -                           iommu->name);
> > -                   return ERR_PTR(-EINVAL);
> > -           }
> > -
> > -           mm = &init_mm;
> > -   }
> > -
> >     mutex_lock(&pasid_mutex);
> >     ret = intel_svm_alloc_pasid(dev, mm, flags);
> >     if (ret) {
> > --
> > 2.25.1  
> 


Thanks,

Jacob
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to