iommufd: Associate fault object with iommufd_hw_pgtable
When allocating a user iommufd_hw_pagetable, the user space is allowed to associate a fault object with the hw_pagetable by specifying the fault object ID in the page table allocation data and setting the IOMMU_HWPT_FAULT_ID_VALID flag bit. On a successful return of hwpt allocation, the user can retrieve and respond to page faults by reading and writing the file interface of the fault object. Once a fault object has been associated with a hwpt, the hwpt is iopf-capable, indicated by hwpt->fault is non NULL. Attaching, detaching, or replacing an iopf-capable hwpt to an RID or PASID will differ from those that are not iopf-capable. Link: https://lore.kernel.org/r/20240702063444.105814-9-baolu.lu@linux.intel.com Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
committed by
Jason Gunthorpe
parent
b7d8833677
commit
34765cbc67
@@ -357,10 +357,13 @@ struct iommu_vfio_ioas {
|
||||
* the parent HWPT in a nesting configuration.
|
||||
* @IOMMU_HWPT_ALLOC_DIRTY_TRACKING: Dirty tracking support for device IOMMU is
|
||||
* enforced on device attachment
|
||||
* @IOMMU_HWPT_FAULT_ID_VALID: The fault_id field of hwpt allocation data is
|
||||
* valid.
|
||||
*/
|
||||
enum iommufd_hwpt_alloc_flags {
|
||||
IOMMU_HWPT_ALLOC_NEST_PARENT = 1 << 0,
|
||||
IOMMU_HWPT_ALLOC_DIRTY_TRACKING = 1 << 1,
|
||||
IOMMU_HWPT_FAULT_ID_VALID = 1 << 2,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -412,6 +415,9 @@ enum iommu_hwpt_data_type {
|
||||
* @data_type: One of enum iommu_hwpt_data_type
|
||||
* @data_len: Length of the type specific data
|
||||
* @data_uptr: User pointer to the type specific data
|
||||
* @fault_id: The ID of IOMMUFD_FAULT object. Valid only if flags field of
|
||||
* IOMMU_HWPT_FAULT_ID_VALID is set.
|
||||
* @__reserved2: Padding to 64-bit alignment. Must be 0.
|
||||
*
|
||||
* Explicitly allocate a hardware page table object. This is the same object
|
||||
* type that is returned by iommufd_device_attach() and represents the
|
||||
@@ -442,6 +448,8 @@ struct iommu_hwpt_alloc {
|
||||
__u32 data_type;
|
||||
__u32 data_len;
|
||||
__aligned_u64 data_uptr;
|
||||
__u32 fault_id;
|
||||
__u32 __reserved2;
|
||||
};
|
||||
#define IOMMU_HWPT_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_HWPT_ALLOC)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user