History

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.

Lu Baolu committed 2 years ago

Commit 34765cb1 parent b7d88334 files · +64 −8Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/linux/iommufd.h+8−0
@@ -357,10 +357,13 @@ struct iommu_vfio_ioas { · 356 unmodified lines
357 * the parent HWPT in a nesting configuration.357 * the parent HWPT in a nesting configuration.
358 * @IOMMU_HWPT_ALLOC_DIRTY_TRACKING: Dirty tracking support for device IOMMU is358 * @IOMMU_HWPT_ALLOC_DIRTY_TRACKING: Dirty tracking support for device IOMMU is
359 * enforced on device attachment359 * enforced on device attachment
360 * @IOMMU_HWPT_FAULT_ID_VALID: The fault_id field of hwpt allocation data is
361 * valid.
360 */362 */
361enum iommufd_hwpt_alloc_flags {363enum iommufd_hwpt_alloc_flags {
362 IOMMU_HWPT_ALLOC_NEST_PARENT = 1 << 0,364 IOMMU_HWPT_ALLOC_NEST_PARENT = 1 << 0,
363 IOMMU_HWPT_ALLOC_DIRTY_TRACKING = 1 << 1,365 IOMMU_HWPT_ALLOC_DIRTY_TRACKING = 1 << 1,
366 IOMMU_HWPT_FAULT_ID_VALID = 1 << 2,
364};367};
365 368
366/**369/**
@@ -412,6 +415,9 @@ enum iommu_hwpt_data_type { · 45 unmodified lines
412 * @data_type: One of enum iommu_hwpt_data_type415 * @data_type: One of enum iommu_hwpt_data_type
413 * @data_len: Length of the type specific data416 * @data_len: Length of the type specific data
414 * @data_uptr: User pointer to the type specific data417 * @data_uptr: User pointer to the type specific data
418 * @fault_id: The ID of IOMMUFD_FAULT object. Valid only if flags field of
419 * IOMMU_HWPT_FAULT_ID_VALID is set.
420 * @__reserved2: Padding to 64-bit alignment. Must be 0.
415 *421 *
416 * Explicitly allocate a hardware page table object. This is the same object422 * Explicitly allocate a hardware page table object. This is the same object
417 * type that is returned by iommufd_device_attach() and represents the423 * type that is returned by iommufd_device_attach() and represents the
@@ -442,6 +448,8 @@ struct iommu_hwpt_alloc { · 24 unmodified lines
442 __u32 data_type;448 __u32 data_type;
443 __u32 data_len;449 __u32 data_len;
444 __aligned_u64 data_uptr;450 __aligned_u64 data_uptr;
451 __u32 fault_id;
452 __u32 __reserved2;
445};453};
446#define IOMMU_HWPT_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_HWPT_ALLOC)454#define IOMMU_HWPT_ALLOC _IO(IOMMUFD_TYPE, IOMMUFD_CMD_HWPT_ALLOC)
447 455