mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
fix: Implement debug area read in Xe by reusing I915 logic
Related-To: NEO-11197 Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2473c38e31
commit
8a60257aac
@@ -360,7 +360,7 @@ TEST(DebugSessionLinuxi915Test, GivenRootDebugSessionWhenCreateTileSessionCalled
|
||||
auto session = std::make_unique<DebugSession>(zet_debug_config_t{0x1234}, &deviceImp, 10, nullptr);
|
||||
ASSERT_NE(nullptr, session);
|
||||
|
||||
std::unique_ptr<TileDebugSessionLinuxi915> tileSession = std::unique_ptr<TileDebugSessionLinuxi915>{session->createTileSession(zet_debug_config_t{0x1234}, &deviceImp, nullptr)};
|
||||
std::unique_ptr<DebugSessionImp> tileSession = std::unique_ptr<DebugSessionImp>{session->createTileSession(zet_debug_config_t{0x1234}, &deviceImp, nullptr)};
|
||||
EXPECT_NE(nullptr, tileSession);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ struct MockDebugSessionLinuxXe : public L0::DebugSessionLinuxXe {
|
||||
using L0::DebugSessionLinuxXe::ClientConnectionXe;
|
||||
using L0::DebugSessionLinuxXe::clientHandleClosed;
|
||||
using L0::DebugSessionLinuxXe::clientHandleToConnection;
|
||||
using L0::DebugSessionLinuxXe::debugArea;
|
||||
using L0::DebugSessionLinuxXe::euControlInterruptSeqno;
|
||||
using L0::DebugSessionLinuxXe::getThreadStateMutexForTileSession;
|
||||
using L0::DebugSessionLinuxXe::getVmHandleFromClientAndlrcHandle;
|
||||
|
||||
@@ -303,7 +303,7 @@ TEST_F(DebugApiLinuxTestXe, GivenDebugSessionWhenPollReturnsZeroThenNotReadyIsRe
|
||||
EXPECT_EQ(ZE_RESULT_NOT_READY, result);
|
||||
}
|
||||
|
||||
TEST_F(DebugApiLinuxTestXe, GivenDebugSessionInitializedThenInternalEventsThreadStarted) {
|
||||
TEST_F(DebugApiLinuxTestXe, GivenDebugSessionInitializationWhenNoValidEventsAreReadThenResultNotReadyIsReturned) {
|
||||
zet_debug_config_t config = {};
|
||||
config.pid = 0x1234;
|
||||
|
||||
@@ -324,8 +324,7 @@ TEST_F(DebugApiLinuxTestXe, GivenDebugSessionInitializedThenInternalEventsThread
|
||||
handler->pollRetVal = 1;
|
||||
|
||||
ze_result_t result = session->initialize();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_TRUE(session->internalEventThread.threadActive);
|
||||
EXPECT_EQ(ZE_RESULT_NOT_READY, result);
|
||||
}
|
||||
|
||||
TEST_F(DebugApiLinuxTestXe, GivenPollReturnsErrorAndEinvalWhenReadingInternalEventsAsyncThenDetachEventIsGenerated) {
|
||||
@@ -2219,5 +2218,62 @@ TEST_F(DebugApiLinuxTestXe, GivenInterruptedThreadsWhenNoAttentionEventIsReadThe
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DebugApiLinuxTestXe, GivenBindInfoForVmHandleWhenReadingModuleDebugAreaThenGpuMemoryIsRead) {
|
||||
auto session = std::make_unique<MockDebugSessionLinuxXe>(zet_debug_config_t{0x1234}, device, 10);
|
||||
ASSERT_NE(nullptr, session);
|
||||
|
||||
auto handler = new MockIoctlHandlerXe;
|
||||
session->ioctlHandler.reset(handler);
|
||||
session->clientHandle = MockDebugSessionLinuxXe::mockClientHandle;
|
||||
|
||||
uint64_t vmHandle = 6;
|
||||
session->clientHandleToConnection[MockDebugSessionLinuxXe::mockClientHandle]->vmToModuleDebugAreaBindInfo[vmHandle] = {0x1234000, 0x1000};
|
||||
|
||||
DebugAreaHeader debugArea;
|
||||
debugArea.reserved1 = 1;
|
||||
debugArea.pgsize = uint8_t(4);
|
||||
debugArea.version = 1;
|
||||
|
||||
handler->mmapRet = reinterpret_cast<char *>(&debugArea);
|
||||
handler->setPreadMemory(reinterpret_cast<char *>(&debugArea), sizeof(session->debugArea), 0x1234000);
|
||||
handler->preadRetVal = sizeof(session->debugArea);
|
||||
|
||||
auto retVal = session->readModuleDebugArea();
|
||||
|
||||
EXPECT_TRUE(retVal);
|
||||
|
||||
if (debugManager.flags.EnableDebuggerMmapMemoryAccess.get()) {
|
||||
EXPECT_EQ(1, handler->mmapCalled);
|
||||
EXPECT_EQ(1, handler->munmapCalled);
|
||||
} else {
|
||||
EXPECT_EQ(1, handler->preadCalled);
|
||||
}
|
||||
EXPECT_EQ(MockDebugSessionLinuxXe::mockClientHandle, handler->vmOpen.client_handle);
|
||||
EXPECT_EQ(vmHandle, handler->vmOpen.vm_handle);
|
||||
EXPECT_EQ(static_cast<uint64_t>(0), handler->vmOpen.flags);
|
||||
|
||||
EXPECT_EQ(1u, session->debugArea.reserved1);
|
||||
EXPECT_EQ(1u, session->debugArea.version);
|
||||
EXPECT_EQ(4u, session->debugArea.pgsize);
|
||||
}
|
||||
|
||||
TEST(DebugSessionLinuxXeTest, GivenRootDebugSessionWhenCreateTileSessionCalledThenSessionIsNotCreated) {
|
||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||
NEO::MockDevice *neoDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
auto mockDrm = new DrmQueryMock(*neoDevice->executionEnvironment->rootDeviceEnvironments[0]);
|
||||
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new NEO::OSInterface);
|
||||
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mockDrm));
|
||||
MockDeviceImp deviceImp(neoDevice, neoDevice->getExecutionEnvironment());
|
||||
struct DebugSession : public DebugSessionLinuxXe {
|
||||
using DebugSessionLinuxXe::createTileSession;
|
||||
using DebugSessionLinuxXe::DebugSessionLinuxXe;
|
||||
};
|
||||
auto session = std::make_unique<DebugSession>(zet_debug_config_t{0x1234}, &deviceImp, 10, nullptr);
|
||||
ASSERT_NE(nullptr, session);
|
||||
|
||||
std::unique_ptr<DebugSessionImp> tileSession = std::unique_ptr<DebugSessionImp>{session->createTileSession(zet_debug_config_t{0x1234}, &deviceImp, nullptr)};
|
||||
EXPECT_EQ(nullptr, tileSession);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user