Revert "fix: use decanonize from gmm helper in xe"

This reverts commit e6b0930657.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation 2023-08-04 16:39:42 +02:00 committed by Compute-Runtime-Automation
parent c44b600ec7
commit d93789dbab
3 changed files with 15 additions and 14 deletions

View File

@ -10,7 +10,6 @@
#include "shared/source/command_stream/csr_definitions.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/basic_math.h"
#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/helpers/common_types.h"
@ -182,6 +181,7 @@ bool IoctlHelperXe::initialize() {
chipsetId = config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
revId = static_cast<int>(config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID] >> 16);
hasVram = config->info[XE_QUERY_CONFIG_FLAGS] & XE_QUERY_CONFIG_FLAGS_HAS_VRAM ? 1 : 0;
addressWidth = static_cast<uint32_t>(config->info[XE_QUERY_CONFIG_VA_BITS]);
memset(&queryConfig, 0, sizeof(queryConfig));
queryConfig.query = DRM_XE_DEVICE_QUERY_HWCONFIG;
@ -909,6 +909,10 @@ void IoctlHelperXe::xeSyncObjDestroy(uint32_t handle) {
UNRECOVERABLE_IF(ret);
}
uint64_t IoctlHelperXe::xeDecanonize(uint64_t address) {
return (address & maxNBitValue(addressWidth));
}
int IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
int ret = -1;
xeLog(" => IoctlHelperXe::%s 0x%x\n", __FUNCTION__, request);
@ -984,11 +988,10 @@ int IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
case DrmIoctl::GemContextGetparam: {
GemContextParam *d = static_cast<GemContextParam *>(arg);
auto addressSpace = drm.getRootDeviceEnvironment().getHardwareInfo()->capabilityTable.gpuAddressSpace;
ret = 0;
switch (d->param) {
case static_cast<int>(DrmParam::ContextParamGttSize):
d->value = addressSpace + 1u;
d->value = 0x1ull << addressWidth;
break;
case static_cast<int>(DrmParam::ContextParamSseu):
d->value = 0x55fdd94d4e40;
@ -1241,8 +1244,7 @@ int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool bindOp) {
}
}
} else {
auto gmmHelper = drm.getRootDeviceEnvironment().getGmmHelper();
uint64_t ad = gmmHelper->decanonize(vmBindParams.start);
uint64_t ad = xeDecanonize(vmBindParams.start);
for (unsigned int i = 0; i < bindInfo.size(); i++) {
if (ad == bindInfo[i].addr) {
found = i;
@ -1267,10 +1269,7 @@ int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool bindOp) {
bind.bind.obj = vmBindParams.handle;
bind.bind.obj_offset = vmBindParams.offset;
bind.bind.range = vmBindParams.length;
auto gmmHelper = drm.getRootDeviceEnvironment().getGmmHelper();
bind.bind.addr = gmmHelper->decanonize(vmBindParams.start);
bind.bind.addr = xeDecanonize(vmBindParams.start);
bind.bind.op = XE_VM_BIND_OP_MAP;
bind.num_syncs = 1;
bind.syncs = reinterpret_cast<uintptr_t>(&sync);

View File

@ -114,6 +114,7 @@ class IoctlHelperXe : public IoctlHelper {
struct drm_xe_engine_class_instance *xeFindMatchingEngine(uint16_t engineClass, uint16_t engineInstance);
protected:
uint64_t xeDecanonize(uint64_t address);
const char *xeGetClassName(int className);
const char *xeGetBindOpName(int bindOp);
const char *xeGetengineClassName(uint32_t engineClass);
@ -136,6 +137,7 @@ class IoctlHelperXe : public IoctlHelper {
int hasVram = 0;
uint32_t xeVmId = 0;
uint32_t userPtrHandle = 0;
uint32_t addressWidth = 48;
int xeFileHandle = 0;
std::mutex xeLock;
std::vector<BindInfo> bindInfo;

View File

@ -29,6 +29,7 @@ using NEO::PrelimI915::drm_syncobj_wait;
struct MockIoctlHelperXe : IoctlHelperXe {
using IoctlHelperXe::bindInfo;
using IoctlHelperXe::IoctlHelperXe;
using IoctlHelperXe::xeDecanonize;
using IoctlHelperXe::xeGetBindOpName;
using IoctlHelperXe::xeGetClassName;
using IoctlHelperXe::xeGetengineClassName;
@ -380,6 +381,9 @@ TEST(IoctlHelperXeTest, verifyPublicFunctions) {
verifyXeEngineClassName("DRM_XE_ENGINE_CLASS_COMPUTE", DRM_XE_ENGINE_CLASS_COMPUTE);
verifyXeEngineClassName("?", 0xffffffff);
// Default is 48b
EXPECT_EQ(0xffffffa10000ul, mockXeIoctlHelper->xeDecanonize(0xffffffffffa10000));
Query query{};
QueryItem queryItem{};
queryItem.queryId = 999999;
@ -729,17 +733,13 @@ TEST(IoctlHelperXeTest, whenCallingIoctlThenProperValueIsReturned) {
EXPECT_EQ(-1, ret);
}
{
auto hwInfo = drm.getRootDeviceEnvironment().getHardwareInfo();
GemContextParam test = {};
ret = mockXeIoctlHelper->ioctl(DrmIoctl::GemContextGetparam, &test);
EXPECT_EQ(-1, ret);
test.param = static_cast<int>(DrmParam::ContextParamGttSize);
ret = mockXeIoctlHelper->ioctl(DrmIoctl::GemContextGetparam, &test);
EXPECT_EQ(0, ret);
auto expectedAddressWidth = hwInfo->capabilityTable.gpuAddressSpace + 1u;
EXPECT_EQ(expectedAddressWidth, test.value);
EXPECT_EQ(0x1ull << 48, test.value);
test.param = static_cast<int>(DrmParam::ContextParamSseu);
ret = mockXeIoctlHelper->ioctl(DrmIoctl::GemContextGetparam, &test);
EXPECT_EQ(0, ret);