aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2024-02-13 11:41:57 -0400
committerAleksandr Nogikh <nogikh@google.com>2024-03-13 10:41:39 +0000
commitf919f2027835450776a432d628fcf8484373fc81 (patch)
treec479bdcad90d1156538e370646bb9b3ba450f6ae /sys/linux
parentc2683c598598d0c54b7de4f1d172a3e4cec9d87f (diff)
sys/linux: add IOMMU_HWPT_INVALIDATE
Diffstat (limited to 'sys/linux')
-rw-r--r--sys/linux/dev_iommu.txt17
-rw-r--r--sys/linux/dev_iommu.txt.const4
-rw-r--r--sys/linux/test/dev_iommu1
3 files changed, 22 insertions, 0 deletions
diff --git a/sys/linux/dev_iommu.txt b/sys/linux/dev_iommu.txt
index 31462b0ee..04182e6f0 100644
--- a/sys/linux/dev_iommu.txt
+++ b/sys/linux/dev_iommu.txt
@@ -38,6 +38,7 @@ ioctl$IOMMU_HWPT_ALLOC$TEST(fd fd_iommufd, cmd const[IOMMU_HWPT_ALLOC], arg ptr[
ioctl$IOMMU_GET_HW_INFO(fd fd_iommufd, cmd const[IOMMU_GET_HW_INFO], arg ptr[in, iommu_hw_info])
ioctl$IOMMU_HWPT_SET_DIRTY_TRACKING(fd fd_iommufd, cmd const[IOMMU_HWPT_SET_DIRTY_TRACKING], arg ptr[in, iommu_hwpt_set_dirty_tracking])
ioctl$IOMMU_HWPT_GET_DIRTY_BITMAP(fd fd_iommufd, cmd const[IOMMU_HWPT_GET_DIRTY_BITMAP], arg ptr[in, iommu_hwpt_get_dirty_bitmap])
+ioctl$IOMMU_HWPT_INVALIDATE$TEST(fd fd_iommufd, cmd const[IOMMU_HWPT_INVALIDATE], arg ptr[in, iommu_hwpt_invalidate$IOMMU_HWPT_INVALIDATE_DATA_SELFTEST])
# VFIO compatibility ioctls
# This shares a few structs with dev_vfio.txt
@@ -226,6 +227,21 @@ iommu_hwpt_get_dirty_bitmap {
data ptr64[out, array[int8]]
}
+iommu_hwpt_invalidate_selftest {
+ flags flags[iommufd_hwpt_invalidate_selftest_flags, int32]
+ iotlb_id int32[0:MOCK_NESTED_DOMAIN_IOTLB_ID_MAX]
+}
+
+iommu_hwpt_invalidate$IOMMU_HWPT_INVALIDATE_DATA_SELFTEST {
+ size len[parent, int32]
+ hwpt_id hwpt_handle
+ data_uptr ptr64[in, array[iommu_hwpt_invalidate_selftest]]
+ data_type const[IOMMU_HWPT_INVALIDATE_DATA_SELFTEST, int32]
+ entry_len const[0x8, int32]
+ entry_num len[data_uptr, int32]
+ __reserved const[0x0, int32]
+}
+
iommu_iova_range {
start int64
last int64
@@ -432,3 +448,4 @@ iommu_test_cmd_acess_pages_flags_syz = MOCK_FLAGS_ACCESS_SYZ, MOCK_FLAGS_ACCESS_
iommu_test_cmd_acess_rw_flags = MOCK_ACCESS_RW_WRITE, MOCK_ACCESS_RW_SLOW_PATH
iommu_test_cmd_acess_rw_flags_syz = MOCK_FLAGS_ACCESS_SYZ, iommu_test_cmd_acess_rw_flags
iommu_test_cmd_mock_domain_flags = MOCK_FLAGS_DEVICE_NO_DIRTY
+iommufd_hwpt_invalidate_selftest_flags = IOMMU_TEST_INVALIDATE_FLAG_ALL
diff --git a/sys/linux/dev_iommu.txt.const b/sys/linux/dev_iommu.txt.const
index f98b10561..a11076ef9 100644
--- a/sys/linux/dev_iommu.txt.const
+++ b/sys/linux/dev_iommu.txt.const
@@ -11,6 +11,8 @@ IOMMU_HWPT_DATA_SELFTEST = 57005
IOMMU_HWPT_DIRTY_TRACKING_ENABLE = 1
IOMMU_HWPT_GET_DIRTY_BITMAP = 15244, mips64le:ppc64le:536886156
IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR = 1
+IOMMU_HWPT_INVALIDATE = 15245, mips64le:ppc64le:536886157
+IOMMU_HWPT_INVALIDATE_DATA_SELFTEST = 3735928559
IOMMU_HWPT_SET_DIRTY_TRACKING = 15243, mips64le:ppc64le:536886155
IOMMU_IOAS_ALLOC = 15233, mips64le:ppc64le:536886145
IOMMU_IOAS_ALLOW_IOVAS = 15234, mips64le:ppc64le:536886146
@@ -28,6 +30,7 @@ IOMMU_OPTION_OP_SET = 0
IOMMU_OPTION_RLIMIT_MODE = 0
IOMMU_TEST_CMD = 15264, mips64le:ppc64le:536886176
IOMMU_TEST_CMD_SIZE = 72
+IOMMU_TEST_INVALIDATE_FLAG_ALL = 1
IOMMU_TEST_OP_ACCESS_PAGES = 7
IOMMU_TEST_OP_ACCESS_REPLACE_IOAS = 11
IOMMU_TEST_OP_ACCESS_RW = 8
@@ -49,6 +52,7 @@ MOCK_FLAGS_ACCESS_CREATE_NEEDS_PIN_PAGES = 1
MOCK_FLAGS_ACCESS_SYZ = 65536
MOCK_FLAGS_ACCESS_WRITE = 1
MOCK_FLAGS_DEVICE_NO_DIRTY = 1
+MOCK_NESTED_DOMAIN_IOTLB_ID_MAX = 3
VFIO_CHECK_EXTENSION = 15205, mips64le:ppc64le:536886117
VFIO_DMA_CC_IOMMU = 4
VFIO_GET_API_VERSION = 15204, mips64le:ppc64le:536886116
diff --git a/sys/linux/test/dev_iommu b/sys/linux/test/dev_iommu
index a1d1a1acc..fc348ff57 100644
--- a/sys/linux/test/dev_iommu
+++ b/sys/linux/test/dev_iommu
@@ -59,6 +59,7 @@ 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_HWPT_INVALIDATE$TEST(r0, 0x3b8d, &AUTO={0x20, r5, &AUTO=[{0x0, 0x0}], 0xdeadbeef, 0x8, 0x1, 0x0})
ioctl$IOMMU_DESTROY$hwpt(r0, 0x3b80, &AUTO={0x8, r5})
ioctl$IOMMU_DESTROY$hwpt(r0, 0x3b80, &AUTO={0x8, r3})
ioctl$IOMMU_GET_HW_INFO(r0, 0x3b8a, &AUTO={0x24, 0x0, r2, 0x1c, &AUTO='LLLLLLLLLLLLLLLLLLLLLLLLLLLL', 0x0, 0x0, 0x0})