diff --git a/shared/source/os_interface/linux/xe/CMakeLists.txt b/shared/source/os_interface/linux/xe/CMakeLists.txt index 9c315f9091..ada45f0135 100644 --- a/shared/source/os_interface/linux/xe/CMakeLists.txt +++ b/shared/source/os_interface/linux/xe/CMakeLists.txt @@ -11,6 +11,7 @@ set(NEO_CORE_OS_INTERFACE_LINUX_XE ${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe.h ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/ioctl_helper_xe_query_hw_ip_version.cpp + ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/ioctl_helper_xe_vm_bind_flags.cpp ) if(NEO_ENABLE_XE_EU_DEBUG_SUPPORT) diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp index 364c109607..0564cd54a7 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp @@ -172,6 +172,7 @@ bool IoctlHelperXe::initialize() { tileIdToGtId[gt.tile_id] = gt.gt_id; } } + querySupportedFeatures(); return true; } @@ -784,6 +785,7 @@ uint64_t IoctlHelperXe::getFlagsForVmBind(bool bindCapture, bool bindImmediate, if (bindCapture) { ret |= DRM_XE_VM_BIND_FLAG_DUMPABLE; } + ret |= getAdditionalFlagsForVmBind(bindImmediate, readOnlyResource); return ret; } diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h index 719051a43c..84437c7e10 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h @@ -204,6 +204,21 @@ class IoctlHelperXe : public IoctlHelper { uint64_t startOffset; uint32_t drmContextId; }; + + struct SupportedFeatures { + union { + struct { + uint32_t vmBindReadOnly : 1; + uint32_t vmBindImmediate : 1; + uint32_t reserved : 30; + } flags; + uint32_t allFlags = 0; + }; + } supportedFeatures{}; + static_assert(sizeof(SupportedFeatures::flags) == sizeof(SupportedFeatures::allFlags), ""); + + void querySupportedFeatures(); + uint64_t getAdditionalFlagsForVmBind(bool bindImmediate, bool readOnlyResource); }; template diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe_vm_bind_flags.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe_vm_bind_flags.cpp new file mode 100644 index 0000000000..aaafec3f61 --- /dev/null +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe_vm_bind_flags.cpp @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2024 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/os_interface/linux/xe/ioctl_helper_xe.h" + +namespace NEO { +void IoctlHelperXe::querySupportedFeatures(){}; + +uint64_t IoctlHelperXe::getAdditionalFlagsForVmBind(bool bindImmediate, bool readOnlyResource) { + return 0; +} +} // namespace NEO \ No newline at end of file diff --git a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.h b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.h index 98ad2b6252..bec4b07ffc 100644 --- a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.h +++ b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.h @@ -38,6 +38,7 @@ struct MockIoctlHelperXe : IoctlHelperXe { using IoctlHelperXe::maxExecQueuePriority; using IoctlHelperXe::queryGtListData; using IoctlHelperXe::setContextProperties; + using IoctlHelperXe::supportedFeatures; using IoctlHelperXe::UserFenceExtension; using IoctlHelperXe::xeGetBindFlagsName; using IoctlHelperXe::xeGetBindOperationName; @@ -260,10 +261,10 @@ class DrmMockXe : public DrmMockCustom { auto vmBindInput = static_cast(arg); vmBindInputs.push_back(*vmBindInput); - EXPECT_EQ(1u, vmBindInput->num_syncs); - - auto &syncInput = reinterpret_cast(vmBindInput->syncs)[0]; - syncInputs.push_back(syncInput); + if (vmBindInput->num_syncs == 1) { + auto &syncInput = reinterpret_cast(vmBindInput->syncs)[0]; + syncInputs.push_back(syncInput); + } } break; case DrmIoctl::gemWaitUserFence: {