mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
L0 Core Add Support For pci_speed_ext
This patch adds support for reading PCI bandwidth, generation and linkwidth information from sysfs nodes for the linux platform. Related-To: LOCI-2969 Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
061af9c284
commit
05a150f49f
@@ -334,7 +334,7 @@ ze_result_t DeviceImp::getPciProperties(ze_pci_ext_properties_t *pPciProperties)
|
|||||||
}
|
}
|
||||||
pPciProperties->address = {pciBusInfo.pciDomain, pciBusInfo.pciBus,
|
pPciProperties->address = {pciBusInfo.pciDomain, pciBusInfo.pciBus,
|
||||||
pciBusInfo.pciDevice, pciBusInfo.pciFunction};
|
pciBusInfo.pciDevice, pciBusInfo.pciFunction};
|
||||||
pPciProperties->maxSpeed = {-1, -1, -1};
|
pPciProperties->maxSpeed = pciMaxSpeed;
|
||||||
return ZE_RESULT_SUCCESS;
|
return ZE_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -906,6 +906,13 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
|
|||||||
device->neoDevice->getHardwareInfo().platform.eProductFamily, device, &cmdQueueDesc, true, NEO::EngineGroupType::Copy, resultValue);
|
device->neoDevice->getHardwareInfo().platform.eProductFamily, device, &cmdQueueDesc, true, NEO::EngineGroupType::Copy, resultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (osInterface) {
|
||||||
|
auto pciSpeedInfo = osInterface->getDriverModel()->getPciSpeedInfo();
|
||||||
|
device->pciMaxSpeed.genVersion = pciSpeedInfo.genVersion;
|
||||||
|
device->pciMaxSpeed.maxBandwidth = pciSpeedInfo.maxBandwidth;
|
||||||
|
device->pciMaxSpeed.width = pciSpeedInfo.width;
|
||||||
|
}
|
||||||
|
|
||||||
if (device->getSourceLevelDebugger()) {
|
if (device->getSourceLevelDebugger()) {
|
||||||
auto osInterface = neoDevice->getRootDeviceEnvironment().osInterface.get();
|
auto osInterface = neoDevice->getRootDeviceEnvironment().osInterface.get();
|
||||||
device->getSourceLevelDebugger()
|
device->getSourceLevelDebugger()
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ struct DeviceImp : public Device {
|
|||||||
std::unordered_map<uint32_t, bool> crossAccessEnabledDevices;
|
std::unordered_map<uint32_t, bool> crossAccessEnabledDevices;
|
||||||
DriverHandle *driverHandle = nullptr;
|
DriverHandle *driverHandle = nullptr;
|
||||||
CommandList *pageFaultCommandList = nullptr;
|
CommandList *pageFaultCommandList = nullptr;
|
||||||
|
ze_pci_speed_ext_t pciMaxSpeed = {-1, -1, -1};
|
||||||
|
|
||||||
bool resourcesReleased = false;
|
bool resourcesReleased = false;
|
||||||
void releaseResources();
|
void releaseResources();
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ struct MockDriverModel : NEO::DriverModel {
|
|||||||
bool isGpuHangDetected(NEO::OsContext &osContext) override {
|
bool isGpuHangDetected(NEO::OsContext &osContext) override {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override { return {}; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MockDriverModelWDDM : NEO::DriverModel {
|
struct MockDriverModelWDDM : NEO::DriverModel {
|
||||||
@@ -55,6 +57,7 @@ struct MockDriverModelWDDM : NEO::DriverModel {
|
|||||||
size_t getMaxMemAllocSize() const override {
|
size_t getMaxMemAllocSize() const override {
|
||||||
return maxAllocSize;
|
return maxAllocSize;
|
||||||
}
|
}
|
||||||
|
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override { return {}; }
|
||||||
|
|
||||||
bool isGpuHangDetected(NEO::OsContext &osContext) override {
|
bool isGpuHangDetected(NEO::OsContext &osContext) override {
|
||||||
return false;
|
return false;
|
||||||
@@ -72,6 +75,7 @@ struct MockDriverModelDRM : NEO::DriverModel {
|
|||||||
size_t getMaxMemAllocSize() const override {
|
size_t getMaxMemAllocSize() const override {
|
||||||
return maxAllocSize;
|
return maxAllocSize;
|
||||||
}
|
}
|
||||||
|
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override { return {}; }
|
||||||
|
|
||||||
bool isGpuHangDetected(NEO::OsContext &osContext) override {
|
bool isGpuHangDetected(NEO::OsContext &osContext) override {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2020-2021 Intel Corporation
|
# Copyright (C) 2020-2022 Intel Corporation
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
#
|
||||||
@@ -7,5 +7,7 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test_device.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test_device_pci_speed_info.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test_device_pci_speed_info.h
|
||||||
)
|
)
|
||||||
add_subdirectories()
|
add_subdirectories()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2021 Intel Corporation
|
# Copyright (C) 2021-2022 Intel Corporation
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
#
|
||||||
@@ -8,5 +8,6 @@ if(UNIX)
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device_uuid.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test_device_uuid.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test_device_pci_speed_info_linux.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shared/test/common/mocks/mock_device.h"
|
||||||
|
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||||
|
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||||
|
|
||||||
|
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||||
|
#include "level_zero/core/test/unit_tests/sources/device/test_device_pci_speed_info.h"
|
||||||
|
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
namespace L0 {
|
||||||
|
namespace ult {
|
||||||
|
|
||||||
|
class PciSpeedInfoTestDriverModel : public MockDriverModel {
|
||||||
|
public:
|
||||||
|
PciSpeedInfoTestDriverModel() : MockDriverModel(0) {}
|
||||||
|
|
||||||
|
void setExpectedPciSpeedInfo(const PhyicalDevicePciSpeedInfo &pciSpeedInfo) {
|
||||||
|
returnedSpeedInfo = pciSpeedInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
NEO::PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override {
|
||||||
|
return returnedSpeedInfo;
|
||||||
|
}
|
||||||
|
NEO::PhysicalDevicePciBusInfo getPciBusInfo() const override {
|
||||||
|
return NEO::PhysicalDevicePciBusInfo(0, 1, 2, 3);
|
||||||
|
}
|
||||||
|
PhyicalDevicePciSpeedInfo returnedSpeedInfo = {-1, -1, -1};
|
||||||
|
};
|
||||||
|
|
||||||
|
void PciSpeedInfoTest::setPciSpeedInfo(NEO::ExecutionEnvironment *executionEnvironment, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo) {
|
||||||
|
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(
|
||||||
|
std::make_unique<PciSpeedInfoTestDriverModel>());
|
||||||
|
PciSpeedInfoTestDriverModel *driverModel = static_cast<PciSpeedInfoTestDriverModel *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel());
|
||||||
|
driverModel->setExpectedPciSpeedInfo(pciSpeedInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ult
|
||||||
|
} // namespace L0
|
||||||
@@ -33,7 +33,7 @@ HWTEST2_F(TestDeviceUuid, GivenCorrectTelemetryNodesAreAvailableWhenRetrievingDe
|
|||||||
|
|
||||||
VariableBackup<decltype(NEO::SysCalls::sysCallsReadlink)> mockReadLink(&NEO::SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(NEO::SysCalls::sysCallsReadlink)> mockReadLink(&NEO::SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
||||||
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
||||||
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
||||||
@@ -71,7 +71,7 @@ HWTEST2_F(TestDeviceUuid, GivenCorrectTelemetryNodesAreAvailableWhenRetrievingDe
|
|||||||
|
|
||||||
fd -= 1;
|
fd -= 1;
|
||||||
|
|
||||||
if ((fd) < static_cast<int>(supportedFiles.size())) {
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
if (supportedFiles[fd].second == "dummy") {
|
if (supportedFiles[fd].second == "dummy") {
|
||||||
uint64_t data = 0xFEEDBEADDEABDEEF;
|
uint64_t data = 0xFEEDBEADDEABDEEF;
|
||||||
memcpy(buf, &data, sizeof(data));
|
memcpy(buf, &data, sizeof(data));
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "level_zero/core/test/unit_tests/sources/device/test_device_pci_speed_info.h"
|
||||||
|
|
||||||
|
#include "shared/source/os_interface/driver_info.h"
|
||||||
|
#include "shared/test/common/mocks/mock_device.h"
|
||||||
|
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||||
|
|
||||||
|
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||||
|
|
||||||
|
namespace L0 {
|
||||||
|
namespace ult {
|
||||||
|
|
||||||
|
std::unique_ptr<NEO::UltDeviceFactory> PciSpeedInfoTest::createDevices(uint32_t numSubDevices, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo) {
|
||||||
|
|
||||||
|
DebugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
|
||||||
|
NEO::ExecutionEnvironment *executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get(), false, 1);
|
||||||
|
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new OSInterface);
|
||||||
|
executionEnvironment->memoryManager.reset(new MockMemoryManagerOsAgnosticContext(*executionEnvironment));
|
||||||
|
setPciSpeedInfo(executionEnvironment, pciSpeedInfo);
|
||||||
|
return std::make_unique<UltDeviceFactory>(1, numSubDevices, *executionEnvironment);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(PciSpeedInfoTest, givenSuccessfulReadingOfSpeedValuesCorrectValuesAreReturned) {
|
||||||
|
|
||||||
|
NEO::PhyicalDevicePciSpeedInfo expectedSpeedInfo;
|
||||||
|
expectedSpeedInfo.genVersion = 4;
|
||||||
|
expectedSpeedInfo.width = 1024;
|
||||||
|
expectedSpeedInfo.maxBandwidth = 4096;
|
||||||
|
|
||||||
|
auto deviceFactory = createDevices(2, expectedSpeedInfo);
|
||||||
|
auto driverHandle = std::make_unique<DriverHandleImp>();
|
||||||
|
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||||
|
auto device = std::unique_ptr<L0::Device>(L0::Device::create(driverHandle.get(), deviceFactory->rootDevices[0], false, &returnValue));
|
||||||
|
|
||||||
|
ze_pci_ext_properties_t pciProperties = {};
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, device->getPciProperties(&pciProperties));
|
||||||
|
EXPECT_EQ(4, pciProperties.maxSpeed.genVersion);
|
||||||
|
EXPECT_EQ(1024, pciProperties.maxSpeed.width);
|
||||||
|
EXPECT_EQ(4096, pciProperties.maxSpeed.maxBandwidth);
|
||||||
|
|
||||||
|
uint32_t subDeviceCount = 0;
|
||||||
|
device->getSubDevices(&subDeviceCount, nullptr);
|
||||||
|
EXPECT_EQ(subDeviceCount, 2u);
|
||||||
|
std::vector<ze_device_handle_t> subDevices;
|
||||||
|
subDevices.resize(subDeviceCount);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, device->getSubDevices(&subDeviceCount, subDevices.data()));
|
||||||
|
for (auto subDevice : subDevices) {
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zeDevicePciGetPropertiesExt(subDevice, &pciProperties));
|
||||||
|
EXPECT_EQ(4, pciProperties.maxSpeed.genVersion);
|
||||||
|
EXPECT_EQ(1024, pciProperties.maxSpeed.width);
|
||||||
|
EXPECT_EQ(4096, pciProperties.maxSpeed.maxBandwidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ult
|
||||||
|
} // namespace L0
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||||
|
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
namespace NEO {
|
||||||
|
struct PhyicalDevicePciSpeedInfo;
|
||||||
|
struct UltDeviceFactory;
|
||||||
|
class ExecutionEnvironment;
|
||||||
|
} // namespace NEO
|
||||||
|
|
||||||
|
namespace L0 {
|
||||||
|
namespace ult {
|
||||||
|
|
||||||
|
struct PciSpeedInfoTest : public ::testing::Test {
|
||||||
|
std::unique_ptr<NEO::UltDeviceFactory> createDevices(uint32_t numSubDevices, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo);
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setPciSpeedInfo(NEO::ExecutionEnvironment *executionEnvironment, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ult
|
||||||
|
} // namespace L0
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2022 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
#
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
target_sources(${TARGET_NAME} PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test_device_pci_speed_info_windows.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shared/test/common/mocks/mock_device.h"
|
||||||
|
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||||
|
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||||
|
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||||
|
|
||||||
|
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||||
|
#include "level_zero/core/test/unit_tests/sources/device/test_device_pci_speed_info.h"
|
||||||
|
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
namespace L0 {
|
||||||
|
namespace ult {
|
||||||
|
|
||||||
|
class PciSpeedInfoTestDriverModel : public WddmMock {
|
||||||
|
public:
|
||||||
|
PciSpeedInfoTestDriverModel(RootDeviceEnvironment &rootDeviceEnvironment) : WddmMock(rootDeviceEnvironment) {}
|
||||||
|
void setExpectedPciSpeedInfo(const PhyicalDevicePciSpeedInfo &pciSpeedInfo) {
|
||||||
|
returnedSpeedInfo = pciSpeedInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override {
|
||||||
|
return returnedSpeedInfo;
|
||||||
|
}
|
||||||
|
PhysicalDevicePciBusInfo getPciBusInfo() const override {
|
||||||
|
return NEO::PhysicalDevicePciBusInfo(0, 1, 2, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo returnedSpeedInfo = {-1, -1, -1};
|
||||||
|
};
|
||||||
|
|
||||||
|
void PciSpeedInfoTest::setPciSpeedInfo(NEO::ExecutionEnvironment *executionEnvironment, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo) {
|
||||||
|
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(
|
||||||
|
std::make_unique<PciSpeedInfoTestDriverModel>(*executionEnvironment->rootDeviceEnvironments[0]));
|
||||||
|
PciSpeedInfoTestDriverModel *driverModel = static_cast<PciSpeedInfoTestDriverModel *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel());
|
||||||
|
driverModel->setExpectedPciSpeedInfo(pciSpeedInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ult
|
||||||
|
} // namespace L0
|
||||||
@@ -366,6 +366,7 @@ class UnknownDriverModel : public DriverModel {
|
|||||||
PhysicalDevicePciBusInfo pciBusInfo(PhysicalDevicePciBusInfo::InvalidValue, PhysicalDevicePciBusInfo::InvalidValue, PhysicalDevicePciBusInfo::InvalidValue, PhysicalDevicePciBusInfo::InvalidValue);
|
PhysicalDevicePciBusInfo pciBusInfo(PhysicalDevicePciBusInfo::InvalidValue, PhysicalDevicePciBusInfo::InvalidValue, PhysicalDevicePciBusInfo::InvalidValue, PhysicalDevicePciBusInfo::InvalidValue);
|
||||||
return pciBusInfo;
|
return pciBusInfo;
|
||||||
}
|
}
|
||||||
|
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override { return {}; }
|
||||||
|
|
||||||
bool isGpuHangDetected(OsContext &osContext) override {
|
bool isGpuHangDetected(OsContext &osContext) override {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2021 Intel Corporation
|
* Copyright (C) 2018-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -31,6 +31,13 @@ struct PhysicalDevicePciBusInfo {
|
|||||||
uint32_t pciFunction = InvalidValue;
|
uint32_t pciFunction = InvalidValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct PhyicalDevicePciSpeedInfo {
|
||||||
|
static constexpr int32_t Unknown = -1;
|
||||||
|
int32_t genVersion = Unknown;
|
||||||
|
int32_t width = Unknown;
|
||||||
|
int64_t maxBandwidth = Unknown;
|
||||||
|
};
|
||||||
|
|
||||||
class DriverInfo {
|
class DriverInfo {
|
||||||
public:
|
public:
|
||||||
DriverInfo()
|
DriverInfo()
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <linux/limits.h>
|
#include <linux/limits.h>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
@@ -1497,4 +1498,88 @@ int Drm::createDrmVirtualMemory(uint32_t &drmVmId) {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo Drm::getPciSpeedInfo() const {
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = {};
|
||||||
|
|
||||||
|
std::string pathPrefix{};
|
||||||
|
bool isIntegratedDevice = rootDeviceEnvironment.getHardwareInfo()->capabilityTable.isIntegratedDevice;
|
||||||
|
// If integrated device, read properties from the specific device path.
|
||||||
|
// If discrete device, read properties from the root path of the pci device.
|
||||||
|
if (isIntegratedDevice) {
|
||||||
|
auto devicePath = NEO::getPciLinkPath(getFileDescriptor());
|
||||||
|
if (!devicePath.has_value()) {
|
||||||
|
return pciSpeedInfo;
|
||||||
|
}
|
||||||
|
pathPrefix = "/sys/class/drm/" + devicePath.value() + "/device/";
|
||||||
|
} else {
|
||||||
|
auto rootPath = NEO::getPciRootPath(getFileDescriptor());
|
||||||
|
if (!rootPath.has_value()) {
|
||||||
|
return pciSpeedInfo;
|
||||||
|
}
|
||||||
|
pathPrefix += "/sys/devices" + rootPath.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::array<char, 32> readString = {'\0'};
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
|
||||||
|
auto readFile = [](const std::string fileName, const std::string_view pathPrefix, std::array<char, 32> &readString) {
|
||||||
|
std::ostringstream linkWidthStream{};
|
||||||
|
linkWidthStream << pathPrefix << fileName;
|
||||||
|
|
||||||
|
int fd = NEO::SysCalls::open(linkWidthStream.str().c_str(), O_RDONLY);
|
||||||
|
ssize_t bytesRead = NEO::SysCalls::pread(fd, readString.data(), readString.size() - 1, 0);
|
||||||
|
NEO::SysCalls::close(fd);
|
||||||
|
if (bytesRead <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::replace(readString.begin(), readString.end(), '\n', '\0');
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// read max link width
|
||||||
|
if (readFile("/max_link_width", pathPrefix, readString) != true) {
|
||||||
|
return pciSpeedInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *endPtr = nullptr;
|
||||||
|
uint32_t linkWidth = static_cast<uint32_t>(std::strtoul(readString.data(), &endPtr, 10));
|
||||||
|
if ((endPtr == readString.data()) || (errno != 0)) {
|
||||||
|
return pciSpeedInfo;
|
||||||
|
}
|
||||||
|
pciSpeedInfo.width = linkWidth;
|
||||||
|
|
||||||
|
// read max link speed
|
||||||
|
if (readFile("/max_link_speed", pathPrefix, readString) != true) {
|
||||||
|
return pciSpeedInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
endPtr = nullptr;
|
||||||
|
const auto maxSpeed = strtod(readString.data(), &endPtr);
|
||||||
|
if ((endPtr == readString.data()) || (errno != 0)) {
|
||||||
|
return pciSpeedInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
double gen3EncodingLossFactor = 128.0 / 130.0;
|
||||||
|
std::map<double, std::pair<int32_t, double>> maxSpeedToGenAndEncodingLossMapping{
|
||||||
|
//{max link speed, {pci generation, encoding loss factor}}
|
||||||
|
{2.5, {1, 0.2}},
|
||||||
|
{5.0, {2, 0.2}},
|
||||||
|
{8.0, {3, gen3EncodingLossFactor}},
|
||||||
|
{16.0, {4, gen3EncodingLossFactor}},
|
||||||
|
{32.0, {5, gen3EncodingLossFactor}}};
|
||||||
|
|
||||||
|
if (maxSpeedToGenAndEncodingLossMapping.find(maxSpeed) == maxSpeedToGenAndEncodingLossMapping.end()) {
|
||||||
|
return pciSpeedInfo;
|
||||||
|
}
|
||||||
|
pciSpeedInfo.genVersion = maxSpeedToGenAndEncodingLossMapping[maxSpeed].first;
|
||||||
|
|
||||||
|
constexpr double gigaBitsPerSecondToBytesPerSecondMultiplier = 125000000;
|
||||||
|
const auto maxSpeedWithEncodingLoss = maxSpeed * gigaBitsPerSecondToBytesPerSecondMultiplier * maxSpeedToGenAndEncodingLossMapping[maxSpeed].second;
|
||||||
|
pciSpeedInfo.maxBandwidth = maxSpeedWithEncodingLoss * pciSpeedInfo.width;
|
||||||
|
|
||||||
|
return pciSpeedInfo;
|
||||||
|
}
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ class Drm : public DriverModel {
|
|||||||
unsigned int getDeviceHandle() const override {
|
unsigned int getDeviceHandle() const override {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override;
|
||||||
int getDeviceRevID(int &revId);
|
int getDeviceRevID(int &revId);
|
||||||
int getExecSoftPin(int &execSoftPin);
|
int getExecSoftPin(int &execSoftPin);
|
||||||
int enableTurboBoost();
|
int enableTurboBoost();
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 Intel Corporation
|
* Copyright (C) 2021-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace UuidUtil {
|
namespace UuidUtil {
|
||||||
static inline bool UuidGetRootPciPath(Drm *pDrm, std::string &rootPciPath);
|
|
||||||
static inline bool UuidReadFromTelem(std::string_view telemDir, std::array<char, PmtUtil::guidStringSize> &guidString,
|
static inline bool UuidReadFromTelem(std::string_view telemDir, std::array<char, PmtUtil::guidStringSize> &guidString,
|
||||||
const uint64_t offset, const uint8_t deviceIndex, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid);
|
const uint64_t offset, const uint8_t deviceIndex, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid);
|
||||||
} // namespace UuidUtil
|
} // namespace UuidUtil
|
||||||
@@ -20,13 +19,13 @@ bool HwInfoConfigHw<gfxProduct>::getUuid(Device *device, std::array<uint8_t, HwI
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto pDrm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<Drm>();
|
auto pDrm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<Drm>();
|
||||||
std::string rootPciPath;
|
std::optional<std::string> rootPciPath = getPciRootPath(pDrm->getFileDescriptor());
|
||||||
if (!UuidUtil::UuidGetRootPciPath(pDrm, rootPciPath)) {
|
if (!rootPciPath.has_value()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<uint32_t, std::string> telemPciPath;
|
std::map<uint32_t, std::string> telemPciPath;
|
||||||
PmtUtil::getTelemNodesInPciPath(rootPciPath, telemPciPath);
|
PmtUtil::getTelemNodesInPciPath(rootPciPath.value(), telemPciPath);
|
||||||
|
|
||||||
// number of telem nodes must be same as subdevice count + 1(root device)
|
// number of telem nodes must be same as subdevice count + 1(root device)
|
||||||
if (telemPciPath.size() < device->getRootDevice()->getNumSubDevices() + 1) {
|
if (telemPciPath.size() < device->getRootDevice()->getNumSubDevices() + 1) {
|
||||||
@@ -52,21 +51,6 @@ bool HwInfoConfigHw<gfxProduct>::getUuid(Device *device, std::array<uint8_t, HwI
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace UuidUtil {
|
namespace UuidUtil {
|
||||||
bool UuidGetRootPciPath(Drm *pDrm, std::string &rootPciPath) {
|
|
||||||
|
|
||||||
auto pciLinkPath = NEO::getPciLinkPath(pDrm->getFileDescriptor());
|
|
||||||
// pciLinkPath = "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128/",
|
|
||||||
// then root path = "/pci0000:37/0000:37:01.0"
|
|
||||||
if (pciLinkPath == std::nullopt) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto startPos = pciLinkPath->find("/pci");
|
|
||||||
auto endPos = pciLinkPath->find("/", startPos + 1);
|
|
||||||
endPos = pciLinkPath->find("/", endPos + 1);
|
|
||||||
rootPciPath = pciLinkPath->substr(startPos, endPos - startPos);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UuidReadFromTelem(std::string_view telemDir, std::array<char, PmtUtil::guidStringSize> &guidString, const uint64_t offset,
|
bool UuidReadFromTelem(std::string_view telemDir, std::array<char, PmtUtil::guidStringSize> &guidString, const uint64_t offset,
|
||||||
const uint8_t deviceIndex, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) {
|
const uint8_t deviceIndex, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 Intel Corporation
|
* Copyright (C) 2021-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -27,7 +27,8 @@ std::optional<std::string> getPciLinkPath(int deviceFd) {
|
|||||||
|
|
||||||
int readLinkSize = 0;
|
int readLinkSize = 0;
|
||||||
char devicePath[256] = {0};
|
char devicePath[256] = {0};
|
||||||
readLinkSize = SysCalls::readlink(path, devicePath, pathlen);
|
size_t devicePathLength = 256;
|
||||||
|
readLinkSize = SysCalls::readlink(path, devicePath, devicePathLength);
|
||||||
|
|
||||||
if (readLinkSize == -1) {
|
if (readLinkSize == -1) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
@@ -46,4 +47,32 @@ std::optional<std::string> getPciPath(int deviceFd) {
|
|||||||
|
|
||||||
return deviceLinkPath->substr(deviceLinkPath->find("/drm/render") - 12u, 12u);
|
return deviceLinkPath->substr(deviceLinkPath->find("/drm/render") - 12u, 12u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> getPciRootPath(int deviceFd) {
|
||||||
|
|
||||||
|
auto pciLinkPath = NEO::getPciLinkPath(deviceFd);
|
||||||
|
// pciLinkPath = "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128/",
|
||||||
|
// Then root path = "/pci0000:37/0000:37:01.0/0000:38:00.0/"
|
||||||
|
if (pciLinkPath == std::nullopt) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto startPos = pciLinkPath->find("/pci");
|
||||||
|
if (startPos == std::string::npos) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Root PCI path is at 2 levels up from drm/renderD128
|
||||||
|
uint32_t rootPciDepth = 4;
|
||||||
|
auto endPos = std::string::npos;
|
||||||
|
while (rootPciDepth--) {
|
||||||
|
endPos = pciLinkPath->rfind('/', endPos - 1);
|
||||||
|
if (endPos == std::string::npos) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pciLinkPath->substr(startPos, endPos - startPos);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 Intel Corporation
|
* Copyright (C) 2021-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -14,5 +14,6 @@ namespace NEO {
|
|||||||
|
|
||||||
std::optional<std::string> getPciPath(int deviceFd);
|
std::optional<std::string> getPciPath(int deviceFd);
|
||||||
std::optional<std::string> getPciLinkPath(int deviceFd);
|
std::optional<std::string> getPciLinkPath(int deviceFd);
|
||||||
|
std::optional<std::string> getPciRootPath(int deviceFd);
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
@@ -77,6 +77,7 @@ class DriverModel : public NonCopyableClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual PhysicalDevicePciBusInfo getPciBusInfo() const = 0;
|
virtual PhysicalDevicePciBusInfo getPciBusInfo() const = 0;
|
||||||
|
virtual PhyicalDevicePciSpeedInfo getPciSpeedInfo() const = 0;
|
||||||
|
|
||||||
virtual size_t getMaxMemAllocSize() const {
|
virtual size_t getMaxMemAllocSize() const {
|
||||||
return std::numeric_limits<size_t>::max();
|
return std::numeric_limits<size_t>::max();
|
||||||
|
|||||||
@@ -1078,4 +1078,9 @@ PhysicalDevicePciBusInfo Wddm::getPciBusInfo() const {
|
|||||||
return PhysicalDevicePciBusInfo(0, adapterBDF.Bus, adapterBDF.Device, adapterBDF.Function);
|
return PhysicalDevicePciBusInfo(0, adapterBDF.Bus, adapterBDF.Device, adapterBDF.Function);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo Wddm::getPciSpeedInfo() const {
|
||||||
|
PhyicalDevicePciSpeedInfo speedInfo{};
|
||||||
|
return speedInfo;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ class Wddm : public DriverModel {
|
|||||||
return adapterBDF;
|
return adapterBDF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<HwDeviceIdWddm> hwDeviceId;
|
std::unique_ptr<HwDeviceIdWddm> hwDeviceId;
|
||||||
D3DKMT_HANDLE device = 0;
|
D3DKMT_HANDLE device = 0;
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ class MockDriverModel : public NEO::DriverModel {
|
|||||||
return isGpuHangDetectedToReturn;
|
return isGpuHangDetectedToReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override { return {}; }
|
||||||
|
|
||||||
NEO::PhysicalDevicePciBusInfo pciBusInfo{};
|
NEO::PhysicalDevicePciBusInfo pciBusInfo{};
|
||||||
bool isGpuHangDetectedToReturn{};
|
bool isGpuHangDetectedToReturn{};
|
||||||
std::function<void()> isGpuHangDetectedSideEffect{};
|
std::function<void()> isGpuHangDetectedSideEffect{};
|
||||||
|
|||||||
@@ -371,4 +371,16 @@ class MockMemoryManagerFailFirstAllocation : public MockMemoryManager {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MockMemoryManagerOsAgnosticContext : public MockMemoryManager {
|
||||||
|
public:
|
||||||
|
MockMemoryManagerOsAgnosticContext(NEO::ExecutionEnvironment &executionEnvironment) : MockMemoryManager(executionEnvironment) {}
|
||||||
|
OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver,
|
||||||
|
const EngineDescriptor &engineDescriptor) override {
|
||||||
|
auto osContext = new OsContext(0, engineDescriptor);
|
||||||
|
osContext->incRefInternal();
|
||||||
|
registeredEngines.emplace_back(commandStreamReceiver, osContext);
|
||||||
|
return osContext;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ TEST_F(DeviceGetCapsTest, whenDriverModelHasLimitationForMaxMemoryAllocationSize
|
|||||||
size_t getMaxMemAllocSize() const override {
|
size_t getMaxMemAllocSize() const override {
|
||||||
return maxAllocSize;
|
return maxAllocSize;
|
||||||
}
|
}
|
||||||
|
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override { return {}; }
|
||||||
};
|
};
|
||||||
|
|
||||||
DebugManagerStateRestore dbgRestorer;
|
DebugManagerStateRestore dbgRestorer;
|
||||||
|
|||||||
@@ -17,18 +17,6 @@
|
|||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
class MockMemoryManagerOsAgnosticContext : public MockMemoryManager {
|
|
||||||
public:
|
|
||||||
MockMemoryManagerOsAgnosticContext(ExecutionEnvironment &executionEnvironment) : MockMemoryManager(executionEnvironment) {}
|
|
||||||
OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver,
|
|
||||||
const EngineDescriptor &engineDescriptor) override {
|
|
||||||
auto osContext = new OsContext(0, engineDescriptor);
|
|
||||||
osContext->incRefInternal();
|
|
||||||
registeredEngines.emplace_back(commandStreamReceiver, osContext);
|
|
||||||
return osContext;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <PRODUCT_FAMILY gfxProduct>
|
template <PRODUCT_FAMILY gfxProduct>
|
||||||
class MockHwInfoConfigHw : public HwInfoConfigHw<gfxProduct> {
|
class MockHwInfoConfigHw : public HwInfoConfigHw<gfxProduct> {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ set(NEO_CORE_OS_INTERFACE_TESTS_LINUX
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_special_heap_test.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_special_heap_test.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_uuid_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_uuid_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/os_context_linux_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/os_context_linux_tests.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_pci_speed_info_tests.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NEO_ENABLE_i915_PRELIM_DETECTION)
|
if(NEO_ENABLE_i915_PRELIM_DETECTION)
|
||||||
|
|||||||
@@ -0,0 +1,320 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "shared/source/helpers/string.h"
|
||||||
|
#include "shared/source/os_interface/linux/os_context_linux.h"
|
||||||
|
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||||
|
#include "shared/test/common/helpers/variable_backup.h"
|
||||||
|
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||||
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||||
|
#include "shared/test/common/os_interface/linux/sys_calls_linux_ult.h"
|
||||||
|
#include "shared/test/common/test_macros/test.h"
|
||||||
|
|
||||||
|
using namespace NEO;
|
||||||
|
|
||||||
|
struct DrmPciSpeedInfoTest : public ::testing::Test {
|
||||||
|
|
||||||
|
void SetUp() override {
|
||||||
|
|
||||||
|
SysCalls::sysCallsReadlink = mockReadLink;
|
||||||
|
SysCalls::sysCallsOpen = mockOpenDiscrete;
|
||||||
|
SysCalls::sysCallsPread = mockPreadDiscrete;
|
||||||
|
}
|
||||||
|
void TearDown() override {
|
||||||
|
SysCalls::sysCallsReadlink = sysCallsReadlinkBackup;
|
||||||
|
SysCalls::sysCallsOpen = sysCallsOpenBackup;
|
||||||
|
SysCalls::sysCallsPread = sysCallsPreadBackup;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<DrmMock> getDrm(bool isTestIntegratedDevice) {
|
||||||
|
HardwareInfo hwInfo = *defaultHwInfo.get();
|
||||||
|
hwInfo.capabilityTable.isIntegratedDevice = isTestIntegratedDevice;
|
||||||
|
executionEnvironment = std::make_unique<MockExecutionEnvironment>(&hwInfo, false, 1);
|
||||||
|
return std::make_unique<DrmMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
decltype(SysCalls::sysCallsReadlink) mockReadLink = [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
|
std::string linkString("../../devices/pci0000:00/0000:00:02.0/0000:00:02.0/0000:00:02.0/drm/renderD128");
|
||||||
|
memcpy_s(buf, bufsize, linkString.c_str(), linkString.size());
|
||||||
|
return static_cast<int>(linkString.size());
|
||||||
|
};
|
||||||
|
|
||||||
|
decltype(SysCalls::sysCallsOpen) mockOpenDiscrete = [](const char *pathname, int flags) -> int {
|
||||||
|
std::vector<std::string> supportedFiles = {
|
||||||
|
"/sys/devices/pci0000:00/0000:00:02.0/max_link_width",
|
||||||
|
"/sys/devices/pci0000:00/0000:00:02.0/max_link_speed"};
|
||||||
|
auto itr = std::find(supportedFiles.begin(), supportedFiles.end(), std::string(pathname));
|
||||||
|
if (itr != supportedFiles.end()) {
|
||||||
|
// skipping "0"
|
||||||
|
return static_cast<int>(std::distance(supportedFiles.begin(), itr)) + 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
decltype(SysCalls::sysCallsPread) mockPreadDiscrete = [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||||
|
std::vector<std::pair<std::string, std::string>> supportedFiles = {
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_width", "64"},
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_speed", "32"},
|
||||||
|
};
|
||||||
|
fd -= 1;
|
||||||
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
|
memcpy_s(buf, count, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
|
return supportedFiles[fd].second.size();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
decltype(SysCalls::sysCallsReadlink) sysCallsReadlinkBackup = SysCalls::sysCallsReadlink;
|
||||||
|
decltype(SysCalls::sysCallsOpen) sysCallsOpenBackup = SysCalls::sysCallsOpen;
|
||||||
|
decltype(SysCalls::sysCallsPread) sysCallsPreadBackup = SysCalls::sysCallsPread;
|
||||||
|
std::unique_ptr<ExecutionEnvironment> executionEnvironment = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenIntegratedDeviceWhenCorrectInputsAreGivenThenCorrectPciSpeedIsReturned) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(SysCalls::sysCallsOpen)> mockOpenIntegrated(&SysCalls::sysCallsOpen, [](const char *pathname, int flags) -> int {
|
||||||
|
std::vector<std::string> supportedFiles = {
|
||||||
|
"/sys/class/drm/../../devices/pci0000:00/0000:00:02.0/0000:00:02.0/0000:00:02.0/drm/renderD128/device//max_link_width",
|
||||||
|
"/sys/class/drm/../../devices/pci0000:00/0000:00:02.0/0000:00:02.0/0000:00:02.0/drm/renderD128/device//max_link_speed"};
|
||||||
|
auto itr = std::find(supportedFiles.begin(), supportedFiles.end(), std::string(pathname));
|
||||||
|
if (itr != supportedFiles.end()) {
|
||||||
|
// skipping "0"
|
||||||
|
return static_cast<int>(std::distance(supportedFiles.begin(), itr)) + 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
VariableBackup<decltype(SysCalls::sysCallsPread)> mockPreadIntegrated(&SysCalls::sysCallsPread, [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||||
|
std::vector<std::pair<std::string, std::string>> supportedFiles = {
|
||||||
|
{"/sys/class/drm/../../devices/pci0000:00/0000:00:02.0/0000:00:02.0/0000:00:02.0/drm/renderD128/device//max_link_width", "64"},
|
||||||
|
{"/sys/class/drm/../../devices/pci0000:00/0000:00:02.0/0000:00:02.0/0000:00:02.0/drm/renderD128/device//max_link_speed", "16.0 GT/s PCIe \n test"},
|
||||||
|
};
|
||||||
|
fd -= 1;
|
||||||
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
|
memcpy_s(buf, count, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
|
return supportedFiles[fd].second.size();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(true)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(4, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(64, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(126030769230, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenCorrectInputsAreGivenThenCorrectPciSpeedIsReturned) {
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(5, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(64, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(252061538461, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenIntegratedDeviceWhenPciLinkPathFailsThenUnknownPciSpeedIsReturned) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsReadlink)> mockReadLink(&NEO::SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(true)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenPciRootPathFailsThenUnknownPciSpeedIsReturned) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsReadlink)> mockReadLink(&NEO::SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenPciRootPathFailsDueToMissingPciThenUnknownPciSpeedIsReturned) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsReadlink)> mockReadLink(&NEO::SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
|
std::string linkString("../../devices/");
|
||||||
|
memcpy_s(buf, bufsize, linkString.c_str(), linkString.size());
|
||||||
|
return static_cast<int>(linkString.size());
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenPciRootPathFailsDueToUnavailableDirectoryPathThenUnknownPciSpeedIsReturned) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsReadlink)> mockReadLink(&NEO::SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
|
std::string linkString("../../devices/pci0000:00");
|
||||||
|
memcpy_s(buf, bufsize, linkString.c_str(), linkString.size());
|
||||||
|
return static_cast<int>(linkString.size());
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenPreadReturnsNegativeValueWhenAccessingSysfsNodesThenUnknownPciSpeedIsReturned) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenPreadReturnsZeroWhenAccessingSysfsNodesThenUnknownPciSpeedIsReturned) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenReadingLinkWidthStrtoulFailsWithNoValidConversionUnknownThenPciSpeedIsReturned) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||||
|
std::vector<std::pair<std::string, std::string>> supportedFiles = {
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_width", "Unknown"},
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_speed", "32"},
|
||||||
|
};
|
||||||
|
fd -= 1;
|
||||||
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
|
memcpy_s(buf, count, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
|
return supportedFiles[fd].second.size();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenReadingLinkWidthStrtoulFailsWithErrnoSetUnknownThenPciSpeedIsReturned) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||||
|
std::vector<std::pair<std::string, std::string>> supportedFiles = {
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_width", "64"},
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_speed", "32"},
|
||||||
|
};
|
||||||
|
fd -= 1;
|
||||||
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
|
memcpy_s(buf, count, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
|
errno = 22;
|
||||||
|
return supportedFiles[fd].second.size();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenReadingMaxLinkSpeedFailsThenUnknownPciSpeedIsReturnedForGenVersionAndMaxBandwidth) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||||
|
std::vector<std::pair<std::string, std::string>> supportedFiles = {
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_width", "64"},
|
||||||
|
};
|
||||||
|
fd -= 1;
|
||||||
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
|
memcpy_s(buf, count, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
|
return supportedFiles[fd].second.size();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(64, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenReadingLinkSpeedStrtoulFailsWithNoValidConversionThenUnknownPciSpeedIsReturnedForGenVersionAndMaxBandwidth) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||||
|
std::vector<std::pair<std::string, std::string>> supportedFiles = {
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_width", "64"},
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_speed", "Unknown"},
|
||||||
|
};
|
||||||
|
fd -= 1;
|
||||||
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
|
memcpy_s(buf, count, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
|
return supportedFiles[fd].second.size();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(64, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenReadingLinkSpeedStrtodFailsWithErrnoSetThenUnknownPciSpeedIsReturnedForGenVersionAndMaxBandwidth) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||||
|
std::vector<std::pair<std::string, std::string>> supportedFiles = {
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_width", "64"},
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_speed", "32"},
|
||||||
|
};
|
||||||
|
fd -= 1;
|
||||||
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
|
memcpy_s(buf, count, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
|
if (fd == 1) {
|
||||||
|
errno = 22;
|
||||||
|
}
|
||||||
|
return supportedFiles[fd].second.size();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(64, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(DrmPciSpeedInfoTest, givenDiscreteDeviceWhenUnSupportedLinkSpeedIsReadThenUnknownPciSpeedIsReturnedForGenVersionAndMaxBandwidth) {
|
||||||
|
|
||||||
|
VariableBackup<decltype(NEO::SysCalls::sysCallsPread)> mockPread(&NEO::SysCalls::sysCallsPread, [](int fd, void *buf, size_t count, off_t offset) -> ssize_t {
|
||||||
|
std::vector<std::pair<std::string, std::string>> supportedFiles = {
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_width", "64"},
|
||||||
|
{"/sys/devices/pci0000:00/0000:00:02.0/max_link_speed", "0 32"},
|
||||||
|
};
|
||||||
|
fd -= 1;
|
||||||
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
|
memcpy_s(buf, count, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
|
return supportedFiles[fd].second.size();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
PhyicalDevicePciSpeedInfo pciSpeedInfo = getDrm(false)->getPciSpeedInfo();
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.genVersion);
|
||||||
|
EXPECT_EQ(64, pciSpeedInfo.width);
|
||||||
|
EXPECT_EQ(-1, pciSpeedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 Intel Corporation
|
* Copyright (C) 2021-2022 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -64,7 +64,7 @@ using namespace NEO;
|
|||||||
HWTEST2_F(MultipleDeviceUuidTest, whenRetrievingDeviceUuidThenCorrectUuidIsReceived, IsXEHP) {
|
HWTEST2_F(MultipleDeviceUuidTest, whenRetrievingDeviceUuidThenCorrectUuidIsReceived, IsXEHP) {
|
||||||
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/crashlog1", "../../devices/pci0000:6a/0000:6a:03.1/intel-dvsec-4.4.auto/intel_pmt/crashlog1/"},
|
{"/sys/class/intel_pmt/crashlog1", "../../devices/pci0000:6a/0000:6a:03.1/intel-dvsec-4.4.auto/intel_pmt/crashlog1/"},
|
||||||
{"/sys/class/intel_pmt/crashlog2", "../../devices/pci0000:6a/0000:6a:03.1/intel-dvsec-4.4.auto/intel_pmt/crashlog2/"},
|
{"/sys/class/intel_pmt/crashlog2", "../../devices/pci0000:6a/0000:6a:03.1/intel-dvsec-4.4.auto/intel_pmt/crashlog2/"},
|
||||||
{"/sys/class/intel_pmt/crashlog3", "../../devices/pci0000:e8/0000:e8:03.1/intel-dvsec-4.8.auto/intel_pmt/crashlog3/"},
|
{"/sys/class/intel_pmt/crashlog3", "../../devices/pci0000:e8/0000:e8:03.1/intel-dvsec-4.8.auto/intel_pmt/crashlog3/"},
|
||||||
@@ -116,7 +116,7 @@ HWTEST2_F(MultipleDeviceUuidTest, whenRetrievingDeviceUuidThenCorrectUuidIsRecei
|
|||||||
|
|
||||||
fd -= 1;
|
fd -= 1;
|
||||||
|
|
||||||
if ((fd) < static_cast<int>(supportedFiles.size())) {
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
if (supportedFiles[fd].second == "dummy") {
|
if (supportedFiles[fd].second == "dummy") {
|
||||||
uint64_t data = 0xFEEDBEADDEABDEEF;
|
uint64_t data = 0xFEEDBEADDEABDEEF;
|
||||||
memcpy(buf, &data, sizeof(data));
|
memcpy(buf, &data, sizeof(data));
|
||||||
@@ -154,7 +154,7 @@ HWTEST2_F(MultipleDeviceUuidTest, whenRetrievingDeviceUuidThenCorrectUuidIsRecei
|
|||||||
|
|
||||||
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/crashlog1", "../../devices/pci0000:6a/0000:6a:03.1/intel-dvsec-4.4.auto/intel_pmt/crashlog1/"},
|
{"/sys/class/intel_pmt/crashlog1", "../../devices/pci0000:6a/0000:6a:03.1/intel-dvsec-4.4.auto/intel_pmt/crashlog1/"},
|
||||||
{"/sys/class/intel_pmt/crashlog2", "../../devices/pci0000:6a/0000:6a:03.1/intel-dvsec-4.4.auto/intel_pmt/crashlog2/"},
|
{"/sys/class/intel_pmt/crashlog2", "../../devices/pci0000:6a/0000:6a:03.1/intel-dvsec-4.4.auto/intel_pmt/crashlog2/"},
|
||||||
{"/sys/class/intel_pmt/crashlog3", "../../devices/pci0000:e8/0000:e8:03.1/intel-dvsec-4.8.auto/intel_pmt/crashlog3/"},
|
{"/sys/class/intel_pmt/crashlog3", "../../devices/pci0000:e8/0000:e8:03.1/intel-dvsec-4.8.auto/intel_pmt/crashlog3/"},
|
||||||
@@ -208,7 +208,7 @@ HWTEST2_F(MultipleDeviceUuidTest, whenRetrievingDeviceUuidThenCorrectUuidIsRecei
|
|||||||
|
|
||||||
fd -= 1;
|
fd -= 1;
|
||||||
|
|
||||||
if ((fd) < static_cast<int>(supportedFiles.size())) {
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
if (supportedFiles[fd].second == "dummy") {
|
if (supportedFiles[fd].second == "dummy") {
|
||||||
uint64_t data = 0xFEEDBEADDEABDEEF;
|
uint64_t data = 0xFEEDBEADDEABDEEF;
|
||||||
memcpy(buf, &data, sizeof(data));
|
memcpy(buf, &data, sizeof(data));
|
||||||
@@ -260,7 +260,7 @@ HWTEST2_F(MultipleDeviceUuidTest, givenTelemDirectoriesAreLessThanExpectedWhenRe
|
|||||||
|
|
||||||
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
||||||
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
||||||
};
|
};
|
||||||
@@ -294,7 +294,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenMissingGuidWhenRetrievingUuidForSubDevice
|
|||||||
|
|
||||||
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
||||||
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
||||||
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
||||||
@@ -330,7 +330,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenMissingGuidWhenRetrievingUuidForSubDevice
|
|||||||
|
|
||||||
fd -= 1;
|
fd -= 1;
|
||||||
|
|
||||||
if ((fd) < static_cast<int>(supportedFiles.size())) {
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
if (supportedFiles[fd].second == "dummy") {
|
if (supportedFiles[fd].second == "dummy") {
|
||||||
uint64_t data = 0xFEEDBEADDEABDEEF;
|
uint64_t data = 0xFEEDBEADDEABDEEF;
|
||||||
memcpy(buf, &data, sizeof(data));
|
memcpy(buf, &data, sizeof(data));
|
||||||
@@ -356,7 +356,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectGuidWhenRetrievingUuidForSubDevi
|
|||||||
|
|
||||||
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
||||||
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
||||||
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
||||||
@@ -402,7 +402,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenMissingOffsetWhenRetrievingUuidForSubDevi
|
|||||||
|
|
||||||
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
||||||
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
||||||
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
||||||
@@ -437,7 +437,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenMissingOffsetWhenRetrievingUuidForSubDevi
|
|||||||
|
|
||||||
fd -= 1;
|
fd -= 1;
|
||||||
|
|
||||||
if ((fd) < static_cast<int>(supportedFiles.size())) {
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
return supportedFiles[fd].second.size();
|
return supportedFiles[fd].second.size();
|
||||||
}
|
}
|
||||||
@@ -458,7 +458,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectOffsetWhenRetrievingUuidForSubDe
|
|||||||
|
|
||||||
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
||||||
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
||||||
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
||||||
@@ -493,7 +493,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectOffsetWhenRetrievingUuidForSubDe
|
|||||||
};
|
};
|
||||||
|
|
||||||
fd -= 1;
|
fd -= 1;
|
||||||
if ((fd) < static_cast<int>(supportedFiles.size())) {
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
return supportedFiles[fd].second.size();
|
return supportedFiles[fd].second.size();
|
||||||
}
|
}
|
||||||
@@ -513,7 +513,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenMissingTelemNodeWhenRetrievingUuidThenFai
|
|||||||
|
|
||||||
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
||||||
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
||||||
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
||||||
@@ -548,7 +548,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenMissingTelemNodeWhenRetrievingUuidThenFai
|
|||||||
|
|
||||||
fd -= 1;
|
fd -= 1;
|
||||||
|
|
||||||
if ((fd) < static_cast<int>(supportedFiles.size())) {
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
return supportedFiles[fd].second.size();
|
return supportedFiles[fd].second.size();
|
||||||
}
|
}
|
||||||
@@ -564,7 +564,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectTelemNodeWhenRetrievingUuidThenF
|
|||||||
|
|
||||||
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
||||||
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
||||||
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
||||||
@@ -600,7 +600,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectTelemNodeWhenRetrievingUuidThenF
|
|||||||
|
|
||||||
fd -= 1;
|
fd -= 1;
|
||||||
|
|
||||||
if ((fd) < static_cast<int>(supportedFiles.size())) {
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
return supportedFiles[fd].second.size();
|
return supportedFiles[fd].second.size();
|
||||||
}
|
}
|
||||||
@@ -616,7 +616,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectGuidValueWhenRetrievingUuidThenF
|
|||||||
|
|
||||||
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
VariableBackup<decltype(SysCalls::sysCallsReadlink)> mockReadLink(&SysCalls::sysCallsReadlink, [](const char *path, char *buf, size_t bufsize) -> int {
|
||||||
std::map<std::string, std::string> fileNameLinkMap = {
|
std::map<std::string, std::string> fileNameLinkMap = {
|
||||||
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/i915-spi.2.auto/mtd/mtd0/mtd3/"},
|
{"/sys/dev/char/226:128", "../../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:01.0/0000:3a:00.0/drm/renderD128"},
|
||||||
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
{"/sys/class/intel_pmt/telem3", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem3/"},
|
||||||
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
{"/sys/class/intel_pmt/telem1", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem1/"},
|
||||||
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
{"/sys/class/intel_pmt/telem2", "./../devices/pci0000:37/0000:37:01.0/0000:38:00.0/0000:39:02.0/0000:3c:00.1/intel-dvsec-2.1.auto/intel_pmt/telem2/"},
|
||||||
@@ -653,7 +653,7 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectGuidValueWhenRetrievingUuidThenF
|
|||||||
|
|
||||||
fd -= 1;
|
fd -= 1;
|
||||||
|
|
||||||
if ((fd) < static_cast<int>(supportedFiles.size())) {
|
if ((fd >= 0) && (fd < static_cast<int>(supportedFiles.size()))) {
|
||||||
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
memcpy(buf, supportedFiles[fd].second.c_str(), supportedFiles[fd].second.size());
|
||||||
return supportedFiles[fd].second.size();
|
return supportedFiles[fd].second.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,4 +83,16 @@ TEST_F(WddmTests, whenCreatingContextWithPowerHintSuccessIsReturned) {
|
|||||||
EXPECT_TRUE(wddm->createContext(*newContext));
|
EXPECT_TRUE(wddm->createContext(*newContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(WddmPciSpeedInfoTest, WhenGetPciSpeedInfoIsCalledThenUnknownIsReturned) {
|
||||||
|
MockExecutionEnvironment executionEnvironment;
|
||||||
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
||||||
|
auto wddm = Wddm::createWddm(nullptr, rootDeviceEnvironment);
|
||||||
|
wddm->init();
|
||||||
|
auto speedInfo = wddm->getPciSpeedInfo();
|
||||||
|
|
||||||
|
EXPECT_EQ(-1, speedInfo.genVersion);
|
||||||
|
EXPECT_EQ(-1, speedInfo.width);
|
||||||
|
EXPECT_EQ(-1, speedInfo.maxBandwidth);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
Reference in New Issue
Block a user