mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
L0Debug refactor - check single thread is stopped accessing regs
- enhance register access tests - remove not used param from resume wa function Related-To: NEO-5784 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5899fc6bfb
commit
ae0e701f6f
@@ -1005,7 +1005,9 @@ ze_result_t DebugSessionImp::registersAccessHelper(const EuThread *thread, const
|
||||
}
|
||||
|
||||
ze_result_t DebugSessionImp::readRegisters(ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void *pRegisterValues) {
|
||||
if (!areRequestedThreadsStopped(thread)) {
|
||||
auto threadId = convertToThreadId(thread);
|
||||
|
||||
if (!allThreads[threadId]->isStopped()) {
|
||||
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
@@ -1015,10 +1017,10 @@ ze_result_t DebugSessionImp::readRegisters(ze_device_thread_t thread, uint32_t t
|
||||
}
|
||||
|
||||
if (type == ZET_DEBUG_REGSET_TYPE_SBA_INTEL_GPU) {
|
||||
return readSbaRegisters(convertToThreadId(thread), start, count, pRegisterValues);
|
||||
return readSbaRegisters(threadId, start, count, pRegisterValues);
|
||||
}
|
||||
|
||||
return readRegistersImp(convertToThreadId(thread), type, start, count, pRegisterValues);
|
||||
return readRegistersImp(threadId, type, start, count, pRegisterValues);
|
||||
}
|
||||
|
||||
ze_result_t DebugSessionImp::readRegistersImp(EuThread::ThreadId threadId, uint32_t type, uint32_t start, uint32_t count, void *pRegisterValues) {
|
||||
@@ -1031,7 +1033,9 @@ ze_result_t DebugSessionImp::readRegistersImp(EuThread::ThreadId threadId, uint3
|
||||
}
|
||||
|
||||
ze_result_t DebugSessionImp::writeRegisters(ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void *pRegisterValues) {
|
||||
if (!areRequestedThreadsStopped(thread)) {
|
||||
auto threadId = convertToThreadId(thread);
|
||||
|
||||
if (!allThreads[threadId]->isStopped()) {
|
||||
return ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
@@ -1040,7 +1044,7 @@ ze_result_t DebugSessionImp::writeRegisters(ze_device_thread_t thread, uint32_t
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
return writeRegistersImp(convertToThreadId(thread), type, start, count, pRegisterValues);
|
||||
return writeRegistersImp(threadId, type, start, count, pRegisterValues);
|
||||
}
|
||||
|
||||
ze_result_t DebugSessionImp::writeRegistersImp(EuThread::ThreadId threadId, uint32_t type, uint32_t start, uint32_t count, void *pRegisterValues) {
|
||||
|
||||
@@ -1136,7 +1136,7 @@ int DebugSessionLinux::threadControl(std::vector<ze_device_thread_t> threads, ui
|
||||
}
|
||||
|
||||
if (command == PRELIM_I915_DEBUG_EU_THREADS_CMD_RESUME) {
|
||||
applyResumeWa(threads, bitmask.get(), bitmaskSize);
|
||||
applyResumeWa(bitmask.get(), bitmaskSize);
|
||||
}
|
||||
|
||||
printBitmask(bitmask.get(), bitmaskSize);
|
||||
@@ -1475,7 +1475,7 @@ uint64_t DebugSessionLinux::getContextStateSaveAreaGpuVa(uint64_t memoryHandle)
|
||||
return bindInfo->second.gpuVa;
|
||||
}
|
||||
|
||||
void DebugSessionLinux::applyResumeWa(std::vector<ze_device_thread_t> threads, uint8_t *bitmask, size_t bitmaskSize) {
|
||||
void DebugSessionLinux::applyResumeWa(uint8_t *bitmask, size_t bitmaskSize) {
|
||||
|
||||
UNRECOVERABLE_IF(bitmaskSize % 8 != 0);
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ struct DebugSessionLinux : DebugSessionImp {
|
||||
ze_result_t readSbaBuffer(EuThread::ThreadId, NEO::SbaTrackedAddresses &sbaBuffer) override;
|
||||
void readStateSaveAreaHeader() override;
|
||||
|
||||
void applyResumeWa(std::vector<ze_device_thread_t> threads, uint8_t *bitmask, size_t bitmaskSize);
|
||||
void applyResumeWa(uint8_t *bitmask, size_t bitmaskSize);
|
||||
|
||||
ze_result_t readGpuMemory(uint64_t vmHandle, char *output, size_t size, uint64_t gpuVa) override;
|
||||
ze_result_t writeGpuMemory(uint64_t vmHandle, const char *input, size_t size, uint64_t gpuVa) override;
|
||||
|
||||
@@ -1669,6 +1669,8 @@ struct DebugSessionRegistersAccess {
|
||||
deviceImp = std::make_unique<Mock<L0::DeviceImp>>(neoDevice, neoDevice->getExecutionEnvironment());
|
||||
|
||||
session = std::make_unique<MockDebugSession>(config, deviceImp.get());
|
||||
|
||||
session->allThreads[stoppedThreadId]->stopThread(1u);
|
||||
}
|
||||
|
||||
void TearDown() { // NOLINT(readability-identifier-naming)
|
||||
@@ -1692,6 +1694,8 @@ struct DebugSessionRegistersAccess {
|
||||
session->writeGpuMemory(0, reinterpret_cast<char *>(&srMagic), sizeof(srMagic), reinterpret_cast<uint64_t>(pStateSaveAreaHeader) + srMagicOffset);
|
||||
}
|
||||
}
|
||||
ze_device_thread_t stoppedThread = {0, 0, 0, 0};
|
||||
EuThread::ThreadId stoppedThreadId{0, stoppedThread};
|
||||
std::unique_ptr<MockDebugSession> session;
|
||||
std::unique_ptr<Mock<L0::DeviceImp>> deviceImp;
|
||||
NEO::MockDevice *neoDevice = nullptr;
|
||||
@@ -1734,80 +1738,80 @@ TEST_F(DebugSessionRegistersAccessTest, givenInvalidRegisterWhenGettingSizeThenZ
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenUnsupportedRegisterTypeWhenReadRegistersCalledThenErrorInvalidArgumentIsReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), {0, 0, 0, 0}, 0x12345, 0, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), stoppedThread, 0x12345, 0, 1, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenUnsupportedRegisterTypeWhenWriteRegistersCalledThenErrorInvalidArgumentIsReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, 0x12345, 0, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), stoppedThread, 0x12345, 0, 1, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenInvalidRegistersIndicesWhenReadRegistersCalledThenErrorInvalidArgumentIsReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 128, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 127, 2, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 128, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 127, 2, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenInvalidRegistersIndicesWheniWriteRegistersCalledThenErrorInvalidArgumentIsReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 128, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 127, 2, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 128, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 127, 2, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenNotReportedRegisterSetAndValidRegisterIndicesWhenReadRegistersCalledThenErrorInvalidArgumentIsReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
// MME is not present
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_MME_INTEL_GPU, 0, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_MME_INTEL_GPU, 0, 1, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenNotReportedRegisterSetAndValidRegisterIndicesWhenWriteRegistersCalledThenErrorInvalidArgumentIsReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
// MME is not present
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_MME_INTEL_GPU, 0, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_MME_INTEL_GPU, 0, 1, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenInvalidSbaRegistersIndicesWhenReadSbaRegistersCalledThenErrorInvalidArgumentIsReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_SBA_INTEL_GPU, 9, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_SBA_INTEL_GPU, 8, 2, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_SBA_INTEL_GPU, 9, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugReadRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_SBA_INTEL_GPU, 8, 2, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenWriteSbaRegistersCalledThenErrorInvalidArgumentIsReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
session->stateSaveAreaHeader = MockSipData::createStateSaveAreaHeader(2);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_SBA_INTEL_GPU, 0, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_SBA_INTEL_GPU, 0, 1, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenNoneThreadsStoppedWhenReadRegistersCalledThenErrorNotAvailableReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 0;
|
||||
|
||||
session->allThreads[stoppedThreadId]->resumeThread();
|
||||
char grf[32] = {0};
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, zetDebugReadRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, grf));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, zetDebugReadRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, grf));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenNoneThreadsStoppedWhenWriteRegistersCalledThenErrorNotAvailableReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 0;
|
||||
|
||||
session->allThreads[stoppedThreadId]->resumeThread();
|
||||
char grf[32] = {0};
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, grf));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, grf));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenNoStateSaveAreaWhenReadRegistersCalledThenErrorUnknownReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
char grf[32] = {0};
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zetDebugReadRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, grf));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zetDebugReadRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, grf));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenNoStateSaveAreaWhenWriteRegistersCalledThenErrorUnknownReturned) {
|
||||
session->areRequestedThreadsStoppedReturnValue = 1;
|
||||
char grf[32] = {0};
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, grf));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, grf));
|
||||
}
|
||||
|
||||
TEST_F(DebugSessionRegistersAccessTest, givenNoStateSaveAreaGpuVaWhenRegistersAccessHelperCalledThenErrorUnknownReturned) {
|
||||
|
||||
@@ -6045,6 +6045,7 @@ struct DebugApiRegistersAccessFixture : public DebugApiLinuxFixture {
|
||||
maxDbgSurfaceSize = hwHelper.getSipKernelMaxDbgSurfaceSize(hwInfo);
|
||||
session->clientHandleToConnection[MockDebugSessionLinux::mockClientHandle]->vmToContextStateSaveAreaBindInfo[vmHandle] = {stateSaveAreaGpuVa, maxDbgSurfaceSize};
|
||||
session->allThreadsStopped = true;
|
||||
session->allThreads[stoppedThreadId]->stopThread(1u);
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
@@ -6058,6 +6059,8 @@ struct DebugApiRegistersAccessFixture : public DebugApiLinuxFixture {
|
||||
uint64_t vmHandle = 7;
|
||||
uint64_t stateSaveAreaGpuVa = 0x123400000000;
|
||||
size_t maxDbgSurfaceSize = 0;
|
||||
ze_device_thread_t stoppedThread = {0, 0, 0, 0};
|
||||
EuThread::ThreadId stoppedThreadId{0, stoppedThread};
|
||||
};
|
||||
|
||||
using DebugApiRegistersAccessTest = Test<DebugApiRegistersAccessFixture>;
|
||||
@@ -6187,8 +6190,8 @@ TEST_F(DebugApiRegistersAccessTest, givenInvalidRegistersIndicesWhenWriteRegiste
|
||||
SIP::version version = {2, 0, 0};
|
||||
initStateSaveArea(session->stateSaveAreaHeader, version);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 128, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 127, 2, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 128, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 127, 2, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(DebugApiRegistersAccessTest, givenStateSaveAreaNotCapturedWhenWriteRegistersIsCalledThenErrorUnknownIsReturned) {
|
||||
@@ -6196,7 +6199,7 @@ TEST_F(DebugApiRegistersAccessTest, givenStateSaveAreaNotCapturedWhenWriteRegist
|
||||
session->clientHandleToConnection[MockDebugSessionLinux::mockClientHandle]->vmToContextStateSaveAreaBindInfo.clear();
|
||||
|
||||
char r0[32];
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, r0));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, r0));
|
||||
session->clientHandleToConnection[MockDebugSessionLinux::mockClientHandle]->vmToContextStateSaveAreaBindInfo[vmHandle] = bindInfoSave;
|
||||
}
|
||||
|
||||
@@ -6211,7 +6214,7 @@ TEST_F(DebugApiRegistersAccessTest, givenWriteGpuMemoryFailedWhenWriteRegistersC
|
||||
ioctlHandler->mmapFail = true;
|
||||
|
||||
char r0[32];
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, r0));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, r0));
|
||||
}
|
||||
|
||||
TEST_F(DebugApiRegistersAccessTest, givenCorruptedSrMagicWhenWriteRegistersCalledThenErrorUnknownIsReturned) {
|
||||
@@ -6226,7 +6229,7 @@ TEST_F(DebugApiRegistersAccessTest, givenCorruptedSrMagicWhenWriteRegistersCalle
|
||||
auto pStateSaveAreaHeader = reinterpret_cast<SIP::StateSaveAreaHeader *>(session->stateSaveAreaHeader.data());
|
||||
strcpy(session->stateSaveAreaHeader.data() + threadSlotOffset(pStateSaveAreaHeader, 0, 0, 0, 0) + pStateSaveAreaHeader->regHeader.sr_magic_offset, "garbage"); // NOLINT(clang-analyzer-security.insecureAPI.strcpy)
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(DebugApiRegistersAccessTest, givenWriteRegistersCalledCorrectValuesRead) {
|
||||
@@ -6247,12 +6250,12 @@ TEST_F(DebugApiRegistersAccessTest, givenWriteRegistersCalledCorrectValuesRead)
|
||||
|
||||
// grfs for 0/0/0/0 - very first eu thread
|
||||
memset(grfRef, 'k', 32); // 'a' + 10, r10
|
||||
session->ensureThreadStopped({0, 0, 0, 0});
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetDebugReadRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 10, 1, grf));
|
||||
session->ensureThreadStopped(stoppedThread);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetDebugReadRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 10, 1, grf));
|
||||
EXPECT_EQ(0, memcmp(grf, grfRef, 32));
|
||||
memset(grfRef, 'x', 32);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 10, 1, grfRef));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetDebugReadRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 10, 1, grf));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 10, 1, grfRef));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetDebugReadRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 10, 1, grf));
|
||||
EXPECT_EQ(0, memcmp(grf, grfRef, 32));
|
||||
|
||||
// grfs for 0/3/7/3 - somewhere in the middle
|
||||
@@ -6278,9 +6281,9 @@ TEST_F(DebugApiRegistersAccessTest, givenWriteRegistersCalledCorrectValuesRead)
|
||||
|
||||
TEST_F(DebugApiRegistersAccessTest, givenNoneThreadsStoppedWhenWriteRegistersCalledThenErrorNotAvailableReturned) {
|
||||
session->allThreadsStopped = false;
|
||||
|
||||
session->allThreads[stoppedThreadId]->resumeThread();
|
||||
char grf[32] = {0};
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, zetDebugWriteRegisters(session->toHandle(), {0, 0, 0, 0}, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, grf));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, zetDebugWriteRegisters(session->toHandle(), stoppedThread, ZET_DEBUG_REGSET_TYPE_GRF_INTEL_GPU, 0, 1, grf));
|
||||
}
|
||||
|
||||
TEST_F(DebugApiRegistersAccessTest, GivenThreadWhenReadingSystemRoutineIdentThenCorrectStateSaveAreaLocationIsRead) {
|
||||
|
||||
Reference in New Issue
Block a user