SysMan:fix device reset

The distance from the SGUnit to the  Root port is constant.
calculating the Rootport and Cardbus based on this observation.
the root port and card bus are used by Warmreset function to
preserve the PCI config space.

Resolves: LOCI-2899

Signed-off-by: Vilvaraj, T J Vivek <t.j.vivek.vilvaraj@intel.com>
This commit is contained in:
Vilvaraj, T J Vivek
2022-06-16 13:02:42 +00:00
committed by Compute-Runtime-Automation
parent 82d3901978
commit 894f90f89e
13 changed files with 95 additions and 151 deletions

View File

@@ -121,7 +121,6 @@ ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
result = pProcfsAccess->listProcesses(processes); result = pProcfsAccess->listProcesses(processes);
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
return result; return result;
} }
for (auto &&pid : processes) { for (auto &&pid : processes) {
@@ -137,7 +136,6 @@ ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
} else { } else {
// Device is in use by another process. // Device is in use by another process.
// Don't reset while in use. // Don't reset while in use.
return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE;
} }
} }
@@ -149,14 +147,12 @@ ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
if (!(deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_INTEGRATED)) { if (!(deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_INTEGRATED)) {
result = pSysfsAccess->unbindDevice(resetName); result = pSysfsAccess->unbindDevice(resetName);
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
return result; return result;
} }
result = pLinuxSysmanImp->osWarmReset(); result = pLinuxSysmanImp->osWarmReset();
if (ZE_RESULT_SUCCESS == result) { if (ZE_RESULT_SUCCESS == result) {
return pLinuxSysmanImp->initDevice(); return pLinuxSysmanImp->initDevice();
} }
return result; return result;
} }
@@ -175,7 +171,6 @@ ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
// Unbind the device from the kernel driver. // Unbind the device from the kernel driver.
result = pSysfsAccess->unbindDevice(resetName); result = pSysfsAccess->unbindDevice(resetName);
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
return result; return result;
} }
@@ -183,7 +178,6 @@ ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
// after we check, kill them here. // after we check, kill them here.
result = pProcfsAccess->listProcesses(processes); result = pProcfsAccess->listProcesses(processes);
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
return result; return result;
} }
std::vector<::pid_t> deviceUsingPids; std::vector<::pid_t> deviceUsingPids;
@@ -192,7 +186,6 @@ ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
std::vector<int> fds; std::vector<int> fds;
pLinuxSysmanImp->getPidFdsForOpenDevice(pProcfsAccess, pSysfsAccess, pid, fds); pLinuxSysmanImp->getPidFdsForOpenDevice(pProcfsAccess, pSysfsAccess, pid, fds);
if (!fds.empty()) { if (!fds.empty()) {
// Kill all processes that have the device open. // Kill all processes that have the device open.
pProcfsAccess->kill(pid); pProcfsAccess->kill(pid);
deviceUsingPids.push_back(pid); deviceUsingPids.push_back(pid);
@@ -210,7 +203,6 @@ ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE;
} }
struct ::timespec timeout = {.tv_sec = 0, .tv_nsec = 1000}; struct ::timespec timeout = {.tv_sec = 0, .tv_nsec = 1000};
::nanosleep(&timeout, NULL); ::nanosleep(&timeout, NULL);
end = std::chrono::steady_clock::now(); end = std::chrono::steady_clock::now();
@@ -220,14 +212,12 @@ ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
// Reset the device. // Reset the device.
result = pFsAccess->write(resetPath, "1"); result = pFsAccess->write(resetPath, "1");
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
return result; return result;
} }
// Rebind the device to the kernel driver. // Rebind the device to the kernel driver.
result = pSysfsAccess->bindDevice(resetName); result = pSysfsAccess->bindDevice(resetName);
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
return result; return result;
} }

View File

