On Thu, Sep 05, 2024 at 11:30:05AM +0800, Baolu Lu wrote:
On 9/4/24 9:17 PM, Joel Granados via B4 Relay wrote:What do you mean here?
From: Joel Granados<j.granados@xxxxxxxxxxx>The iommu_attach_handle is expected only when an iopf-capable domain is
iommu_report_device_fault expects a pasid array to have an
iommu_attach_handle when a fault is detected.
attached to the device or PASID. The iommu_report_device_fault() treats
it as a fault when a fault occurs, but no iopf-capable domain is
attached.
Add this handle when theThe iommu_attach_handle is managed by the caller (iommufd here for
replacing hwpt has a valid iommufd fault object. Remove it when we
release ownership of the group.
example). Therefore, before iommu_attach_handle tries to attach a domain
to an iopf-capable device or pasid, it should allocate the handle and
pass it to the domain attachment interfaces.
1. Do you want to move the iommufd_init_pasid_array call up to
iommufd_hwpt_replace_device?
2. Do you want to move it further up to iommufd_device_do_replace?
Note that all this implemented on a call to replace HWPT. So a
non-iopf-capable VFIO_DEVICE_ATTACH_IOMMUFD_PT ioctl has already been
completed before the one that calls iommufd_device_do_replace.
Conversely, the handle canDo you have a function in specific where you would put the free handle
only be freed after the domain is detached.
logic?