9
9
#include " shared/source/gen12lp/hw_cmds_dg1.h"
10
10
#include " shared/source/os_interface/hw_info_config.h"
11
11
#include " shared/source/os_interface/os_interface.h"
12
- #include " shared/test/common/helpers/hw_helper_tests.h"
12
+ #include " shared/test/common/helpers/default_hw_info.h"
13
+ #include " shared/test/common/helpers/gtest_helpers.h"
13
14
#include " shared/test/common/test_macros/header/per_product_test_definitions.h"
14
15
#include " shared/test/common/test_macros/test.h"
16
+ #include " shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
15
17
16
- using HwHelperTestGen12Lp = HwHelperTest;
18
+ using HwInfoConfigTestLinuxDg1 = ::testing::Test;
19
+ using namespace NEO ;
17
20
18
- DG1TEST_F (HwHelperTestGen12Lp, GivenDG1WhenConfigureHardwareCustomThenMTPIsNotSet) {
21
+ DG1TEST_F (HwInfoConfigTestLinuxDg1, GivenDG1WhenConfigureHardwareCustomThenMTPIsNotSet) {
22
+ HardwareInfo hardwareInfo = *defaultHwInfo;
19
23
HwInfoConfig *hwInfoConfig = HwInfoConfig::get (hardwareInfo.platform .eProductFamily );
20
24
21
25
OSInterface osIface;
@@ -26,11 +30,74 @@ DG1TEST_F(HwHelperTestGen12Lp, GivenDG1WhenConfigureHardwareCustomThenMTPIsNotSe
26
30
EXPECT_FALSE (hardwareInfo.featureTable .flags .ftrGpGpuMidThreadLevelPreempt );
27
31
}
28
32
29
- DG1TEST_F (HwHelperTestGen12Lp, GivenDG1WhenConfigureHardwareCustomThenKmdNotifyIsEnabled) {
33
+ DG1TEST_F (HwInfoConfigTestLinuxDg1, GivenDG1WhenConfigureHardwareCustomThenKmdNotifyIsEnabled) {
34
+ HardwareInfo hardwareInfo = *defaultHwInfo;
30
35
HwInfoConfig *hwInfoConfig = HwInfoConfig::get (hardwareInfo.platform .eProductFamily );
31
36
32
37
OSInterface osIface;
33
38
hwInfoConfig->configureHardwareCustom (&hardwareInfo, &osIface);
34
39
EXPECT_TRUE (hardwareInfo.capabilityTable .kmdNotifyProperties .enableKmdNotify );
35
40
EXPECT_EQ (300ll , hardwareInfo.capabilityTable .kmdNotifyProperties .delayKmdNotifyMicroseconds );
36
41
}
42
+
43
+ struct HwInfoConfigTestsLinuxDg1 : HwInfoConfigTestLinux {
44
+ void SetUp () override {
45
+ HwInfoConfigTestLinux::SetUp ();
46
+
47
+ drm = new DrmMock (*executionEnvironment->rootDeviceEnvironments [0 ]);
48
+ osInterface->setDriverModel (std::unique_ptr<DriverModel>(drm));
49
+ }
50
+ };
51
+
52
+ DG1TEST_F (HwInfoConfigTestsLinuxDg1, WhenConfiguringHwInfoThenInfoIsSetCorrectly) {
53
+ auto hwInfoConfig = HwInfoConfig::get (productFamily);
54
+ int ret = hwInfoConfig->configureHwInfoDrm (&pInHwInfo, &outHwInfo, osInterface);
55
+ EXPECT_EQ (0 , ret);
56
+ EXPECT_EQ (static_cast <uint32_t >(drm->storedEUVal ), outHwInfo.gtSystemInfo .EUCount );
57
+ EXPECT_EQ (static_cast <uint32_t >(drm->storedSSVal ), outHwInfo.gtSystemInfo .SubSliceCount );
58
+ EXPECT_EQ (1u , outHwInfo.gtSystemInfo .SliceCount );
59
+
60
+ EXPECT_FALSE (outHwInfo.featureTable .flags .ftrTileY );
61
+ }
62
+
63
+ DG1TEST_F (HwInfoConfigTestsLinuxDg1, GivenInvalidDeviceIdWhenConfiguringHwInfoThenErrorIsReturned) {
64
+ auto hwInfoConfig = HwInfoConfig::get (productFamily);
65
+
66
+ drm->failRetTopology = true ;
67
+ drm->storedRetValForEUVal = -1 ;
68
+ auto ret = hwInfoConfig->configureHwInfoDrm (&pInHwInfo, &outHwInfo, osInterface);
69
+ EXPECT_EQ (-1 , ret);
70
+
71
+ drm->storedRetValForEUVal = 0 ;
72
+ drm->storedRetValForSSVal = -1 ;
73
+ ret = hwInfoConfig->configureHwInfoDrm (&pInHwInfo, &outHwInfo, osInterface);
74
+ EXPECT_EQ (-1 , ret);
75
+ }
76
+
77
+ template <typename T>
78
+ class Dg1HwInfoTests : public ::testing::Test {};
79
+ using dg1TestTypes = ::testing::Types<Dg1HwConfig>;
80
+ TYPED_TEST_CASE (Dg1HwInfoTests, dg1TestTypes);
81
+ TYPED_TEST (Dg1HwInfoTests, WhenGtIsSetupThenGtSystemInfoIsCorrect) {
82
+ auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
83
+ executionEnvironment->prepareRootDeviceEnvironments (1 );
84
+ executionEnvironment->rootDeviceEnvironments [0 ]->setHwInfo (defaultHwInfo.get ());
85
+ executionEnvironment->rootDeviceEnvironments [0 ]->initGmm ();
86
+
87
+ DrmMock drm (*executionEnvironment->rootDeviceEnvironments [0 ]);
88
+ DeviceDescriptor device = {0 , &TypeParam::hwInfo, &TypeParam::setupHardwareInfo};
89
+ const auto >SystemInfo = executionEnvironment->rootDeviceEnvironments [0 ]->getHardwareInfo ()->gtSystemInfo ;
90
+
91
+ int ret = drm.setupHardwareInfo (&device, false );
92
+
93
+ EXPECT_EQ (ret, 0 );
94
+ EXPECT_GT (gtSystemInfo.EUCount , 0u );
95
+ EXPECT_GT (gtSystemInfo.ThreadCount , 0u );
96
+ EXPECT_GT (gtSystemInfo.SliceCount , 0u );
97
+ EXPECT_GT (gtSystemInfo.SubSliceCount , 0u );
98
+ EXPECT_GT_VAL (gtSystemInfo.L3CacheSizeInKb , 0u );
99
+ EXPECT_EQ (gtSystemInfo.CsrSizeInMb , 8u );
100
+ EXPECT_FALSE (gtSystemInfo.IsDynamicallyPopulated );
101
+ EXPECT_GT (gtSystemInfo.DualSubSliceCount , 0u );
102
+ EXPECT_GT (gtSystemInfo.MaxDualSubSlicesSupported , 0u );
103
+ }
0 commit comments