@@ -65,13 +65,13 @@ void LinuxSysmanImp::createFwUtilInterface() {
} }
ze_result_t LinuxSysmanImp::createPmtHandles() { ze_result_t LinuxSysmanImp::createPmtHandles() {
std::string realRootPath; std::string gtDevicePCIPath;
auto result = pSysfsAccess->getRealPath("device", realRootPath); auto result = pSysfsAccess->getRealPath("device", gtDevicePCIPath);
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
return result; return result;
} }
auto rootPciPathOfGpuDevice = getPciRootPortDirectoryPath(realRootPath); auto gpuUpstreamPortPath = getPciCardBusDirectoryPath(gtDevicePCIPath);
PlatformMonitoringTech::create(pParentSysmanDeviceImp->deviceHandles, pFsAccess, rootPciPathOfGpuDevice, mapOfSubDeviceIdToPmtObject); PlatformMonitoringTech::create(pParentSysmanDeviceImp->deviceHandles, pFsAccess, gpuUpstreamPortPath, mapOfSubDeviceIdToPmtObject);
return result; return result;
} }
@@ -136,12 +136,9 @@ SysmanDeviceImp *LinuxSysmanImp::getSysmanDeviceImp() {
return pParentSysmanDeviceImp; return pParentSysmanDeviceImp;
} }
std::string LinuxSysmanImp::getPciRootPortDirectoryPath(std::string realPciPath) { static std::string modifyPathOnLevel(std::string realPciPath, uint8_t nLevel) {
size_t loc; size_t loc;
// we need to change the absolute path to two levels up to get // we need to change the absolute path to 'nLevel' levels up
// the Discrete card's root port.
// the root port is always at a fixed distance as defined in HW
uint8_t nLevel = 2;
while (nLevel > 0) { while (nLevel > 0) {
loc = realPciPath.find_last_of('/'); loc = realPciPath.find_last_of('/');
if (loc == std::string::npos) { if (loc == std::string::npos) {
@@ -152,38 +149,36 @@ std::string LinuxSysmanImp::getPciRootPortDirectoryPath(std::string realPciPath)
} }
return realPciPath; return realPciPath;
} }
std::string getPciRootPortDirectoryPath(std::string realPciPath) {
static std::string modifyPathOnLevel(std::string path, uint8_t level) {
size_t loc = 0;
size_t count = 0;
std::string modifiedPath(path);
uint8_t nLevel = level;
do {
loc = path.find_first_of('/');
count = count + loc;
if (loc == std::string::npos) {
break;
}
path = path.substr(loc + 1, path.size());
nLevel--;
} while (nLevel > 0);
if (nLevel == 0) {
modifiedPath = modifiedPath.substr(0, (count + level - 1)); // need to adjust for last '/' that the code encounters
}
return modifiedPath;
}
std::string LinuxSysmanImp::getPciRootPortDirectoryPathForReset(std::string realPciPath) {
// the rootport is always the first pci folder after the pcie slot. // the rootport is always the first pci folder after the pcie slot.
// +-[0000:89]-+-00.0
// | +-00.1
// | +-00.2
// | +-00.4
// | \-02.0-[8a-8e]----00.0-[8b-8e]--+-01.0-[8c-8d]----00.0
// | \-02.0-[8e]--+-00.0
// | +-00.1
// | \-00.2
// /sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0 // /sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0
// '/sys/devices/pci0000:89/0000:89:02.0/' will always be the same distance. // '/sys/devices/pci0000:89/0000:89:02.0/' will always be the same distance.
return modifyPathOnLevel(realPciPath, 5); // from 0000:8c:00.0 i.e the 3rd PCI address from the gt tile
return modifyPathOnLevel(realPciPath, 3);
} }
std::string LinuxSysmanImp::getPciCardBusDirectoryPath(std::string realPciPath) { std::string LinuxSysmanImp::getPciCardBusDirectoryPath(std::string realPciPath) {
// the cardbus is always the second pci folder after the pcie slot. // the cardbus is always the second pci folder after the pcie slot.
// +-[0000:89]-+-00.0
// | +-00.1
// | +-00.2
// | +-00.4
// | \-02.0-[8a-8e]----00.0-[8b-8e]--+-01.0-[8c-8d]----00.0
// | \-02.0-[8e]--+-00.0
// | +-00.1
// | \-00.2
// /sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0 // /sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0
// '/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/' will always be the same distance. // '/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/' will always be the same distance.
return modifyPathOnLevel(realPciPath, 6); // from 0000:8c:00.0 i.e the 2nd PCI address from the gt tile.
return modifyPathOnLevel(realPciPath, 2);
} }
PlatformMonitoringTech *LinuxSysmanImp::getPlatformMonitoringTechAccess(uint32_t subDeviceId) { PlatformMonitoringTech *LinuxSysmanImp::getPlatformMonitoringTechAccess(uint32_t subDeviceId) {
@@ -274,7 +269,7 @@ void LinuxSysmanImp::releaseDeviceResources() {
executionEnvironment = devicePtr->getNEODevice()->getExecutionEnvironment(); executionEnvironment = devicePtr->getNEODevice()->getExecutionEnvironment();
devicePciBdf = devicePtr->getNEODevice()->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Drm>()->getPciPath(); devicePciBdf = devicePtr->getNEODevice()->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Drm>()->getPciPath();
rootDeviceIndex = devicePtr->getNEODevice()->getRootDeviceIndex(); rootDeviceIndex = devicePtr->getNEODevice()->getRootDeviceIndex();
pSysfsAccess->getRealPath(deviceDir, gtDevicePath);
releaseSysmanDeviceResources(); releaseSysmanDeviceResources();
auto device = static_cast<DeviceImp *>(getDeviceHandle()); auto device = static_cast<DeviceImp *>(getDeviceHandle());
executionEnvironment = device->getNEODevice()->getExecutionEnvironment(); executionEnvironment = device->getNEODevice()->getExecutionEnvironment();
@@ -320,20 +315,14 @@ ze_result_t LinuxSysmanImp::initDevice() {
// in the bridge control register in the PCI configuration space of the bridge port upstream of the device. // in the bridge control register in the PCI configuration space of the bridge port upstream of the device.
ze_result_t LinuxSysmanImp::osWarmReset() { ze_result_t LinuxSysmanImp::osWarmReset() {
std::string rootPortPath; std::string rootPortPath;
std::string realRootPath; std::string cardBusPath = getPciCardBusDirectoryPath(gtDevicePath);
ze_result_t result = pSysfsAccess->getRealPath(deviceDir, realRootPath); ze_result_t result = pFsAccess->write(cardBusPath + '/' + "remove", "1");
if (ZE_RESULT_SUCCESS != result) {
return result;
}
std::string cardBusPath = getPciCardBusDirectoryPath(realRootPath);
result = pFsAccess->write(cardBusPath + '/' + "remove", "1");
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
return result; return result;
} }
this->pSleepFunctionSecs(10); // Sleep for 10seconds to make sure that the config spaces of all devices are saved correctly this->pSleepFunctionSecs(10); // Sleep for 10seconds to make sure that the config spaces of all devices are saved correctly
rootPortPath = getPciRootPortDirectoryPathForReset(realRootPath); rootPortPath = getPciRootPortDirectoryPath(gtDevicePath);
int fd, ret = 0; int fd, ret = 0;
unsigned int offset = PCI_BRIDGE_CONTROL; // Bridge control offset in Header of PCI config space unsigned int offset = PCI_BRIDGE_CONTROL; // Bridge control offset in Header of PCI config space
@@ -370,19 +359,14 @@ std::string LinuxSysmanImp::getAddressFromPath(std::string &rootPortPath) {
} }
ze_result_t LinuxSysmanImp::osColdReset() { ze_result_t LinuxSysmanImp::osColdReset() {
const std::string slotPath("/sys/bus/pci/slots/"); // holds the directories matching to the number of slots in the PC const std::string slotPath("/sys/bus/pci/slots/"); // holds the directories matching to the number of slots in the PC
std::string cardBusPath; // will hold the PCIe Root port directory path (the address of the PCIe slot). std::string cardBusPath; // will hold the PCIe Root port directory path (the address of the PCIe slot). // will hold the absolute real path (not symlink) to the selected Device
std::string realRootPath; // will hold the absolute real path (not symlink) to the selected Device
ze_result_t result = pSysfsAccess->getRealPath(deviceDir, realRootPath); // e.g realRootPath=/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0
if (ZE_RESULT_SUCCESS != result) {
return result;
}
cardBusPath = getPciCardBusDirectoryPath(realRootPath); // e.g cardBusPath=/sys/devices/pci0000:89/0000:89:02.0/ cardBusPath = getPciCardBusDirectoryPath(gtDevicePath); // e.g cardBusPath=/sys/devices/pci0000:89/0000:89:02.0/
std::string rootAddress = getAddressFromPath(cardBusPath); // e.g rootAddress = 0000:8a:00.0 std::string rootAddress = getAddressFromPath(cardBusPath); // e.g rootAddress = 0000:8a:00.0
std::vector<std::string> dir; std::vector<std::string> dir;
result = pFsAccess->listDirectory(slotPath, dir); // get list of slot directories from /sys/bus/pci/slots/ ze_result_t result = pFsAccess->listDirectory(slotPath, dir); // get list of slot directories from /sys/bus/pci/slots/
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
return result; return result;
} }

View File

@@ -53,8 +53,6 @@ class LinuxSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass {
PlatformMonitoringTech *getPlatformMonitoringTechAccess(uint32_t subDeviceId); PlatformMonitoringTech *getPlatformMonitoringTechAccess(uint32_t subDeviceId);
Device *getDeviceHandle(); Device *getDeviceHandle();
SysmanDeviceImp *getSysmanDeviceImp(); SysmanDeviceImp *getSysmanDeviceImp();
std::string getPciRootPortDirectoryPath(std::string realPciPath);
std::string getPciRootPortDirectoryPathForReset(std::string realPciPath);
std::string getPciCardBusDirectoryPath(std::string realPciPath); std::string getPciCardBusDirectoryPath(std::string realPciPath);
void releasePmtObject(); void releasePmtObject();
ze_result_t createPmtHandles(); ze_result_t createPmtHandles();
@@ -80,6 +78,7 @@ class LinuxSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass {
NEO::ExecutionEnvironment *executionEnvironment = nullptr; NEO::ExecutionEnvironment *executionEnvironment = nullptr;
bool diagnosticsReset = false; bool diagnosticsReset = false;
Device *pDevice = nullptr; Device *pDevice = nullptr;
std::string gtDevicePath;
protected: protected:
FsAccess *pFsAccess = nullptr; FsAccess *pFsAccess = nullptr;

View File

@@ -74,8 +74,8 @@ bool compareTelemNodes(std::string &telemNode1, std::string &telemNode2) {
return indexForTelemNode1 < indexForTelemNode2; return indexForTelemNode1 < indexForTelemNode2;
} }
// Check if Telemetry node(say /sys/class/intel_pmt/telem1) and rootPciPathOfGpuDevice share same PCI Root port // Check if Telemetry node(say /sys/class/intel_pmt/telem1) and gpuUpstreamPortPath share same PCI Root port
static bool isValidTelemNode(FsAccess *pFsAccess, const std::string &rootPciPathOfGpuDevice, const std::string sysfsTelemNode) { static bool isValidTelemNode(FsAccess *pFsAccess, const std::string &gpuUpstreamPortPath, const std::string sysfsTelemNode) {
std::string realPathOfTelemNode; std::string realPathOfTelemNode;
auto result = pFsAccess->getRealPath(sysfsTelemNode, realPathOfTelemNode); auto result = pFsAccess->getRealPath(sysfsTelemNode, realPathOfTelemNode);
if (result != ZE_RESULT_SUCCESS) { if (result != ZE_RESULT_SUCCESS) {
@@ -83,14 +83,15 @@ static bool isValidTelemNode(FsAccess *pFsAccess, const std::string &rootPciPath
} }
// Example: If // Example: If
// rootPciPathOfGpuDevice = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0"; // gpuUpstreamPortPath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0";
// realPathOfTelemNode = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1"; // realPathOfTelemNode = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1";
// As rootPciPathOfGpuDevice is a substring og realPathOfTelemNode , hence both sysfs telemNode and GPU device share same PCI Root. // As gpuUpstreamPortPath is a substring of realPathOfTelemNode , hence both sysfs telemNode and GPU device share same PCI Root.
// the PMT is part of the OOBMSM sitting on a switch port 0000:8b:02.0 attached to the upstream port/ Also known as CardBus
// Hence this telem node entry is valid for GPU device. // Hence this telem node entry is valid for GPU device.
return (realPathOfTelemNode.compare(0, rootPciPathOfGpuDevice.size(), rootPciPathOfGpuDevice) == 0); return (realPathOfTelemNode.compare(0, gpuUpstreamPortPath.size(), gpuUpstreamPortPath) == 0);
} }
ze_result_t PlatformMonitoringTech::enumerateRootTelemIndex(FsAccess *pFsAccess, std::string &rootPciPathOfGpuDevice) { ze_result_t PlatformMonitoringTech::enumerateRootTelemIndex(FsAccess *pFsAccess, std::string &gpuUpstreamPortPath) {
std::vector<std::string> listOfTelemNodes; std::vector<std::string> listOfTelemNodes;
auto result = pFsAccess->listDirectory(baseTelemSysFS, listOfTelemNodes); auto result = pFsAccess->listDirectory(baseTelemSysFS, listOfTelemNodes);
if (ZE_RESULT_SUCCESS != result) { if (ZE_RESULT_SUCCESS != result) {
@@ -111,7 +112,7 @@ ze_result_t PlatformMonitoringTech::enumerateRootTelemIndex(FsAccess *pFsAccess,
// Then listOfTelemNodes would contain telem1, telem2, telem3 // Then listOfTelemNodes would contain telem1, telem2, telem3
std::sort(listOfTelemNodes.begin(), listOfTelemNodes.end(), compareTelemNodes); // sort listOfTelemNodes, to arange telem nodes in ascending order std::sort(listOfTelemNodes.begin(), listOfTelemNodes.end(), compareTelemNodes); // sort listOfTelemNodes, to arange telem nodes in ascending order
for (const auto &telemNode : listOfTelemNodes) { for (const auto &telemNode : listOfTelemNodes) {
if (isValidTelemNode(pFsAccess, rootPciPathOfGpuDevice, baseTelemSysFS + "/" + telemNode)) { if (isValidTelemNode(pFsAccess, gpuUpstreamPortPath, baseTelemSysFS + "/" + telemNode)) {
auto indexString = telemNode.substr(telem.size(), telemNode.size()); auto indexString = telemNode.substr(telem.size(), telemNode.size());
rootDeviceTelemNodeIndex = stoi(indexString); // if telemNode is telemN, then rootDeviceTelemNodeIndex = N rootDeviceTelemNodeIndex = stoi(indexString); // if telemNode is telemN, then rootDeviceTelemNodeIndex = N
return ZE_RESULT_SUCCESS; return ZE_RESULT_SUCCESS;
@@ -120,7 +121,7 @@ ze_result_t PlatformMonitoringTech::enumerateRootTelemIndex(FsAccess *pFsAccess,
return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
} }
ze_result_t PlatformMonitoringTech::init(FsAccess *pFsAccess, const std::string &rootPciPathOfGpuDevice) { ze_result_t PlatformMonitoringTech::init(FsAccess *pFsAccess, const std::string &gpuUpstreamPortPath) {
std::string telemNode = telem + std::to_string(rootDeviceTelemNodeIndex); std::string telemNode = telem + std::to_string(rootDeviceTelemNodeIndex);
if (isSubdevice) { if (isSubdevice) {
uint32_t telemNodeIndex = 0; uint32_t telemNodeIndex = 0;
@@ -131,7 +132,7 @@ ze_result_t PlatformMonitoringTech::init(FsAccess *pFsAccess, const std::string
telemNode = telem + std::to_string(telemNodeIndex); telemNode = telem + std::to_string(telemNodeIndex);
} }
std::string baseTelemSysFSNode = baseTelemSysFS + "/" + telemNode; std::string baseTelemSysFSNode = baseTelemSysFS + "/" + telemNode;
if (!isValidTelemNode(pFsAccess, rootPciPathOfGpuDevice, baseTelemSysFSNode)) { if (!isValidTelemNode(pFsAccess, gpuUpstreamPortPath, baseTelemSysFSNode)) {
return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
} }
@@ -172,9 +173,9 @@ PlatformMonitoringTech::PlatformMonitoringTech(FsAccess *pFsAccess, ze_bool_t on
} }
void PlatformMonitoringTech::doInitPmtObject(FsAccess *pFsAccess, uint32_t subdeviceId, PlatformMonitoringTech *pPmt, void PlatformMonitoringTech::doInitPmtObject(FsAccess *pFsAccess, uint32_t subdeviceId, PlatformMonitoringTech *pPmt,
const std::string &rootPciPathOfGpuDevice, const std::string &gpuUpstreamPortPath,
std::map<uint32_t, L0::PlatformMonitoringTech *> &mapOfSubDeviceIdToPmtObject) { std::map<uint32_t, L0::PlatformMonitoringTech *> &mapOfSubDeviceIdToPmtObject) {
if (pPmt->init(pFsAccess, rootPciPathOfGpuDevice) == ZE_RESULT_SUCCESS) { if (pPmt->init(pFsAccess, gpuUpstreamPortPath) == ZE_RESULT_SUCCESS) {
mapOfSubDeviceIdToPmtObject.emplace(subdeviceId, pPmt); mapOfSubDeviceIdToPmtObject.emplace(subdeviceId, pPmt);
return; return;
} }
@@ -182,9 +183,9 @@ void PlatformMonitoringTech::doInitPmtObject(FsAccess *pFsAccess, uint32_t subde
} }
void PlatformMonitoringTech::create(const std::vector<ze_device_handle_t> &deviceHandles, void PlatformMonitoringTech::create(const std::vector<ze_device_handle_t> &deviceHandles,
FsAccess *pFsAccess, std::string &rootPciPathOfGpuDevice, FsAccess *pFsAccess, std::string &gpuUpstreamPortPath,
std::map<uint32_t, L0::PlatformMonitoringTech *> &mapOfSubDeviceIdToPmtObject) { std::map<uint32_t, L0::PlatformMonitoringTech *> &mapOfSubDeviceIdToPmtObject) {
if (ZE_RESULT_SUCCESS == PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, rootPciPathOfGpuDevice)) { if (ZE_RESULT_SUCCESS == PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, gpuUpstreamPortPath)) {
for (const auto &deviceHandle : deviceHandles) { for (const auto &deviceHandle : deviceHandles) {
uint32_t subdeviceId = 0; uint32_t subdeviceId = 0;
ze_bool_t onSubdevice = false; ze_bool_t onSubdevice = false;
@@ -192,7 +193,7 @@ void PlatformMonitoringTech::create(const std::vector<ze_device_handle_t> &devic
auto pPmt = new PlatformMonitoringTech(pFsAccess, onSubdevice, subdeviceId); auto pPmt = new PlatformMonitoringTech(pFsAccess, onSubdevice, subdeviceId);
UNRECOVERABLE_IF(nullptr == pPmt); UNRECOVERABLE_IF(nullptr == pPmt);
PlatformMonitoringTech::doInitPmtObject(pFsAccess, subdeviceId, pPmt, PlatformMonitoringTech::doInitPmtObject(pFsAccess, subdeviceId, pPmt,
rootPciPathOfGpuDevice, mapOfSubDeviceIdToPmtObject); gpuUpstreamPortPath, mapOfSubDeviceIdToPmtObject);
} }
} }
} }

View File

@@ -27,9 +27,9 @@ class PlatformMonitoringTech : NEO::NonCopyableOrMovableClass {
virtual ze_result_t readValue(const std::string key, uint32_t &value); virtual ze_result_t readValue(const std::string key, uint32_t &value);
virtual ze_result_t readValue(const std::string key, uint64_t &value); virtual ze_result_t readValue(const std::string key, uint64_t &value);
static ze_result_t enumerateRootTelemIndex(FsAccess *pFsAccess, std::string &rootPciPathOfGpuDevice); static ze_result_t enumerateRootTelemIndex(FsAccess *pFsAccess, std::string &gpuUpstreamPortPath);
static void create(const std::vector<ze_device_handle_t> &deviceHandles, static void create(const std::vector<ze_device_handle_t> &deviceHandles,
FsAccess *pFsAccess, std::string &rootPciPathOfGpuDevice, FsAccess *pFsAccess, std::string &gpuUpstreamPortPath,
std::map<uint32_t, L0::PlatformMonitoringTech *> &mapOfSubDeviceIdToPmtObject); std::map<uint32_t, L0::PlatformMonitoringTech *> &mapOfSubDeviceIdToPmtObject);
protected: protected:
@@ -37,8 +37,8 @@ class PlatformMonitoringTech : NEO::NonCopyableOrMovableClass {
std::string telemetryDeviceEntry{}; std::string telemetryDeviceEntry{};
std::map<std::string, uint64_t> keyOffsetMap; std::map<std::string, uint64_t> keyOffsetMap;
ze_result_t getKeyOffsetMap(std::string guid, std::map<std::string, uint64_t> &keyOffsetMap); ze_result_t getKeyOffsetMap(std::string guid, std::map<std::string, uint64_t> &keyOffsetMap);
ze_result_t init(FsAccess *pFsAccess, const std::string &rootPciPathOfGpuDevice); ze_result_t init(FsAccess *pFsAccess, const std::string &gpuUpstreamPortPath);
static void doInitPmtObject(FsAccess *pFsAccess, uint32_t subdeviceId, PlatformMonitoringTech *pPmt, const std::string &rootPciPathOfGpuDevice, static void doInitPmtObject(FsAccess *pFsAccess, uint32_t subdeviceId, PlatformMonitoringTech *pPmt, const std::string &gpuUpstreamPortPath,
std::map<uint32_t, L0::PlatformMonitoringTech *> &mapOfSubDeviceIdToPmtObject); std::map<uint32_t, L0::PlatformMonitoringTech *> &mapOfSubDeviceIdToPmtObject);
decltype(&NEO::SysCalls::open) openFunction = NEO::SysCalls::open; decltype(&NEO::SysCalls::open) openFunction = NEO::SysCalls::open;
decltype(&NEO::SysCalls::close) closeFunction = NEO::SysCalls::close; decltype(&NEO::SysCalls::close) closeFunction = NEO::SysCalls::close;

View File

@@ -274,7 +274,7 @@ void LinuxPciImp::pciCardBusConfigRead() {
std::string pciConfigNode; std::string pciConfigNode;
std::string rootPortPath; std::string rootPortPath;
pSysfsAccess->getRealPath(deviceDir, pciConfigNode); pSysfsAccess->getRealPath(deviceDir, pciConfigNode);
rootPortPath = pLinuxSysmanImp->getPciRootPortDirectoryPath(pciConfigNode); rootPortPath = pLinuxSysmanImp->getPciCardBusDirectoryPath(pciConfigNode);
pciConfigNode = rootPortPath + "/config"; pciConfigNode = rootPortPath + "/config";
int fdConfig = -1; int fdConfig = -1;
fdConfig = this->openFunction(pciConfigNode.c_str(), O_RDONLY); fdConfig = this->openFunction(pciConfigNode.c_str(), O_RDONLY);

View File

@@ -537,6 +537,7 @@ TEST_F(ZesDiagnosticsFixture, GivenValidDiagnosticsHandleWhenInvalidateLmemFails
} }
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetThenCallSucceeds) { TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetThenCallSucceeds) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pLinuxSysmanImp->openFunction = openMockDiag; pLinuxSysmanImp->openFunction = openMockDiag;
pLinuxSysmanImp->closeFunction = closeMockDiag; pLinuxSysmanImp->closeFunction = closeMockDiag;
pLinuxSysmanImp->preadFunction = preadMockDiag; pLinuxSysmanImp->preadFunction = preadMockDiag;
@@ -547,6 +548,7 @@ TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetThen
} }
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndRootPortConfigFileFailsToOpenThenCallFails) { TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndRootPortConfigFileFailsToOpenThenCallFails) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pLinuxSysmanImp->openFunction = openMockDiagFail; pLinuxSysmanImp->openFunction = openMockDiagFail;
pLinuxSysmanImp->closeFunction = closeMockDiag; pLinuxSysmanImp->closeFunction = closeMockDiag;
pLinuxSysmanImp->preadFunction = preadMockDiag; pLinuxSysmanImp->preadFunction = preadMockDiag;
@@ -557,6 +559,7 @@ TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndR
} }
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndRootPortConfigFileFailsToCloseThenCallFails) { TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndRootPortConfigFileFailsToCloseThenCallFails) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pLinuxSysmanImp->openFunction = openMockDiag; pLinuxSysmanImp->openFunction = openMockDiag;
pLinuxSysmanImp->closeFunction = closeMockDiagFail; pLinuxSysmanImp->closeFunction = closeMockDiagFail;
pLinuxSysmanImp->preadFunction = preadMockDiag; pLinuxSysmanImp->preadFunction = preadMockDiag;
@@ -566,18 +569,8 @@ TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndR
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pLinuxSysmanImp->osWarmReset()); EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pLinuxSysmanImp->osWarmReset());
} }
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndGetRealPathFailsThenCallFails) {
pLinuxSysmanImp->openFunction = openMockDiag;
pLinuxSysmanImp->closeFunction = closeMockDiag;
pLinuxSysmanImp->preadFunction = preadMockDiag;
pLinuxSysmanImp->pwriteFunction = pwriteMockDiag;
pLinuxSysmanImp->pSleepFunctionSecs = mockSleepFunctionSecs;
pMockSysfsAccess->setMockError(ZE_RESULT_ERROR_NOT_AVAILABLE);
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, pLinuxSysmanImp->osWarmReset());
}
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndCardbusRemoveFailsThenCallFails) { TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndCardbusRemoveFailsThenCallFails) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pLinuxSysmanImp->openFunction = openMockDiag; pLinuxSysmanImp->openFunction = openMockDiag;
pLinuxSysmanImp->closeFunction = closeMockDiag; pLinuxSysmanImp->closeFunction = closeMockDiag;
pLinuxSysmanImp->preadFunction = preadMockDiag; pLinuxSysmanImp->preadFunction = preadMockDiag;
@@ -589,6 +582,7 @@ TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndC
} }
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndRootPortRescanFailsThenCallFails) { TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndRootPortRescanFailsThenCallFails) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pLinuxSysmanImp->openFunction = openMockDiag; pLinuxSysmanImp->openFunction = openMockDiag;
pLinuxSysmanImp->closeFunction = closeMockDiag; pLinuxSysmanImp->closeFunction = closeMockDiag;
pLinuxSysmanImp->preadFunction = preadMockDiag; pLinuxSysmanImp->preadFunction = preadMockDiag;
@@ -601,25 +595,24 @@ TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndR
} }
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetThenCallSucceeds) { TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetThenCallSucceeds) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
EXPECT_EQ(ZE_RESULT_SUCCESS, pLinuxSysmanImp->osColdReset()); EXPECT_EQ(ZE_RESULT_SUCCESS, pLinuxSysmanImp->osColdReset());
} }
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetAndGetRealPathFailsThenCallFails) {
pMockSysfsAccess->setMockError(ZE_RESULT_ERROR_NOT_AVAILABLE);
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, pLinuxSysmanImp->osColdReset());
}
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetAndListDirFailsThenCallFails) { TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetAndListDirFailsThenCallFails) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pMockFsAccess->mockListDirError = ZE_RESULT_ERROR_NOT_AVAILABLE; pMockFsAccess->mockListDirError = ZE_RESULT_ERROR_NOT_AVAILABLE;
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, pLinuxSysmanImp->osColdReset()); EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, pLinuxSysmanImp->osColdReset());
} }
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetAndReadSlotAddressFailsThenCallFails) { TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetAndReadSlotAddressFailsThenCallFails) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pMockFsAccess->mockReadError = ZE_RESULT_ERROR_NOT_AVAILABLE; pMockFsAccess->mockReadError = ZE_RESULT_ERROR_NOT_AVAILABLE;
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, pLinuxSysmanImp->osColdReset()); EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, pLinuxSysmanImp->osColdReset());
} }
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetandWriteFailsThenCallFails) { TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetandWriteFailsThenCallFails) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pMockFsAccess->mockWriteError = ZE_RESULT_ERROR_NOT_AVAILABLE; pMockFsAccess->mockWriteError = ZE_RESULT_ERROR_NOT_AVAILABLE;
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, pLinuxSysmanImp->osColdReset()); EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, pLinuxSysmanImp->osColdReset());
pMockFsAccess->checkErrorAfterCount = 1; pMockFsAccess->checkErrorAfterCount = 1;
@@ -627,6 +620,7 @@ TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetandW
} }
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetandWrongSlotAddressIsReturnedThenCallFails) { TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingColdResetandWrongSlotAddressIsReturnedThenCallFails) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pMockFsAccess->setWrongMockAddress(); pMockFsAccess->setWrongMockAddress();
EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, pLinuxSysmanImp->osColdReset()); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, pLinuxSysmanImp->osColdReset());
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 Intel Corporation * Copyright (C) 2021-2022 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -17,7 +17,7 @@ const std::string baseTelemSysFS("/sys/class/intel_pmt");
const std::string telem("telem"); const std::string telem("telem");
const std::string telemNodeForSubdevice0("telem2"); const std::string telemNodeForSubdevice0("telem2");
const std::string telemNodeForSubdevice1("telem3"); const std::string telemNodeForSubdevice1("telem3");
std::string rootPciPathOfGpuDeviceInPmt = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0"; std::string gpuUpstreamPortPathInPmt = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0";
const std::string realPathTelem1 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1"; const std::string realPathTelem1 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1";
const std::string realPathTelem2 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem2"; const std::string realPathTelem2 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem2";
const std::string realPathTelem3 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem3"; const std::string realPathTelem3 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem3";

