|
8 | 8 | #include "shared/source/execution_environment/execution_environment.h"
|
9 | 9 | #include "shared/source/execution_environment/root_device_environment.h"
|
10 | 10 | #include "shared/source/os_interface/linux/os_context_linux.h"
|
| 11 | +#include "shared/source/os_interface/product_helper.h" |
11 | 12 | #include "shared/test/common/helpers/debug_manager_state_restore.h"
|
12 | 13 | #include "shared/test/common/helpers/engine_descriptor_helper.h"
|
13 | 14 | #include "shared/test/common/libult/linux/drm_query_mock.h"
|
@@ -121,3 +122,27 @@ TEST(DrmVmBindTest, givenUseKmdMigrationWhenCallingBindBoOnUnifiedSharedMemoryTh
|
121 | 122 | EXPECT_FALSE(bo.isExplicitResidencyRequired());
|
122 | 123 | EXPECT_EQ(DrmPrelimHelper::getImmediateVmBindFlag(), drm.context.receivedVmBind->flags);
|
123 | 124 | }
|
| 125 | + |
| 126 | +TEST(DrmVmBindTest, givenDefaultDriverSettingsWhenCallingBindBoOnUnifiedSharedMemoryThenMarkAllocationShouldPageFaultWhenKmdMigrationIsSupported) { |
| 127 | + auto executionEnvironment = std::make_unique<MockExecutionEnvironment>(); |
| 128 | + executionEnvironment->rootDeviceEnvironments[0]->initGmm(); |
| 129 | + executionEnvironment->initializeMemoryManager(); |
| 130 | + |
| 131 | + DrmQueryMock drm(*executionEnvironment->rootDeviceEnvironments[0]); |
| 132 | + drm.pageFaultSupported = true; |
| 133 | + |
| 134 | + OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor()); |
| 135 | + osContext.ensureContextInitialized(); |
| 136 | + uint32_t vmHandleId = 0; |
| 137 | + |
| 138 | + MockBufferObject bo(0u, &drm, 3, 0, 0, 1); |
| 139 | + MockDrmAllocation allocation(0u, AllocationType::UNIFIED_SHARED_MEMORY, MemoryPool::LocalMemory); |
| 140 | + allocation.bufferObjects[0] = &bo; |
| 141 | + |
| 142 | + allocation.bindBO(&bo, &osContext, vmHandleId, nullptr, true); |
| 143 | + |
| 144 | + auto &productHelper = drm.getRootDeviceEnvironment().getHelper<ProductHelper>(); |
| 145 | + auto isKmdMigrationSupported = productHelper.isKmdMigrationSupported(); |
| 146 | + |
| 147 | + EXPECT_EQ(isKmdMigrationSupported, allocation.shouldAllocationPageFault(&drm)); |
| 148 | +} |
0 commit comments