diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp index 33544ba7670c3..ad912d746c81b 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp @@ -736,6 +736,12 @@ uint64_t IoctlHelperXe::getFlagsForVmBind(bool bindCapture, bool bindImmediate, if (bindCapture) { ret |= DRM_XE_VM_BIND_FLAG_DUMPABLE; } + if (bindImmediate) { + ret |= DRM_XE_VM_BIND_FLAG_IMMEDIATE; + } + if (readOnlyResource) { + ret |= DRM_XE_VM_BIND_FLAG_READONLY; + } return ret; } diff --git a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp index b0cd8309f651c..0236e252a0adf 100644 --- a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp @@ -418,8 +418,16 @@ TEST(IoctlHelperXeTest, whenGettingFlagsForVmBindThenPropertValueIsReturned) { DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]}; auto xeIoctlHelper = std::make_unique(drm); - EXPECT_EQ(static_cast(DRM_XE_VM_BIND_FLAG_DUMPABLE), xeIoctlHelper->getFlagsForVmBind(true, true, true, true)); - EXPECT_EQ(static_cast(0), xeIoctlHelper->getFlagsForVmBind(false, true, true, true)); + EXPECT_EQ(static_cast(DRM_XE_VM_BIND_FLAG_DUMPABLE | DRM_XE_VM_BIND_FLAG_IMMEDIATE | DRM_XE_VM_BIND_FLAG_READONLY), xeIoctlHelper->getFlagsForVmBind(true, true, true, true)); + EXPECT_EQ(static_cast(DRM_XE_VM_BIND_FLAG_DUMPABLE | DRM_XE_VM_BIND_FLAG_IMMEDIATE), xeIoctlHelper->getFlagsForVmBind(true, true, true, false)); + EXPECT_EQ(static_cast(DRM_XE_VM_BIND_FLAG_DUMPABLE | DRM_XE_VM_BIND_FLAG_IMMEDIATE | DRM_XE_VM_BIND_FLAG_READONLY), xeIoctlHelper->getFlagsForVmBind(true, true, false, true)); + EXPECT_EQ(static_cast(DRM_XE_VM_BIND_FLAG_DUMPABLE | DRM_XE_VM_BIND_FLAG_READONLY), xeIoctlHelper->getFlagsForVmBind(true, false, true, true)); + EXPECT_EQ(static_cast(DRM_XE_VM_BIND_FLAG_IMMEDIATE | DRM_XE_VM_BIND_FLAG_READONLY), xeIoctlHelper->getFlagsForVmBind(false, true, true, true)); + EXPECT_EQ(static_cast(DRM_XE_VM_BIND_FLAG_DUMPABLE), xeIoctlHelper->getFlagsForVmBind(true, false, false, false)); + EXPECT_EQ(static_cast(DRM_XE_VM_BIND_FLAG_IMMEDIATE), xeIoctlHelper->getFlagsForVmBind(false, true, false, false)); + EXPECT_EQ(static_cast(0), xeIoctlHelper->getFlagsForVmBind(false, false, true, false)); + EXPECT_EQ(static_cast(DRM_XE_VM_BIND_FLAG_READONLY), xeIoctlHelper->getFlagsForVmBind(false, false, false, true)); + EXPECT_EQ(static_cast(0), xeIoctlHelper->getFlagsForVmBind(false, false, false, false)); } TEST(IoctlHelperXeTest, whenGettingIoctlRequestValueThenPropertValueIsReturned) { diff --git a/third_party/uapi/drm/xe_drm.h b/third_party/uapi/drm/xe_drm.h index 6c98c3dfa8909..1525b74f4876b 100644 --- a/third_party/uapi/drm/xe_drm.h +++ b/third_party/uapi/drm/xe_drm.h @@ -831,6 +831,10 @@ struct drm_xe_vm_destroy { * - %DRM_XE_VM_BIND_OP_PREFETCH * * and the @flags can be: + * - %DRM_XE_VM_BIND_FLAG_READONLY + * - %DRM_XE_VM_BIND_FLAG_IMMEDIATE - Valid on a faulting VM only, do the + * MAP operation immediately rather than deferring the MAP to the page + * fault handler. * - %DRM_XE_VM_BIND_FLAG_NULL - When the NULL flag is set, the page * tables are setup with a special bit which indicates writes are * dropped and all reads return zero. In the future, the NULL flags @@ -923,6 +927,8 @@ struct drm_xe_vm_bind_op { /** @op: Bind operation to perform */ __u32 op; +#define DRM_XE_VM_BIND_FLAG_READONLY (1 << 0) +#define DRM_XE_VM_BIND_FLAG_IMMEDIATE (1 << 1) #define DRM_XE_VM_BIND_FLAG_NULL (1 << 2) #define DRM_XE_VM_BIND_FLAG_DUMPABLE (1 << 3) /** @flags: Bind flags */