diff --git a/level_zero/sysman/source/api/global_operations/linux/CMakeLists.txt b/level_zero/sysman/source/api/global_operations/linux/CMakeLists.txt index c5e433708b..2e7ac90aee 100644 --- a/level_zero/sysman/source/api/global_operations/linux/CMakeLists.txt +++ b/level_zero/sysman/source/api/global_operations/linux/CMakeLists.txt @@ -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() diff --git a/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_helper.cpp b/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_helper.cpp deleted file mode 100644 index 60978c9567..0000000000 --- a/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_helper.cpp +++ /dev/null @@ -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 diff --git a/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_imp.cpp b/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_imp.cpp index 17671f0405..ab8b11fe5f 100644 --- a/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_imp.cpp +++ b/level_zero/sysman/source/api/global_operations/linux/sysman_os_global_operations_imp.cpp @@ -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; diff --git a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h index f477f43569..a4899e3402 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h +++ b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper.h @@ -53,6 +53,9 @@ class SysmanProductHelper { virtual RasInterfaceType getGtRasUtilInterface() = 0; virtual RasInterfaceType getHbmRasUtilInterface() = 0; + // Global Operations + virtual bool isRepairStatusSupported() = 0; + virtual ~SysmanProductHelper() = default; protected: diff --git a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.h b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.h index c4222fbe65..3551f6835f 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.h +++ b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.h @@ -39,6 +39,9 @@ class SysmanProductHelperHw : public SysmanProductHelper { RasInterfaceType getGtRasUtilInterface() override; RasInterfaceType getHbmRasUtilInterface() override; + // global ops + bool isRepairStatusSupported() override; + ~SysmanProductHelperHw() override = default; protected: diff --git a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.inl b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.inl index 3977b82857..5ab1ed5a7d 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.inl +++ b/level_zero/sysman/source/shared/linux/product_helper/sysman_product_helper_hw.inl @@ -116,5 +116,10 @@ RasInterfaceType SysmanProductHelperHw::getHbmRasUtilInterface() { return RasInterfaceType::none; } +template +bool SysmanProductHelperHw::isRepairStatusSupported() { + return false; +} + } // namespace Sysman } // namespace L0 diff --git a/level_zero/sysman/source/shared/linux/product_helper/xe_hpc_core/pvc/sysman_product_helper_pvc.cpp b/level_zero/sysman/source/shared/linux/product_helper/xe_hpc_core/pvc/sysman_product_helper_pvc.cpp index 8615b712d1..631447cdc4 100644 --- a/level_zero/sysman/source/shared/linux/product_helper/xe_hpc_core/pvc/sysman_product_helper_pvc.cpp +++ b/level_zero/sysman/source/shared/linux/product_helper/xe_hpc_core/pvc/sysman_product_helper_pvc.cpp @@ -87,6 +87,11 @@ RasInterfaceType SysmanProductHelperHw::getHbmRasUtilInterface() { return RasInterfaceType::gsc; } +template <> +bool SysmanProductHelperHw::isRepairStatusSupported() { + return true; +} + template class SysmanProductHelperHw; } // namespace Sysman diff --git a/level_zero/sysman/test/unit_tests/sources/shared/linux/product_helper/CMakeLists.txt b/level_zero/sysman/test/unit_tests/sources/shared/linux/product_helper/CMakeLists.txt index 774fa25aea..54855d6cdf 100644 --- a/level_zero/sysman/test/unit_tests/sources/shared/linux/product_helper/CMakeLists.txt +++ b/level_zero/sysman/test/unit_tests/sources/shared/linux/product_helper/CMakeLists.txt @@ -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() diff --git a/level_zero/sysman/test/unit_tests/sources/shared/linux/product_helper/sysman_product_helper_globalops_tests.cpp b/level_zero/sysman/test/unit_tests/sources/shared/linux/product_helper/sysman_product_helper_globalops_tests.cpp new file mode 100644 index 0000000000..20b4e71387 --- /dev/null +++ b/level_zero/sysman/test/unit_tests/sources/shared/linux/product_helper/sysman_product_helper_globalops_tests.cpp @@ -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 \ No newline at end of file