diff options
| author | Jason Gunthorpe <jgg@nvidia.com> | 2024-02-07 12:52:16 -0400 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-03-13 10:41:39 +0000 |
| commit | 400732e21bdb27e4c3e1c2cf933c4f57fab7d4f8 (patch) | |
| tree | eeb6e39b1990d2f839001e288f5d247b949a3042 /sys/linux | |
| parent | e3d0b70923ed1e01d3b0339b21910fa4f0e975ae (diff) | |
sys/linux: add IOMMUFD_CMD_HWPT_ALLOC
New ioctl to create hwpt objects directly with two forms.
Diffstat (limited to 'sys/linux')
| -rw-r--r-- | sys/linux/dev_iommu.txt | 24 | ||||
| -rw-r--r-- | sys/linux/dev_iommu.txt.const | 5 | ||||
| -rw-r--r-- | sys/linux/test/dev_iommu | 7 |
3 files changed, 36 insertions, 0 deletions
diff --git a/sys/linux/dev_iommu.txt b/sys/linux/dev_iommu.txt index e31be76a3..482d81053 100644 --- a/sys/linux/dev_iommu.txt +++ b/sys/linux/dev_iommu.txt @@ -32,6 +32,9 @@ ioctl$IOMMU_VFIO_IOAS$GET(fd fd_iommufd, cmd const[IOMMU_VFIO_IOAS], arg ptr[in, ioctl$IOMMU_VFIO_IOAS$SET(fd fd_iommufd, cmd const[IOMMU_VFIO_IOAS], arg ptr[in, iommu_vfio_ioas$SET]) ioctl$IOMMU_VFIO_IOAS$CLEAR(fd fd_iommufd, cmd const[IOMMU_VFIO_IOAS], arg ptr[in, iommu_vfio_ioas$CLEAR]) +ioctl$IOMMU_HWPT_ALLOC$NONE(fd fd_iommufd, cmd const[IOMMU_HWPT_ALLOC], arg ptr[in, iommu_hwpt_alloc$IOMMU_HWPT_DATA_NONE]) +ioctl$IOMMU_HWPT_ALLOC$TEST(fd fd_iommufd, cmd const[IOMMU_HWPT_ALLOC], arg ptr[in, iommu_hwpt_alloc$IOMMU_HWPT_DATA_SELFTEST]) + # VFIO compatibility ioctls # This shares a few structs with dev_vfio.txt ioctl$IOMMU_VFIO_GET_API_VERSION(fd fd_iommufd, cmd const[VFIO_GET_API_VERSION]) @@ -170,6 +173,26 @@ iommu_vfio_ioas$CLEAR { __reserved const[0x0, int16] } +type iommu_hwpt_alloc[DATA_TYPE, DATA] { + size len[parent, int32] + flags flags[iommufd_hwpt_alloc_flags, int32] + dev_id device_handle + pt_id ioas_handle + out_hwpt_id hwpt_handle (out) + __reserved const[0x0, int32] + data_type const[DATA_TYPE, int32] + data_len len[uptr, int32] + uptr ptr64[in, DATA] +} + +type iommu_hwpt_alloc$IOMMU_HWPT_DATA_NONE iommu_hwpt_alloc[IOMMU_HWPT_DATA_NONE, array[int8]] + +iommu_hwpt_selftest { + iotlb const[0xbadbeef, int32] +} + +type iommu_hwpt_alloc$IOMMU_HWPT_DATA_SELFTEST iommu_hwpt_alloc[IOMMU_HWPT_DATA_SELFTEST, iommu_hwpt_selftest] + iommu_iova_range { start int64 last int64 @@ -178,6 +201,7 @@ iommu_iova_range { iommufd_ioas_map_flags = IOMMU_IOAS_MAP_FIXED_IOVA, IOMMU_IOAS_MAP_WRITEABLE, IOMMU_IOAS_MAP_READABLE iommufd_ioas_map_flags_syz = MOCK_FLAGS_ACCESS_SYZ, IOMMU_IOAS_MAP_WRITEABLE, IOMMU_IOAS_MAP_READABLE, MOCK_FLAGS_ACCESS_SYZ, IOMMU_IOAS_MAP_READABLE iommufd_option_ops = IOMMU_OPTION_OP_SET, IOMMU_OPTION_OP_GET +iommufd_hwpt_alloc_flags = IOMMU_HWPT_ALLOC_NEST_PARENT, IOMMU_HWPT_ALLOC_DIRTY_TRACKING iommu_type = VFIO_TYPE1_IOMMU, VFIO_TYPE1v2_IOMMU iommu_extension = VFIO_TYPE1_IOMMU, VFIO_TYPE1v2_IOMMU, VFIO_UNMAP_ALL, VFIO_DMA_CC_IOMMU, VFIO_TYPE1_NESTING_IOMMU, VFIO_UPDATE_VADDR diff --git a/sys/linux/dev_iommu.txt.const b/sys/linux/dev_iommu.txt.const index 830b696d5..4483b88da 100644 --- a/sys/linux/dev_iommu.txt.const +++ b/sys/linux/dev_iommu.txt.const @@ -2,6 +2,11 @@ arches = 386, amd64, arm, arm64, mips64le, ppc64le, riscv64, s390x AT_FDCWD = 18446744073709551516 IOMMU_DESTROY = 15232, mips64le:ppc64le:536886144 +IOMMU_HWPT_ALLOC = 15241, mips64le:ppc64le:536886153 +IOMMU_HWPT_ALLOC_DIRTY_TRACKING = 2 +IOMMU_HWPT_ALLOC_NEST_PARENT = 1 +IOMMU_HWPT_DATA_NONE = 0 +IOMMU_HWPT_DATA_SELFTEST = 57005 IOMMU_IOAS_ALLOC = 15233, mips64le:ppc64le:536886145 IOMMU_IOAS_ALLOW_IOVAS = 15234, mips64le:ppc64le:536886146 IOMMU_IOAS_COPY = 15235, mips64le:ppc64le:536886147 diff --git a/sys/linux/test/dev_iommu b/sys/linux/test/dev_iommu index 4038a77e6..4b3efaf75 100644 --- a/sys/linux/test/dev_iommu +++ b/sys/linux/test/dev_iommu @@ -56,6 +56,13 @@ ioctl$IOMMU_TEST_OP_DESTROY_ACCESS_PAGES(r0, 0x3ba0, &AUTO={0x48, 0x6, r2, 0x0, ioctl$IOMMU_IOAS_UNMAP$ALL(r0, 0x3b86, &AUTO={0x18, r1, 0, 0xFFFFFFFFFFFFFFFF}) close(r2) +ioctl$IOMMU_TEST_OP_MOCK_DOMAIN(r0, 0x3ba0, &AUTO={0x48, 0x2, r1, 0x0, <r4=>0x0, <r3=>0x0, <r2=>0x0}) +ioctl$IOMMU_HWPT_ALLOC$NONE(r0, 0x3b89, &AUTO={0x28, 0x1, r2, r1, <r3=>0x0, 0x0, 0x0, 0x0, &AUTO=''}) +ioctl$IOMMU_HWPT_ALLOC$TEST(r0, 0x3b89, &AUTO={0x28, 0, r2, r3, <r5=>0x0, 0x0, 0xdead, 0x4, &AUTO={0xbadbeef}}) +ioctl$IOMMU_DESTROY$hwpt(r0, 0x3b80, &AUTO={0x8, r5}) +ioctl$IOMMU_DESTROY$hwpt(r0, 0x3b80, &AUTO={0x8, r3}) +ioctl$IOMMU_DESTROY$stdev(r0, 0x3b80, &AUTO={0x8, r4}) + ioctl$IOMMU_TEST_OP_SET_TEMP_MEMORY_LIMIT(r0, 0x3ba0, &AUTO={0x48, 0x9, 0x0, 0x0, 0x10}) ioctl$IOMMU_DESTROY$ioas(r0, 0x3b80, &AUTO={0x8, r1}) |
