From 34a80e915cc1133799345e991098eccd3644aa92 Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Wed, 27 Mar 2024 17:39:41 +0000 Subject: [PATCH] fix: correct xe kmd flag for bind capture Related-To: NEO-10496 Signed-off-by: Mateusz Jablonski --- .../source/os_interface/linux/xe/ioctl_helper_xe.cpp | 3 +++ .../os_interface/linux/xe/ioctl_helper_xe_tests.cpp | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) 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 1613b94650..ca91e373c8 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp @@ -733,6 +733,9 @@ bool IoctlHelperXe::completionFenceExtensionSupported(const bool isVmBindAvailab uint64_t IoctlHelperXe::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool readOnlyResource) { uint64_t ret = 0; xeLog(" -> IoctlHelperXe::%s %d %d %d %d\n", __FUNCTION__, bindCapture, bindImmediate, bindMakeResident, readOnlyResource); + if (bindCapture) { + ret |= DRM_XE_VM_BIND_FLAG_DUMPABLE; + } 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 92dec8e5dd..e883e7842e 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 @@ -394,8 +394,6 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe EXPECT_TRUE(xeIoctlHelper->completionFenceExtensionSupported(true)); - EXPECT_EQ(0ull, xeIoctlHelper->getFlagsForVmBind(true, true, true, true)); - uint32_t fabricId = 0, latency = 0, bandwidth = 0; EXPECT_FALSE(xeIoctlHelper->getFabricLatency(fabricId, latency, bandwidth)); } @@ -415,6 +413,15 @@ TEST(IoctlHelperXeTest, whenGettingFlagsForVmCreateThenPropertValueIsReturned) { EXPECT_EQ(static_cast(DRM_XE_VM_CREATE_FLAG_LR_MODE | DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE), xeIoctlHelper->getFlagsForVmCreate(false, false, false)); } +TEST(IoctlHelperXeTest, whenGettingFlagsForVmBindThenPropertValueIsReturned) { + auto executionEnvironment = std::make_unique(); + 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)); +} + TEST(IoctlHelperXeTest, whenGettingIoctlRequestValueThenPropertValueIsReturned) { auto executionEnvironment = std::make_unique(); DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};