|
49 | 49 | IOMMUFD_CMD_GET_HW_INFO, |
50 | 50 | IOMMUFD_CMD_HWPT_SET_DIRTY_TRACKING, |
51 | 51 | IOMMUFD_CMD_HWPT_GET_DIRTY_BITMAP, |
| 52 | + IOMMUFD_CMD_HWPT_INVALIDATE, |
52 | 53 | }; |
53 | 54 |
|
54 | 55 | /** |
@@ -613,4 +614,46 @@ struct iommu_hwpt_get_dirty_bitmap { |
613 | 614 | #define IOMMU_HWPT_GET_DIRTY_BITMAP _IO(IOMMUFD_TYPE, \ |
614 | 615 | IOMMUFD_CMD_HWPT_GET_DIRTY_BITMAP) |
615 | 616 |
|
| 617 | +/** |
| 618 | + * enum iommu_hwpt_invalidate_data_type - IOMMU HWPT Cache Invalidation |
| 619 | + * Data Type |
| 620 | + * @IOMMU_HWPT_INVALIDATE_DATA_VTD_S1: Invalidation data for VTD_S1 |
| 621 | + */ |
| 622 | +enum iommu_hwpt_invalidate_data_type { |
| 623 | + IOMMU_HWPT_INVALIDATE_DATA_VTD_S1, |
| 624 | +}; |
| 625 | + |
| 626 | +/** |
| 627 | + * struct iommu_hwpt_invalidate - ioctl(IOMMU_HWPT_INVALIDATE) |
| 628 | + * @size: sizeof(struct iommu_hwpt_invalidate) |
| 629 | + * @hwpt_id: ID of a nested HWPT for cache invalidation |
| 630 | + * @data_uptr: User pointer to an array of driver-specific cache invalidation |
| 631 | + * data. |
| 632 | + * @data_type: One of enum iommu_hwpt_invalidate_data_type, defining the data |
| 633 | + * type of all the entries in the invalidation request array. It |
| 634 | + * should be a type supported by the hwpt pointed by @hwpt_id. |
| 635 | + * @entry_len: Length (in bytes) of a request entry in the request array |
| 636 | + * @entry_num: Input the number of cache invalidation requests in the array. |
| 637 | + * Output the number of requests successfully handled by kernel. |
| 638 | + * @__reserved: Must be 0. |
| 639 | + * |
| 640 | + * Invalidate the iommu cache for user-managed page table. Modifications on a |
| 641 | + * user-managed page table should be followed by this operation to sync cache. |
| 642 | + * Each ioctl can support one or more cache invalidation requests in the array |
| 643 | + * that has a total size of @entry_len * @entry_num. |
| 644 | + * |
| 645 | + * An empty invalidation request array by setting @entry_num==0 is allowed, and |
| 646 | + * @entry_len and @data_uptr would be ignored in this case. This can be used to |
| 647 | + * check if the given @data_type is supported or not by kernel. |
| 648 | + */ |
| 649 | +struct iommu_hwpt_invalidate { |
| 650 | + __u32 size; |
| 651 | + __u32 hwpt_id; |
| 652 | + __aligned_u64 data_uptr; |
| 653 | + __u32 data_type; |
| 654 | + __u32 entry_len; |
| 655 | + __u32 entry_num; |
| 656 | + __u32 __reserved; |
| 657 | +}; |
| 658 | +#define IOMMU_HWPT_INVALIDATE _IO(IOMMUFD_TYPE, IOMMUFD_CMD_HWPT_INVALIDATE) |
616 | 659 | #endif |
0 commit comments