Skip to content

Commit dec695f

Browse files
luluu9Compute-Runtime-Automation
authored andcommitted
fix: add scratch page support with xekmd
Also explicitly disable it by default. Signed-off-by: Naklicki, Mateusz <[email protected]>
1 parent 1083ad1 commit dec695f

File tree

8 files changed

+33
-15
lines changed

8 files changed

+33
-15
lines changed

shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,9 @@ uint32_t IoctlHelperXe::getFlagsForVmCreate(bool disableScratch, bool enablePage
968968
if (enablePageFault) {
969969
flags |= DRM_XE_VM_CREATE_FLAG_FAULT_MODE;
970970
}
971+
if (!disableScratch) {
972+
flags |= DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE;
973+
}
971974
return flags;
972975
}
973976

shared/source/xe2_hpg_core/linux/product_helper_bmg.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,10 @@ int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, O
3333
return 0;
3434
}
3535

36+
template <>
37+
bool ProductHelperHw<gfxProduct>::isDisableScratchPagesSupported() const {
38+
return true;
39+
}
40+
3641
template class ProductHelperHw<gfxProduct>;
3742
} // namespace NEO

shared/source/xe2_hpg_core/linux/product_helper_lnl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,10 @@ int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, O
3535
return 0;
3636
}
3737

38+
template <>
39+
bool ProductHelperHw<gfxProduct>::isDisableScratchPagesSupported() const {
40+
return true;
41+
}
42+
3843
template class ProductHelperHw<gfxProduct>;
3944
} // namespace NEO

shared/test/unit_test/os_interface/linux/drm_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ HWTEST2_F(DrmDisableScratchPagesDefaultTest,
15491549
}
15501550

15511551
HWTEST2_F(DrmDisableScratchPagesDefaultTest,
1552-
givenDefaultDisableScratchPagesThenCheckingGpuFaultCheckIsSetToDefaultAndScratchPageIsEnabled, IsNotPVC) {
1552+
givenDefaultDisableScratchPagesThenCheckingGpuFaultCheckIsSetToDefaultAndScratchPageIsEnabled, IsBeforeXeHpcCore) {
15531553
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
15541554
DrmMockCheckPageFault drm{*executionEnvironment->rootDeviceEnvironments[0]};
15551555
drm.configureScratchPagePolicy();

shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,14 +456,20 @@ TEST_F(IoctlHelperXeTest, whenGettingFlagsForVmCreateThenPropertValueIsReturned)
456456
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
457457
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
458458

459-
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_LR_MODE | DRM_XE_VM_CREATE_FLAG_FAULT_MODE), xeIoctlHelper->getFlagsForVmCreate(true, true, true));
460-
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_LR_MODE | DRM_XE_VM_CREATE_FLAG_FAULT_MODE), xeIoctlHelper->getFlagsForVmCreate(true, true, false));
461-
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_LR_MODE | DRM_XE_VM_CREATE_FLAG_FAULT_MODE), xeIoctlHelper->getFlagsForVmCreate(false, true, true));
462-
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_LR_MODE | DRM_XE_VM_CREATE_FLAG_FAULT_MODE), xeIoctlHelper->getFlagsForVmCreate(false, true, false));
463-
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_LR_MODE), xeIoctlHelper->getFlagsForVmCreate(true, false, true));
464-
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_LR_MODE), xeIoctlHelper->getFlagsForVmCreate(true, false, false));
465-
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_LR_MODE), xeIoctlHelper->getFlagsForVmCreate(false, false, true));
466-
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_LR_MODE), xeIoctlHelper->getFlagsForVmCreate(false, false, false));
459+
for (auto &disableScratch : ::testing::Bool()) {
460+
for (auto &enablePageFault : ::testing::Bool()) {
461+
for (auto &useVmBind : ::testing::Bool()) {
462+
auto flags = xeIoctlHelper->getFlagsForVmCreate(disableScratch, enablePageFault, useVmBind);
463+
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_LR_MODE), (flags & DRM_XE_VM_CREATE_FLAG_LR_MODE));
464+
if (enablePageFault) {
465+
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_FAULT_MODE), (flags & DRM_XE_VM_CREATE_FLAG_FAULT_MODE));
466+
}
467+
if (!disableScratch) {
468+
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE), (flags & DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE));
469+
}
470+
}
471+
}
472+
}
467473
}
468474

469475
TEST_F(IoctlHelperXeTest, whenGettingFlagsForVmBindThenPropertValueIsReturned) {

shared/test/unit_test/os_interface/product_helper_tests.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ HWTEST_F(ProductHelperTest, givenProductHelperWhenAskedIfKmdMigrationIsSupported
457457
EXPECT_FALSE(productHelper->isKmdMigrationSupported());
458458
}
459459

460-
HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIfDisableScratchPagesIsSupportedThenReturnFalse, IsNotPVC) {
461-
460+
HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIfDisableScratchPagesIsSupportedThenReturnFalse, IsBeforeXeHpcCore) {
462461
EXPECT_FALSE(productHelper->isDisableScratchPagesSupported());
463462
}
464463

shared/test/unit_test/xe2_hpg_core/bmg/linux/product_helper_tests_bmg_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ BMGTEST_F(BmgProductHelperLinux, givenProductHelperWhenAskedIsKmdMigrationSuppor
6161
EXPECT_FALSE(productHelper->isKmdMigrationSupported());
6262
}
6363

64-
BMGTEST_F(BmgProductHelperLinux, givenProductHelperWhenAskedIsDisableScratchPagesSupportedThenReturnFalse) {
65-
EXPECT_FALSE(productHelper->isDisableScratchPagesSupported());
64+
BMGTEST_F(BmgProductHelperLinux, givenProductHelperWhenAskedIsDisableScratchPagesSupportedThenReturnTrue) {
65+
EXPECT_TRUE(productHelper->isDisableScratchPagesSupported());
6666
}
6767

6868
BMGTEST_F(BmgProductHelperLinux, WhenGtIsSetupThenGtSystemInfoIsCorrect) {

shared/test/unit_test/xe2_hpg_core/lnl/linux/product_helper_tests_lnl_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ LNLTEST_F(LnlProductHelperLinux, givenProductHelperWhenAskedIsKmdMigrationSuppor
6060
EXPECT_FALSE(productHelper->isKmdMigrationSupported());
6161
}
6262

63-
LNLTEST_F(LnlProductHelperLinux, givenProductHelperWhenAskedIsDisableScratchPagesSupportedThenReturnFalse) {
64-
EXPECT_FALSE(productHelper->isDisableScratchPagesSupported());
63+
LNLTEST_F(LnlProductHelperLinux, givenProductHelperWhenAskedIsDisableScratchPagesSupportedThenReturnTrue) {
64+
EXPECT_TRUE(productHelper->isDisableScratchPagesSupported());
6565
}
6666

6767
LNLTEST_F(LnlProductHelperLinux, givenProductHelperWhenCheckDirectSubmissionSupportedThenFalseIsReturned) {

0 commit comments

Comments
 (0)