Skip to content

Commit 136a806

Browse files
committed
iommufd: Put constants for all the uAPI enums
Relying on position in the enum makes it subtly harder when doing merge resolutions or backporting as it is easy to grab a patch and not notice it is a uAPI change with a differently ordered enum. This may become a bigger problem in next cycles when iommu_hwpt_invalidate_data_type and other per-driver enums have patches flowing through different trees. So lets start including constants for all the uAPI enums to make this safer. No functional change. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Yi Liu <[email protected]> Tested-by: Yi Liu <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 595572a commit 136a806

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

include/uapi/linux/iommufd.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@
3737
enum {
3838
IOMMUFD_CMD_BASE = 0x80,
3939
IOMMUFD_CMD_DESTROY = IOMMUFD_CMD_BASE,
40-
IOMMUFD_CMD_IOAS_ALLOC,
41-
IOMMUFD_CMD_IOAS_ALLOW_IOVAS,
42-
IOMMUFD_CMD_IOAS_COPY,
43-
IOMMUFD_CMD_IOAS_IOVA_RANGES,
44-
IOMMUFD_CMD_IOAS_MAP,
45-
IOMMUFD_CMD_IOAS_UNMAP,
46-
IOMMUFD_CMD_OPTION,
47-
IOMMUFD_CMD_VFIO_IOAS,
48-
IOMMUFD_CMD_HWPT_ALLOC,
49-
IOMMUFD_CMD_GET_HW_INFO,
50-
IOMMUFD_CMD_HWPT_SET_DIRTY_TRACKING,
51-
IOMMUFD_CMD_HWPT_GET_DIRTY_BITMAP,
52-
IOMMUFD_CMD_HWPT_INVALIDATE,
53-
IOMMUFD_CMD_FAULT_QUEUE_ALLOC,
40+
IOMMUFD_CMD_IOAS_ALLOC = 0x81,
41+
IOMMUFD_CMD_IOAS_ALLOW_IOVAS = 0x82,
42+
IOMMUFD_CMD_IOAS_COPY = 0x83,
43+
IOMMUFD_CMD_IOAS_IOVA_RANGES = 0x84,
44+
IOMMUFD_CMD_IOAS_MAP = 0x85,
45+
IOMMUFD_CMD_IOAS_UNMAP = 0x86,
46+
IOMMUFD_CMD_OPTION = 0x87,
47+
IOMMUFD_CMD_VFIO_IOAS = 0x88,
48+
IOMMUFD_CMD_HWPT_ALLOC = 0x89,
49+
IOMMUFD_CMD_GET_HW_INFO = 0x8a,
50+
IOMMUFD_CMD_HWPT_SET_DIRTY_TRACKING = 0x8b,
51+
IOMMUFD_CMD_HWPT_GET_DIRTY_BITMAP = 0x8c,
52+
IOMMUFD_CMD_HWPT_INVALIDATE = 0x8d,
53+
IOMMUFD_CMD_FAULT_QUEUE_ALLOC = 0x8e,
5454
};
5555

5656
/**
@@ -400,8 +400,8 @@ struct iommu_hwpt_vtd_s1 {
400400
* @IOMMU_HWPT_DATA_VTD_S1: Intel VT-d stage-1 page table
401401
*/
402402
enum iommu_hwpt_data_type {
403-
IOMMU_HWPT_DATA_NONE,
404-
IOMMU_HWPT_DATA_VTD_S1,
403+
IOMMU_HWPT_DATA_NONE = 0,
404+
IOMMU_HWPT_DATA_VTD_S1 = 1,
405405
};
406406

407407
/**
@@ -491,8 +491,8 @@ struct iommu_hw_info_vtd {
491491
* @IOMMU_HW_INFO_TYPE_INTEL_VTD: Intel VT-d iommu info type
492492
*/
493493
enum iommu_hw_info_type {
494-
IOMMU_HW_INFO_TYPE_NONE,
495-
IOMMU_HW_INFO_TYPE_INTEL_VTD,
494+
IOMMU_HW_INFO_TYPE_NONE = 0,
495+
IOMMU_HW_INFO_TYPE_INTEL_VTD = 1,
496496
};
497497

498498
/**
@@ -629,7 +629,7 @@ struct iommu_hwpt_get_dirty_bitmap {
629629
* @IOMMU_HWPT_INVALIDATE_DATA_VTD_S1: Invalidation data for VTD_S1
630630
*/
631631
enum iommu_hwpt_invalidate_data_type {
632-
IOMMU_HWPT_INVALIDATE_DATA_VTD_S1,
632+
IOMMU_HWPT_INVALIDATE_DATA_VTD_S1 = 0,
633633
};
634634

635635
/**
@@ -768,7 +768,7 @@ struct iommu_hwpt_pgfault {
768768
*/
769769
enum iommufd_page_response_code {
770770
IOMMUFD_PAGE_RESP_SUCCESS = 0,
771-
IOMMUFD_PAGE_RESP_INVALID,
771+
IOMMUFD_PAGE_RESP_INVALID = 1,
772772
};
773773

774774
/**

0 commit comments

Comments
 (0)