Skip to content

Commit 82b6661

Browse files
yiliu1765jgunthorpe
authored andcommitted
iommufd: Add data structure for Intel VT-d stage-1 domain allocation
This adds IOMMU_HWPT_DATA_VTD_S1 for stage-1 hw_pagetable of Intel VT-d and the corressponding data structure for userspace specified parameter for the domain allocation. Link: https://lore.kernel.org/r/20231026044216.64964-2-yi.l.liu@intel.com Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Yi Liu <yi.l.liu@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent a2cdecd commit 82b6661

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

include/uapi/linux/iommufd.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,42 @@ enum iommufd_hwpt_alloc_flags {
361361
IOMMU_HWPT_ALLOC_DIRTY_TRACKING = 1 << 1,
362362
};
363363

364+
/**
365+
* enum iommu_hwpt_vtd_s1_flags - Intel VT-d stage-1 page table
366+
* entry attributes
367+
* @IOMMU_VTD_S1_SRE: Supervisor request
368+
* @IOMMU_VTD_S1_EAFE: Extended access enable
369+
* @IOMMU_VTD_S1_WPE: Write protect enable
370+
*/
371+
enum iommu_hwpt_vtd_s1_flags {
372+
IOMMU_VTD_S1_SRE = 1 << 0,
373+
IOMMU_VTD_S1_EAFE = 1 << 1,
374+
IOMMU_VTD_S1_WPE = 1 << 2,
375+
};
376+
377+
/**
378+
* struct iommu_hwpt_vtd_s1 - Intel VT-d stage-1 page table
379+
* info (IOMMU_HWPT_DATA_VTD_S1)
380+
* @flags: Combination of enum iommu_hwpt_vtd_s1_flags
381+
* @pgtbl_addr: The base address of the stage-1 page table.
382+
* @addr_width: The address width of the stage-1 page table
383+
* @__reserved: Must be 0
384+
*/
385+
struct iommu_hwpt_vtd_s1 {
386+
__aligned_u64 flags;
387+
__aligned_u64 pgtbl_addr;
388+
__u32 addr_width;
389+
__u32 __reserved;
390+
};
391+
364392
/**
365393
* enum iommu_hwpt_data_type - IOMMU HWPT Data Type
366394
* @IOMMU_HWPT_DATA_NONE: no data
395+
* @IOMMU_HWPT_DATA_VTD_S1: Intel VT-d stage-1 page table
367396
*/
368397
enum iommu_hwpt_data_type {
369398
IOMMU_HWPT_DATA_NONE,
399+
IOMMU_HWPT_DATA_VTD_S1,
370400
};
371401

372402
/**

0 commit comments

Comments
 (0)