mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
refactor: include xe header in dedicated namespace
avoid redefinition issue in case of integrating multiple xe drm versions define mock drm xe in inl file to provide xe definitions for mock members Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
ee2a688323
commit
07a11e640f
@@ -7,14 +7,13 @@
|
|||||||
|
|
||||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||||
#include "shared/source/os_interface/linux/engine_info.h"
|
#include "shared/source/os_interface/linux/engine_info.h"
|
||||||
|
#include "shared/source/os_interface/linux/xe/xedrm.h"
|
||||||
|
|
||||||
#include "level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface.h"
|
#include "level_zero/sysman/source/shared/linux/kmd_interface/sysman_kmd_interface.h"
|
||||||
#include "level_zero/sysman/source/shared/linux/pmu/sysman_pmu_imp.h"
|
#include "level_zero/sysman/source/shared/linux/pmu/sysman_pmu_imp.h"
|
||||||
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h"
|
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h"
|
||||||
#include "level_zero/sysman/source/shared/linux/sysman_fs_access_interface.h"
|
#include "level_zero/sysman/source/shared/linux/sysman_fs_access_interface.h"
|
||||||
|
|
||||||
#include "xe_drm.h"
|
|
||||||
|
|
||||||
namespace L0 {
|
namespace L0 {
|
||||||
namespace Sysman {
|
namespace Sysman {
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "shared/source/os_interface/linux/engine_info.h"
|
#include "shared/source/os_interface/linux/engine_info.h"
|
||||||
|
#include "shared/source/os_interface/linux/xe/xedrm.h"
|
||||||
|
|
||||||
#include "level_zero/sysman/source/api/scheduler/linux/sysman_os_scheduler_imp.h"
|
#include "level_zero/sysman/source/api/scheduler/linux/sysman_os_scheduler_imp.h"
|
||||||
#include "level_zero/sysman/source/shared/linux/sysman_fs_access_interface.h"
|
#include "level_zero/sysman/source/shared/linux/sysman_fs_access_interface.h"
|
||||||
#include "level_zero/sysman/test/unit_tests/sources/linux/mock_sysman_hw_device_id.h"
|
#include "level_zero/sysman/test/unit_tests/sources/linux/mock_sysman_hw_device_id.h"
|
||||||
|
|
||||||
#include "xe_drm.h"
|
|
||||||
|
|
||||||
namespace L0 {
|
namespace L0 {
|
||||||
namespace Sysman {
|
namespace Sysman {
|
||||||
namespace ult {
|
namespace ult {
|
||||||
|
|||||||
@@ -26,10 +26,9 @@
|
|||||||
#include "shared/source/os_interface/linux/memory_info.h"
|
#include "shared/source/os_interface/linux/memory_info.h"
|
||||||
#include "shared/source/os_interface/linux/os_context_linux.h"
|
#include "shared/source/os_interface/linux/os_context_linux.h"
|
||||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||||
|
#include "shared/source/os_interface/linux/xe/xedrm.h"
|
||||||
#include "shared/source/os_interface/os_time.h"
|
#include "shared/source/os_interface/os_time.h"
|
||||||
|
|
||||||
#include "xe_drm.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@@ -178,7 +177,10 @@ bool IoctlHelperXe::initialize() {
|
|||||||
hwInfo->platform.usRevId = static_cast<int>((config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] >> 16) & 0xff);
|
hwInfo->platform.usRevId = static_cast<int>((config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] >> 16) & 0xff);
|
||||||
hwInfo->capabilityTable.gpuAddressSpace = (1ull << config->info[DRM_XE_QUERY_CONFIG_VA_BITS]) - 1;
|
hwInfo->capabilityTable.gpuAddressSpace = (1ull << config->info[DRM_XE_QUERY_CONFIG_VA_BITS]) - 1;
|
||||||
|
|
||||||
hwInfo->capabilityTable.cxlType = getCxlType(config);
|
hwInfo->capabilityTable.cxlType = 0;
|
||||||
|
if (getCxlType() && config->num_params > *getCxlType()) {
|
||||||
|
hwInfo->capabilityTable.cxlType = static_cast<uint32_t>(config->info[*getCxlType()]);
|
||||||
|
}
|
||||||
|
|
||||||
queryGtListData = queryData<uint64_t>(DRM_XE_DEVICE_QUERY_GT_LIST);
|
queryGtListData = queryData<uint64_t>(DRM_XE_DEVICE_QUERY_GT_LIST);
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,13 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
namespace NEO {
|
||||||
|
|
||||||
|
namespace XeDrm {
|
||||||
struct drm_xe_engine_class_instance;
|
struct drm_xe_engine_class_instance;
|
||||||
struct drm_xe_query_gt_list;
|
struct drm_xe_query_gt_list;
|
||||||
struct drm_xe_query_config;
|
struct drm_xe_query_config;
|
||||||
|
} // namespace XeDrm
|
||||||
namespace NEO {
|
|
||||||
|
|
||||||
enum class EngineClass : uint16_t;
|
enum class EngineClass : uint16_t;
|
||||||
|
|
||||||
@@ -151,7 +153,7 @@ class IoctlHelperXe : public IoctlHelper {
|
|||||||
int debuggerMetadataDestroyIoctl(DrmIoctl request, void *arg);
|
int debuggerMetadataDestroyIoctl(DrmIoctl request, void *arg);
|
||||||
int getRunaloneExtProperty();
|
int getRunaloneExtProperty();
|
||||||
virtual bool isExtraEngineClassAllowed(uint16_t engineClass) const { return false; }
|
virtual bool isExtraEngineClassAllowed(uint16_t engineClass) const { return false; }
|
||||||
virtual uint32_t getCxlType(struct drm_xe_query_config *config) { return 0u; }
|
virtual std::optional<uint32_t> getCxlType() { return {}; }
|
||||||
|
|
||||||
struct UserFenceExtension {
|
struct UserFenceExtension {
|
||||||
static constexpr uint32_t tagValue = 0x123987;
|
static constexpr uint32_t tagValue = 0x123987;
|
||||||
@@ -176,15 +178,15 @@ class IoctlHelperXe : public IoctlHelper {
|
|||||||
std::mutex xeLock;
|
std::mutex xeLock;
|
||||||
std::vector<BindInfo> bindInfo;
|
std::vector<BindInfo> bindInfo;
|
||||||
std::vector<uint32_t> hwconfig;
|
std::vector<uint32_t> hwconfig;
|
||||||
std::vector<drm_xe_engine_class_instance> contextParamEngine;
|
std::vector<XeDrm::drm_xe_engine_class_instance> contextParamEngine;
|
||||||
|
|
||||||
std::vector<uint64_t> queryGtListData;
|
std::vector<uint64_t> queryGtListData;
|
||||||
constexpr static int invalidIndex = -1;
|
constexpr static int invalidIndex = -1;
|
||||||
StackVec<int, 2> gtIdToTileId;
|
StackVec<int, 2> gtIdToTileId;
|
||||||
StackVec<int, 2> tileIdToGtId;
|
StackVec<int, 2> tileIdToGtId;
|
||||||
drm_xe_query_gt_list *xeGtListData = nullptr;
|
XeDrm::drm_xe_query_gt_list *xeGtListData = nullptr;
|
||||||
|
|
||||||
std::unique_ptr<drm_xe_engine_class_instance> defaultEngine;
|
std::unique_ptr<XeDrm::drm_xe_engine_class_instance> defaultEngine;
|
||||||
struct DebugMetadata {
|
struct DebugMetadata {
|
||||||
DrmResourceClass type;
|
DrmResourceClass type;
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
|
|
||||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||||
#include "shared/source/os_interface/linux/xe/ioctl_helper_xe.h"
|
#include "shared/source/os_interface/linux/xe/ioctl_helper_xe.h"
|
||||||
|
#include "shared/source/os_interface/linux/xe/xedrm.h"
|
||||||
#include "xe_drm.h"
|
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
@@ -36,4 +35,4 @@ bool IoctlHelperXe::isEuStallSupported() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
20
shared/source/os_interface/linux/xe/xedrm.h
Normal file
20
shared/source/os_interface/linux/xe/xedrm.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef _XE_DRM_H_
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
namespace NEO {
|
||||||
|
namespace XeDrm {
|
||||||
|
#include "xe_drm.h"
|
||||||
|
}
|
||||||
|
} // namespace NEO
|
||||||
|
using namespace NEO::XeDrm;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -8,7 +8,6 @@ set(NEO_CORE_OS_INTERFACE_TESTS_LINUX_XE
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/ioctl_helper_xe_perf_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/ioctl_helper_xe_perf_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe_tests.h
|
|
||||||
)
|
)
|
||||||
if(NEO_ENABLE_XE_EU_DEBUG_SUPPORT)
|
if(NEO_ENABLE_XE_EU_DEBUG_SUPPORT)
|
||||||
list(APPEND NEO_CORE_OS_INTERFACE_TESTS_LINUX_XE
|
list(APPEND NEO_CORE_OS_INTERFACE_TESTS_LINUX_XE
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||||
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
|
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
|
||||||
#include "shared/test/common/mocks/linux/mock_os_context_linux.h"
|
#include "shared/test/common/mocks/linux/mock_os_context_linux.h"
|
||||||
#include "shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.h"
|
#include "shared/test/common/test_macros/test.h"
|
||||||
|
#include "shared/test/unit_test/os_interface/linux/xe/mock_drm_xe.h"
|
||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,17 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.h"
|
#include "shared/source/helpers/compiler_product_helper.h"
|
||||||
|
#include "shared/source/os_interface/linux/memory_info.h"
|
||||||
#include "shared/source/os_interface/linux/os_context_linux.h"
|
#include "shared/source/os_interface/linux/os_context_linux.h"
|
||||||
|
#include "shared/source/os_interface/product_helper.h"
|
||||||
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||||
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
|
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
|
||||||
#include "shared/test/common/mocks/linux/mock_os_context_linux.h"
|
#include "shared/test/common/mocks/linux/mock_os_context_linux.h"
|
||||||
|
#include "shared/test/common/mocks/linux/mock_os_time_linux.h"
|
||||||
|
#include "shared/test/common/test_macros/test.h"
|
||||||
|
#include "shared/test/unit_test/os_interface/linux/xe/mock_drm_xe.h"
|
||||||
|
|
||||||
using namespace NEO;
|
using namespace NEO;
|
||||||
|
|
||||||
|
|||||||
18
shared/test/unit_test/os_interface/linux/xe/mock_drm_xe.h
Normal file
18
shared/test/unit_test/os_interface/linux/xe/mock_drm_xe.h
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "shared/source/os_interface/linux/xe/xedrm.h"
|
||||||
|
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||||
|
#include "shared/test/unit_test/os_interface/linux/xe/mock_ioctl_helper_xe.h"
|
||||||
|
namespace NEO {
|
||||||
|
namespace XeDrm {
|
||||||
|
#include "shared/test/unit_test/os_interface/linux/xe/mock_drm_xe.inl"
|
||||||
|
}
|
||||||
|
} // namespace NEO
|
||||||
|
using NEO::XeDrm::DrmMockXe;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2023-2024 Intel Corporation
|
* Copyright (C) 2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -7,72 +7,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "shared/source/helpers/common_types.h"
|
|
||||||
#include "shared/source/helpers/compiler_product_helper.h"
|
|
||||||
#include "shared/source/helpers/register_offsets.h"
|
|
||||||
#include "shared/source/os_interface/linux/engine_info.h"
|
|
||||||
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
|
||||||
#include "shared/source/os_interface/linux/memory_info.h"
|
|
||||||
#include "shared/source/os_interface/linux/xe/ioctl_helper_xe.h"
|
|
||||||
#include "shared/source/os_interface/product_helper.h"
|
|
||||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
|
||||||
#include "shared/test/common/helpers/default_hw_info.h"
|
|
||||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
|
||||||
#include "shared/test/common/mocks/linux/mock_os_time_linux.h"
|
|
||||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
|
||||||
#include "shared/test/common/test_macros/test.h"
|
|
||||||
|
|
||||||
#include "xe_drm.h"
|
|
||||||
|
|
||||||
using namespace NEO;
|
|
||||||
|
|
||||||
struct MockIoctlHelperXe : IoctlHelperXe {
|
|
||||||
using IoctlHelperXe::bindInfo;
|
|
||||||
using IoctlHelperXe::contextParamEngine;
|
|
||||||
using IoctlHelperXe::defaultEngine;
|
|
||||||
using IoctlHelperXe::getDefaultEngineClass;
|
|
||||||
using IoctlHelperXe::getFdFromVmExport;
|
|
||||||
using IoctlHelperXe::ioctl;
|
|
||||||
using IoctlHelperXe::IoctlHelperXe;
|
|
||||||
using IoctlHelperXe::maxContextSetProperties;
|
|
||||||
using IoctlHelperXe::maxExecQueuePriority;
|
|
||||||
using IoctlHelperXe::queryGtListData;
|
|
||||||
using IoctlHelperXe::setContextProperties;
|
|
||||||
using IoctlHelperXe::supportedFeatures;
|
|
||||||
using IoctlHelperXe::tileIdToGtId;
|
|
||||||
using IoctlHelperXe::UserFenceExtension;
|
|
||||||
using IoctlHelperXe::xeGetBindFlagNames;
|
|
||||||
using IoctlHelperXe::xeGetBindOperationName;
|
|
||||||
using IoctlHelperXe::xeGetClassName;
|
|
||||||
using IoctlHelperXe::xeGetengineClassName;
|
|
||||||
using IoctlHelperXe::xeGtListData;
|
|
||||||
using IoctlHelperXe::xeShowBindTable;
|
|
||||||
|
|
||||||
int perfOpenIoctl(DrmIoctl request, void *arg) override {
|
|
||||||
if (failPerfOpen) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return IoctlHelperXe::perfOpenIoctl(request, arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ioctl(int fd, DrmIoctl request, void *arg) override {
|
|
||||||
if (request == DrmIoctl::perfDisable) {
|
|
||||||
if (failPerfDisable) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (request == DrmIoctl::perfEnable) {
|
|
||||||
if (failPerfEnable) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return IoctlHelperXe::ioctl(fd, request, arg);
|
|
||||||
}
|
|
||||||
bool failPerfDisable = false;
|
|
||||||
bool failPerfEnable = false;
|
|
||||||
bool failPerfOpen = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline constexpr int testValueVmId = 0x5764;
|
inline constexpr int testValueVmId = 0x5764;
|
||||||
inline constexpr int testValueMapOff = 0x7788;
|
inline constexpr int testValueMapOff = 0x7788;
|
||||||
inline constexpr int testValuePrime = 0x4321;
|
inline constexpr int testValuePrime = 0x4321;
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "shared/source/os_interface/linux/xe/ioctl_helper_xe.h"
|
||||||
|
|
||||||
|
using namespace NEO;
|
||||||
|
|
||||||
|
struct MockIoctlHelperXe : IoctlHelperXe {
|
||||||
|
using IoctlHelperXe::bindInfo;
|
||||||
|
using IoctlHelperXe::contextParamEngine;
|
||||||
|
using IoctlHelperXe::defaultEngine;
|
||||||
|
using IoctlHelperXe::getDefaultEngineClass;
|
||||||
|
using IoctlHelperXe::getFdFromVmExport;
|
||||||
|
using IoctlHelperXe::ioctl;
|
||||||
|
using IoctlHelperXe::IoctlHelperXe;
|
||||||
|
using IoctlHelperXe::maxContextSetProperties;
|
||||||
|
using IoctlHelperXe::maxExecQueuePriority;
|
||||||
|
using IoctlHelperXe::queryGtListData;
|
||||||
|
using IoctlHelperXe::setContextProperties;
|
||||||
|
using IoctlHelperXe::supportedFeatures;
|
||||||
|
using IoctlHelperXe::tileIdToGtId;
|
||||||
|
using IoctlHelperXe::UserFenceExtension;
|
||||||
|
using IoctlHelperXe::xeGetBindFlagNames;
|
||||||
|
using IoctlHelperXe::xeGetBindOperationName;
|
||||||
|
using IoctlHelperXe::xeGetClassName;
|
||||||
|
using IoctlHelperXe::xeGetengineClassName;
|
||||||
|
using IoctlHelperXe::xeGtListData;
|
||||||
|
using IoctlHelperXe::xeShowBindTable;
|
||||||
|
|
||||||
|
int perfOpenIoctl(DrmIoctl request, void *arg) override {
|
||||||
|
if (failPerfOpen) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return IoctlHelperXe::perfOpenIoctl(request, arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ioctl(int fd, DrmIoctl request, void *arg) override {
|
||||||
|
if (request == DrmIoctl::perfDisable) {
|
||||||
|
if (failPerfDisable) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (request == DrmIoctl::perfEnable) {
|
||||||
|
if (failPerfEnable) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return IoctlHelperXe::ioctl(fd, request, arg);
|
||||||
|
}
|
||||||
|
bool failPerfDisable = false;
|
||||||
|
bool failPerfEnable = false;
|
||||||
|
bool failPerfOpen = false;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user