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)
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);
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.