refactor: remove not needed hardcoded values in xe path

Related-To: NEO-10496
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2024-03-26 16:51:39 +00:00
committed by Compute-Runtime-Automation
parent 0b57b0fb7a
commit 5b6dd87fc3
3 changed files with 9 additions and 29 deletions

View File

@@ -583,13 +583,13 @@ CacheRegion IoctlHelperXe::closFree(CacheRegion closIndex) {
return CacheRegion::none;
}
int IoctlHelperXe::xeWaitUserFence(uint32_t ctxId, uint64_t mask, uint16_t op, uint64_t addr, uint64_t value,
int IoctlHelperXe::xeWaitUserFence(uint32_t ctxId, uint16_t op, uint64_t addr, uint64_t value,
int64_t timeout) {
struct drm_xe_wait_user_fence wait = {};
wait.addr = addr;
wait.op = op;
wait.value = value;
wait.mask = mask;
wait.mask = std::numeric_limits<uint64_t>::max();
wait.timeout = timeout;
wait.exec_queue_id = ctxId;
auto retVal = IoctlHelper::ioctl(DrmIoctl::gemWaitUserFence, &wait);
@@ -601,27 +601,13 @@ int IoctlHelperXe::xeWaitUserFence(uint32_t ctxId, uint64_t mask, uint16_t op, u
int IoctlHelperXe::waitUserFence(uint32_t ctxId, uint64_t address,
uint64_t value, uint32_t dataWidth, int64_t timeout, uint16_t flags) {
xeLog(" -> IoctlHelperXe::%s a=0x%llx v=0x%llx w=0x%x T=0x%llx F=0x%x ctx=0x%x\n", __FUNCTION__, address, value, dataWidth, timeout, flags, ctxId);
uint64_t mask;
switch (dataWidth) {
case static_cast<uint32_t>(Drm::ValueWidth::u64):
mask = DRM_XE_UFENCE_WAIT_MASK_U64;
break;
case static_cast<uint32_t>(Drm::ValueWidth::u32):
mask = DRM_XE_UFENCE_WAIT_MASK_U32;
break;
case static_cast<uint32_t>(Drm::ValueWidth::u16):
mask = DRM_XE_UFENCE_WAIT_MASK_U16;
break;
default:
mask = DRM_XE_UFENCE_WAIT_MASK_U8;
break;
}
UNRECOVERABLE_IF(dataWidth != static_cast<uint32_t>(Drm::ValueWidth::u64));
if (timeout == -1) {
/* expected in i915 but not in xe where timeout is an unsigned long */
timeout = TimeoutControls::maxTimeout;
}
if (address) {
return xeWaitUserFence(ctxId, mask, DRM_XE_UFENCE_WAIT_OP_GTE, address, value, timeout);
return xeWaitUserFence(ctxId, DRM_XE_UFENCE_WAIT_OP_GTE, address, value, timeout);
}
return 0;
}
@@ -1270,7 +1256,7 @@ int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool isBind) {
return ret;
}
return xeWaitUserFence(bind.exec_queue_id, DRM_XE_UFENCE_WAIT_MASK_U64, DRM_XE_UFENCE_WAIT_OP_EQ,
return xeWaitUserFence(bind.exec_queue_id, DRM_XE_UFENCE_WAIT_OP_EQ,
sync[0].addr,
sync[0].timeline_value, XE_ONE_SEC);
}

View File

@@ -26,11 +26,6 @@ struct drm_xe_engine_class_instance;
#define XE_ONE_SEC 1000000000
#define DRM_XE_UFENCE_WAIT_MASK_U8 0xffu
#define DRM_XE_UFENCE_WAIT_MASK_U16 0xffffu
#define DRM_XE_UFENCE_WAIT_MASK_U32 0xffffffffu
#define DRM_XE_UFENCE_WAIT_MASK_U64 0xffffffffffffffffu
namespace NEO {
enum class EngineClass : uint16_t;
@@ -151,7 +146,7 @@ class IoctlHelperXe : public IoctlHelper {
const char *xeGetengineClassName(uint32_t engineClass);
template <typename DataType>
std::vector<DataType> queryData(uint32_t queryId);
int xeWaitUserFence(uint32_t ctxId, uint64_t mask, uint16_t op, uint64_t addr, uint64_t value, int64_t timeout);
int xeWaitUserFence(uint32_t ctxId, uint16_t op, uint64_t addr, uint64_t value, int64_t timeout);
int xeVmBind(const VmBindParams &vmBindParams, bool bindOp);
void xeShowBindTable();
void updateBindInfo(uint32_t handle, uint64_t userPtr, uint64_t size);