mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
feature: supports boot time survivability mode recovery
Related-To: NEO-14331 Signed-off-by: Kulkarni, Ashwin Kumar <ashwin.kumar.kulkarni@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5a057bbd46
commit
75d592d940
@@ -25,10 +25,14 @@ void OsFirmware::getSupportedFwTypes(std::vector<std::string> &supportedFwTypes,
|
||||
FirmwareUtil *pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
|
||||
supportedFwTypes.clear();
|
||||
if (pFwInterface != nullptr) {
|
||||
auto pSysmanProductHelper = pLinuxSysmanImp->getSysmanProductHelper();
|
||||
pSysmanProductHelper->getDeviceSupportedFwTypes(pFwInterface, supportedFwTypes);
|
||||
if (pSysmanProductHelper->isLateBindingSupported()) {
|
||||
pFwInterface->getLateBindingSupportedFwTypes(supportedFwTypes);
|
||||
if (pLinuxSysmanImp->isDeviceInSurvivabilityMode()) {
|
||||
pFwInterface->getDeviceSupportedFwTypes(supportedFwTypes);
|
||||
} else {
|
||||
auto pSysmanProductHelper = pLinuxSysmanImp->getSysmanProductHelper();
|
||||
pSysmanProductHelper->getDeviceSupportedFwTypes(pFwInterface, supportedFwTypes);
|
||||
if (pSysmanProductHelper->isLateBindingSupported()) {
|
||||
pFwInterface->getLateBindingSupportedFwTypes(supportedFwTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,7 +66,9 @@ ze_result_t LinuxFirmwareImp::osGetFirmwareFlashProgress(uint32_t *pCompletionPe
|
||||
|
||||
LinuxFirmwareImp::LinuxFirmwareImp(OsSysman *pOsSysman, const std::string &fwType) : osFwType(fwType) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
|
||||
if (!pLinuxSysmanImp->isDeviceInSurvivabilityMode()) {
|
||||
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
|
||||
}
|
||||
pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
|
||||
}
|
||||
|
||||
|
||||
13
level_zero/sysman/source/device/linux/CMakeLists.txt
Normal file
13
level_zero/sysman/source/device/linux/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright (C) 2025 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(UNIX)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_device_imp.cpp
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "level_zero/sysman/source/device/os_sysman.h"
|
||||
#include "level_zero/sysman/source/device/sysman_device_imp.h"
|
||||
#include "level_zero/sysman/source/device/sysman_os_device.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
struct OsSysman;
|
||||
|
||||
SysmanDevice *OsSysmanSurvivabilityDevice::createSurvivabilityDevice(std::unique_ptr<NEO::HwDeviceId> hwDeviceId) {
|
||||
SysmanDeviceImp *pSysmanDevice = new SysmanDeviceImp();
|
||||
DEBUG_BREAK_IF(!pSysmanDevice);
|
||||
ze_result_t result = pSysmanDevice->pOsSysman->initSurvivabilityMode(std::move(hwDeviceId));
|
||||
pSysmanDevice->isDeviceInSurvivabilityMode = true;
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
delete pSysmanDevice;
|
||||
pSysmanDevice = nullptr;
|
||||
}
|
||||
|
||||
return pSysmanDevice;
|
||||
}
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -8,8 +8,10 @@
|
||||
#pragma once
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
|
||||
#include "level_zero/sysman/source/device/sysman_hw_device_id.h"
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace L0 {
|
||||
@@ -21,8 +23,10 @@ struct OsSysman {
|
||||
virtual ~OsSysman(){};
|
||||
|
||||
virtual ze_result_t init() = 0;
|
||||
virtual ze_result_t initSurvivabilityMode(std::unique_ptr<NEO::HwDeviceId> hwDeviceId) = 0;
|
||||
static OsSysman *create(SysmanDeviceImp *pSysmanImp);
|
||||
virtual uint32_t getSubDeviceCount() = 0;
|
||||
virtual bool isDeviceInSurvivabilityMode() = 0;
|
||||
virtual const NEO::HardwareInfo &getHardwareInfo() const = 0;
|
||||
virtual void getDeviceUuids(std::vector<std::string> &deviceUuids) = 0;
|
||||
};
|
||||
|
||||
@@ -44,6 +44,9 @@ ze_result_t SysmanDevice::fabricPortGet(zes_device_handle_t hDevice, uint32_t *p
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->fabricPortGet(pCount, phPort);
|
||||
}
|
||||
ze_result_t SysmanDevice::memoryGet(zes_device_handle_t hDevice, uint32_t *pCount, zes_mem_handle_t *phMemory) {
|
||||
@@ -51,6 +54,9 @@ ze_result_t SysmanDevice::memoryGet(zes_device_handle_t hDevice, uint32_t *pCoun
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->memoryGet(pCount, phMemory);
|
||||
}
|
||||
|
||||
@@ -59,6 +65,9 @@ ze_result_t SysmanDevice::powerGet(zes_device_handle_t hDevice, uint32_t *pCount
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->powerGet(pCount, phPower);
|
||||
}
|
||||
|
||||
@@ -67,6 +76,9 @@ ze_result_t SysmanDevice::powerGetCardDomain(zes_device_handle_t hDevice, zes_pw
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->powerGetCardDomain(phPower);
|
||||
}
|
||||
|
||||
@@ -75,6 +87,9 @@ ze_result_t SysmanDevice::engineGet(zes_device_handle_t hDevice, uint32_t *pCoun
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->engineGet(pCount, phEngine);
|
||||
}
|
||||
|
||||
@@ -83,6 +98,9 @@ ze_result_t SysmanDevice::frequencyGet(zes_device_handle_t hDevice, uint32_t *pC
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->frequencyGet(pCount, phFrequency);
|
||||
}
|
||||
|
||||
@@ -91,6 +109,9 @@ ze_result_t SysmanDevice::schedulerGet(zes_device_handle_t hDevice, uint32_t *pC
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->schedulerGet(pCount, phScheduler);
|
||||
}
|
||||
|
||||
@@ -99,6 +120,9 @@ ze_result_t SysmanDevice::rasGet(zes_device_handle_t hDevice, uint32_t *pCount,
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->rasGet(pCount, phRas);
|
||||
}
|
||||
|
||||
@@ -107,6 +131,9 @@ ze_result_t SysmanDevice::diagnosticsGet(zes_device_handle_t hDevice, uint32_t *
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->diagnosticsGet(pCount, phDiagnostics);
|
||||
}
|
||||
|
||||
@@ -123,6 +150,9 @@ ze_result_t SysmanDevice::deviceGetProperties(zes_device_handle_t hDevice, zes_d
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceGetProperties(pProperties);
|
||||
}
|
||||
|
||||
@@ -131,6 +161,9 @@ ze_result_t SysmanDevice::deviceEnumEnabledVF(zes_device_handle_t hDevice, uint3
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceEnumEnabledVF(pCount, phVFhandle);
|
||||
}
|
||||
|
||||
@@ -139,6 +172,9 @@ ze_result_t SysmanDevice::processesGetState(zes_device_handle_t hDevice, uint32_
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->processesGetState(pCount, pProcesses);
|
||||
}
|
||||
|
||||
@@ -147,6 +183,9 @@ ze_result_t SysmanDevice::deviceReset(zes_device_handle_t hDevice, ze_bool_t for
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceReset(force);
|
||||
}
|
||||
ze_result_t SysmanDevice::deviceGetState(zes_device_handle_t hDevice, zes_device_state_t *pState) {
|
||||
@@ -154,6 +193,9 @@ ze_result_t SysmanDevice::deviceGetState(zes_device_handle_t hDevice, zes_device
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceGetState(pState);
|
||||
}
|
||||
ze_result_t SysmanDevice::deviceGetSubDeviceProperties(zes_device_handle_t hDevice,
|
||||
@@ -163,6 +205,9 @@ ze_result_t SysmanDevice::deviceGetSubDeviceProperties(zes_device_handle_t hDevi
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceGetSubDeviceProperties(pCount, pSubdeviceProps);
|
||||
}
|
||||
ze_result_t SysmanDevice::standbyGet(zes_device_handle_t hDevice, uint32_t *pCount, zes_standby_handle_t *phStandby) {
|
||||
@@ -170,6 +215,9 @@ ze_result_t SysmanDevice::standbyGet(zes_device_handle_t hDevice, uint32_t *pCou
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->standbyGet(pCount, phStandby);
|
||||
}
|
||||
|
||||
@@ -178,6 +226,9 @@ ze_result_t SysmanDevice::deviceEccAvailable(zes_device_handle_t hDevice, ze_boo
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceEccAvailable(pAvailable);
|
||||
}
|
||||
|
||||
@@ -186,6 +237,9 @@ ze_result_t SysmanDevice::deviceEccConfigurable(zes_device_handle_t hDevice, ze_
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceEccConfigurable(pConfigurable);
|
||||
}
|
||||
|
||||
@@ -194,6 +248,9 @@ ze_result_t SysmanDevice::deviceGetEccState(zes_device_handle_t hDevice, zes_dev
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceGetEccState(pState);
|
||||
}
|
||||
|
||||
@@ -202,6 +259,9 @@ ze_result_t SysmanDevice::deviceSetEccState(zes_device_handle_t hDevice, const z
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceSetEccState(newState, pState);
|
||||
}
|
||||
|
||||
@@ -210,6 +270,9 @@ ze_result_t SysmanDevice::temperatureGet(zes_device_handle_t hDevice, uint32_t *
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->temperatureGet(pCount, phTemperature);
|
||||
}
|
||||
|
||||
@@ -218,6 +281,9 @@ ze_result_t SysmanDevice::performanceGet(zes_device_handle_t hDevice, uint32_t *
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->performanceGet(pCount, phPerformance);
|
||||
}
|
||||
|
||||
@@ -226,6 +292,9 @@ ze_result_t SysmanDevice::pciGetProperties(zes_device_handle_t hDevice, zes_pci_
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->pciGetProperties(pProperties);
|
||||
}
|
||||
|
||||
@@ -234,6 +303,9 @@ ze_result_t SysmanDevice::pciGetState(zes_device_handle_t hDevice, zes_pci_state
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->pciGetState(pState);
|
||||
}
|
||||
|
||||
@@ -242,6 +314,9 @@ ze_result_t SysmanDevice::pciGetBars(zes_device_handle_t hDevice, uint32_t *pCou
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->pciGetBars(pCount, pProperties);
|
||||
}
|
||||
|
||||
@@ -250,6 +325,9 @@ ze_result_t SysmanDevice::pciGetStats(zes_device_handle_t hDevice, zes_pci_stats
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->pciGetStats(pStats);
|
||||
}
|
||||
|
||||
@@ -258,6 +336,9 @@ ze_result_t SysmanDevice::fanGet(zes_device_handle_t hDevice, uint32_t *pCount,
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->fanGet(pCount, phFan);
|
||||
}
|
||||
|
||||
@@ -266,6 +347,9 @@ ze_result_t SysmanDevice::deviceEventRegister(zes_device_handle_t hDevice, zes_e
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceEventRegister(events);
|
||||
}
|
||||
|
||||
@@ -279,6 +363,9 @@ ze_result_t SysmanDevice::deviceResetExt(zes_device_handle_t hDevice, zes_reset_
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->deviceResetExt(pProperties);
|
||||
}
|
||||
|
||||
@@ -287,6 +374,9 @@ ze_result_t SysmanDevice::fabricPortGetMultiPortThroughput(zes_device_handle_t h
|
||||
if (pSysmanDevice == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
if (pSysmanDevice->isDeviceInSurvivabilityMode) {
|
||||
return ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED;
|
||||
}
|
||||
return pSysmanDevice->fabricPortGetMultiPortThroughput(numPorts, phPort, pThroughput);
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,7 @@ struct SysmanDevice : _ze_device_handle_t {
|
||||
|
||||
virtual OsSysman *deviceGetOsInterface() = 0;
|
||||
virtual void getDeviceUuids(std::vector<std::string> &deviceUuids) = 0;
|
||||
bool isDeviceInSurvivabilityMode = false;
|
||||
};
|
||||
|
||||
} // namespace Sysman
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "level_zero/sysman/source/device/sysman_device_imp.h"
|
||||
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "level_zero/sysman/source/api/ecc/sysman_ecc_imp.h"
|
||||
#include "level_zero/sysman/source/api/events/sysman_events_imp.h"
|
||||
@@ -46,6 +47,12 @@ SysmanDeviceImp::SysmanDeviceImp(NEO::ExecutionEnvironment *executionEnvironment
|
||||
pVfManagementHandleContext = new VfManagementHandleContext(pOsSysman);
|
||||
}
|
||||
|
||||
SysmanDeviceImp::SysmanDeviceImp() : rootDeviceIndex(0) {
|
||||
pOsSysman = OsSysman::create(this);
|
||||
UNRECOVERABLE_IF(nullptr == pOsSysman);
|
||||
pFirmwareHandleContext = new FirmwareHandleContext(pOsSysman);
|
||||
}
|
||||
|
||||
SysmanDeviceImp::~SysmanDeviceImp() {
|
||||
freeResource(pGlobalOperations);
|
||||
freeResource(pDiagnosticsHandleContext);
|
||||
@@ -66,7 +73,9 @@ SysmanDeviceImp::~SysmanDeviceImp() {
|
||||
freeResource(pOsSysman);
|
||||
freeResource(pEvents);
|
||||
freeResource(pVfManagementHandleContext);
|
||||
executionEnvironment->decRefInternal();
|
||||
if (executionEnvironment != nullptr) {
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t SysmanDeviceImp::init() {
|
||||
|
||||
@@ -22,9 +22,9 @@ struct OsSysman;
|
||||
struct SysmanDeviceImp : SysmanDevice, NEO::NonCopyableAndNonMovableClass {
|
||||
|
||||
SysmanDeviceImp(NEO::ExecutionEnvironment *executionEnvironment, const uint32_t rootDeviceIndex);
|
||||
SysmanDeviceImp();
|
||||
~SysmanDeviceImp() override;
|
||||
|
||||
SysmanDeviceImp() = delete;
|
||||
ze_result_t init();
|
||||
|
||||
OsSysman *pOsSysman = nullptr;
|
||||
|
||||
20
level_zero/sysman/source/device/sysman_os_device.h
Normal file
20
level_zero/sysman/source/device/sysman_os_device.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "level_zero/sysman/source/device/sysman_device.h"
|
||||
#include "level_zero/sysman/source/device/sysman_hw_device_id.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
struct OsSysmanSurvivabilityDevice {
|
||||
static SysmanDevice *createSurvivabilityDevice(std::unique_ptr<NEO::HwDeviceId> hwDeviceId);
|
||||
};
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
13
level_zero/sysman/source/device/windows/CMakeLists.txt
Normal file
13
level_zero/sysman/source/device/windows/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright (C) 2025 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(WIN32)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_device_imp.cpp
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "level_zero/sysman/source/device/sysman_os_device.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
SysmanDevice *OsSysmanSurvivabilityDevice::createSurvivabilityDevice(std::unique_ptr<NEO::HwDeviceId> hwDeviceId) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
14
level_zero/sysman/source/driver/linux/CMakeLists.txt
Normal file
14
level_zero/sysman/source/driver/linux/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Copyright (C) 2025 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(UNIX)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_driver_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_driver_imp.h
|
||||
)
|
||||
endif()
|
||||
146
level_zero/sysman/source/driver/linux/sysman_os_driver_imp.cpp
Normal file
146
level_zero/sysman/source/driver/linux/sysman_os_driver_imp.cpp
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/sysman/source/driver/linux/sysman_os_driver_imp.h"
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/driver_model_type.h"
|
||||
#include "shared/source/os_interface/driver_info.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/utilities/directory.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
#include "level_zero/sysman/source/device/sysman_hw_device_id.h"
|
||||
#include "level_zero/sysman/source/device/sysman_os_device.h"
|
||||
#include "level_zero/sysman/source/driver/os_sysman_driver.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
std::vector<std::string> getFiles(const std::string &path) {
|
||||
std::vector<std::string> files;
|
||||
|
||||
DIR *dir = NEO::SysCalls::opendir(path.c_str());
|
||||
if (dir == nullptr) {
|
||||
return files;
|
||||
}
|
||||
|
||||
struct dirent *entry = nullptr;
|
||||
while ((entry = NEO::SysCalls::readdir(dir)) != nullptr) {
|
||||
if (entry->d_name[0] == '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string fullPath;
|
||||
fullPath += path;
|
||||
fullPath += "/";
|
||||
fullPath += entry->d_name;
|
||||
|
||||
files.push_back(fullPath);
|
||||
}
|
||||
|
||||
NEO::SysCalls::closedir(dir);
|
||||
return files;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> LinuxDriverImp::discoverDevicesWithSurvivabilityMode() {
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> hwSurvivabilityDeviceIds;
|
||||
const char *pciXeKmdDevicesDirectory = "/sys/bus/pci/drivers/xe";
|
||||
const char *survivabilitySysFsNodeName = "/survivability_mode";
|
||||
|
||||
std::vector<std::string> files = getFiles(pciXeKmdDevicesDirectory);
|
||||
|
||||
for (std::vector<std::string>::iterator file = files.begin(); file != files.end(); ++file) {
|
||||
std::string devicePathView(file->c_str(), file->size());
|
||||
std::size_t loc = devicePathView.find_last_of("/");
|
||||
std::string bdfString = devicePathView.substr(loc + 1); // omits / character too
|
||||
|
||||
constexpr int bdfTokensNum = 4;
|
||||
uint16_t domain = -1;
|
||||
uint8_t bus = -1, device = -1, function = -1;
|
||||
if (NEO::parseBdfString(bdfString, domain, bus, device, function) != bdfTokensNum) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string path = std::string(file->c_str()) + std::string(survivabilitySysFsNodeName);
|
||||
int fileDescriptor = NEO::SysCalls::open(path.c_str(), O_RDONLY);
|
||||
if (fileDescriptor < 0) {
|
||||
continue;
|
||||
}
|
||||
hwSurvivabilityDeviceIds.push_back(std::make_unique<NEO::HwDeviceIdDrm>(fileDescriptor, bdfString.c_str(), file->c_str()));
|
||||
}
|
||||
|
||||
return hwSurvivabilityDeviceIds;
|
||||
}
|
||||
|
||||
ze_result_t LinuxDriverImp::initializeInSurvivabilityMode(std::vector<std::unique_ptr<NEO::HwDeviceId>> &&hwDeviceIds, SysmanDriverHandleImp *pSysmanDriverHandleImp) {
|
||||
for (auto &hwDeviceId : hwDeviceIds) {
|
||||
auto sysmanHwDeviceId = createSysmanHwDeviceId(hwDeviceId);
|
||||
auto pSysmanDevice = OsSysmanSurvivabilityDevice::createSurvivabilityDevice(std::move(sysmanHwDeviceId));
|
||||
if (pSysmanDevice != nullptr) {
|
||||
pSysmanDriverHandleImp->sysmanDevices.push_back(pSysmanDevice);
|
||||
}
|
||||
}
|
||||
|
||||
if (pSysmanDriverHandleImp->sysmanDevices.size() == 0) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
||||
if (pSysmanDriverHandleImp->pOsSysmanDriver == nullptr) {
|
||||
pSysmanDriverHandleImp->pOsSysmanDriver = L0::Sysman::OsSysmanDriver::create();
|
||||
}
|
||||
pSysmanDriverHandleImp->numDevices = static_cast<uint32_t>(pSysmanDriverHandleImp->sysmanDevices.size());
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
SysmanDriverHandle *LinuxDriverImp::createInSurvivabilityMode(std::vector<std::unique_ptr<NEO::HwDeviceId>> &&hwDeviceId, ze_result_t *returnValue) {
|
||||
SysmanDriverHandleImp *driverHandle = new SysmanDriverHandleImp;
|
||||
UNRECOVERABLE_IF(nullptr == driverHandle);
|
||||
ze_result_t res = initializeInSurvivabilityMode(std::move(hwDeviceId), driverHandle);
|
||||
if (res != ZE_RESULT_SUCCESS) {
|
||||
delete driverHandle;
|
||||
driverHandle = nullptr;
|
||||
*returnValue = res;
|
||||
return nullptr;
|
||||
}
|
||||
globalSysmanDriver = driverHandle;
|
||||
*returnValue = res;
|
||||
return driverHandle;
|
||||
}
|
||||
|
||||
void LinuxDriverImp::initSurvivabilityDevices(_ze_driver_handle_t *sysmanDriverHandle, ze_result_t *result) {
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> hwSurvivabilityDeviceIds = discoverDevicesWithSurvivabilityMode();
|
||||
if (!hwSurvivabilityDeviceIds.empty()) {
|
||||
SysmanDriverHandleImp *pSysmanDriverHandleImp = static_cast<SysmanDriverHandleImp *>(sysmanDriverHandle);
|
||||
*result = initializeInSurvivabilityMode(std::move(hwSurvivabilityDeviceIds), pSysmanDriverHandleImp);
|
||||
}
|
||||
}
|
||||
|
||||
SysmanDriverHandle *LinuxDriverImp::initSurvivabilityDevicesWithDriver(ze_result_t *result, uint32_t *driverCount) {
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> hwSurvivabilityDeviceIds = discoverDevicesWithSurvivabilityMode();
|
||||
SysmanDriverHandle *pSysmanDriverHandle = nullptr;
|
||||
if (!hwSurvivabilityDeviceIds.empty()) {
|
||||
pSysmanDriverHandle = createInSurvivabilityMode(std::move(hwSurvivabilityDeviceIds), result);
|
||||
*driverCount = 1;
|
||||
} else {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"%s\n", "No devices found");
|
||||
*result = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
||||
return pSysmanDriverHandle;
|
||||
}
|
||||
|
||||
std::unique_ptr<OsDriver> OsDriver::create() {
|
||||
std::unique_ptr<LinuxDriverImp> pLinuxDriverImp = std::make_unique<LinuxDriverImp>();
|
||||
return pLinuxDriverImp;
|
||||
}
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
32
level_zero/sysman/source/driver/linux/sysman_os_driver_imp.h
Normal file
32
level_zero/sysman/source/driver/linux/sysman_os_driver_imp.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "level_zero/sysman/source/driver/sysman_os_driver.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
class LinuxDriverImp : public OsDriver, NEO::NonCopyableAndNonMovableClass {
|
||||
public:
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> discoverDevicesWithSurvivabilityMode() override;
|
||||
void initSurvivabilityDevices(_ze_driver_handle_t *sysmanDriverHandle, ze_result_t *result) override;
|
||||
SysmanDriverHandle *initSurvivabilityDevicesWithDriver(ze_result_t *result, uint32_t *driverCount) override;
|
||||
SysmanDriverHandle *createInSurvivabilityMode(std::vector<std::unique_ptr<NEO::HwDeviceId>> &&hwDeviceId, ze_result_t *returnValue);
|
||||
LinuxDriverImp() = default;
|
||||
~LinuxDriverImp() override = default;
|
||||
|
||||
protected:
|
||||
ze_result_t initializeInSurvivabilityMode(std::vector<std::unique_ptr<NEO::HwDeviceId>> &&hwDeviceIds, SysmanDriverHandleImp *pSysmanDriverHandleImp);
|
||||
};
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
* Copyright (C) 2023-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "level_zero/sysman/source/device/sysman_hw_device_id.h"
|
||||
#include "level_zero/sysman/source/driver/sysman_driver_handle_imp.h"
|
||||
#include "level_zero/sysman/source/driver/sysman_driver_imp.h"
|
||||
#include "level_zero/sysman/source/driver/sysman_os_driver.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
@@ -62,6 +63,13 @@ void SysmanDriverImp::initialize(ze_result_t *result) {
|
||||
*result = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
executionEnvironment->decRefInternal();
|
||||
|
||||
std::unique_ptr<OsDriver> pOsDriverInterface = OsDriver::create();
|
||||
if (globalSysmanDriverHandle != nullptr) {
|
||||
pOsDriverInterface->initSurvivabilityDevices(globalSysmanDriverHandle, result);
|
||||
} else {
|
||||
globalSysmanDriverHandle = pOsDriverInterface->initSurvivabilityDevicesWithDriver(result, &driverCount);
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t SysmanDriverImp::initStatus(ZE_RESULT_ERROR_UNINITIALIZED);
|
||||
|
||||
27
level_zero/sysman/source/driver/sysman_os_driver.h
Normal file
27
level_zero/sysman/source/driver/sysman_os_driver.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
|
||||
#include "level_zero/sysman/source/device/sysman_hw_device_id.h"
|
||||
#include "level_zero/sysman/source/driver/sysman_driver_handle_imp.h"
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
class OsDriver {
|
||||
public:
|
||||
virtual std::vector<std::unique_ptr<NEO::HwDeviceId>> discoverDevicesWithSurvivabilityMode() = 0;
|
||||
virtual void initSurvivabilityDevices(_ze_driver_handle_t *sysmanDriverHandle, ze_result_t *result) = 0;
|
||||
virtual SysmanDriverHandle *initSurvivabilityDevicesWithDriver(ze_result_t *result, uint32_t *driverCount) = 0;
|
||||
static std::unique_ptr<OsDriver> create();
|
||||
virtual ~OsDriver() = default;
|
||||
};
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
14
level_zero/sysman/source/driver/windows/CMakeLists.txt
Normal file
14
level_zero/sysman/source/driver/windows/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Copyright (C) 2025 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(WIN32)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_driver_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_driver_imp.h
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/sysman/source/driver/windows/sysman_os_driver_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> WddmDriverImp::discoverDevicesWithSurvivabilityMode() {
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> hwSurvivabilityDeviceIds;
|
||||
hwSurvivabilityDeviceIds.clear();
|
||||
return hwSurvivabilityDeviceIds;
|
||||
}
|
||||
|
||||
void WddmDriverImp::initSurvivabilityDevices(_ze_driver_handle_t *sysmanDriverHandle, ze_result_t *result) {
|
||||
}
|
||||
|
||||
SysmanDriverHandle *WddmDriverImp::initSurvivabilityDevicesWithDriver(ze_result_t *result, uint32_t *driverCount) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<OsDriver> OsDriver::create() {
|
||||
std::unique_ptr<WddmDriverImp> pWddmDriverImp = std::make_unique<WddmDriverImp>();
|
||||
return pWddmDriverImp;
|
||||
}
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "level_zero/sysman/source/driver/sysman_os_driver.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
class WddmDriverImp : public OsDriver, NEO::NonCopyableAndNonMovableClass {
|
||||
public:
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> discoverDevicesWithSurvivabilityMode() override;
|
||||
void initSurvivabilityDevices(_ze_driver_handle_t *sysmanDriverHandle, ze_result_t *result) override;
|
||||
SysmanDriverHandle *initSurvivabilityDevicesWithDriver(ze_result_t *result, uint32_t *driverCount) override;
|
||||
|
||||
WddmDriverImp() = default;
|
||||
~WddmDriverImp() override = default;
|
||||
};
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "shared/source/os_interface/linux/pmt_util.h"
|
||||
#include "shared/source/os_interface/linux/system_info.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/utilities/directory.h"
|
||||
|
||||
#include "level_zero/core/source/driver/driver.h"
|
||||
#include "level_zero/sysman/source/api/pci/linux/sysman_os_pci_imp.h"
|
||||
@@ -182,13 +183,17 @@ LinuxSysmanImp::LinuxSysmanImp(SysmanDeviceImp *pParentSysmanDeviceImp) {
|
||||
}
|
||||
|
||||
void LinuxSysmanImp::createFwUtilInterface() {
|
||||
const auto pciBusInfo = pParentSysmanDeviceImp->getRootDeviceEnvironment().osInterface->getDriverModel()->getPciBusInfo();
|
||||
const uint16_t domain = static_cast<uint16_t>(pciBusInfo.pciDomain);
|
||||
const uint8_t bus = static_cast<uint8_t>(pciBusInfo.pciBus);
|
||||
const uint8_t device = static_cast<uint8_t>(pciBusInfo.pciDevice);
|
||||
const uint8_t function = static_cast<uint8_t>(pciBusInfo.pciFunction);
|
||||
if (isDeviceInSurvivabilityMode()) {
|
||||
pFwUtilInterface = FirmwareUtil::create(pciBdfInfo.pciDomain, pciBdfInfo.pciBus, pciBdfInfo.pciDevice, pciBdfInfo.pciFunction);
|
||||
} else {
|
||||
const auto pciBusInfo = pParentSysmanDeviceImp->getRootDeviceEnvironment().osInterface->getDriverModel()->getPciBusInfo();
|
||||
const uint16_t domain = static_cast<uint16_t>(pciBusInfo.pciDomain);
|
||||
const uint8_t bus = static_cast<uint8_t>(pciBusInfo.pciBus);
|
||||
const uint8_t device = static_cast<uint8_t>(pciBusInfo.pciDevice);
|
||||
const uint8_t function = static_cast<uint8_t>(pciBusInfo.pciFunction);
|
||||
|
||||
pFwUtilInterface = FirmwareUtil::create(domain, bus, device, function);
|
||||
pFwUtilInterface = FirmwareUtil::create(domain, bus, device, function);
|
||||
}
|
||||
}
|
||||
|
||||
FirmwareUtil *LinuxSysmanImp::getFwUtilInterface() {
|
||||
@@ -590,6 +595,29 @@ bool LinuxSysmanImp::getUuidFromSubDeviceInfo(uint32_t subDeviceID, std::array<u
|
||||
return this->uuidVec[subDeviceID].isValid;
|
||||
}
|
||||
|
||||
static NEO::PhysicalDevicePciBusInfo getPciBufInfo(const char *bdfString) {
|
||||
constexpr int bdfTokensNum = 4;
|
||||
uint16_t domain = -1;
|
||||
uint8_t bus = -1, device = -1, function = -1;
|
||||
if (NEO::parseBdfString(bdfString, domain, bus, device, function) != bdfTokensNum) {
|
||||
return NEO::PhysicalDevicePciBusInfo{};
|
||||
}
|
||||
return NEO::PhysicalDevicePciBusInfo{domain, bus, device, function};
|
||||
}
|
||||
|
||||
ze_result_t LinuxSysmanImp::initSurvivabilityMode(std::unique_ptr<NEO::HwDeviceId> hwDeviceId) {
|
||||
const auto hwDeviceIdDrm = static_cast<NEO::HwDeviceIdDrm *>(hwDeviceId.get());
|
||||
pciBdfInfo = getPciBufInfo(hwDeviceIdDrm->getPciPath());
|
||||
if (pciBdfInfo.pciDomain == pciBdfInfo.invalidValue) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
bool LinuxSysmanImp::isDeviceInSurvivabilityMode() {
|
||||
return pParentSysmanDeviceImp->isDeviceInSurvivabilityMode;
|
||||
}
|
||||
|
||||
OsSysman *OsSysman::create(SysmanDeviceImp *pParentSysmanDeviceImp) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = new LinuxSysmanImp(pParentSysmanDeviceImp);
|
||||
return static_cast<OsSysman *>(pLinuxSysmanImp);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
#include "shared/source/os_interface/driver_info.h"
|
||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||
|
||||
#include "level_zero/sysman/source/device/os_sysman.h"
|
||||
@@ -81,6 +82,8 @@ class LinuxSysmanImp : public OsSysman, NEO::NonCopyableAndNonMovableClass {
|
||||
bool getTelemData(uint32_t subDeviceId, std::string &telemDir, std::string &guid, uint64_t &telemOffset);
|
||||
bool getUuidFromSubDeviceInfo(uint32_t subDeviceID, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid);
|
||||
bool generateUuidFromPciAndSubDeviceInfo(uint32_t subDeviceID, const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid);
|
||||
ze_result_t initSurvivabilityMode(std::unique_ptr<NEO::HwDeviceId> hwDeviceId) override;
|
||||
bool isDeviceInSurvivabilityMode() override;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<SysmanProductHelper> pSysmanProductHelper;
|
||||
@@ -102,6 +105,7 @@ class LinuxSysmanImp : public OsSysman, NEO::NonCopyableAndNonMovableClass {
|
||||
std::array<uint8_t, NEO::ProductHelper::uuidSize> id{};
|
||||
};
|
||||
std::vector<Uuid> uuidVec;
|
||||
NEO::PhysicalDevicePciBusInfo pciBdfInfo = {};
|
||||
|
||||
private:
|
||||
LinuxSysmanImp() = delete;
|
||||
|
||||
@@ -191,6 +191,14 @@ bool WddmSysmanImp::generateUuidFromPciBusInfo(const NEO::PhysicalDevicePciBusIn
|
||||
return false;
|
||||
}
|
||||
|
||||
ze_result_t WddmSysmanImp::initSurvivabilityMode(std::unique_ptr<NEO::HwDeviceId> hwDeviceId) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
||||
bool WddmSysmanImp::isDeviceInSurvivabilityMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
OsSysman *OsSysman::create(SysmanDeviceImp *pParentSysmanDeviceImp) {
|
||||
WddmSysmanImp *pWddmSysmanImp = new WddmSysmanImp(pParentSysmanDeviceImp);
|
||||
return static_cast<OsSysman *>(pWddmSysmanImp);
|
||||
|
||||
@@ -46,6 +46,8 @@ class WddmSysmanImp : public OsSysman, NEO::NonCopyableAndNonMovableClass {
|
||||
PlatformMonitoringTech *getSysmanPmt();
|
||||
bool getUuid(std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid);
|
||||
bool generateUuidFromPciBusInfo(const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid);
|
||||
ze_result_t initSurvivabilityMode(std::unique_ptr<NEO::HwDeviceId> hwDeviceId) override;
|
||||
bool isDeviceInSurvivabilityMode() override;
|
||||
|
||||
protected:
|
||||
FirmwareUtil *pFwUtilInterface = nullptr;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/sysman/source/driver/sysman_os_driver.h"
|
||||
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.h"
|
||||
#include "level_zero/sysman/test/unit_tests/sources/firmware/linux/mock_zes_sysman_firmware.h"
|
||||
|
||||
@@ -415,6 +416,61 @@ HWTEST2_F(ZesSysmanFirmwareFixture, GivenValidLateBindingFirmwareHandleWhenGetti
|
||||
}
|
||||
}
|
||||
|
||||
using SysmanSurvivabilityDeviceTest = ::testing::Test;
|
||||
struct dirent mockSurvivabilityDevEntries[] = {
|
||||
{0, 0, 0, 0, "0000:03:00.0"},
|
||||
{0, 0, 0, 0, "0000:09:00.0"},
|
||||
};
|
||||
|
||||
inline static int openMockReturnSuccess(const char *pathname, int flags) {
|
||||
NEO::SysCalls::closeFuncCalled = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
TEST_F(SysmanSurvivabilityDeviceTest, GivenSurvivabilityDeviceWhenFirmwareEnumerationApiIsCalledThenFirmwareHandlesAreReturned) {
|
||||
const uint32_t numEntries = sizeof(mockSurvivabilityDevEntries) / sizeof(mockSurvivabilityDevEntries[0]);
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpendir)> mockOpendir(&NEO::SysCalls::sysCallsOpendir, [](const char *name) -> DIR * {
|
||||
return reinterpret_cast<DIR *>(0xc001);
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> openBackup{&NEO::SysCalls::sysCallsOpen, openMockReturnSuccess};
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsReaddir)> mockReaddir(
|
||||
&NEO::SysCalls::sysCallsReaddir, [](DIR * dir) -> struct dirent * {
|
||||
static uint32_t entryIndex = 0u;
|
||||
if (entryIndex >= numEntries) {
|
||||
entryIndex = 0;
|
||||
return nullptr;
|
||||
}
|
||||
return &mockSurvivabilityDevEntries[entryIndex++];
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsClosedir)> mockClosedir(&NEO::SysCalls::sysCallsClosedir, [](DIR *dir) -> int {
|
||||
return 0;
|
||||
});
|
||||
|
||||
std::unique_ptr<OsDriver> pOsDriverInterface = OsDriver::create();
|
||||
uint32_t driverCount = 0;
|
||||
ze_result_t result;
|
||||
auto sysmanDriverHandle = pOsDriverInterface->initSurvivabilityDevicesWithDriver(&result, &driverCount);
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_TRUE(sysmanDriverHandle != nullptr);
|
||||
|
||||
SysmanDriverHandleImp *pSysmanDriverHandleImp = static_cast<SysmanDriverHandleImp *>(sysmanDriverHandle);
|
||||
auto pSysmanDevice = pSysmanDriverHandleImp->sysmanDevices[0];
|
||||
auto pSysmanDeviceImp = static_cast<L0::Sysman::SysmanDeviceImp *>(pSysmanDevice);
|
||||
auto pOsSysman = pSysmanDeviceImp->pOsSysman;
|
||||
auto pLinuxSysmanImp = static_cast<PublicLinuxSysmanImp *>(pOsSysman);
|
||||
pLinuxSysmanImp->pFwUtilInterface = new MockFirmwareInterface();
|
||||
|
||||
uint32_t count = 0;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, SysmanDevice::firmwareGet(pSysmanDevice->toHandle(), &count, nullptr));
|
||||
EXPECT_EQ(count, mockFwHandlesCount);
|
||||
delete pLinuxSysmanImp->pFwUtilInterface;
|
||||
pLinuxSysmanImp->pFwUtilInterface = nullptr;
|
||||
delete sysmanDriverHandle;
|
||||
globalSysmanDriver = nullptr;
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
|
||||
@@ -15,6 +15,7 @@ if(UNIX)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sysman_hw_device_id.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_sysman_hw_device_id.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sysman_core_handle_support.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sysman_survivability.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/os_interface/linux/sys_calls_linux_ult.h"
|
||||
|
||||
#include "level_zero/core/source/driver/driver.h"
|
||||
#include "level_zero/sysman/source/device/sysman_device.h"
|
||||
#include "level_zero/sysman/source/driver/linux/sysman_os_driver_imp.h"
|
||||
#include "level_zero/sysman/source/driver/sysman_driver_handle_imp.h"
|
||||
#include "level_zero/sysman/source/driver/sysman_os_driver.h"
|
||||
#include "level_zero/sysman/source/shared/linux/zes_os_sysman_imp.h"
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <bitset>
|
||||
#include <cstring>
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
namespace ult {
|
||||
|
||||
inline static int openMockReturnFailure(const char *pathname, int flags) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
inline static int openMockReturnSuccess(const char *pathname, int flags) {
|
||||
NEO::SysCalls::closeFuncCalled = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct dirent mockSurvivabilityEntries[] = {
|
||||
{0, 0, 0, 0, "0000:03:00.0"},
|
||||
{0, 0, 0, 0, "0000:09:00.0"},
|
||||
};
|
||||
|
||||
struct dirent mockInvalidSurvivabilityEntries[] = {
|
||||
{0, 0, 0, 0, "."},
|
||||
{0, 0, 0, 0, "000000:03:00.0"},
|
||||
{0, 0, 0, 0, "000000:00:00.0"},
|
||||
};
|
||||
|
||||
struct SysmanDriverTestSurvivabilityDevice : public ::testing::Test {};
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenSurvivabilityDeviceConditionWhenDiscoverDevicesWithSurvivabilityModeIsCalledThenCorrectNumberOfDevicesIsReturned) {
|
||||
const uint32_t numEntries = sizeof(mockSurvivabilityEntries) / sizeof(mockSurvivabilityEntries[0]);
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpendir)> mockOpendir(&NEO::SysCalls::sysCallsOpendir, [](const char *name) -> DIR * {
|
||||
return reinterpret_cast<DIR *>(0xc001);
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> openBackup{&NEO::SysCalls::sysCallsOpen, openMockReturnSuccess};
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsReaddir)> mockReaddir(
|
||||
&NEO::SysCalls::sysCallsReaddir, [](DIR * dir) -> struct dirent * {
|
||||
static uint32_t entryIndex = 0u;
|
||||
if (entryIndex >= numEntries) {
|
||||
entryIndex = 0;
|
||||
return nullptr;
|
||||
}
|
||||
return &mockSurvivabilityEntries[entryIndex++];
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsClosedir)> mockClosedir(&NEO::SysCalls::sysCallsClosedir, [](DIR *dir) -> int {
|
||||
return 0;
|
||||
});
|
||||
|
||||
std::unique_ptr<OsDriver> pOsDriverInterface = OsDriver::create();
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> hwSurvivabilityDeviceIds = pOsDriverInterface->discoverDevicesWithSurvivabilityMode();
|
||||
EXPECT_EQ(2u, (uint32_t)hwSurvivabilityDeviceIds.size());
|
||||
}
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenSurvivabilityDeviceConditionWhenIncorrectPciBdfInfoIsFountThenZeroDevicesIsReported) {
|
||||
const uint32_t numEntries = sizeof(mockInvalidSurvivabilityEntries) / sizeof(mockInvalidSurvivabilityEntries[0]);
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpendir)> mockOpendir(&NEO::SysCalls::sysCallsOpendir, [](const char *name) -> DIR * {
|
||||
return reinterpret_cast<DIR *>(0xc001);
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> openBackup{&NEO::SysCalls::sysCallsOpen, openMockReturnSuccess};
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsReaddir)> mockReaddir(
|
||||
&NEO::SysCalls::sysCallsReaddir, [](DIR * dir) -> struct dirent * {
|
||||
static uint32_t entryIndex = 0u;
|
||||
if (entryIndex >= numEntries) {
|
||||
entryIndex = 0;
|
||||
return nullptr;
|
||||
}
|
||||
return &mockInvalidSurvivabilityEntries[entryIndex++];
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsClosedir)> mockClosedir(&NEO::SysCalls::sysCallsClosedir, [](DIR *dir) -> int {
|
||||
return 0;
|
||||
});
|
||||
|
||||
std::unique_ptr<OsDriver> pOsDriverInterface = OsDriver::create();
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> hwSurvivabilityDeviceIds = pOsDriverInterface->discoverDevicesWithSurvivabilityMode();
|
||||
EXPECT_EQ(0u, (uint32_t)hwSurvivabilityDeviceIds.size());
|
||||
}
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenSurvivabilityDeviceConditionAndInvalidSurvivabilitySysfsNodeWhenDiscoverDevicesWithSurvivabilityModeIsCalledThenZeroDevicesAreReturned) {
|
||||
const uint32_t numEntries = sizeof(mockSurvivabilityEntries) / sizeof(mockSurvivabilityEntries[0]);
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpendir)> mockOpendir(&NEO::SysCalls::sysCallsOpendir, [](const char *name) -> DIR * {
|
||||
return reinterpret_cast<DIR *>(0xc001);
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> openBackup{&NEO::SysCalls::sysCallsOpen, openMockReturnFailure};
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsReaddir)> mockReaddir(
|
||||
&NEO::SysCalls::sysCallsReaddir, [](DIR * dir) -> struct dirent * {
|
||||
static uint32_t entryIndex = 0u;
|
||||
if (entryIndex >= numEntries) {
|
||||
entryIndex = 0;
|
||||
return nullptr;
|
||||
}
|
||||
return &mockSurvivabilityEntries[entryIndex++];
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsClosedir)> mockClosedir(&NEO::SysCalls::sysCallsClosedir, [](DIR *dir) -> int {
|
||||
return 0;
|
||||
});
|
||||
|
||||
std::unique_ptr<OsDriver> pOsDriverInterface = OsDriver::create();
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> hwSurvivabilityDeviceIds = pOsDriverInterface->discoverDevicesWithSurvivabilityMode();
|
||||
EXPECT_EQ(0u, (uint32_t)hwSurvivabilityDeviceIds.size());
|
||||
}
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenSurvivabilityModeConditionWhenCreateInSurvivabilityModeIsCalledThenSysmanDriverHandleIsCreated) {
|
||||
const uint32_t numEntries = sizeof(mockSurvivabilityEntries) / sizeof(mockSurvivabilityEntries[0]);
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpendir)> mockOpendir(&NEO::SysCalls::sysCallsOpendir, [](const char *name) -> DIR * {
|
||||
return reinterpret_cast<DIR *>(0xc001);
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> openBackup{&NEO::SysCalls::sysCallsOpen, openMockReturnSuccess};
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsReaddir)> mockReaddir(
|
||||
&NEO::SysCalls::sysCallsReaddir, [](DIR * dir) -> struct dirent * {
|
||||
static uint32_t entryIndex = 0u;
|
||||
if (entryIndex >= numEntries) {
|
||||
entryIndex = 0;
|
||||
return nullptr;
|
||||
}
|
||||
return &mockSurvivabilityEntries[entryIndex++];
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsClosedir)> mockClosedir(&NEO::SysCalls::sysCallsClosedir, [](DIR *dir) -> int {
|
||||
return 0;
|
||||
});
|
||||
SysmanDriverHandle *sysmanDriverHandle = nullptr;
|
||||
std::unique_ptr<OsDriver> pOsDriverInterface = OsDriver::create();
|
||||
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
uint32_t driverCount = 0;
|
||||
sysmanDriverHandle = pOsDriverInterface->initSurvivabilityDevicesWithDriver(&result, &driverCount);
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, driverCount);
|
||||
EXPECT_TRUE(sysmanDriverHandle != nullptr);
|
||||
|
||||
delete sysmanDriverHandle;
|
||||
globalSysmanDriver = nullptr;
|
||||
}
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenSurvivabilityModeConditionWhenCreateInSurvivabilityModeIsCalledWithInvalidParamsThenSysmanDriverHandleIsNullPointer) {
|
||||
ze_result_t result;
|
||||
std::unique_ptr<OsDriver> pOsDriverInterface = OsDriver::create();
|
||||
|
||||
uint32_t driverCount = 0;
|
||||
auto sysmanDriverHandle = pOsDriverInterface->initSurvivabilityDevicesWithDriver(&result, &driverCount);
|
||||
EXPECT_EQ(result, ZE_RESULT_ERROR_UNINITIALIZED);
|
||||
EXPECT_TRUE(sysmanDriverHandle == nullptr);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenSurvivabilityModeConditionWhenSysmanApisAreInvokedThenSurvivabilityModeDetectedErrorIsReturned) {
|
||||
const uint32_t numEntries = sizeof(mockSurvivabilityEntries) / sizeof(mockSurvivabilityEntries[0]);
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpendir)> mockOpendir(&NEO::SysCalls::sysCallsOpendir, [](const char *name) -> DIR * {
|
||||
return reinterpret_cast<DIR *>(0xc001);
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> openBackup{&NEO::SysCalls::sysCallsOpen, openMockReturnSuccess};
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsReaddir)> mockReaddir(
|
||||
&NEO::SysCalls::sysCallsReaddir, [](DIR * dir) -> struct dirent * {
|
||||
static uint32_t entryIndex = 0u;
|
||||
if (entryIndex >= numEntries) {
|
||||
entryIndex = 0;
|
||||
return nullptr;
|
||||
}
|
||||
return &mockSurvivabilityEntries[entryIndex++];
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsClosedir)> mockClosedir(&NEO::SysCalls::sysCallsClosedir, [](DIR *dir) -> int {
|
||||
return 0;
|
||||
});
|
||||
|
||||
std::unique_ptr<OsDriver> pOsDriverInterface = OsDriver::create();
|
||||
ze_result_t result;
|
||||
|
||||
uint32_t driverCount = 0;
|
||||
auto sysmanDriverHandle = pOsDriverInterface->initSurvivabilityDevicesWithDriver(&result, &driverCount);
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_TRUE(sysmanDriverHandle != nullptr);
|
||||
uint32_t count = 2;
|
||||
std::vector<zes_device_handle_t> phDevices;
|
||||
phDevices.resize(2u);
|
||||
result = sysmanDriverHandle->getDevice(&count, phDevices.data());
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::performanceGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::powerGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::powerGetCardDomain(phDevices[0], nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::frequencyGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::fabricPortGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::temperatureGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::standbyGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceGetProperties(phDevices[0], nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceGetSubDeviceProperties(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::processesGetState(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceGetState(phDevices[0], nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceReset(phDevices[0], false));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::engineGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::pciGetProperties(phDevices[0], nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::pciGetState(phDevices[0], nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::pciGetBars(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::pciGetStats(phDevices[0], nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::schedulerGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::rasGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::memoryGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::fanGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::diagnosticsGet(phDevices[0], &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceEventRegister(phDevices[0], u_int32_t(0)));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceEccAvailable(phDevices[0], nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceEccConfigurable(phDevices[0], nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceGetEccState(phDevices[0], nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceSetEccState(phDevices[0], nullptr, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceResetExt(phDevices[0], nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::fabricPortGetMultiPortThroughput(phDevices[0], count, nullptr, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceEnumEnabledVF(phDevices[0], &count, nullptr));
|
||||
|
||||
delete sysmanDriverHandle;
|
||||
globalSysmanDriver = nullptr;
|
||||
}
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenSysmanDriverHandleWhenSurvivabilityDevicesAreAddedToSameDriverHandleThenSuccessIsReturned) {
|
||||
const uint32_t numEntriesAllowed = 1;
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpendir)> mockOpendir(&NEO::SysCalls::sysCallsOpendir, [](const char *name) -> DIR * {
|
||||
return reinterpret_cast<DIR *>(0xc001);
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsOpen)> openBackup{&NEO::SysCalls::sysCallsOpen, openMockReturnSuccess};
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsReaddir)> mockReaddir(
|
||||
&NEO::SysCalls::sysCallsReaddir, [](DIR * dir) -> struct dirent * {
|
||||
static uint32_t entryIndex = 0u;
|
||||
if (entryIndex >= numEntriesAllowed) {
|
||||
entryIndex = 0;
|
||||
return nullptr;
|
||||
}
|
||||
return &mockSurvivabilityEntries[entryIndex++];
|
||||
});
|
||||
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsClosedir)> mockClosedir(&NEO::SysCalls::sysCallsClosedir, [](DIR *dir) -> int {
|
||||
return 0;
|
||||
});
|
||||
|
||||
std::unique_ptr<OsDriver> pOsDriverInterface = OsDriver::create();
|
||||
|
||||
ze_result_t result;
|
||||
uint32_t driverCount = 0;
|
||||
auto sysmanDriverHandle = pOsDriverInterface->initSurvivabilityDevicesWithDriver(&result, &driverCount);
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_TRUE(sysmanDriverHandle != nullptr);
|
||||
uint32_t count = 0;
|
||||
result = sysmanDriverHandle->getDevice(&count, nullptr);
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(count, 1u);
|
||||
|
||||
pOsDriverInterface->initSurvivabilityDevices(sysmanDriverHandle, &result);
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
count = 0;
|
||||
result = sysmanDriverHandle->getDevice(&count, nullptr);
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(count, 2u);
|
||||
|
||||
delete sysmanDriverHandle;
|
||||
globalSysmanDriver = nullptr;
|
||||
}
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenSurvivabilityModeConditionWhenCreateInSurvivabilityModeIsCalledWithInvalidPciBdfInfoThenSysmanDriverHandleIsNullPointer) {
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> hwSurvivabilityDeviceIds;
|
||||
hwSurvivabilityDeviceIds.push_back(std::make_unique<NEO::HwDeviceIdDrm>(0, "000000:03:00.0", "dummy file path"));
|
||||
ze_result_t result;
|
||||
|
||||
std::unique_ptr<LinuxDriverImp> pLinuxDriverImp = std::make_unique<LinuxDriverImp>();
|
||||
auto sysmanDriverHandle = pLinuxDriverImp->createInSurvivabilityMode(std::move(hwSurvivabilityDeviceIds), &result);
|
||||
EXPECT_EQ(result, ZE_RESULT_ERROR_UNINITIALIZED);
|
||||
EXPECT_TRUE(sysmanDriverHandle == nullptr);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenValidSurvivabilityModeDeviceWhenCalllingGetFwUtilInterfaceWithNoValidFwUtilInterfaceSupportThenReturnsNullPointer) {
|
||||
std::vector<std::unique_ptr<NEO::HwDeviceId>> hwSurvivabilityDeviceIds;
|
||||
hwSurvivabilityDeviceIds.push_back(std::make_unique<NEO::HwDeviceIdDrm>(0, "0000:03:00.0", "dummy file path"));
|
||||
ze_result_t result;
|
||||
std::unique_ptr<LinuxDriverImp> pLinuxDriverImp = std::make_unique<LinuxDriverImp>();
|
||||
auto sysmanDriverHandle = pLinuxDriverImp->createInSurvivabilityMode(std::move(hwSurvivabilityDeviceIds), &result);
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_TRUE(sysmanDriverHandle != nullptr);
|
||||
SysmanDriverHandleImp *pSysmanDriverHandleImp = (SysmanDriverHandleImp *)sysmanDriverHandle;
|
||||
auto pSysmanDevice = pSysmanDriverHandleImp->sysmanDevices[0];
|
||||
auto pSysmanDeviceImp = static_cast<L0::Sysman::SysmanDeviceImp *>(pSysmanDevice);
|
||||
auto pOsSysman = pSysmanDeviceImp->pOsSysman;
|
||||
auto pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
EXPECT_EQ(nullptr, pLinuxSysmanImp->getFwUtilInterface());
|
||||
delete sysmanDriverHandle;
|
||||
globalSysmanDriver = nullptr;
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -16,6 +16,7 @@ if(WIN32)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sysman_manager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sysman.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sysman_core_handle_support.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sysman_survivability.cpp
|
||||
)
|
||||
endif()
|
||||
add_subdirectories()
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/sysman/source/device/sysman_os_device.h"
|
||||
#include "level_zero/sysman/source/driver/sysman_os_driver.h"
|
||||
#include "level_zero/sysman/test/unit_tests/sources/windows/mock_sysman_fixture.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
namespace ult {
|
||||
|
||||
TEST_F(SysmanDeviceFixture, GivenSysmanDeviceHandleWhenCallingSysmanDeviceFunctionswithSurvivabilityModeSetToTrueThenSurvivabiityModeDetectedErrorIsReturned) {
|
||||
|
||||
uint32_t count = 0;
|
||||
pSysmanDevice->isDeviceInSurvivabilityMode = true;
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::performanceGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::powerGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::powerGetCardDomain(pSysmanDevice, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::frequencyGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::fabricPortGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::temperatureGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::standbyGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceGetProperties(pSysmanDevice, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceGetSubDeviceProperties(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::processesGetState(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceGetState(pSysmanDevice, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceReset(pSysmanDevice, false));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::engineGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::pciGetProperties(pSysmanDevice, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::pciGetState(pSysmanDevice, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::pciGetBars(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::pciGetStats(pSysmanDevice, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::schedulerGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::rasGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::memoryGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::fanGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::diagnosticsGet(pSysmanDevice, &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceEventRegister(pSysmanDevice, uint32_t(0)));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceEccAvailable(pSysmanDevice, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceEccConfigurable(pSysmanDevice, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceGetEccState(pSysmanDevice, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceSetEccState(pSysmanDevice, nullptr, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceResetExt(pSysmanDevice, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::fabricPortGetMultiPortThroughput(pSysmanDevice, count, nullptr, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED, SysmanDevice::deviceEnumEnabledVF(pSysmanDevice, &count, nullptr));
|
||||
|
||||
pSysmanDevice->isDeviceInSurvivabilityMode = false;
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceFixture, GivenValidSysmanDeviceHandleWhenQueryingSurvivabilityModeStatusThenFalseIsReturned) {
|
||||
|
||||
auto hwDeviceId = std::make_unique<NEO::HwDeviceId>(NEO::DriverModelType::wddm);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, pOsSysman->initSurvivabilityMode(std::move(hwDeviceId)));
|
||||
EXPECT_FALSE(pOsSysman->isDeviceInSurvivabilityMode());
|
||||
}
|
||||
|
||||
struct SysmanDriverTestSurvivabilityDevice : public ::testing::Test {};
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenOsDriverHandleWhenInitializingSurvivabilityModeThenUninitialisedErrorIsReturned) {
|
||||
auto pOsDriver = OsDriver::create();
|
||||
auto hwdeviceIds = pOsDriver->discoverDevicesWithSurvivabilityMode();
|
||||
EXPECT_EQ(0u, static_cast<uint32_t>(hwdeviceIds.size()));
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
uint32_t driverCount = 0;
|
||||
|
||||
SysmanDriverHandle *pSysmanDriverHandle = pOsDriver->initSurvivabilityDevicesWithDriver(&result, &driverCount);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, result);
|
||||
EXPECT_EQ(nullptr, pSysmanDriverHandle);
|
||||
EXPECT_EQ(0u, driverCount);
|
||||
|
||||
pOsDriver->initSurvivabilityDevices(pSysmanDriverHandle, &result);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, result);
|
||||
|
||||
auto hwDeviceId = std::make_unique<NEO::HwDeviceId>(NEO::DriverModelType::wddm);
|
||||
auto pOsSysmanSurvivabilityDevice = OsSysmanSurvivabilityDevice::createSurvivabilityDevice(std::move(hwDeviceId));
|
||||
EXPECT_EQ(nullptr, pOsSysmanSurvivabilityDevice);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDriverTestSurvivabilityDevice, GivenSysmanDeviceImpWhenInitializingSurvivabilityModeThenUninitialisedErrorIsReturned) {
|
||||
SysmanDeviceImp *pSysmanDevice = new SysmanDeviceImp();
|
||||
EXPECT_NE(nullptr, pSysmanDevice);
|
||||
EXPECT_NE(nullptr, pSysmanDevice->pOsSysman);
|
||||
auto hwDeviceId = std::make_unique<NEO::HwDeviceId>(NEO::DriverModelType::wddm);
|
||||
ze_result_t result = pSysmanDevice->pOsSysman->initSurvivabilityMode(std::move(hwDeviceId));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, result);
|
||||
delete pSysmanDevice;
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -567,6 +567,54 @@ void testSysmanEcc(ze_device_handle_t &device) {
|
||||
}
|
||||
}
|
||||
|
||||
void testSysmanSurvivability(ze_device_handle_t &device) {
|
||||
zes_device_properties_t properties = {ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||
ze_result_t result = zesDeviceGetProperties(device, &properties);
|
||||
if (result == ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED) {
|
||||
std::cout << "Device is in survivability mode!!, Only firmware update supported" << std::endl;
|
||||
}
|
||||
if ((result == ZE_RESULT_SUCCESS) && verbose) {
|
||||
std::cout << "Device is in Normal operations Mode. Device properties retrieved successfully. " << std::endl;
|
||||
std::cout << "Device Name = " << properties.core.name << std::endl;
|
||||
std::cout << "properties.vendorName = " << properties.vendorName << std::endl;
|
||||
std::cout << "properties.core.vendorId = " << properties.core.vendorId << std::endl;
|
||||
std::cout << "properties.core.deviceId = " << properties.core.deviceId << std::endl;
|
||||
std::cout << "properties.core.uuid = " << std::endl;
|
||||
for (uint32_t i = 0; i < ZE_MAX_UUID_SIZE; i++) {
|
||||
std::cout << +properties.core.uuid.id[i] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
return;
|
||||
}
|
||||
uint32_t count = 0;
|
||||
result = zesDeviceEnumFirmwares(device, &count, nullptr);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
std::cout << "zesDeviceEnumFirmwares() Failed!!" << std::endl;
|
||||
return;
|
||||
}
|
||||
if (count == 0) {
|
||||
std::cout << "Could not retrieve Firmware domains" << std::endl;
|
||||
return;
|
||||
} else {
|
||||
std::cout << "Found " << count << " firmware handles.." << std::endl;
|
||||
}
|
||||
|
||||
std::vector<zes_firmware_handle_t> handles(count, nullptr);
|
||||
VALIDATECALL(zesDeviceEnumFirmwares(device, &count, handles.data()));
|
||||
|
||||
for (auto handle : handles) {
|
||||
zes_firmware_properties_t fwProperties = {};
|
||||
|
||||
VALIDATECALL(zesFirmwareGetProperties(handle, &fwProperties));
|
||||
if (verbose) {
|
||||
std::cout << "firmware name = " << fwProperties.name << std::endl;
|
||||
std::cout << "On Subdevice = " << static_cast<uint32_t>(fwProperties.onSubdevice) << std::endl;
|
||||
std::cout << "Subdevice Id = " << fwProperties.subdeviceId << std::endl;
|
||||
std::cout << "firmware version = " << fwProperties.version << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void testSysmanPci(ze_device_handle_t &device) {
|
||||
std::cout << std::endl
|
||||
<< " ---- PCI tests ---- " << std::endl;
|
||||
@@ -1767,6 +1815,11 @@ int main(int argc, char *argv[]) {
|
||||
testSysmanPci(device);
|
||||
});
|
||||
}
|
||||
if (isParamEnabled(argc, argv, "-z", "--survive", &optind)) {
|
||||
std::for_each(devices.begin(), devices.end(), [&](auto device) {
|
||||
testSysmanSurvivability(device);
|
||||
});
|
||||
}
|
||||
if (isParamEnabled(argc, argv, "-P", "--performance", &optind)) {
|
||||
deviceIndex = 0;
|
||||
optind = optind + 1;
|
||||
|
||||
Reference in New Issue
Block a user