From 8bef74133f72218df9b1a4cd119b2874bbf323e1 Mon Sep 17 00:00:00 2001 From: Maciej Bielski Date: Wed, 27 Mar 2024 16:55:20 +0000 Subject: [PATCH] feature: add setupIpVersion for Xe Related-To: NEO-10773 Signed-off-by: Maciej Bielski --- .../source/os_interface/linux/xe/CMakeLists.txt | 1 + .../os_interface/linux/xe/ioctl_helper_xe.cpp | 16 ++++++++++++++++ .../os_interface/linux/xe/ioctl_helper_xe.h | 8 ++++++++ .../xe/ioctl_helper_xe_query_hw_ip_version.cpp | 15 +++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 shared/source/os_interface/linux/xe/ioctl_helper_xe_query_hw_ip_version.cpp diff --git a/shared/source/os_interface/linux/xe/CMakeLists.txt b/shared/source/os_interface/linux/xe/CMakeLists.txt index 6542f149f3..9c315f9091 100644 --- a/shared/source/os_interface/linux/xe/CMakeLists.txt +++ b/shared/source/os_interface/linux/xe/CMakeLists.txt @@ -10,6 +10,7 @@ set(NEO_CORE_OS_INTERFACE_LINUX_XE ${CMAKE_CURRENT_SOURCE_DIR}/drm_version_xe.cpp ${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 ) 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 d9e02947d0..7f87564fb5 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp @@ -209,6 +209,8 @@ std::vector IoctlHelperXe::queryData(uint32_t queryId) { return retVal; } +template std::vector IoctlHelperXe::queryData(uint32_t queryId); +template std::vector IoctlHelperXe::queryData(uint32_t queryId); std::unique_ptr IoctlHelperXe::createEngineInfo(bool isSysmanEnabled) { auto enginesData = queryData(DRM_XE_DEVICE_QUERY_ENGINES); @@ -331,6 +333,20 @@ size_t IoctlHelperXe::getLocalMemoryRegionsSize(const MemoryInfo *memoryInfo, ui return size; } +void IoctlHelperXe::setupIpVersion() { + auto &rootDeviceEnvironment = drm.getRootDeviceEnvironment(); + auto hwInfo = rootDeviceEnvironment.getMutableHardwareInfo(); + + if (auto hwIpVersion = GtIpVersion{}; queryHwIpVersion(hwIpVersion)) { + hwInfo->ipVersion.architecture = hwIpVersion.major; + hwInfo->ipVersion.release = hwIpVersion.minor; + hwInfo->ipVersion.revision = hwIpVersion.revision; + } else { + xeLog("No HW IP version received from drm_xe_gt. Falling back to default value."); + IoctlHelper::setupIpVersion(); + } +} + bool IoctlHelperXe::setGpuCpuTimes(TimeStampData *pGpuCpuTime, OSTime *osTime) { if (pGpuCpuTime == nullptr || osTime == nullptr) { return false; 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 3129ab1e49..2216a0eb6c 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h @@ -106,6 +106,7 @@ class IoctlHelperXe : public IoctlHelper { std::unique_ptr createEngineInfo(bool isSysmanEnabled) override; std::unique_ptr createMemoryInfo() override; size_t getLocalMemoryRegionsSize(const MemoryInfo *memoryInfo, uint32_t subDevicesCount, uint32_t deviceBitfield) const override; + void setupIpVersion() override; void getTopologyData(size_t nTiles, std::vector> *geomDss, std::vector> *computeDss, std::vector> *euDss, DrmQueryTopologyData &topologyData, bool &isComputeDssEmpty); void getTopologyMap(size_t nTiles, std::vector> *dssInfo, TopologyMap &topologyMap); @@ -159,6 +160,13 @@ class IoctlHelperXe : public IoctlHelper { uint16_t getDefaultEngineClass(const aub_stream::EngineType &defaultEngineType); virtual void setContextProperties(const OsContextLinux &osContext, void *extProperties, uint32_t &extIndexInOut); + struct GtIpVersion { + uint16_t major; + uint16_t minor; + uint16_t revision; + }; + bool queryHwIpVersion(GtIpVersion >IpVersion); + int maxExecQueuePriority = 0; std::mutex xeLock; std::vector bindInfo; diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe_query_hw_ip_version.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe_query_hw_ip_version.cpp new file mode 100644 index 0000000000..c50c540157 --- /dev/null +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe_query_hw_ip_version.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2024 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/os_interface/linux/xe/ioctl_helper_xe.h" + +namespace NEO { + +bool IoctlHelperXe::queryHwIpVersion(GtIpVersion >IpVersion) { + return false; +} +} // namespace NEO \ No newline at end of file