Skip to content

Commit 66c4288

Browse files
Revert "fix: using canonized addr in xe kmd"
This reverts commit 683d7c7. Signed-off-by: Compute-Runtime-Validation <[email protected]>
1 parent 91c07e2 commit 66c4288

File tree

6 files changed

+8
-48
lines changed

6 files changed

+8
-48
lines changed

level_zero/tools/source/debug/linux/debug_session.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ ze_result_t DebugSessionLinux::readGpuMemory(uint64_t vmHandle, char *output, si
315315

316316
int64_t retVal = 0;
317317
auto gmmHelper = connectedDevice->getNEODevice()->getGmmHelper();
318-
gpuVa = gmmHelper->canonize(gpuVa);
318+
gpuVa = gmmHelper->decanonize(gpuVa);
319319
if (flushVmCache(vmDebugFd) != 0) {
320320
return ZE_RESULT_ERROR_UNKNOWN;
321321
}
@@ -377,7 +377,7 @@ ze_result_t DebugSessionLinux::writeGpuMemory(uint64_t vmHandle, const char *inp
377377

378378
int64_t retVal = 0;
379379
auto gmmHelper = connectedDevice->getNEODevice()->getGmmHelper();
380-
gpuVa = gmmHelper->canonize(gpuVa);
380+
gpuVa = gmmHelper->decanonize(gpuVa);
381381
if (flushVmCache(vmDebugFd) != 0) {
382382
return ZE_RESULT_ERROR_UNKNOWN;
383383
}

level_zero/tools/source/debug/linux/prelim/debug_session.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,8 @@ bool DebugSessionLinuxi915::handleVmBindEvent(prelim_drm_i915_debug_event_vm_bin
641641
std::unique_lock<std::mutex> memLock(asyncThreadMutex);
642642
isaMap[vmBind->va_start] = std::move(isa);
643643

644-
// Expect canonical va_start
645-
DEBUG_BREAK_IF(gmmHelper->canonize(vmBind->va_start) != vmBind->va_start);
644+
// Expect non canonical va_start
645+
DEBUG_BREAK_IF(gmmHelper->decanonize(vmBind->va_start) != vmBind->va_start);
646646

647647
bool apiEventNeedsAck = (vmBind->base.flags & PRELIM_DRM_I915_DEBUG_EVENT_NEED_ACK);
648648
// If ACK flag is not set when triggering MODULE LOAD event, auto-ack immediately

level_zero/tools/source/debug/linux/xe/debug_session.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,15 +466,13 @@ bool DebugSessionLinuxXe::handleVmBind(VmBindData &vmBindData) {
466466
if (vmBindOp.base.flags & euDebugInterface->getParamValue(NEO::EuDebugParam::eventBitCreate)) {
467467
{
468468
std::lock_guard<std::mutex> lock(asyncThreadMutex);
469-
470469
if (metaDataEntry.metadata.type == euDebugInterface->getParamValue(NEO::EuDebugParam::metadataSbaArea)) {
471470
connection->vmToStateBaseAreaBindInfo[vmBindData.vmBind.vmHandle] = {vmBindOp.addr, vmBindOp.range};
472471
}
473472
if (metaDataEntry.metadata.type == euDebugInterface->getParamValue(NEO::EuDebugParam::metadataSipArea)) {
474473
connection->vmToContextStateSaveAreaBindInfo[vmBindData.vmBind.vmHandle] = {vmBindOp.addr, vmBindOp.range};
475474
}
476475
if (metaDataEntry.metadata.type == euDebugInterface->getParamValue(NEO::EuDebugParam::metadataModuleArea)) {
477-
478476
isaAddr = vmBindOp.addr;
479477
if (connection->isaMap[tileIndex].find(vmBindOp.addr) == connection->isaMap[tileIndex].end()) {
480478
auto &isaMap = connection->isaMap[tileIndex];

shared/source/os_interface/linux/ioctl_helper.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#pragma once
99
#include "shared/source/command_stream/task_count_helper.h"
10-
#include "shared/source/gmm_helper/gmm_helper.h"
1110
#include "shared/source/helpers/topology_map.h"
1211
#include "shared/source/os_interface/linux/drm_allocation.h"
1312
#include "shared/source/os_interface/linux/drm_debug.h"

shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,7 @@ int IoctlHelperXe::createDrmContext(Drm &drm, OsContextLinux &osContext, uint32_
13411341
}
13421342

13431343
int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool isBind) {
1344+
auto gmmHelper = drm.getRootDeviceEnvironment().getGmmHelper();
13441345
int ret = -1;
13451346
const char *operation = isBind ? "bind" : "unbind";
13461347

@@ -1352,14 +1353,14 @@ int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool isBind) {
13521353
for (auto i = 0u; i < bindInfo.size(); i++) {
13531354
if (vmBindParams.userptr == bindInfo[i].userptr) {
13541355
userptr = bindInfo[i].userptr;
1355-
bindInfo[i].addr = vmBindParams.start;
1356+
bindInfo[i].addr = gmmHelper->decanonize(vmBindParams.start);
13561357
break;
13571358
}
13581359
}
13591360
}
13601361
} else // unbind
13611362
{
1362-
auto address = vmBindParams.start;
1363+
auto address = gmmHelper->decanonize(vmBindParams.start);
13631364
for (auto i = 0u; i < bindInfo.size(); i++) {
13641365
if (address == bindInfo[i].addr) {
13651366
userptr = bindInfo[i].userptr;
@@ -1384,10 +1385,7 @@ int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool isBind) {
13841385
if (vmBindParams.sharedSystemUsmBind == true) {
13851386
bind.bind.addr = 0;
13861387
} else {
1387-
// Expect canonical address
1388-
DEBUG_BREAK_IF(drm.getRootDeviceEnvironment().getGmmHelper()->canonize(vmBindParams.start) != vmBindParams.start);
1389-
1390-
bind.bind.addr = vmBindParams.start;
1388+
bind.bind.addr = gmmHelper->decanonize(vmBindParams.start);
13911389
}
13921390
bind.num_syncs = 1;
13931391
UNRECOVERABLE_IF(vmBindParams.userFence == 0x0);

shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,41 +2090,6 @@ TEST_F(IoctlHelperXeTest, givenMultipleBindInfosWhenVmBindIsCalledThenProperHand
20902090
ioctlHelper->bindInfo.clear();
20912091
}
20922092

2093-
TEST_F(IoctlHelperXeTest, whenVmBindIsCalledThenProperCanonicalOrNonCanonicalAddressIsExpectedInVmBindInputsList) {
2094-
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
2095-
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
2096-
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
2097-
unsigned int idx = 0;
2098-
2099-
auto testAddress = [&](uint64_t addr) {
2100-
MockIoctlHelperXe::UserFenceExtension userFence{};
2101-
userFence.tag = userFence.tagValue;
2102-
userFence.addr = idx + 1;
2103-
2104-
VmBindParams vmBindParams{};
2105-
vmBindParams.userFence = castToUint64(&userFence);
2106-
vmBindParams.handle = idx + 1;
2107-
vmBindParams.userptr = idx + 1;
2108-
vmBindParams.start = addr;
2109-
2110-
auto ret = ioctlHelper->vmBind(vmBindParams);
2111-
EXPECT_EQ(0, ret);
2112-
2113-
auto &list = drm->vmBindInputs;
2114-
EXPECT_EQ(list.size(), idx + 1);
2115-
2116-
if (list.size() == idx + 1) {
2117-
EXPECT_EQ(list[idx].num_binds, 1u);
2118-
EXPECT_EQ(list[idx].bind.addr, vmBindParams.start);
2119-
}
2120-
2121-
idx++;
2122-
};
2123-
2124-
testAddress(0xfffff00000000000); // canonical address test
2125-
testAddress(0xf00000000000); // non-canonical address test
2126-
}
2127-
21282093
TEST_F(IoctlHelperXeTest, givenLowPriorityContextWhenSettingPropertiesThenCorrectIndexIsUsedAndReturend) {
21292094
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
21302095
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);

0 commit comments

Comments
 (0)