1 /*
2  * Copyright (C) 2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #include "shared/source/os_interface/os_interface.h"
9 #include "shared/test/common/helpers/default_hw_info.h"
10 #include "shared/test/common/libult/linux/drm_mock.h"
11 
12 #include "opencl/test/unit_test/helpers/gtest_helpers.h"
13 #include "opencl/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
14 
15 using namespace NEO;
16 
17 struct HwInfoConfigTestLinuxXeHp : HwInfoConfigTestLinux {
SetUpHwInfoConfigTestLinuxXeHp18     void SetUp() override {
19         HwInfoConfigTestLinux::SetUp();
20 
21         drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
22         osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
23 
24         drm->storedDeviceID = 0x0201;
25         drm->setGtType(GTTYPE_GT4);
26     }
27 };
28 
XEHPTEST_F(HwInfoConfigTestLinuxXeHp,WhenConfiguringHwInfoThenZeroIsReturned)29 XEHPTEST_F(HwInfoConfigTestLinuxXeHp, WhenConfiguringHwInfoThenZeroIsReturned) {
30     auto hwInfoConfig = HwInfoConfig::get(productFamily);
31     int ret = hwInfoConfig->configureHwInfoDrm(&pInHwInfo, &outHwInfo, osInterface);
32     EXPECT_EQ(0, ret);
33 }
34 
XEHPTEST_F(HwInfoConfigTestLinuxXeHp,GivenXeHpSdvWhenConfigureHardwareCustomThenKmdNotifyIsEnabled)35 XEHPTEST_F(HwInfoConfigTestLinuxXeHp, GivenXeHpSdvWhenConfigureHardwareCustomThenKmdNotifyIsEnabled) {
36     HwInfoConfig *hwInfoConfig = HwInfoConfig::get(productFamily);
37 
38     hwInfoConfig->configureHardwareCustom(&pInHwInfo, osInterface);
39     EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify);
40     EXPECT_EQ(150ll, pInHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
41     EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForDirectSubmission);
42     EXPECT_EQ(20ll, pInHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForDirectSubmissionMicroseconds);
43 }
44