Skip to content

Commit 393a577

Browse files
yiliu1765jgunthorpe
authored andcommitted
iommufd: Add data structure for Intel VT-d stage-1 cache invalidation
This adds the data structure invalidating caches for the nested domain allocated with IOMMU_HWPT_DATA_VTD_S1 type. Link: https://lore.kernel.org/r/20240111041015.47920-8-yi.l.liu@intel.com Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent bf26eb8 commit 393a577

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

include/uapi/linux/iommufd.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,42 @@ enum iommu_hwpt_invalidate_data_type {
623623
IOMMU_HWPT_INVALIDATE_DATA_VTD_S1,
624624
};
625625

626+
/**
627+
* enum iommu_hwpt_vtd_s1_invalidate_flags - Flags for Intel VT-d
628+
* stage-1 cache invalidation
629+
* @IOMMU_VTD_INV_FLAGS_LEAF: Indicates whether the invalidation applies
630+
* to all-levels page structure cache or just
631+
* the leaf PTE cache.
632+
*/
633+
enum iommu_hwpt_vtd_s1_invalidate_flags {
634+
IOMMU_VTD_INV_FLAGS_LEAF = 1 << 0,
635+
};
636+
637+
/**
638+
* struct iommu_hwpt_vtd_s1_invalidate - Intel VT-d cache invalidation
639+
* (IOMMU_HWPT_INVALIDATE_DATA_VTD_S1)
640+
* @addr: The start address of the range to be invalidated. It needs to
641+
* be 4KB aligned.
642+
* @npages: Number of contiguous 4K pages to be invalidated.
643+
* @flags: Combination of enum iommu_hwpt_vtd_s1_invalidate_flags
644+
* @__reserved: Must be 0
645+
*
646+
* The Intel VT-d specific invalidation data for user-managed stage-1 cache
647+
* invalidation in nested translation. Userspace uses this structure to
648+
* tell the impacted cache scope after modifying the stage-1 page table.
649+
*
650+
* Invalidating all the caches related to the page table by setting @addr
651+
* to be 0 and @npages to be U64_MAX.
652+
*
653+
* The device TLB will be invalidated automatically if ATS is enabled.
654+
*/
655+
struct iommu_hwpt_vtd_s1_invalidate {
656+
__aligned_u64 addr;
657+
__aligned_u64 npages;
658+
__u32 flags;
659+
__u32 __reserved;
660+
};
661+
626662
/**
627663
* struct iommu_hwpt_invalidate - ioctl(IOMMU_HWPT_INVALIDATE)
628664
* @size: sizeof(struct iommu_hwpt_invalidate)

0 commit comments

Comments
 (0)