From 2d1f4e6214a3c8dd8f181785068d14a7eaa9ebaa Mon Sep 17 00:00:00 2001 From: Katarzyna Cencelewska Date: Wed, 17 Jul 2024 13:51:20 +0000 Subject: [PATCH] fix: use WB for cpu caching only if system memory affect xe kmd only Related-To: NEO-11690 Signed-off-by: Katarzyna Cencelewska --- shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp | 6 ++++-- .../os_interface/linux/xe/ioctl_helper_xe_tests.cpp | 2 +- 2 files changed, 5 insertions(+), 3 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 cefdfcac1c..927056fbb1 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp @@ -540,8 +540,10 @@ uint16_t IoctlHelperXe::getDefaultEngineClass(const aub_stream::EngineType &defa */ uint16_t IoctlHelperXe::getCpuCachingMode(std::optional isCoherent, bool allocationInSystemMemory) const { uint16_t cpuCachingMode = DRM_XE_GEM_CPU_CACHING_WC; - if ((isCoherent.value_or(false) == true) || (isCoherent == std::nullopt && allocationInSystemMemory)) { - cpuCachingMode = DRM_XE_GEM_CPU_CACHING_WB; + if (allocationInSystemMemory) { + if ((isCoherent.value_or(true) == true)) { + cpuCachingMode = DRM_XE_GEM_CPU_CACHING_WB; + } } if (debugManager.flags.OverrideCpuCaching.get() != -1) { 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 66a076e1eb..06987a995e 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 @@ -1816,7 +1816,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenGetCpuCachingModeCalledThenCorrect EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(false, false), DRM_XE_GEM_CPU_CACHING_WC); EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(false, true), DRM_XE_GEM_CPU_CACHING_WC); EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(true, true), DRM_XE_GEM_CPU_CACHING_WB); - EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(true, false), DRM_XE_GEM_CPU_CACHING_WB); + EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(true, false), DRM_XE_GEM_CPU_CACHING_WC); EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(std::nullopt, false), DRM_XE_GEM_CPU_CACHING_WC); EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(std::nullopt, true), DRM_XE_GEM_CPU_CACHING_WB);