View File

@@ -51,7 +51,7 @@ class ZesPmtFixtureMultiDevice : public SysmanMultiDeviceFixture {
.WillByDefault(::testing::Invoke(pTestFsAccess.get(), &Mock<PmtFsAccess>::getRealPathSuccess)); .WillByDefault(::testing::Invoke(pTestFsAccess.get(), &Mock<PmtFsAccess>::getRealPathSuccess));
ON_CALL(*pTestFsAccess.get(), fileExists(_)) ON_CALL(*pTestFsAccess.get(), fileExists(_))
.WillByDefault(::testing::Invoke(pTestFsAccess.get(), &Mock<PmtFsAccess>::isFileExists)); .WillByDefault(::testing::Invoke(pTestFsAccess.get(), &Mock<PmtFsAccess>::isFileExists));
PlatformMonitoringTech::create(deviceHandles, pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt, mapOfSubDeviceIdToPmtObject); PlatformMonitoringTech::create(deviceHandles, pTestFsAccess.get(), gpuUpstreamPortPathInPmt, mapOfSubDeviceIdToPmtObject);
} }
void TearDown() override { void TearDown() override {
if (!sysmanUltsEnable) { if (!sysmanUltsEnable) {
@@ -70,50 +70,50 @@ TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenCreatingPMTHandlesTh
TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenenumerateRootTelemIndexThenCheckForErrorIflistDirectoryFails) { TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenenumerateRootTelemIndexThenCheckForErrorIflistDirectoryFails) {
EXPECT_CALL(*pTestFsAccess.get(), listDirectory(_, _)) EXPECT_CALL(*pTestFsAccess.get(), listDirectory(_, _))
.WillOnce(Return(ZE_RESULT_ERROR_NOT_AVAILABLE)); .WillOnce(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt)); EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), gpuUpstreamPortPathInPmt));
} }
TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenenumerateRootTelemIndexThenCheckForErrorIfgetRealPathFails) { TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenenumerateRootTelemIndexThenCheckForErrorIfgetRealPathFails) {
EXPECT_CALL(*pTestFsAccess.get(), getRealPath(_, _)) EXPECT_CALL(*pTestFsAccess.get(), getRealPath(_, _))
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE)); .WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt)); EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), gpuUpstreamPortPathInPmt));
} }
TEST_F(ZesPmtFixtureMultiDevice, GivenWhenenumerateRootTelemIndexThenCheckForErrorIfgetRealPathSuccessButNoTelemetryNodeAndGPUDeviceShareRootPciPort) { TEST_F(ZesPmtFixtureMultiDevice, GivenWhenenumerateRootTelemIndexThenCheckForErrorIfgetRealPathSuccessButNoTelemetryNodeAndGPUDeviceShareRootPciPort) {
EXPECT_CALL(*pTestFsAccess.get(), getRealPath(_, _)) EXPECT_CALL(*pTestFsAccess.get(), getRealPath(_, _))
.Times(5) .Times(5)
.WillRepeatedly(::testing::DoAll(::testing::SetArgReferee<1>("/sys/devices/pci0000:89/0000:89:02.0/0000:8e:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1"), Return(ZE_RESULT_SUCCESS))); .WillRepeatedly(::testing::DoAll(::testing::SetArgReferee<1>("/sys/devices/pci0000:89/0000:89:02.0/0000:8e:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1"), Return(ZE_RESULT_SUCCESS)));
EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt)); EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), gpuUpstreamPortPathInPmt));
} }
TEST_F(ZesPmtFixtureMultiDevice, GivenTelemDirectoryContainNowTelemEntryWhenenumerateRootTelemIndexThenCheckForError) { TEST_F(ZesPmtFixtureMultiDevice, GivenTelemDirectoryContainNowTelemEntryWhenenumerateRootTelemIndexThenCheckForError) {
ON_CALL(*pTestFsAccess.get(), listDirectory(_, _)) ON_CALL(*pTestFsAccess.get(), listDirectory(_, _))
.WillByDefault(::testing::Invoke(pTestFsAccess.get(), &Mock<PmtFsAccess>::listDirectoryNoTelemNode)); .WillByDefault(::testing::Invoke(pTestFsAccess.get(), &Mock<PmtFsAccess>::listDirectoryNoTelemNode));
EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt)); EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), gpuUpstreamPortPathInPmt));
} }
TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenCreatingPMTHandlesThenCheckForErrorThatCouldHappenDuringWhileValidatingTelemNode) { TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenCreatingPMTHandlesThenCheckForErrorThatCouldHappenDuringWhileValidatingTelemNode) {
EXPECT_CALL(*pTestFsAccess.get(), getRealPath(_, _)) EXPECT_CALL(*pTestFsAccess.get(), getRealPath(_, _))
.WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE)); .WillRepeatedly(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt); PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), gpuUpstreamPortPathInPmt);
auto pPmt = std::make_unique<PublicPlatformMonitoringTech>(pTestFsAccess.get(), 1, 0); auto pPmt = std::make_unique<PublicPlatformMonitoringTech>(pTestFsAccess.get(), 1, 0);
EXPECT_EQ(pPmt->init(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt), ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); EXPECT_EQ(pPmt->init(pTestFsAccess.get(), gpuUpstreamPortPathInPmt), ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE);
} }
TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenCreatingPMTHandlesThenCheckForErrorThatCouldHappenDuringGUIDRead) { TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenCreatingPMTHandlesThenCheckForErrorThatCouldHappenDuringGUIDRead) {
EXPECT_CALL(*pTestFsAccess.get(), read(_, Matcher<std::string &>(_))) EXPECT_CALL(*pTestFsAccess.get(), read(_, Matcher<std::string &>(_)))
.WillOnce(Return(ZE_RESULT_ERROR_NOT_AVAILABLE)); .WillOnce(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt); PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), gpuUpstreamPortPathInPmt);
auto pPmt = std::make_unique<PublicPlatformMonitoringTech>(pTestFsAccess.get(), 1, 0); auto pPmt = std::make_unique<PublicPlatformMonitoringTech>(pTestFsAccess.get(), 1, 0);
EXPECT_EQ(pPmt->init(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt), ZE_RESULT_ERROR_NOT_AVAILABLE); EXPECT_EQ(pPmt->init(pTestFsAccess.get(), gpuUpstreamPortPathInPmt), ZE_RESULT_ERROR_NOT_AVAILABLE);
} }
TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenCreatingPMTHandlesThenCheckForErrorIfGUIDReadValueIsNotSupported) { TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenCreatingPMTHandlesThenCheckForErrorIfGUIDReadValueIsNotSupported) {
EXPECT_CALL(*pTestFsAccess.get(), read(_, Matcher<std::string &>(_))) EXPECT_CALL(*pTestFsAccess.get(), read(_, Matcher<std::string &>(_)))
.WillOnce(::testing::DoAll(::testing::SetArgReferee<1>(""), Return(ZE_RESULT_SUCCESS))); .WillOnce(::testing::DoAll(::testing::SetArgReferee<1>(""), Return(ZE_RESULT_SUCCESS)));
PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt); PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), gpuUpstreamPortPathInPmt);
auto pPmt = std::make_unique<PublicPlatformMonitoringTech>(pTestFsAccess.get(), 1, 0); auto pPmt = std::make_unique<PublicPlatformMonitoringTech>(pTestFsAccess.get(), 1, 0);
EXPECT_EQ(pPmt->init(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); EXPECT_EQ(pPmt->init(pTestFsAccess.get(), gpuUpstreamPortPathInPmt), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
} }
TEST_F(ZesPmtFixtureMultiDevice, GivenSomeKeyWhenCallingreadValueWithUint64TypeThenCheckForErrorBranches) { TEST_F(ZesPmtFixtureMultiDevice, GivenSomeKeyWhenCallingreadValueWithUint64TypeThenCheckForErrorBranches) {
@@ -133,9 +133,9 @@ TEST_F(ZesPmtFixtureMultiDevice, GivenSomeKeyWhenCallingreadValueWithUint32TypeT
TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenCreatingPMTHandlesThenCheckForErrorThatCouldHappenDuringbaseOffsetRead) { TEST_F(ZesPmtFixtureMultiDevice, GivenValidDeviceHandlesWhenCreatingPMTHandlesThenCheckForErrorThatCouldHappenDuringbaseOffsetRead) {
EXPECT_CALL(*pTestFsAccess.get(), read(_, Matcher<uint64_t &>(_))) EXPECT_CALL(*pTestFsAccess.get(), read(_, Matcher<uint64_t &>(_)))
.WillOnce(Return(ZE_RESULT_ERROR_NOT_AVAILABLE)); .WillOnce(Return(ZE_RESULT_ERROR_NOT_AVAILABLE));
PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt); PlatformMonitoringTech::enumerateRootTelemIndex(pTestFsAccess.get(), gpuUpstreamPortPathInPmt);
auto pPmt = std::make_unique<PublicPlatformMonitoringTech>(pTestFsAccess.get(), 1, 0); auto pPmt = std::make_unique<PublicPlatformMonitoringTech>(pTestFsAccess.get(), 1, 0);
EXPECT_EQ(pPmt->init(pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt), ZE_RESULT_ERROR_NOT_AVAILABLE); EXPECT_EQ(pPmt->init(pTestFsAccess.get(), gpuUpstreamPortPathInPmt), ZE_RESULT_ERROR_NOT_AVAILABLE);
} }
inline static int openMock(const char *pathname, int flags) { inline static int openMock(const char *pathname, int flags) {
@@ -246,7 +246,7 @@ TEST_F(ZesPmtFixtureMultiDevice, GivenValidSyscallsWhenDoingPMTInitThenPMTmapOfS
deviceProperties.subdeviceId); deviceProperties.subdeviceId);
UNRECOVERABLE_IF(nullptr == pPmt); UNRECOVERABLE_IF(nullptr == pPmt);
PublicPlatformMonitoringTech::doInitPmtObject(pTestFsAccess.get(), deviceProperties.subdeviceId, pPmt, PublicPlatformMonitoringTech::doInitPmtObject(pTestFsAccess.get(), deviceProperties.subdeviceId, pPmt,
rootPciPathOfGpuDeviceInPmt, mapOfSubDeviceIdToPmtObject); gpuUpstreamPortPathInPmt, mapOfSubDeviceIdToPmtObject);
auto subDeviceIdToPmtEntry = mapOfSubDeviceIdToPmtObject.find(deviceProperties.subdeviceId); auto subDeviceIdToPmtEntry = mapOfSubDeviceIdToPmtObject.find(deviceProperties.subdeviceId);
EXPECT_EQ(subDeviceIdToPmtEntry->second, pPmt); EXPECT_EQ(subDeviceIdToPmtEntry->second, pPmt);
delete pPmt; delete pPmt;
@@ -264,7 +264,7 @@ TEST_F(ZesPmtFixtureMultiDevice, GivenBaseOffsetReadFailWhenDoingPMTInitThenPMTm
deviceProperties.subdeviceId); deviceProperties.subdeviceId);
UNRECOVERABLE_IF(nullptr == pPmt); UNRECOVERABLE_IF(nullptr == pPmt);
PublicPlatformMonitoringTech::doInitPmtObject(pTestFsAccess.get(), deviceProperties.subdeviceId, pPmt, PublicPlatformMonitoringTech::doInitPmtObject(pTestFsAccess.get(), deviceProperties.subdeviceId, pPmt,
rootPciPathOfGpuDeviceInPmt, mapOfSubDeviceIdToPmtObject); gpuUpstreamPortPathInPmt, mapOfSubDeviceIdToPmtObject);
EXPECT_TRUE(mapOfSubDeviceIdToPmtObject.empty()); EXPECT_TRUE(mapOfSubDeviceIdToPmtObject.empty());
} }
} }
@@ -311,7 +311,7 @@ class ZesPmtFixtureNoSubDevice : public SysmanDeviceFixture {
.WillByDefault(::testing::Invoke(pTestFsAccess.get(), &Mock<PmtFsAccess>::getRealPathSuccess)); .WillByDefault(::testing::Invoke(pTestFsAccess.get(), &Mock<PmtFsAccess>::getRealPathSuccess));
ON_CALL(*pTestFsAccess.get(), fileExists(_)) ON_CALL(*pTestFsAccess.get(), fileExists(_))
.WillByDefault(::testing::Invoke(pTestFsAccess.get(), &Mock<PmtFsAccess>::isFileExists)); .WillByDefault(::testing::Invoke(pTestFsAccess.get(), &Mock<PmtFsAccess>::isFileExists));
PlatformMonitoringTech::create(deviceHandles, pTestFsAccess.get(), rootPciPathOfGpuDeviceInPmt, mapOfSubDeviceIdToPmtObject); PlatformMonitoringTech::create(deviceHandles, pTestFsAccess.get(), gpuUpstreamPortPathInPmt, mapOfSubDeviceIdToPmtObject);
} }
void TearDown() override { void TearDown() override {
if (!sysmanUltsEnable) { if (!sysmanUltsEnable) {

View File

@@ -301,18 +301,6 @@ TEST_F(SysmanDeviceFixture, GivenPmuInterfaceHandleWhenCallinggetPmuInterfaceThe
EXPECT_EQ(pLinuxSysmanImp->getPmuInterface(), pLinuxSysmanImp->pPmuInterface); EXPECT_EQ(pLinuxSysmanImp->getPmuInterface(), pLinuxSysmanImp->pPmuInterface);
} }
TEST_F(SysmanDeviceFixture, GivenValidPciPathWhileGettingRootPciPortThenReturnedPathIs2LevelUpThenTheCurrentPath) {
const std::string mockBdf = "0000:00:02.0";
const std::string mockRealPath = "/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/" + mockBdf;
const std::string mockRealPath2LevelsUp = "/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0";
std::string pciRootPort1 = pLinuxSysmanImp->getPciRootPortDirectoryPath(mockRealPath);
EXPECT_EQ(pciRootPort1, mockRealPath2LevelsUp);
std::string pciRootPort2 = pLinuxSysmanImp->getPciRootPortDirectoryPath("device");
EXPECT_EQ(pciRootPort2, "device");
}
TEST_F(SysmanDeviceFixture, GivenValidPciPathWhileGettingCardBusPortThenReturnedPathIs1LevelUpThenTheCurrentPath) { TEST_F(SysmanDeviceFixture, GivenValidPciPathWhileGettingCardBusPortThenReturnedPathIs1LevelUpThenTheCurrentPath) {
const std::string mockBdf = "0000:00:02.0"; const std::string mockBdf = "0000:00:02.0";
const std::string mockRealPath = "/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/" + mockBdf; const std::string mockRealPath = "/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/" + mockBdf;
@@ -325,18 +313,6 @@ TEST_F(SysmanDeviceFixture, GivenValidPciPathWhileGettingCardBusPortThenReturned
EXPECT_EQ(pciRootPort2, "device"); EXPECT_EQ(pciRootPort2, "device");
} }
TEST_F(SysmanDeviceFixture, GivenValidPciPathWhileGettingRootPciPortThenReturnedPathIs1LevelAfterPCIePath) {
const std::string mockBdf = "0000:00:02.0";
const std::string mockRealPath = "/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/" + mockBdf;
const std::string mockRootPortPath = "/sys/devices/pci0000:00/0000:00:01.0";
std::string pciRootPort1 = pLinuxSysmanImp->getPciRootPortDirectoryPathForReset(mockRealPath);
EXPECT_EQ(pciRootPort1, mockRootPortPath);
std::string pciRootPort2 = pLinuxSysmanImp->getPciRootPortDirectoryPathForReset("device");
EXPECT_EQ(pciRootPort2, "device");
}
TEST_F(SysmanDeviceFixture, GivenNullDrmHandleWhenGettingDrmHandleThenValidDrmHandleIsReturned) { TEST_F(SysmanDeviceFixture, GivenNullDrmHandleWhenGettingDrmHandleThenValidDrmHandleIsReturned) {
pLinuxSysmanImp->releaseLocalDrmHandle(); pLinuxSysmanImp->releaseLocalDrmHandle();
EXPECT_NO_THROW(pLinuxSysmanImp->getDrm()); EXPECT_NO_THROW(pLinuxSysmanImp->getDrm());

View File

@@ -274,8 +274,8 @@ struct Mock<PowerPmt> : public PowerPmt {
Mock<PowerPmt>(FsAccess *pFsAccess, ze_bool_t onSubdevice, uint32_t subdeviceId) : PowerPmt(pFsAccess, onSubdevice, subdeviceId) {} Mock<PowerPmt>(FsAccess *pFsAccess, ze_bool_t onSubdevice, uint32_t subdeviceId) : PowerPmt(pFsAccess, onSubdevice, subdeviceId) {}
void mockedInit(FsAccess *pFsAccess) { void mockedInit(FsAccess *pFsAccess) {
std::string rootPciPathOfGpuDevice = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0"; std::string gpuUpstreamPortPath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0";
if (ZE_RESULT_SUCCESS != PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, rootPciPathOfGpuDevice)) { if (ZE_RESULT_SUCCESS != PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, gpuUpstreamPortPath)) {
return; return;
} }

View File

@@ -32,7 +32,7 @@ constexpr uint64_t offsetForNoSubDevices = 0x60;
constexpr uint8_t computeIndexForNoSubDevices = 9; constexpr uint8_t computeIndexForNoSubDevices = 9;
constexpr uint8_t globalIndexForNoSubDevices = 3; constexpr uint8_t globalIndexForNoSubDevices = 3;
const std::string baseTelemSysFS("/sys/class/intel_pmt"); const std::string baseTelemSysFS("/sys/class/intel_pmt");
std::string rootPciPathOfGpuDeviceInTemperature = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0"; std::string gpuUpstreamPortPathInTemperature = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0";
const std::string realPathTelem1 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1"; const std::string realPathTelem1 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem1";
const std::string realPathTelem2 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem2"; const std::string realPathTelem2 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem2";
const std::string realPathTelem3 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem3"; const std::string realPathTelem3 = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:02.0/0000:8e:00.1/pmt_telemetry.1.auto/intel_pmt/telem3";
@@ -61,7 +61,7 @@ struct Mock<TemperaturePmt> : public TemperaturePmt {
} }
void mockedInit(FsAccess *pFsAccess) { void mockedInit(FsAccess *pFsAccess) {
if (ZE_RESULT_SUCCESS != PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, rootPciPathOfGpuDeviceInTemperature)) { if (ZE_RESULT_SUCCESS != PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess, gpuUpstreamPortPathInTemperature)) {
return; return;
} }
telemetryDeviceEntry = "/sys/class/intel_pmt/telem2/telem"; telemetryDeviceEntry = "/sys/class/intel_pmt/telem2/telem";

View File

@@ -13,7 +13,7 @@ extern bool sysmanUltsEnable;
namespace L0 { namespace L0 {
namespace ult { namespace ult {
const static int fakeFileDescriptor = 123; const static int fakeFileDescriptor = 123;
std::string rootPciPathOfGpuDevice = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0"; std::string gpuUpstreamPortPath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0";
constexpr uint32_t handleComponentCountForSubDevices = 6u; constexpr uint32_t handleComponentCountForSubDevices = 6u;
constexpr uint32_t handleComponentCountForNoSubDevices = 2u; constexpr uint32_t handleComponentCountForNoSubDevices = 2u;
constexpr uint32_t invalidMaxTemperature = 125; constexpr uint32_t invalidMaxTemperature = 125;
@@ -185,7 +185,7 @@ TEST_F(SysmanMultiDeviceTemperatureFixture, GivenValidTempHandleWhenSettingTempe
TEST_F(SysmanMultiDeviceTemperatureFixture, GivenCreatePmtObjectsWhenRootTileIndexEnumeratesSuccessfulThenValidatePmtObjectsReceivedAndBranches) { TEST_F(SysmanMultiDeviceTemperatureFixture, GivenCreatePmtObjectsWhenRootTileIndexEnumeratesSuccessfulThenValidatePmtObjectsReceivedAndBranches) {
std::map<uint32_t, L0::PlatformMonitoringTech *> mapOfSubDeviceIdToPmtObject; std::map<uint32_t, L0::PlatformMonitoringTech *> mapOfSubDeviceIdToPmtObject;
PlatformMonitoringTech::create(deviceHandles, pFsAccess.get(), rootPciPathOfGpuDevice, mapOfSubDeviceIdToPmtObject); PlatformMonitoringTech::create(deviceHandles, pFsAccess.get(), gpuUpstreamPortPath, mapOfSubDeviceIdToPmtObject);
uint32_t deviceHandlesIndex = 0; uint32_t deviceHandlesIndex = 0;
for (auto &subDeviceIdToPmtEntry : mapOfSubDeviceIdToPmtObject) { for (auto &subDeviceIdToPmtEntry : mapOfSubDeviceIdToPmtObject) {
ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES}; ze_device_properties_t deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES};
@@ -322,13 +322,13 @@ TEST_F(SysmanDeviceTemperatureFixture, GivenValidTempHandleWhenGettingUnsupporte
TEST_F(SysmanDeviceTemperatureFixture, GivenValidateEnumerateRootTelemIndexWhengetRealPathFailsThenFailureReturned) { TEST_F(SysmanDeviceTemperatureFixture, GivenValidateEnumerateRootTelemIndexWhengetRealPathFailsThenFailureReturned) {
pFsAccess->mockErrorGetRealPath = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; pFsAccess->mockErrorGetRealPath = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE,
PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess.get(), rootPciPathOfGpuDevice)); PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess.get(), gpuUpstreamPortPath));
pFsAccess->mockErrorListDirectory = ZE_RESULT_ERROR_NOT_AVAILABLE; pFsAccess->mockErrorListDirectory = ZE_RESULT_ERROR_NOT_AVAILABLE;
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE,
PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess.get(), rootPciPathOfGpuDevice)); PlatformMonitoringTech::enumerateRootTelemIndex(pFsAccess.get(), gpuUpstreamPortPath));
std::map<uint32_t, L0::PlatformMonitoringTech *> mapOfSubDeviceIdToPmtObject; std::map<uint32_t, L0::PlatformMonitoringTech *> mapOfSubDeviceIdToPmtObject;
PlatformMonitoringTech::create(deviceHandles, pFsAccess.get(), rootPciPathOfGpuDevice, mapOfSubDeviceIdToPmtObject); PlatformMonitoringTech::create(deviceHandles, pFsAccess.get(), gpuUpstreamPortPath, mapOfSubDeviceIdToPmtObject);
EXPECT_TRUE(mapOfSubDeviceIdToPmtObject.empty()); EXPECT_TRUE(mapOfSubDeviceIdToPmtObject.empty());
} }
@@ -342,7 +342,7 @@ TEST_F(SysmanDeviceTemperatureFixture, GivenValidatePmtReadValueWhenkeyOffsetMap
TEST_F(SysmanDeviceTemperatureFixture, GivenCreatePmtObjectsWhenRootTileIndexEnumeratesSuccessfulThenValidatePmtObjectsReceivedAndBranches) { TEST_F(SysmanDeviceTemperatureFixture, GivenCreatePmtObjectsWhenRootTileIndexEnumeratesSuccessfulThenValidatePmtObjectsReceivedAndBranches) {
std::map<uint32_t, L0::PlatformMonitoringTech *> mapOfSubDeviceIdToPmtObject1; std::map<uint32_t, L0::PlatformMonitoringTech *> mapOfSubDeviceIdToPmtObject1;
PlatformMonitoringTech::create(deviceHandles, pFsAccess.get(), rootPciPathOfGpuDevice, mapOfSubDeviceIdToPmtObject1); PlatformMonitoringTech::create(deviceHandles, pFsAccess.get(), gpuUpstreamPortPath, mapOfSubDeviceIdToPmtObject1);
for (auto &subDeviceIdToPmtEntry : mapOfSubDeviceIdToPmtObject1) { for (auto &subDeviceIdToPmtEntry : mapOfSubDeviceIdToPmtObject1) {
EXPECT_NE(subDeviceIdToPmtEntry.second, nullptr); EXPECT_NE(subDeviceIdToPmtEntry.second, nullptr);
EXPECT_EQ(subDeviceIdToPmtEntry.first, 0u); // We know that subdeviceID is zero as core device didnt have any subdevices EXPECT_EQ(subDeviceIdToPmtEntry.first, 0u); // We know that subdeviceID is zero as core device didnt have any subdevices
@@ -352,7 +352,7 @@ TEST_F(SysmanDeviceTemperatureFixture, GivenCreatePmtObjectsWhenRootTileIndexEnu
std::map<uint32_t, L0::PlatformMonitoringTech *> mapOfSubDeviceIdToPmtObject2; std::map<uint32_t, L0::PlatformMonitoringTech *> mapOfSubDeviceIdToPmtObject2;
std::vector<ze_device_handle_t> testHandleVector; std::vector<ze_device_handle_t> testHandleVector;
// If empty device handle vector is provided then empty map is retrieved // If empty device handle vector is provided then empty map is retrieved
PlatformMonitoringTech::create(testHandleVector, pFsAccess.get(), rootPciPathOfGpuDevice, mapOfSubDeviceIdToPmtObject2); PlatformMonitoringTech::create(testHandleVector, pFsAccess.get(), gpuUpstreamPortPath, mapOfSubDeviceIdToPmtObject2);
EXPECT_TRUE(mapOfSubDeviceIdToPmtObject2.empty()); EXPECT_TRUE(mapOfSubDeviceIdToPmtObject2.empty());
} }