Revert "fix: remove not needed checks in ioctl helper xe"

This reverts commit 5a6d0b21ac.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2024-03-14 21:06:14 +01:00
committed by Compute-Runtime-Automation
parent 64d13d2396
commit e11917cfcd
5 changed files with 16 additions and 12 deletions

View File

@@ -1122,7 +1122,6 @@ unsigned int Drm::bindDrmContext(uint32_t drmContextId, uint32_t deviceIndex, au
param.size = static_cast<uint32_t>(ptrDiff(contextEngines.engines + numEnginesInContext, &contextEngines));
param.param = ioctlHelper->getDrmParamValue(DrmParam::contextParamEngines);
param.value = castToUint64(&contextEngines);
param.gtId = deviceIndex;
auto ioctlValue = ioctlHelper->ioctl(DrmIoctl::gemContextSetparam, &param);
UNRECOVERABLE_IF(ioctlValue != 0);

View File

@@ -119,7 +119,6 @@ struct GemContextParam {
uint32_t size;
uint64_t param;
uint64_t value;
uint32_t gtId;
};
struct DrmUserExtension {

View File

@@ -85,7 +85,7 @@ static_assert(offsetof(GemSetDomain, handle) == offsetof(drm_i915_gem_set_domain
static_assert(offsetof(GemSetDomain, readDomains) == offsetof(drm_i915_gem_set_domain, read_domains));
static_assert(offsetof(GemSetDomain, writeDomain) == offsetof(drm_i915_gem_set_domain, write_domain));
static_assert(sizeof(GemContextParam) >= sizeof(drm_i915_gem_context_param));
static_assert(sizeof(GemContextParam) == sizeof(drm_i915_gem_context_param));
static_assert(offsetof(GemContextParam, contextId) == offsetof(drm_i915_gem_context_param, ctx_id));
static_assert(offsetof(GemContextParam, size) == offsetof(drm_i915_gem_context_param, size));
static_assert(offsetof(GemContextParam, param) == offsetof(drm_i915_gem_context_param, param));
@@ -97,7 +97,7 @@ static_assert(offsetof(DrmUserExtension, name) == offsetof(i915_user_extension,
static_assert(offsetof(DrmUserExtension, flags) == offsetof(i915_user_extension, flags));
static_assert(offsetof(DrmUserExtension, reserved) == offsetof(i915_user_extension, rsvd));
static_assert(sizeof(GemContextCreateExtSetParam) >= sizeof(drm_i915_gem_context_create_ext_setparam));
static_assert(sizeof(GemContextCreateExtSetParam) == sizeof(drm_i915_gem_context_create_ext_setparam));
static_assert(offsetof(GemContextCreateExtSetParam, base) == offsetof(drm_i915_gem_context_create_ext_setparam, base));
static_assert(offsetof(GemContextCreateExtSetParam, param) == offsetof(drm_i915_gem_context_create_ext_setparam, param));

View File

@@ -807,10 +807,10 @@ int IoctlHelperPrelim20::unregisterUuid(uint32_t handle) {
}
bool IoctlHelperPrelim20::isContextDebugSupported() {
GemContextParam ctxParam = {};
drm_i915_gem_context_param ctxParam = {};
ctxParam.size = 0;
ctxParam.param = PRELIM_I915_CONTEXT_PARAM_DEBUG_FLAGS;
ctxParam.contextId = 0;
ctxParam.ctx_id = 0;
ctxParam.value = 0;
const auto retVal = IoctlHelper::ioctl(DrmIoctl::gemContextGetparam, &ctxParam);
@@ -818,10 +818,10 @@ bool IoctlHelperPrelim20::isContextDebugSupported() {
}
int IoctlHelperPrelim20::setContextDebugFlag(uint32_t drmContextId) {
GemContextParam ctxParam = {};
drm_i915_gem_context_param ctxParam = {};
ctxParam.size = 0;
ctxParam.param = PRELIM_I915_CONTEXT_PARAM_DEBUG_FLAGS;
ctxParam.contextId = drmContextId;
ctxParam.ctx_id = drmContextId;
ctxParam.value = PRELIM_I915_CONTEXT_PARAM_DEBUG_FLAG_SIP << 32 | PRELIM_I915_CONTEXT_PARAM_DEBUG_FLAG_SIP;
return IoctlHelper::ioctl(DrmIoctl::gemContextSetparam, &ctxParam);

View File

@@ -1019,13 +1019,14 @@ int IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
auto contextEngine = reinterpret_cast<ContextParamEngines<> *>(d->value);
int items = (d->size - sizeof(uint64_t)) / sizeof(uint32_t);
contextParamEngine.clear();
for (int i = 0; i < items; i++) {
if (contextEngine->engines[i].engineClass != getDrmParamValue(DrmParam::engineClassInvalid)) {
if (items < 11) {
for (int i = 0; i < items; i++) {
drm_xe_engine_class_instance engine = {
contextEngine->engines[i].engineClass,
contextEngine->engines[i].engineInstance,
static_cast<uint16_t>(d->gtId)};
contextParamEngine.push_back(engine);
0};
if (engine.engine_class != 65535)
contextParamEngine.push_back(engine);
}
}
if (contextParamEngine.size())
@@ -1223,6 +1224,11 @@ int IoctlHelperXe::createDrmContext(Drm &drm, OsContextLinux &osContext, uint32_
engine.push_back(*currentEngine);
}
}
if (engine.size() > 9) {
xeLog("Too much instances...\n", "");
UNRECOVERABLE_IF(true);
return 0;
}
create.instances = castToUint64(engine.data());
create.num_placements = engine.size();