Re: [PATCH v2 1/6] iommu: Add iommu page fault cookie helpers

2023-12-07 Thread Baolu Lu
On 12/1/23 10:38 PM, Jason Gunthorpe wrote: On Thu, Oct 26, 2023 at 10:49:25AM +0800, Lu Baolu wrote: +void *iopf_pasid_cookie_get(struct device *dev, ioasid_t pasid) +{ + struct iommu_fault_param *iopf_param = iopf_get_dev_fault_param(dev); + void *curr; + + if (!iopf_param)

Re: [PATCH v2 1/6] iommu: Add iommu page fault cookie helpers

2023-12-01 Thread Jason Gunthorpe
On Thu, Oct 26, 2023 at 10:49:25AM +0800, Lu Baolu wrote: > +void *iopf_pasid_cookie_get(struct device *dev, ioasid_t pasid) > +{ > + struct iommu_fault_param *iopf_param = iopf_get_dev_fault_param(dev); > + void *curr; > + > + if (!iopf_param) > + return ERR_PTR(-ENODEV);

[PATCH v2 1/6] iommu: Add iommu page fault cookie helpers

2023-10-25 Thread Lu Baolu
Add an xarray in iommu_fault_param as place holder for per-{device, pasid} fault cookie. The iommufd will use it to store the iommufd device pointers. This allows the iommufd to quickly retrieve the device object ID for a given {device, pasid} pair in the hot path of I/O page fault delivery.