feature(sysman): Add pciGetStats support in win

Related-To: NEO-10662

Signed-off-by: shubham kumar <shubham.kumar@intel.com>
This commit is contained in:
shubham kumar
2024-05-09 07:15:57 +00:00
committed by Compute-Runtime-Automation
parent e35b951a00
commit 05406722b9
16 changed files with 80 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -290,6 +290,10 @@ ze_result_t LinuxPciImp::getState(zes_pci_state_t *state) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t LinuxPciImp::getStats(zes_pci_stats_t *stats) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
bool LinuxPciImp::getPciConfigMemory(std::string pciPath, std::vector<uint8_t> &configMem) {
if (!pSysfsAccess->isRootUser()) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(): Need to be root to read config space \n", __FUNCTION__);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -25,6 +25,7 @@ class LinuxPciImp : public OsPci, NEO::NonCopyableOrMovableClass {
ze_result_t getPciBdf(zes_pci_properties_t &pciProperties) override;
void getMaxLinkCaps(double &maxLinkSpeed, int32_t &maxLinkWidth) override;
ze_result_t getState(zes_pci_state_t *state) override;
ze_result_t getStats(zes_pci_stats_t *stats) override;
ze_result_t getProperties(zes_pci_properties_t *properties) override;
bool resizableBarSupported() override;
bool resizableBarEnabled(uint32_t barIndex) override;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -21,6 +21,7 @@ class OsPci {
virtual ze_result_t getPciBdf(zes_pci_properties_t &pciProperties) = 0;
virtual void getMaxLinkCaps(double &maxLinkSpeed, int32_t &maxLinkWidth) = 0;
virtual ze_result_t getState(zes_pci_state_t *state) = 0;
virtual ze_result_t getStats(zes_pci_stats_t *stats) = 0;
virtual ze_result_t getProperties(zes_pci_properties_t *properties) = 0;
virtual bool resizableBarSupported() = 0;
virtual bool resizableBarEnabled(uint32_t barIndex) = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -17,6 +17,7 @@ class Pci {
virtual ze_result_t pciStaticProperties(zes_pci_properties_t *pProperties) = 0;
virtual ze_result_t pciGetInitializedBars(uint32_t *pCount, zes_pci_bar_properties_t *pProperties) = 0;
virtual ze_result_t pciGetState(zes_pci_state_t *pState) = 0;
virtual ze_result_t pciGetStats(zes_pci_stats_t *pStats) = 0;
virtual void init() = 0;
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -128,6 +128,11 @@ ze_result_t PciImp::pciGetState(zes_pci_state_t *pState) {
return pOsPci->getState(pState);
}
ze_result_t PciImp::pciGetStats(zes_pci_stats_t *pStats) {
initPci();
return pOsPci->getStats(pStats);
}
void PciImp::pciGetStaticFields() {
pOsPci->getProperties(&pciProperties);
resizableBarSupported = pOsPci->resizableBarSupported();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -24,6 +24,7 @@ class PciImp : public L0::Sysman::Pci, NEO::NonCopyableOrMovableClass {
ze_result_t pciStaticProperties(zes_pci_properties_t *pProperties) override;
ze_result_t pciGetInitializedBars(uint32_t *pCount, zes_pci_bar_properties_t *pProperties) override;
ze_result_t pciGetState(zes_pci_state_t *pState) override;
ze_result_t pciGetStats(zes_pci_stats_t *pStats) override;
void pciGetStaticFields();
PciImp(L0::Sysman::OsSysman *pOsSysman) : pOsSysman(pOsSysman){};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,8 +7,8 @@
#include "level_zero/sysman/source/api/pci/windows/sysman_os_pci_imp.h"
#include "level_zero/sysman/source/shared/windows/product_helper/sysman_product_helper.h"
#include "level_zero/sysman/source/shared/windows/sysman_kmd_sys_manager.h"
#include "level_zero/sysman/source/shared/windows/zes_os_sysman_imp.h"
namespace L0 {
namespace Sysman {
@@ -154,6 +154,11 @@ ze_result_t WddmPciImp::getState(zes_pci_state_t *state) {
return ZE_RESULT_SUCCESS;
}
ze_result_t WddmPciImp::getStats(zes_pci_stats_t *stats) {
auto pSysmanProductHelper = pWddmSysmanImp->getSysmanProductHelper();
return pSysmanProductHelper->getPciStats(stats, pWddmSysmanImp);
}
bool WddmPciImp::resizableBarSupported() {
uint32_t valueSmall = 0;
bool supported = false;
@@ -200,7 +205,7 @@ ze_result_t WddmPciImp::initializeBarProperties(std::vector<zes_pci_bar_properti
}
WddmPciImp::WddmPciImp(OsSysman *pOsSysman) {
WddmSysmanImp *pWddmSysmanImp = static_cast<WddmSysmanImp *>(pOsSysman);
pWddmSysmanImp = static_cast<WddmSysmanImp *>(pOsSysman);
pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();
isLmemSupported = !(pWddmSysmanImp->getSysmanDeviceImp()->getRootDeviceEnvironment().getHardwareInfo()->capabilityTable.isIntegratedDevice);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,6 +9,7 @@
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "level_zero/sysman/source/api/pci/sysman_os_pci.h"
#include "level_zero/sysman/source/shared/windows/zes_os_sysman_imp.h"
namespace L0 {
namespace Sysman {
@@ -19,6 +20,7 @@ class WddmPciImp : public OsPci, NEO::NonCopyableOrMovableClass {
ze_result_t getPciBdf(zes_pci_properties_t &pciProperties) override;
void getMaxLinkCaps(double &maxLinkSpeed, int32_t &maxLinkWidth) override;
ze_result_t getState(zes_pci_state_t *state) override;
ze_result_t getStats(zes_pci_stats_t *stats) override;
ze_result_t getProperties(zes_pci_properties_t *properties) override;
bool resizableBarSupported() override;
bool resizableBarEnabled(uint32_t barIndex) override;
@@ -28,6 +30,7 @@ class WddmPciImp : public OsPci, NEO::NonCopyableOrMovableClass {
bool isLocalMemSupported();
protected:
WddmSysmanImp *pWddmSysmanImp = nullptr;
KmdSysManager *pKmdSysManager = nullptr;
private: