|
|
|
|
@@ -16,17 +16,20 @@
|
|
|
|
|
#include "shared/test/common/mocks/linux/mock_os_time_linux.h"
|
|
|
|
|
#include "shared/test/common/os_interface/linux/xe/mock_drm_xe.h"
|
|
|
|
|
#include "shared/test/common/os_interface/linux/xe/mock_ioctl_helper_xe.h"
|
|
|
|
|
#include "shared/test/common/os_interface/linux/xe/xe_config_fixture.h"
|
|
|
|
|
#include "shared/test/common/test_macros/test.h"
|
|
|
|
|
using namespace NEO;
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenXeDrmVersionsWhenGettingIoctlHelperThenValidIoctlHelperIsReturned) {
|
|
|
|
|
using IoctlHelperXeTest = Test<XeConfigFixture>;
|
|
|
|
|
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenXeDrmVersionsWhenGettingIoctlHelperThenValidIoctlHelperIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
|
|
|
|
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
|
|
|
|
|
EXPECT_NE(nullptr, xeIoctlHelper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenGettingIfImmediateVmBindIsRequiredThenTrueIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenGettingIfImmediateVmBindIsRequiredThenTrueIsReturned) {
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
std::unique_ptr<Drm> drm{Drm::create(std::make_unique<HwDeviceIdDrm>(0, ""), *executionEnvironment.rootDeviceEnvironments[0])};
|
|
|
|
|
IoctlHelperXe ioctlHelper{*drm};
|
|
|
|
|
@@ -34,7 +37,7 @@ TEST(IoctlHelperXeTest, whenGettingIfImmediateVmBindIsRequiredThenTrueIsReturned
|
|
|
|
|
EXPECT_TRUE(ioctlHelper.isImmediateVmBindRequired());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenXeDrmWhenGetPciBarrierMmapThenReturnsNullptr) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenXeDrmWhenGetPciBarrierMmapThenReturnsNullptr) {
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
std::unique_ptr<Drm> drm{Drm::create(std::make_unique<HwDeviceIdDrm>(0, ""), *executionEnvironment.rootDeviceEnvironments[0])};
|
|
|
|
|
IoctlHelperXe ioctlHelper{*drm};
|
|
|
|
|
@@ -43,7 +46,7 @@ TEST(IoctlHelperXeTest, givenXeDrmWhenGetPciBarrierMmapThenReturnsNullptr) {
|
|
|
|
|
EXPECT_EQ(ptr, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenChangingBufferBindingThenWaitIsNeededAlways) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenChangingBufferBindingThenWaitIsNeededAlways) {
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
std::unique_ptr<Drm> drm{Drm::create(std::make_unique<HwDeviceIdDrm>(0, ""), *executionEnvironment.rootDeviceEnvironments[0])};
|
|
|
|
|
|
|
|
|
|
@@ -116,7 +119,7 @@ TEST_F(IoctlHelperXeGemCreateExtTests, givenIoctlHelperXeWhenCallingGemCreateExt
|
|
|
|
|
EXPECT_EQ(DRM_XE_GEM_CPU_CACHING_WB, drm->createParamsCpuCaching);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThenProperValuesSet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThenProperValuesSet) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.EnableLocalMemory.set(0);
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
@@ -146,7 +149,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThenP
|
|
|
|
|
EXPECT_EQ(handle, testValueGemCreate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateWhenMemoryBanksZeroThenProperValuesSet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateWhenMemoryBanksZeroThenProperValuesSet) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.EnableLocalMemory.set(0);
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
@@ -176,7 +179,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateWhenMemoryBanksZeroTh
|
|
|
|
|
EXPECT_EQ(handle, testValueGemCreate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndLocalMemoryThenProperValuesSet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndLocalMemoryThenProperValuesSet) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.EnableLocalMemory.set(1);
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
@@ -206,7 +209,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndLocalMemoryThenPro
|
|
|
|
|
EXPECT_EQ(handle, testValueGemCreate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateWithRegionsAndCoherencyThenUncachedCPUCachingIsUsed) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateWithRegionsAndCoherencyThenUncachedCPUCachingIsUsed) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.EnableLocalMemory.set(1);
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
@@ -225,7 +228,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateWithRegionsAndCohe
|
|
|
|
|
EXPECT_EQ(DRM_XE_GEM_CPU_CACHING_WC, drm->createParamsCpuCaching);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateWithOnlySystemRegionAndCoherencyThenWriteBackCPUCachingIsUsed) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateWithOnlySystemRegionAndCoherencyThenWriteBackCPUCachingIsUsed) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.EnableLocalMemory.set(0);
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
@@ -244,7 +247,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateWithOnlySystemRegi
|
|
|
|
|
EXPECT_EQ(DRM_XE_GEM_CPU_CACHING_WB, drm->createParamsCpuCaching);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallSetGemTilingThenAlwaysTrue) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallSetGemTilingThenAlwaysTrue) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -257,7 +260,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallSetGemTilingThenAlwaysTrue) {
|
|
|
|
|
EXPECT_FALSE(drm->ioctlCalled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGetGemTilingThenAlwaysTrue) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGetGemTilingThenAlwaysTrue) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -270,14 +273,14 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGetGemTilingThenAlwaysTrue) {
|
|
|
|
|
EXPECT_FALSE(drm->ioctlCalled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeisVmBindPatIndexExtSupportedReturnsFalse) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeisVmBindPatIndexExtSupportedReturnsFalse) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
|
|
|
|
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
|
|
|
|
|
ASSERT_EQ(false, xeIoctlHelper->isVmBindPatIndexExtSupported());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
|
|
|
|
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
|
|
|
|
|
@@ -448,7 +451,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
|
|
|
|
|
EXPECT_FALSE(xeIoctlHelper->getFabricLatency(fabricId, latency, bandwidth));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenGettingFlagsForVmCreateThenPropertValueIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenGettingFlagsForVmCreateThenPropertValueIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
|
|
|
|
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
|
|
|
|
|
@@ -463,7 +466,7 @@ TEST(IoctlHelperXeTest, whenGettingFlagsForVmCreateThenPropertValueIsReturned) {
|
|
|
|
|
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_VM_CREATE_FLAG_LR_MODE), xeIoctlHelper->getFlagsForVmCreate(false, false, false));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenGettingFlagsForVmBindThenPropertValueIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenGettingFlagsForVmBindThenPropertValueIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
|
|
|
|
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
|
|
|
|
|
@@ -472,7 +475,7 @@ TEST(IoctlHelperXeTest, whenGettingFlagsForVmBindThenPropertValueIsReturned) {
|
|
|
|
|
EXPECT_EQ(static_cast<uint64_t>(0), xeIoctlHelper->getFlagsForVmBind(false, false, false, false, false));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenGettingIoctlRequestValueThenPropertValueIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenGettingIoctlRequestValueThenPropertValueIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
|
|
|
|
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
|
|
|
|
|
@@ -497,7 +500,7 @@ TEST(IoctlHelperXeTest, whenGettingIoctlRequestValueThenPropertValueIsReturned)
|
|
|
|
|
verifyIoctlRequestValue(DRM_IOCTL_PRIME_HANDLE_TO_FD, DrmIoctl::primeHandleToFd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, verifyPublicFunctions) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, verifyPublicFunctions) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
|
|
|
|
@@ -571,7 +574,7 @@ TEST(IoctlHelperXeTest, verifyPublicFunctions) {
|
|
|
|
|
EXPECT_EQ(0, queryItem.length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenGettingFileNamesForFrequencyThenProperStringIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenGettingFileNamesForFrequencyThenProperStringIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto ioctlHelper = std::make_unique<IoctlHelperXe>(*drm);
|
|
|
|
|
@@ -581,7 +584,7 @@ TEST(IoctlHelperXeTest, whenGettingFileNamesForFrequencyThenProperStringIsReturn
|
|
|
|
|
EXPECT_STREQ("/device/tile1/gt2/freq0/rp0_freq", ioctlHelper->getFileForMaxMemoryFrequencyOfSubDevice(1).c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenCallingIoctlThenProperValueIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenCallingIoctlThenProperValueIsReturned) {
|
|
|
|
|
int ret;
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
@@ -732,7 +735,7 @@ TEST(IoctlHelperXeTest, whenCallingIoctlThenProperValueIsReturned) {
|
|
|
|
|
drm->reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenUnknownTopologyTypeWhenGetTopologyDataAndMapThenNotRecognizedTopologyIsIgnored) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenUnknownTopologyTypeWhenGetTopologyDataAndMapThenNotRecognizedTopologyIsIgnored) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -785,7 +788,7 @@ TEST(IoctlHelperXeTest, givenUnknownTopologyTypeWhenGetTopologyDataAndMapThenNot
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenVariousDssConfigInputsWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenVariousDssConfigInputsWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -836,7 +839,7 @@ TEST(IoctlHelperXeTest, givenVariousDssConfigInputsWhenGetTopologyDataAndMapThen
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenOnlyMediaTypeWhenGetTopologyDataAndMapThenSubsliceIndicesNotSet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenOnlyMediaTypeWhenGetTopologyDataAndMapThenSubsliceIndicesNotSet) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -884,7 +887,7 @@ TEST(IoctlHelperXeTest, givenOnlyMediaTypeWhenGetTopologyDataAndMapThenSubsliceI
|
|
|
|
|
ASSERT_EQ(0u, topologyMap[tileId].subsliceIndices.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenMainAndMediaTypesWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenMainAndMediaTypesWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -963,7 +966,7 @@ TEST(IoctlHelperXeTest, givenMainAndMediaTypesWhenGetTopologyDataAndMapThenResul
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, given2TileAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, given2TileAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1021,7 +1024,7 @@ TEST(IoctlHelperXeTest, given2TileAndComputeDssWhenGetTopologyDataAndMapThenResu
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, given2TileWithDisabledDssOn1TileAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, given2TileWithDisabledDssOn1TileAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -1089,7 +1092,7 @@ TEST(IoctlHelperXeTest, given2TileWithDisabledDssOn1TileAndComputeDssWhenGetTopo
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, given2TileWithDisabledEvenDssAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, given2TileWithDisabledEvenDssAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1152,7 +1155,7 @@ TEST(IoctlHelperXeTest, given2TileWithDisabledEvenDssAndComputeDssWhenGetTopolog
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenMissingDssGeometryOrDssComputeInTopologyWhenGetTopologyDataAndMapThenReturnFalse) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenMissingDssGeometryOrDssComputeInTopologyWhenGetTopologyDataAndMapThenReturnFalse) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1178,7 +1181,7 @@ TEST(IoctlHelperXeTest, givenMissingDssGeometryOrDssComputeInTopologyWhenGetTopo
|
|
|
|
|
EXPECT_TRUE(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenMissingEuPerDssInTopologyWhenGetTopologyDataAndMapThenSetupEuCountToZeroAndReturnTrue) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenMissingEuPerDssInTopologyWhenGetTopologyDataAndMapThenSetupEuCountToZeroAndReturnTrue) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1215,7 +1218,7 @@ TEST(IoctlHelperXeTest, givenMissingEuPerDssInTopologyWhenGetTopologyDataAndMapT
|
|
|
|
|
EXPECT_EQ(0, topologyData.maxEusPerSubSlice);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenCreatingEngineInfoThenProperEnginesAreDiscovered) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenCreatingEngineInfoThenProperEnginesAreDiscovered) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1337,7 +1340,7 @@ TEST(IoctlHelperXeTest, whenCreatingEngineInfoThenProperEnginesAreDiscovered) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenCreatingMemoryInfoThenProperMemoryBanksAreDiscovered) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenCreatingMemoryInfoThenProperMemoryBanksAreDiscovered) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.EnableLocalMemory.set(1);
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
@@ -1378,7 +1381,7 @@ TEST(IoctlHelperXeTest, whenCreatingMemoryInfoThenProperMemoryBanksAreDiscovered
|
|
|
|
|
EXPECT_EQ(2 * MemoryConstants::gigaByte - MemoryConstants::megaByte, memoryRegions[1].unallocatedSize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenXeDrmMemoryManagerWhenGetLocalMemorySizeIsCalledThenReturnMemoryRegionSizeCorrectly) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenXeDrmMemoryManagerWhenGetLocalMemorySizeIsCalledThenReturnMemoryRegionSizeCorrectly) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.EnableLocalMemory.set(1);
|
|
|
|
|
|
|
|
|
|
@@ -1417,7 +1420,7 @@ TEST(IoctlHelperXeTest, givenXeDrmMemoryManagerWhenGetLocalMemorySizeIsCalledThe
|
|
|
|
|
EXPECT_EQ(memoryManager.getLocalMemorySize(0, tileMask), lmemSizes[1]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlFailureWhenCreatingMemoryInfoThenNoMemoryBanksAreDiscovered) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlFailureWhenCreatingMemoryInfoThenNoMemoryBanksAreDiscovered) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1429,7 +1432,7 @@ TEST(IoctlHelperXeTest, givenIoctlFailureWhenCreatingMemoryInfoThenNoMemoryBanks
|
|
|
|
|
EXPECT_EQ(nullptr, memoryInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenNoMemoryRegionsWhenCreatingMemoryInfoThenMemoryInfoIsNotCreated) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenNoMemoryRegionsWhenCreatingMemoryInfoThenMemoryInfoIsNotCreated) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1442,7 +1445,7 @@ TEST(IoctlHelperXeTest, givenNoMemoryRegionsWhenCreatingMemoryInfoThenMemoryInfo
|
|
|
|
|
EXPECT_EQ(nullptr, memoryInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlFailureWhenCreatingEngineInfoThenNoEnginesAreDiscovered) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlFailureWhenCreatingEngineInfoThenNoEnginesAreDiscovered) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1454,7 +1457,7 @@ TEST(IoctlHelperXeTest, givenIoctlFailureWhenCreatingEngineInfoThenNoEnginesAreD
|
|
|
|
|
EXPECT_EQ(nullptr, engineInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenEnabledFtrMultiTileArchWhenCreatingEngineInfoThenMultiTileArchInfoIsProperlySet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenEnabledFtrMultiTileArchWhenCreatingEngineInfoThenMultiTileArchInfoIsProperlySet) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto &rootDeviceEnvironment = *executionEnvironment->rootDeviceEnvironments[0];
|
|
|
|
|
@@ -1475,7 +1478,7 @@ TEST(IoctlHelperXeTest, givenEnabledFtrMultiTileArchWhenCreatingEngineInfoThenMu
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenDisabledFtrMultiTileArchWhenCreatingEngineInfoThenMultiTileArchInfoIsNotSet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenDisabledFtrMultiTileArchWhenCreatingEngineInfoThenMultiTileArchInfoIsNotSet) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto &rootDeviceEnvironment = *executionEnvironment->rootDeviceEnvironments[0];
|
|
|
|
|
@@ -1573,7 +1576,7 @@ TEST_F(IoctlHelperXeFenceWaitTest, whenCallingVmBindThenWaitUserFenceIsCalled) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenVmBindWaitUserFenceTimeoutWhenCallingVmBindThenWaitUserFenceIsCalledWithSpecificTimeout) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenVmBindWaitUserFenceTimeoutWhenCallingVmBindThenWaitUserFenceIsCalledWithSpecificTimeout) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.VmBindWaitUserFenceTimeout.set(5000000000ll);
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
@@ -1625,7 +1628,7 @@ TEST(IoctlHelperXeTest, givenVmBindWaitUserFenceTimeoutWhenCallingVmBindThenWait
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenGemVmBindFailsThenErrorIsPropagated) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenGemVmBindFailsThenErrorIsPropagated) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1653,7 +1656,7 @@ TEST(IoctlHelperXeTest, whenGemVmBindFailsThenErrorIsPropagated) {
|
|
|
|
|
EXPECT_EQ(0u, drm->waitUserFenceInputs.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenUserFenceFailsThenErrorIsPropagated) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenUserFenceFailsThenErrorIsPropagated) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1679,7 +1682,7 @@ TEST(IoctlHelperXeTest, whenUserFenceFailsThenErrorIsPropagated) {
|
|
|
|
|
EXPECT_EQ(errorValue, xeIoctlHelper->vmUnbind(vmBindParams));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, WhenSetupIpVersionIsCalledThenIpVersionIsCorrect) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, WhenSetupIpVersionIsCalledThenIpVersionIsCorrect) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -1692,7 +1695,7 @@ TEST(IoctlHelperXeTest, WhenSetupIpVersionIsCalledThenIpVersionIsCorrect) {
|
|
|
|
|
EXPECT_EQ(config, hwInfo.ipVersion.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenXeShowBindTableIsCalledThenBindLogsArePrinted) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenXeShowBindTableIsCalledThenBindLogsArePrinted) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1717,7 +1720,7 @@ TEST(IoctlHelperXeTest, whenXeShowBindTableIsCalledThenBindLogsArePrinted) {
|
|
|
|
|
EXPECT_NE(std::string::npos, output.find(expectedOutput2, expectedOutput1.size())) << output;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlFailureWhenSetGpuCpuTimesIsCalledThenFalseIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlFailureWhenSetGpuCpuTimesIsCalledThenFalseIsReturned) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto &rootDeviceEnvironment = *executionEnvironment->rootDeviceEnvironments[0];
|
|
|
|
|
@@ -1735,7 +1738,7 @@ TEST(IoctlHelperXeTest, givenIoctlFailureWhenSetGpuCpuTimesIsCalledThenFalseIsRe
|
|
|
|
|
EXPECT_EQ(false, ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlFailureWhenSetGpuCpuTimesIsCalledThenProperValuesAreSet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlFailureWhenSetGpuCpuTimesIsCalledThenProperValuesAreSet) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto &rootDeviceEnvironment = *executionEnvironment->rootDeviceEnvironments[0];
|
|
|
|
|
@@ -1761,7 +1764,7 @@ TEST(IoctlHelperXeTest, givenIoctlFailureWhenSetGpuCpuTimesIsCalledThenProperVal
|
|
|
|
|
EXPECT_EQ(pGpuCpuTime.cpuTimeinNS, expectedTimestamp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenDeviceTimestampWidthSetThenProperValuesAreSet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenDeviceTimestampWidthSetThenProperValuesAreSet) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto &rootDeviceEnvironment = *executionEnvironment->rootDeviceEnvironments[0];
|
|
|
|
|
@@ -1790,7 +1793,7 @@ TEST(IoctlHelperXeTest, whenDeviceTimestampWidthSetThenProperValuesAreSet) {
|
|
|
|
|
EXPECT_EQ(pGpuCpuTime.gpuTimeStamp, expectedCycles);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenSetDefaultEngineIsCalledThenProperEngineIsSet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenSetDefaultEngineIsCalledThenProperEngineIsSet) {
|
|
|
|
|
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>(&hwInfo);
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1807,7 +1810,7 @@ TEST(IoctlHelperXeTest, whenSetDefaultEngineIsCalledThenProperEngineIsSet) {
|
|
|
|
|
EXPECT_THROW(xeIoctlHelper->getDefaultEngineClass(aub_stream::EngineType::ENGINE_VECS), std::exception);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenGettingPreemptionSupportThenTrueIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenGettingPreemptionSupportThenTrueIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -1815,7 +1818,7 @@ TEST(IoctlHelperXeTest, whenGettingPreemptionSupportThenTrueIsReturned) {
|
|
|
|
|
EXPECT_TRUE(xeIoctlHelper->isPreemptionSupported());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenGetCpuCachingModeCalledThenCorrectValueIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenGetCpuCachingModeCalledThenCorrectValueIsReturned) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1837,7 +1840,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenGetCpuCachingModeCalledThenCorrect
|
|
|
|
|
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(false, false), DRM_XE_GEM_CPU_CACHING_WB);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenCallingVmBindThenPatIndexIsSet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenCallingVmBindThenPatIndexIsSet) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -1865,7 +1868,7 @@ TEST(IoctlHelperXeTest, whenCallingVmBindThenPatIndexIsSet) {
|
|
|
|
|
EXPECT_EQ(drm->vmBindInputs[0].bind.pat_index, expectedPatIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenBindingDrmContextWithoutVirtualEnginesThenProperEnginesAreSelected) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenBindingDrmContextWithoutVirtualEnginesThenProperEnginesAreSelected) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -1889,7 +1892,7 @@ TEST(IoctlHelperXeTest, whenBindingDrmContextWithoutVirtualEnginesThenProperEngi
|
|
|
|
|
EXPECT_EQ(expectedGtId, ioctlHelper->contextParamEngine[0].gt_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenBindingDrmContextWithVirtualEnginesThenProperEnginesAreSelected) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenBindingDrmContextWithVirtualEnginesThenProperEnginesAreSelected) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -1923,7 +1926,7 @@ TEST(IoctlHelperXeTest, whenBindingDrmContextWithVirtualEnginesThenProperEngines
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenCallingGetResetStatsThenSuccessIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenCallingGetResetStatsThenSuccessIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -1938,7 +1941,7 @@ TEST(IoctlHelperXeTest, whenCallingGetResetStatsThenSuccessIsReturned) {
|
|
|
|
|
EXPECT_EQ(0, xeIoctlHelper->getResetStats(resetStats, nullptr, nullptr));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenCallingGetStatusAndFlagsForResetStatsThenZeroIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenCallingGetStatusAndFlagsForResetStatsThenZeroIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -1949,27 +1952,27 @@ TEST(IoctlHelperXeTest, whenCallingGetStatusAndFlagsForResetStatsThenZeroIsRetur
|
|
|
|
|
EXPECT_FALSE(ioctlHelper->validPageFault(0u));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenInitializeThenProperHwInfoIsSet) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenInitializeThenProperHwInfoIsSet) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
|
|
|
|
|
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
|
|
|
|
|
|
|
|
|
hwInfo->platform.usDeviceID = 0;
|
|
|
|
|
hwInfo->platform.usRevId = 0;
|
|
|
|
|
hwInfo->platform.usDeviceID = defaultHwInfo->platform.usDeviceID + 1;
|
|
|
|
|
hwInfo->platform.usRevId = defaultHwInfo->platform.usRevId + 1;
|
|
|
|
|
hwInfo->capabilityTable.gpuAddressSpace = 0;
|
|
|
|
|
|
|
|
|
|
ioctlHelper->initialize();
|
|
|
|
|
EXPECT_EQ(drm->revId, hwInfo->platform.usRevId);
|
|
|
|
|
EXPECT_EQ(drm->devId, hwInfo->platform.usDeviceID);
|
|
|
|
|
EXPECT_EQ(defaultHwInfo->platform.usRevId, hwInfo->platform.usRevId);
|
|
|
|
|
EXPECT_EQ(defaultHwInfo->platform.usDeviceID, hwInfo->platform.usDeviceID);
|
|
|
|
|
EXPECT_EQ((1ull << 48) - 1, hwInfo->capabilityTable.gpuAddressSpace);
|
|
|
|
|
EXPECT_EQ(static_cast<uint32_t>(DrmMockXe::mockDefaultCxlType), hwInfo->capabilityTable.cxlType);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(DrmMockXe::mockMaxExecQueuePriority, ioctlHelper->maxExecQueuePriority);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenMultipleBindInfosWhenGemCloseIsCalledThenProperHandleIsTaken) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenMultipleBindInfosWhenGemCloseIsCalledThenProperHandleIsTaken) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -2009,7 +2012,7 @@ TEST(IoctlHelperXeTest, givenMultipleBindInfosWhenGemCloseIsCalledThenProperHand
|
|
|
|
|
EXPECT_EQ(0ul, ioctlHelper->bindInfo.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenMultipleBindInfosWhenVmBindIsCalledThenProperHandleIsTaken) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenMultipleBindInfosWhenVmBindIsCalledThenProperHandleIsTaken) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -2072,7 +2075,7 @@ TEST(IoctlHelperXeTest, givenMultipleBindInfosWhenVmBindIsCalledThenProperHandle
|
|
|
|
|
ioctlHelper->bindInfo.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenLowPriorityContextWhenSettingPropertiesThenCorrectIndexIsUsedAndReturend) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenLowPriorityContextWhenSettingPropertiesThenCorrectIndexIsUsedAndReturend) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -2087,7 +2090,7 @@ TEST(IoctlHelperXeTest, givenLowPriorityContextWhenSettingPropertiesThenCorrectI
|
|
|
|
|
EXPECT_EQ(2u, extIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenLowPriorityContextWhenCreatingDrmContextThenExtPropertyIsSetCorrectly) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenLowPriorityContextWhenCreatingDrmContextThenExtPropertyIsSetCorrectly) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
|
|
|
|
|
@@ -2103,7 +2106,7 @@ TEST(IoctlHelperXeTest, givenLowPriorityContextWhenCreatingDrmContextThenExtProp
|
|
|
|
|
EXPECT_EQ(0u, drm->execQueueProperties[0].value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenInitializeThenGtListDataIsQueried) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenInitializeThenGtListDataIsQueried) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -2119,7 +2122,7 @@ TEST(IoctlHelperXeTest, whenInitializeThenGtListDataIsQueried) {
|
|
|
|
|
EXPECT_EQ(drm->queryGtList.size(), ioctlHelper->queryGtListData.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenNoGtListDataWhenInitializeThenInitializationFails) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenNoGtListDataWhenInitializeThenInitializationFails) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -2129,7 +2132,7 @@ TEST(IoctlHelperXeTest, givenNoGtListDataWhenInitializeThenInitializationFails)
|
|
|
|
|
EXPECT_FALSE(ioctlHelper->initialize());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGetFlagsForVmBindThenExpectedValueIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGetFlagsForVmBindThenExpectedValueIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
|
|
|
|
|
@@ -2154,7 +2157,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGetFlagsForVmBindThenExpect
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenGetFdFromVmExportIsCalledThenFalseIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenGetFdFromVmExportIsCalledThenFalseIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -2163,7 +2166,7 @@ TEST(IoctlHelperXeTest, whenGetFdFromVmExportIsCalledThenFalseIsReturned) {
|
|
|
|
|
EXPECT_FALSE(xeIoctlHelper->getFdFromVmExport(vmId, flags, &fd));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, whenCheckingGpuHangThenBanPropertyIsQueried) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenCheckingGpuHangThenBanPropertyIsQueried) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
|
|
|
|
|
@@ -2178,7 +2181,7 @@ TEST(IoctlHelperXeTest, whenCheckingGpuHangThenBanPropertyIsQueried) {
|
|
|
|
|
EXPECT_TRUE(osContext.isHangDetected());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeVmBindTest, givenImmediateAndReadOnlyBindFlagsSupportedWhenGettingFlagsForVmBindThenCorrectFlagsAreReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenImmediateAndReadOnlyBindFlagsSupportedWhenGettingFlagsForVmBindThenCorrectFlagsAreReturned) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -2247,7 +2250,7 @@ struct DrmMockXeVmBind : public DrmMockXe {
|
|
|
|
|
DrmMockXeVmBind(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockXe(rootDeviceEnvironment) {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeVmBindTest, whenInitializeIoctlHelperThenQueryPageFaultFlagsSupport) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenInitializeIoctlHelperThenQueryPageFaultFlagsSupport) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXeVmBind::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -2260,7 +2263,7 @@ TEST(IoctlHelperXeVmBindTest, whenInitializeIoctlHelperThenQueryPageFaultFlagsSu
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeVmBindTest, givenDeviceInFaultModeWhenInitializeIoctlHelperThenQueryFeaturesIsSuccessful) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenDeviceInFaultModeWhenInitializeIoctlHelperThenQueryFeaturesIsSuccessful) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXeVmBind::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
drm->deviceIsInFaultMode = true;
|
|
|
|
|
@@ -2356,7 +2359,7 @@ TEST_F(IoctlHelperXeHwIpVersionTests, WhenSetupIpVersionIsCalledAndIoctlReturnsN
|
|
|
|
|
EXPECT_EQ(config, hwInfo.ipVersion.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperWhenSettingExtContextThenCallExternalIoctlFunction) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperWhenSettingExtContextThenCallExternalIoctlFunction) {
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
std::unique_ptr<Drm> drm{Drm::create(std::make_unique<HwDeviceIdDrm>(0, ""), *executionEnvironment.rootDeviceEnvironments[0])};
|
|
|
|
|
IoctlHelperXe ioctlHelper{*drm};
|
|
|
|
|
@@ -2380,7 +2383,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperWhenSettingExtContextThenCallExternalIoc
|
|
|
|
|
EXPECT_TRUE(ioctlHelper.ioctl(DrmIoctl::getResetStats, &resetStats));
|
|
|
|
|
EXPECT_FALSE(ioctlCalled);
|
|
|
|
|
}
|
|
|
|
|
TEST(IoctlHelperXeTest, givenL3BankWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenL3BankWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
|
|
|
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
@@ -2405,7 +2408,7 @@ TEST(IoctlHelperXeTest, givenL3BankWhenGetTopologyDataAndMapThenResultsAreCorrec
|
|
|
|
|
EXPECT_EQ(12, topologyData.numL3Banks);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperWhenGettingFenceAddressThenReturnCorrectValue) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperWhenGettingFenceAddressThenReturnCorrectValue) {
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
std::unique_ptr<Drm> drm{Drm::create(std::make_unique<HwDeviceIdDrm>(0, ""), *executionEnvironment.rootDeviceEnvironments[0])};
|
|
|
|
|
IoctlHelperXe ioctlHelper{*drm};
|
|
|
|
|
@@ -2418,7 +2421,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperWhenGettingFenceAddressThenReturnCorrect
|
|
|
|
|
EXPECT_EQ(osContext.getFenceAddr(0), fenceAddr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlWhenQueryDeviceParamsIsCalledThenFalseIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlWhenQueryDeviceParamsIsCalledThenFalseIsReturned) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
|
|
|
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
|
|
|
|
@@ -2428,7 +2431,7 @@ TEST(IoctlHelperXeTest, givenIoctlWhenQueryDeviceParamsIsCalledThenFalseIsReturn
|
|
|
|
|
EXPECT_FALSE(xeIoctlHelper->queryDeviceParams(&moduleId, &serverType));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingSetVmPrefetchThenVmBindIsCalled) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingSetVmPrefetchThenVmBindIsCalled) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.EnableLocalMemory.set(1);
|
|
|
|
|
|
|
|
|
|
@@ -2456,7 +2459,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingSetVmPrefetchThenVmBindIsCa
|
|
|
|
|
EXPECT_EQ(drm->vmBindInputs[0].bind.prefetch_mem_region_instance, targetMemoryRegion.memoryInstance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingSetVmPrefetchOnSecondTileThenVmBindIsCalled) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingSetVmPrefetchOnSecondTileThenVmBindIsCalled) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.EnableLocalMemory.set(1);
|
|
|
|
|
|
|
|
|
|
@@ -2484,7 +2487,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingSetVmPrefetchOnSecondTileTh
|
|
|
|
|
EXPECT_EQ(drm->vmBindInputs[0].bind.prefetch_mem_region_instance, targetMemoryRegion.memoryInstance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenIoctlFailureWhenCallingSetVmPrefetchThenFalseIsReturned) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenIoctlFailureWhenCallingSetVmPrefetchThenFalseIsReturned) {
|
|
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
debugManager.flags.EnableLocalMemory.set(1);
|
|
|
|
|
|
|
|
|
|
@@ -2502,9 +2505,91 @@ TEST(IoctlHelperXeTest, givenIoctlFailureWhenCallingSetVmPrefetchThenFalseIsRetu
|
|
|
|
|
EXPECT_EQ(0u, drm->vmBindInputs.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(IoctlHelperXeTest, givenXeIoctlHelperWhenIsTimestampsRefreshEnabledCalledThenReturnTrue) {
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenXeIoctlHelperWhenIsTimestampsRefreshEnabledCalledThenReturnTrue) {
|
|
|
|
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
|
|
|
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
|
|
|
|
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
|
|
|
|
|
EXPECT_TRUE(xeIoctlHelper->isTimestampsRefreshEnabled());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenIoctlFailsOnQueryConfigSizeThenQueryDeviceIdAndRevisionFails) {
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
std::unique_ptr<Drm> drm{Drm::create(std::make_unique<HwDeviceIdDrm>(0, ""), *executionEnvironment.rootDeviceEnvironments[0])};
|
|
|
|
|
|
|
|
|
|
mockIoctl = [](int fileDescriptor, unsigned long int request, void *arg) -> int {
|
|
|
|
|
return -1;
|
|
|
|
|
};
|
|
|
|
|
EXPECT_FALSE(IoctlHelperXe::queryDeviceIdAndRevision(*drm));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(IoctlHelperXeTest, givenZeroConfigSizeWhenQueryDeviceIdAndRevisionThenFail) {
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
std::unique_ptr<Drm> drm{Drm::create(std::make_unique<HwDeviceIdDrm>(0, ""), *executionEnvironment.rootDeviceEnvironments[0])};
|
|
|
|
|
|
|
|
|
|
mockIoctl = [](int fileDescriptor, unsigned long int request, void *arg) -> int {
|
|
|
|
|
if (request == DRM_IOCTL_XE_DEVICE_QUERY) {
|
|
|
|
|
struct drm_xe_device_query *deviceQuery = static_cast<struct drm_xe_device_query *>(arg);
|
|
|
|
|
if (deviceQuery->query == DRM_XE_DEVICE_QUERY_CONFIG) {
|
|
|
|
|
deviceQuery->size = 0;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
};
|
|
|
|
|
EXPECT_FALSE(IoctlHelperXe::queryDeviceIdAndRevision(*drm));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenIoctlFailsOnQueryConfigThenQueryDeviceIdAndRevisionFails) {
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
std::unique_ptr<Drm> drm{Drm::create(std::make_unique<HwDeviceIdDrm>(0, ""), *executionEnvironment.rootDeviceEnvironments[0])};
|
|
|
|
|
|
|
|
|
|
mockIoctl = [](int fileDescriptor, unsigned long int request, void *arg) -> int {
|
|
|
|
|
if (request == DRM_IOCTL_XE_DEVICE_QUERY) {
|
|
|
|
|
struct drm_xe_device_query *deviceQuery = static_cast<struct drm_xe_device_query *>(arg);
|
|
|
|
|
if (deviceQuery->query == DRM_XE_DEVICE_QUERY_CONFIG) {
|
|
|
|
|
if (deviceQuery->data) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
deviceQuery->size = 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
};
|
|
|
|
|
EXPECT_FALSE(IoctlHelperXe::queryDeviceIdAndRevision(*drm));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(IoctlHelperXeTest, whenQueryDeviceIdAndRevisionThenProperValuesAreSet) {
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
std::unique_ptr<Drm> drm{Drm::create(std::make_unique<HwDeviceIdDrm>(0, ""), *executionEnvironment.rootDeviceEnvironments[0])};
|
|
|
|
|
|
|
|
|
|
auto hwInfo = drm->getRootDeviceEnvironment().getMutableHardwareInfo();
|
|
|
|
|
|
|
|
|
|
static constexpr uint16_t mockDeviceId = 0x1234;
|
|
|
|
|
static constexpr uint16_t mockRevisionId = 0xB;
|
|
|
|
|
|
|
|
|
|
hwInfo->platform.usDeviceID = 0;
|
|
|
|
|
hwInfo->platform.usRevId = 0;
|
|
|
|
|
|
|
|
|
|
mockIoctl = [](int fileDescriptor, unsigned long int request, void *arg) -> int {
|
|
|
|
|
if (request == DRM_IOCTL_XE_DEVICE_QUERY) {
|
|
|
|
|
struct drm_xe_device_query *deviceQuery = static_cast<struct drm_xe_device_query *>(arg);
|
|
|
|
|
if (deviceQuery->query == DRM_XE_DEVICE_QUERY_CONFIG) {
|
|
|
|
|
if (deviceQuery->data) {
|
|
|
|
|
struct drm_xe_query_config *config = reinterpret_cast<struct drm_xe_query_config *>(deviceQuery->data);
|
|
|
|
|
config->num_params = DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID + 1;
|
|
|
|
|
config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] = (static_cast<uint32_t>(mockRevisionId) << 16) | mockDeviceId;
|
|
|
|
|
} else {
|
|
|
|
|
deviceQuery->size = (DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID + 1) * sizeof(uint64_t);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
};
|
|
|
|
|
EXPECT_TRUE(IoctlHelperXe::queryDeviceIdAndRevision(*drm));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mockDeviceId, hwInfo->platform.usDeviceID);
|
|
|
|
|
EXPECT_EQ(mockRevisionId, hwInfo->platform.usRevId);
|
|
|
|
|
}
|
|
|
|
|
|