mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 05:24:02 +08:00
fix: create eudebug interface at initialize of ioctl helper
Related-To: NEO-13511 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
31f0eef4be
commit
53d255063c
@@ -130,6 +130,7 @@ IoctlHelperXe::IoctlHelperXe(Drm &drmArg) : IoctlHelper(drmArg) {
|
||||
bool IoctlHelperXe::initialize() {
|
||||
xeLog("IoctlHelperXe::initialize\n", "");
|
||||
|
||||
euDebugInterface = EuDebugInterface::create(drm.getSysFsPciPath());
|
||||
drm_xe_device_query queryConfig = {};
|
||||
queryConfig.query = DRM_XE_DEVICE_QUERY_CONFIG;
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ int IoctlHelperXe::getEudebugExtProperty() {
|
||||
}
|
||||
|
||||
int IoctlHelperXe::getEuDebugSysFsEnable() {
|
||||
euDebugInterface = EuDebugInterface::create(drm.getSysFsPciPath());
|
||||
return euDebugInterface != nullptr ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ using namespace NEO;
|
||||
|
||||
struct MockIoctlHelperXeDebug : IoctlHelperXe {
|
||||
using IoctlHelperXe::bindInfo;
|
||||
using IoctlHelperXe::euDebugInterface;
|
||||
using IoctlHelperXe::getEudebugExtProperty;
|
||||
using IoctlHelperXe::IoctlHelperXe;
|
||||
using IoctlHelperXe::tileIdToGtId;
|
||||
@@ -56,6 +57,7 @@ struct DrmMockXeDebug : public DrmMockCustom {
|
||||
drm->reset();
|
||||
|
||||
drm->ioctlHelper = std::make_unique<IoctlHelperXe>(*drm);
|
||||
drm->ioctlHelper->initialize();
|
||||
EXPECT_EQ(1, drm->ioctlHelper->getEuDebugSysFsEnable());
|
||||
auto xeQueryEngines = reinterpret_cast<drm_xe_query_engines *>(drm->queryEngines);
|
||||
xeQueryEngines->num_engines = 11;
|
||||
|
||||
@@ -169,35 +169,41 @@ TEST(IoctlHelperXeTest, GivenXeDriverThenDebugAttachReturnsTrue) {
|
||||
EXPECT_TRUE(xeIoctlHelper->isDebugAttachAvailable());
|
||||
}
|
||||
|
||||
TEST(IoctlHelperXeTest, givenXeEnableEuDebugThenReturnCorrectValue) {
|
||||
TEST(IoctlHelperXeTest, givenEuDebugSysFsContentWhenItIsZeroThenEuDebugInterfaceIsNotCreated) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
|
||||
VariableBackup<char> euDebugAvailabilityBackup(&MockEuDebugInterface::sysFsContent);
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto xeIoctlHelper = static_cast<MockIoctlHelperXeDebug *>(drm->ioctlHelper.get());
|
||||
|
||||
MockEuDebugInterface::sysFsContent = '1';
|
||||
int enableEuDebug = xeIoctlHelper->getEuDebugSysFsEnable();
|
||||
EXPECT_EQ(1, enableEuDebug);
|
||||
auto euDebugInterface = EuDebugInterface::create(drm->getSysFsPciPath());
|
||||
EXPECT_NE(nullptr, euDebugInterface);
|
||||
|
||||
MockEuDebugInterface::sysFsContent = '0';
|
||||
enableEuDebug = xeIoctlHelper->getEuDebugSysFsEnable();
|
||||
EXPECT_EQ(0, enableEuDebug);
|
||||
euDebugInterface = EuDebugInterface::create(drm->getSysFsPciPath());
|
||||
EXPECT_EQ(nullptr, euDebugInterface);
|
||||
}
|
||||
|
||||
TEST(IoctlHelperXeTest, givenXeEnableEuDebugWithInvalidPathThenReturnCorrectValue) {
|
||||
|
||||
TEST(IoctlHelperXeTest, givenInvalidPathWhenCreateEuDebugInterfaceThenReturnNullptr) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto xeIoctlHelper = static_cast<MockIoctlHelperXeDebug *>(drm->ioctlHelper.get());
|
||||
|
||||
VariableBackup<size_t> mockFreadReturnBackup(&IoFunctions::mockFreadReturn, 0);
|
||||
VariableBackup<const char *> eudebugSysFsEntryBackup(&eudebugSysfsEntry[static_cast<uint32_t>(MockEuDebugInterface::euDebugInterfaceType)], "invalidEntry");
|
||||
|
||||
int enableEuDebug = xeIoctlHelper->getEuDebugSysFsEnable();
|
||||
auto euDebugInterface = EuDebugInterface::create(drm->getSysFsPciPath());
|
||||
EXPECT_EQ(nullptr, euDebugInterface);
|
||||
}
|
||||
|
||||
EXPECT_EQ(0, enableEuDebug);
|
||||
TEST(IoctlHelperXeTest, whenEuDebugInterfaceIsCreatedThenEuDebugIsAvailable) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto xeIoctlHelper = static_cast<MockIoctlHelperXeDebug *>(drm->ioctlHelper.get());
|
||||
|
||||
xeIoctlHelper->euDebugInterface.reset();
|
||||
EXPECT_EQ(0, xeIoctlHelper->getEuDebugSysFsEnable());
|
||||
xeIoctlHelper->euDebugInterface = std::make_unique<MockEuDebugInterface>();
|
||||
EXPECT_EQ(1, xeIoctlHelper->getEuDebugSysFsEnable());
|
||||
}
|
||||
|
||||
TEST(IoctlHelperXeTest, givenXeRegisterResourceThenCorrectIoctlCalled) {
|
||||
|
||||
Reference in New Issue
Block a user