feature(sysman): enable product helper for global operations

Related-To: NEO-8754

Signed-off-by: Kulkarni, Ashwin Kumar <ashwin.kumar.kulkarni@intel.com>
This commit is contained in:
Kulkarni, Ashwin Kumar 2023-12-20 10:39:15 +00:00 committed by Compute-Runtime-Automation
parent b80a435686
commit e3fb97c722
9 changed files with 67 additions and 31 deletions

View File

@ -10,6 +10,5 @@ if(UNIX)
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_global_operations_imp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_global_operations_imp.h
${CMAKE_CURRENT_SOURCE_DIR}/sysman_os_global_operations_helper.cpp
)
endif()

View File

@ -1,30 +0,0 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_imp.h"
#include "level_zero/sysman/source/shared/firmware_util/sysman_firmware_util.h"
namespace L0 {
namespace Sysman {
void LinuxGlobalOperationsImp::getRepairStatus(zes_device_state_t *pState) {
bool ifrStatus = false;
if (IGFX_PVC == pLinuxSysmanImp->getParentSysmanDeviceImp()->getProductFamily()) {
auto pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
if (pFwInterface != nullptr) {
auto result = pFwInterface->fwIfrApplied(ifrStatus);
if (result == ZE_RESULT_SUCCESS) {
pState->repaired = ZES_REPAIR_STATUS_NOT_PERFORMED;
if (ifrStatus) {
pState->reset |= ZES_RESET_REASON_FLAG_REPAIR;
pState->repaired = ZES_REPAIR_STATUS_PERFORMED;
}
}
}
}
}
} // namespace Sysman
} // namespace L0

View File

@ -18,7 +18,9 @@
#include "shared/source/os_interface/linux/pci_path.h"
#include "level_zero/sysman/source/api/global_operations/sysman_global_operations_imp.h"
#include "level_zero/sysman/source/shared/firmware_util/sysman_firmware_util.h"
#include "level_zero/sysman/source/shared/linux/pmt/sysman_pmt.h"
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h"
#include "level_zero/sysman/source/shared/linux/sysman_fs_access_interface.h"
#include "level_zero/sysman/source/shared/linux/sysman_kmd_interface.h"
#include "level_zero/sysman/source/sysman_const.h"
@ -720,6 +722,25 @@ void LinuxGlobalOperationsImp::getWedgedStatus(zes_device_state_t *pState) {
pState->reset |= ZES_RESET_REASON_FLAG_WEDGED;
}
}
void LinuxGlobalOperationsImp::getRepairStatus(zes_device_state_t *pState) {
SysmanProductHelper *pSysmanProductHelper = pLinuxSysmanImp->getSysmanProductHelper();
if (pSysmanProductHelper->isRepairStatusSupported()) {
bool ifrStatus = false;
auto pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
if (pFwInterface != nullptr) {
ze_result_t result = pFwInterface->fwIfrApplied(ifrStatus);
if (result == ZE_RESULT_SUCCESS) {
pState->repaired = ZES_REPAIR_STATUS_NOT_PERFORMED;
if (ifrStatus) {
pState->reset |= ZES_RESET_REASON_FLAG_REPAIR;
pState->repaired = ZES_REPAIR_STATUS_PERFORMED;
}
}
}
}
}
ze_result_t LinuxGlobalOperationsImp::deviceGetState(zes_device_state_t *pState) {
memset(pState, 0, sizeof(zes_device_state_t));
pState->repaired = ZES_REPAIR_STATUS_UNSUPPORTED;

View File

@ -53,6 +53,9 @@ class SysmanProductHelper {
virtual RasInterfaceType getGtRasUtilInterface() = 0;
virtual RasInterfaceType getHbmRasUtilInterface() = 0;
// Global Operations
virtual bool isRepairStatusSupported() = 0;
virtual ~SysmanProductHelper() = default;
protected:

View File

@ -39,6 +39,9 @@ class SysmanProductHelperHw : public SysmanProductHelper {
RasInterfaceType getGtRasUtilInterface() override;
RasInterfaceType getHbmRasUtilInterface() override;
// global ops
bool isRepairStatusSupported() override;
~SysmanProductHelperHw() override = default;
protected:

View File

@ -116,5 +116,10 @@ RasInterfaceType SysmanProductHelperHw<gfxProduct>::getHbmRasUtilInterface() {
return RasInterfaceType::none;
}
template <PRODUCT_FAMILY gfxProduct>
bool SysmanProductHelperHw<gfxProduct>::isRepairStatusSupported() {
return false;
}
} // namespace Sysman
} // namespace L0

View File

@ -87,6 +87,11 @@ RasInterfaceType SysmanProductHelperHw<gfxProduct>::getHbmRasUtilInterface() {
return RasInterfaceType::gsc;
}
template <>
bool SysmanProductHelperHw<gfxProduct>::isRepairStatusSupported() {
return true;
}
template class SysmanProductHelperHw<gfxProduct>;
} // namespace Sysman

View File

@ -10,6 +10,7 @@ if(UNIX)
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_performance_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_memory_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_temperature_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sysman_product_helper_globalops_tests.cpp
)
endif()

View File

@ -0,0 +1,29 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h"
#include "level_zero/sysman/test/unit_tests/sources/global_operations/linux/mock_global_operations.h"
#include "level_zero/sysman/test/unit_tests/sources/linux/mock_sysman_fixture.h"
namespace L0 {
namespace Sysman {
namespace ult {
using SysmanProductHelperGlobalOperationsTest = SysmanDeviceFixture;
HWTEST2_F(SysmanProductHelperGlobalOperationsTest, GivenValidProductHelperHandleWhenQueryingRepairStatusSupportThenTrueIsReturned, IsPVC) {
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(defaultHwInfo->platform.eProductFamily);
EXPECT_EQ(true, pSysmanProductHelper->isRepairStatusSupported());
}
HWTEST2_F(SysmanProductHelperGlobalOperationsTest, GivenValidProductHelperHandleWhenQueryingRepairStatusSupportThenFalseIsReturned, IsNotPVC) {
auto pSysmanProductHelper = L0::Sysman::SysmanProductHelper::create(defaultHwInfo->platform.eProductFamily);
EXPECT_EQ(false, pSysmanProductHelper->isRepairStatusSupported());
}
} // namespace ult
} // namespace Sysman
} // namespace L0