Messages in this thread |  | | Date | Fri, 9 Aug 2024 16:25:30 +0800 | | Subject | Re: [PATCH v2 4/5] vt-d/iommu: Refactor quirk_extra_dev_tlb_flush() | | From | Baolu Lu <> |
| |
On 2024/8/9 10:54, Tina Zhang wrote: > Extract the core logic from quirk_extra_dev_tlb_flush() into a new > helper __quirk_extra_dev_tlb_flush(). This helper is for accommodating > for both individual and batched TLB invalidation commands, thereby > streamlining the process for handling device-specific TLB flush quirks. > > Signed-off-by: Tina Zhang<tina.zhang@intel.com> > --- > drivers/iommu/intel/iommu.c | 55 +++++++++++++++++++++++++++++-------- > drivers/iommu/intel/iommu.h | 4 +++ > 2 files changed, 47 insertions(+), 12 deletions(-) > > diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c > index 9ff8b83c19a3..160d569015b4 100644 > --- a/drivers/iommu/intel/iommu.c > +++ b/drivers/iommu/intel/iommu.c > @@ -4875,6 +4875,41 @@ static void __init check_tylersburg_isoch(void) > vtisochctrl); > } > > +static inline void __quirk_extra_dev_tlb_flush(struct device_domain_info *info, > + unsigned long address, unsigned long mask, > + u32 pasid, u16 qdep, > + struct qi_batch *batch) > +{ > + u16 sid; > + > + if (likely(!info->dtlb_extra_inval)) > + return; > + > + sid = PCI_DEVID(info->bus, info->devfn); > + if (batch == NULL) { > + if (pasid == IOMMU_NO_PASID) > + qi_flush_dev_iotlb(info->iommu, sid, info->pfsid, > + qdep, address, mask); > + else > + qi_flush_dev_iotlb_pasid(info->iommu, sid, > + info->pfsid, pasid, > + qdep, address, mask); > + } else { > + if (pasid == IOMMU_NO_PASID) > + qi_batch_add_dev_iotlb_desc(info->iommu, sid, > + info->pfsid, qdep, > + address, mask, batch); > + else > + qi_batch_add_dev_iotlb_pasid_desc(info->iommu, > + sid, > + info->pfsid, > + pasid, qdep, > + address, > + mask, > + batch); > + } > +}
How about moving this helper into cache.c? That's its only or major consumer, right?
By the way, in which case could 'batch' be a NULL?
Thanks, baolu
|  |