Re: [PATCH v2 10/11] iommu/vt-d: Use xarray for global device_domain_info

2022-02-14 Thread Lu Baolu
Hi Christoph, On 2/14/22 3:38 PM, Christoph Hellwig wrote: const struct iommu_ops intel_iommu_ops; @@ -903,7 +905,8 @@ static void pgtable_walk(struct intel_iommu *iommu, unsigned long pfn, u8 bus, u struct dmar_domain *domain; int offset, level; - info =

Re: [PATCH v2 10/11] iommu/vt-d: Use xarray for global device_domain_info

2022-02-14 Thread Lu Baolu
Hi Jason, On 2/14/22 10:00 PM, Jason Gunthorpe wrote: + +/* Convert device source ID into the index of device_domain_array. */ +static inline unsigned long devi_idx(unsigned long seg, u8 bus, u8 devfn) +{ + return (seg << 16) | PCI_DEVID(bus, devfn); +} /* - * Iterate over elements

Re: [PATCH v2 10/11] iommu/vt-d: Use xarray for global device_domain_info

2022-02-14 Thread Jason Gunthorpe via iommu
On Mon, Feb 14, 2022 at 10:57:03AM +0800, Lu Baolu wrote: > Replace the existing global device_domain_list with an array so that it > could be rapidly searched. The index of the array is composed by the PCI > segment, bus and devfn. Use RCU for lock protection. > > Signed-off-by: Lu Baolu >

Re: [PATCH v2 10/11] iommu/vt-d: Use xarray for global device_domain_info

2022-02-13 Thread Christoph Hellwig
> > const struct iommu_ops intel_iommu_ops; > @@ -903,7 +905,8 @@ static void pgtable_walk(struct intel_iommu *iommu, > unsigned long pfn, u8 bus, u > struct dmar_domain *domain; > int offset, level; > > - info = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn); > +

[PATCH v2 10/11] iommu/vt-d: Use xarray for global device_domain_info

2022-02-13 Thread Lu Baolu
Replace the existing global device_domain_list with an array so that it could be rapidly searched. The index of the array is composed by the PCI segment, bus and devfn. Use RCU for lock protection. Signed-off-by: Lu Baolu --- include/linux/intel-iommu.h | 1 - drivers/iommu/intel/iommu.c | 72