mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
sysman:add support for Diagnostis API.
Signed-off-by: Vilvaraj, T J Vivek <t.j.vivek.vilvaraj@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6f555d6258
commit
24a745f4bd
@@ -18,17 +18,17 @@ DiagnosticsHandleContext::~DiagnosticsHandleContext() {
|
||||
handleList.clear();
|
||||
}
|
||||
|
||||
void DiagnosticsHandleContext::createHandle() {
|
||||
Diagnostics *pDiagnostics = new DiagnosticsImp(pOsSysman);
|
||||
if (pDiagnostics->isDiagnosticsEnabled == true) {
|
||||
handleList.push_back(pDiagnostics);
|
||||
} else {
|
||||
delete pDiagnostics;
|
||||
}
|
||||
void DiagnosticsHandleContext::createHandle(const std::string &diagTests) {
|
||||
Diagnostics *pDiagnostics = new DiagnosticsImp(pOsSysman, diagTests);
|
||||
handleList.push_back(pDiagnostics);
|
||||
}
|
||||
|
||||
void DiagnosticsHandleContext::init() {
|
||||
createHandle();
|
||||
|
||||
OsDiagnostics::getSupportedDiagTests(supportedDiagTests, pOsSysman);
|
||||
for (const std::string &diagTests : supportedDiagTests) {
|
||||
createHandle(diagTests);
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t DiagnosticsHandleContext::diagnosticsGet(uint32_t *pCount, zes_diag_handle_t *phDiagnostics) {
|
||||
|
||||
@@ -23,12 +23,13 @@ class Diagnostics : _zes_diag_handle_t {
|
||||
public:
|
||||
virtual ~Diagnostics() {}
|
||||
virtual ze_result_t diagnosticsGetProperties(zes_diag_properties_t *pProperties) = 0;
|
||||
virtual ze_result_t diagnosticsGetTests(uint32_t *pCount, zes_diag_test_t *pTests) = 0;
|
||||
virtual ze_result_t diagnosticsRunTests(uint32_t start, uint32_t end, zes_diag_result_t *pResult) = 0;
|
||||
inline zes_diag_handle_t toHandle() { return this; }
|
||||
|
||||
static Diagnostics *fromHandle(zes_diag_handle_t handle) {
|
||||
return static_cast<Diagnostics *>(handle);
|
||||
}
|
||||
bool isDiagnosticsEnabled = false;
|
||||
};
|
||||
|
||||
struct DiagnosticsHandleContext {
|
||||
@@ -38,12 +39,12 @@ struct DiagnosticsHandleContext {
|
||||
void init();
|
||||
|
||||
ze_result_t diagnosticsGet(uint32_t *pCount, zes_diag_handle_t *phDiagnostics);
|
||||
|
||||
std::vector<std::string> supportedDiagTests = {};
|
||||
OsSysman *pOsSysman = nullptr;
|
||||
std::vector<Diagnostics *> handleList = {};
|
||||
|
||||
private:
|
||||
void createHandle();
|
||||
void createHandle(const std::string &DiagTests);
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -20,14 +20,17 @@ ze_result_t DiagnosticsImp::diagnosticsGetProperties(zes_diag_properties_t *pPro
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
void DiagnosticsImp::init() {
|
||||
this->isDiagnosticsEnabled = pOsDiagnostics->isDiagnosticsSupported();
|
||||
ze_result_t DiagnosticsImp::diagnosticsGetTests(uint32_t *pCount, zes_diag_test_t *pTests) {
|
||||
return pOsDiagnostics->osGetDiagTests(pCount, pTests);
|
||||
}
|
||||
|
||||
DiagnosticsImp::DiagnosticsImp(OsSysman *pOsSysman) {
|
||||
pOsDiagnostics = OsDiagnostics::create(pOsSysman);
|
||||
ze_result_t DiagnosticsImp::diagnosticsRunTests(uint32_t start, uint32_t end, zes_diag_result_t *pResult) {
|
||||
return pOsDiagnostics->osRunDiagTests(start, end, pResult);
|
||||
}
|
||||
|
||||
DiagnosticsImp::DiagnosticsImp(OsSysman *pOsSysman, const std::string &initalizedDiagTest) {
|
||||
pOsDiagnostics = OsDiagnostics::create(pOsSysman, initalizedDiagTest);
|
||||
UNRECOVERABLE_IF(nullptr == pOsDiagnostics);
|
||||
init();
|
||||
}
|
||||
|
||||
DiagnosticsImp::~DiagnosticsImp() {
|
||||
|
||||
@@ -20,12 +20,12 @@ class OsDiagnostics;
|
||||
class DiagnosticsImp : public Diagnostics, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
ze_result_t diagnosticsGetProperties(zes_diag_properties_t *pProperties) override;
|
||||
ze_result_t diagnosticsGetTests(uint32_t *pCount, zes_diag_test_t *pTests) override;
|
||||
ze_result_t diagnosticsRunTests(uint32_t start, uint32_t end, zes_diag_result_t *pResult) override;
|
||||
DiagnosticsImp() = default;
|
||||
DiagnosticsImp(OsSysman *pOsSysman);
|
||||
DiagnosticsImp(OsSysman *pOsSysman, const std::string &initalizedDiagTest);
|
||||
~DiagnosticsImp() override;
|
||||
std::unique_ptr<OsDiagnostics> pOsDiagnostics = nullptr;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -8,6 +8,7 @@ set(L0_SRCS_TOOLS_SYSMAN_DIAGNOSTICS_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_diagnostics_imp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_diagnostics_imp.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/os_diagnostics_helper.cpp
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/string.h"
|
||||
|
||||
#include "level_zero/tools/source/sysman/diagnostics/linux/os_diagnostics_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
void OsDiagnostics::getSupportedDiagTestsFromFW(void *pFwInterface, std::vector<std::string> &supportedDiagTests) {
|
||||
}
|
||||
|
||||
ze_result_t LinuxDiagnosticsImp::osRunDiagTestsinFW(zes_diag_result_t *pResult) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
} // namespace L0
|
||||
@@ -11,25 +11,37 @@
|
||||
|
||||
namespace L0 {
|
||||
|
||||
bool LinuxDiagnosticsImp::isDiagnosticsSupported(void) {
|
||||
void OsDiagnostics::getSupportedDiagTests(std::vector<std::string> &supportedDiagTests, OsSysman *pOsSysman) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
FirmwareUtil *pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
|
||||
if (pFwInterface != nullptr) {
|
||||
isFWInitalized = ((ZE_RESULT_SUCCESS == pFwInterface->fwDeviceInit()) ? true : false);
|
||||
return this->isFWInitalized;
|
||||
getSupportedDiagTestsFromFW(pFwInterface, supportedDiagTests);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void LinuxDiagnosticsImp::osGetDiagProperties(zes_diag_properties_t *pProperties) {
|
||||
pProperties->onSubdevice = false;
|
||||
pProperties->haveTests = 0; // osGetDiagTests is Unsupported
|
||||
strncpy_s(pProperties->name, ZES_STRING_PROPERTY_SIZE, osDiagType.c_str(), osDiagType.size());
|
||||
return;
|
||||
}
|
||||
|
||||
LinuxDiagnosticsImp::LinuxDiagnosticsImp(OsSysman *pOsSysman) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
|
||||
ze_result_t LinuxDiagnosticsImp::osGetDiagTests(uint32_t *pCount, zes_diag_test_t *pTests) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
std::unique_ptr<OsDiagnostics> OsDiagnostics::create(OsSysman *pOsSysman) {
|
||||
std::unique_ptr<LinuxDiagnosticsImp> pLinuxDiagnosticsImp = std::make_unique<LinuxDiagnosticsImp>(pOsSysman);
|
||||
ze_result_t LinuxDiagnosticsImp::osRunDiagTests(uint32_t start, uint32_t end, zes_diag_result_t *pResult) {
|
||||
return osRunDiagTestsinFW(pResult);
|
||||
}
|
||||
|
||||
LinuxDiagnosticsImp::LinuxDiagnosticsImp(OsSysman *pOsSysman, const std::string &diagTests) : osDiagType(diagTests) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
pFwInterface = pLinuxSysmanImp->getFwUtilInterface();
|
||||
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
|
||||
}
|
||||
|
||||
std::unique_ptr<OsDiagnostics> OsDiagnostics::create(OsSysman *pOsSysman, const std::string &diagTests) {
|
||||
std::unique_ptr<LinuxDiagnosticsImp> pLinuxDiagnosticsImp = std::make_unique<LinuxDiagnosticsImp>(pOsSysman, diagTests);
|
||||
return pLinuxDiagnosticsImp;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,21 @@ namespace L0 {
|
||||
|
||||
class LinuxDiagnosticsImp : public OsDiagnostics, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
bool isDiagnosticsSupported(void) override;
|
||||
void osGetDiagProperties(zes_diag_properties_t *pProperties) override;
|
||||
ze_result_t osGetDiagTests(uint32_t *pCount, zes_diag_test_t *pTests) override;
|
||||
ze_result_t osRunDiagTests(uint32_t start, uint32_t end, zes_diag_result_t *pResult) override;
|
||||
ze_result_t osRunDiagTestsinFW(zes_diag_result_t *pResult);
|
||||
LinuxDiagnosticsImp() = default;
|
||||
LinuxDiagnosticsImp(OsSysman *pOsSysman);
|
||||
LinuxDiagnosticsImp(OsSysman *pOsSysman, const std::string &diagTests);
|
||||
~LinuxDiagnosticsImp() override = default;
|
||||
std::string osDiagType = "unknown";
|
||||
|
||||
protected:
|
||||
FirmwareUtil *pFwInterface = nullptr;
|
||||
bool isFWInitalized = false;
|
||||
SysfsAccess *pSysfsAccess = nullptr;
|
||||
|
||||
private:
|
||||
static const std::string quiescentGpuFile;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -18,9 +18,12 @@ namespace L0 {
|
||||
|
||||
class OsDiagnostics {
|
||||
public:
|
||||
virtual bool isDiagnosticsSupported(void) = 0;
|
||||
virtual void osGetDiagProperties(zes_diag_properties_t *pProperties) = 0;
|
||||
static std::unique_ptr<OsDiagnostics> create(OsSysman *pOsSysman);
|
||||
virtual ze_result_t osGetDiagTests(uint32_t *pCount, zes_diag_test_t *pTests) = 0;
|
||||
virtual ze_result_t osRunDiagTests(uint32_t start, uint32_t end, zes_diag_result_t *pResult) = 0;
|
||||
static std::unique_ptr<OsDiagnostics> create(OsSysman *pOsSysman, const std::string &DiagTests);
|
||||
static void getSupportedDiagTestsFromFW(void *pFwInterface, std::vector<std::string> &supportedDiagTests);
|
||||
static void getSupportedDiagTests(std::vector<std::string> &supportedDiagTests, OsSysman *pOsSysman);
|
||||
virtual ~OsDiagnostics() {}
|
||||
};
|
||||
|
||||
|
||||
@@ -9,15 +9,24 @@
|
||||
|
||||
namespace L0 {
|
||||
|
||||
bool WddmDiagnosticsImp::isDiagnosticsSupported(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void WddmDiagnosticsImp::osGetDiagProperties(zes_diag_properties_t *pProperties){};
|
||||
|
||||
std::unique_ptr<OsDiagnostics> OsDiagnostics::create(OsSysman *pOsSysman) {
|
||||
ze_result_t WddmDiagnosticsImp::osGetDiagTests(uint32_t *pCount, zes_diag_test_t *pTests) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
ze_result_t WddmDiagnosticsImp::osRunDiagTests(uint32_t start, uint32_t end, zes_diag_result_t *pResult) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
std::unique_ptr<OsDiagnostics> OsDiagnostics::create(OsSysman *pOsSysman, const std::string &diagTests) {
|
||||
std::unique_ptr<WddmDiagnosticsImp> pWddmDiagnosticsImp = std::make_unique<WddmDiagnosticsImp>();
|
||||
return pWddmDiagnosticsImp;
|
||||
}
|
||||
|
||||
void OsDiagnostics::getSupportedDiagTests(std::vector<std::string> &supportedDiagTests, OsSysman *pOsSysman) {
|
||||
}
|
||||
|
||||
void OsDiagnostics::getSupportedDiagTestsFromFW(void *pFwInterface, std::vector<std::string> &supportedDiagTests) {
|
||||
}
|
||||
} // namespace L0
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
namespace L0 {
|
||||
class WddmDiagnosticsImp : public OsDiagnostics {
|
||||
public:
|
||||
bool isDiagnosticsSupported(void) override;
|
||||
void osGetDiagProperties(zes_diag_properties_t *pProperties) override;
|
||||
ze_result_t osGetDiagTests(uint32_t *pCount, zes_diag_test_t *pTests) override;
|
||||
ze_result_t osRunDiagTests(uint32_t start, uint32_t end, zes_diag_result_t *pResult) override;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user