> From: Lu Baolu [mailto:baolu.lu@xxxxxxxxxxxxxxx] > Sent: Tuesday, December 17, 2019 9:39 AM > To: Liu, Yi L <yi.l.liu@xxxxxxxxx>; Joerg Roedel <joro@xxxxxxxxxx>; David > Woodhouse <dwmw2@xxxxxxxxxxxxx>; Alex Williamson > <alex.williamson@xxxxxxxxxx> > Subject: Re: [PATCH v3 5/6] iommu/vt-d: Flush PASID-based iotlb for iova over first > level > > Hi, > > On 12/17/19 9:37 AM, Lu Baolu wrote: > > You are right. I will change it accordingly. The logic should look > > like: > > > > if (domain attached to physical device) > > flush_piotlb_with_RID2PASID() > > else if (domain_attached_to_mdev_device) > > flush_piotlb_with_default_pasid() > > > > Both! so no "else" here. aha, if we want to flush more precisely, we may check whether domain->default_pasid is allocated. If not, it means no mdev is involved, then we may save a p_iotlb_inv_dsc submission and also save VT-d hardware circles from doing useless flush. This is just optimization, it's up to you to pick it or not in this patchset. I'm fine with flush "both" since it guarantees correctness. Regards, Yi Liu