On Tue, Jan 05, 2021 at 05:50:22AM +0000, Liu, Yi L wrote:
> > > +static void __iommu_flush_dev_iotlb(struct device_domain_info *info,
> > > +                             u64 addr, unsigned int mask)
> > > +{
> > > + u16 sid, qdep;
> > > +
> > > + if (!info || !info->ats_enabled)
> > > +         return;
> > > +
> > > + sid = info->bus << 8 | info->devfn;
> > > + qdep = info->ats_qdep;
> > > + qi_flush_dev_iotlb(info->iommu, sid, info->pfsid,
> > > +                    qdep, addr, mask);
> > > +}
> > > +
> > >   static void iommu_flush_dev_iotlb(struct dmar_domain *domain,
> > >                                     u64 addr, unsigned mask)
> > >   {
> > > - u16 sid, qdep;
> > >           unsigned long flags;
> > >           struct device_domain_info *info;
> > > + struct subdev_domain_info *sinfo;
> > >
> > >           if (!domain->has_iotlb_device)
> > >                   return;
> > >
> > >           spin_lock_irqsave(&device_domain_lock, flags);
> > > - list_for_each_entry(info, &domain->devices, link) {
> > > -         if (!info->ats_enabled)
> > > -                 continue;
> > > + list_for_each_entry(info, &domain->devices, link)
> > > +         __iommu_flush_dev_iotlb(info, addr, mask);
> > >
> > > -         sid = info->bus << 8 | info->devfn;
> > > -         qdep = info->ats_qdep;
> > > -         qi_flush_dev_iotlb(info->iommu, sid, info->pfsid,
> > > -                         qdep, addr, mask);
> > > + list_for_each_entry(sinfo, &domain->subdevices, link_domain) {
> > > +         __iommu_flush_dev_iotlb(get_domain_info(sinfo->pdev),
> > > +                                 addr, mask);
> > >           }
> > 
> > Nit:
> >     list_for_each_entry(sinfo, &domain->subdevices, link_domain) {
> >             info = get_domain_info(sinfo->pdev);
> >             __iommu_flush_dev_iotlb(info, addr, mask);
> >     }
> 
> you are right. this should be better.

Please can you post a v4, with Lu's acks and the issue reported by Dan fixed
too?

Thanks,

Will

Reply via email to