add getDeviceHandle() at OS specific level

Change-Id: I95fc24043f8f603d6270323b0f23a78f9d8ad2f1
Signed-off-by: mraghuwa <mayank.raghuwanshi@intel.com>
This commit is contained in:
mraghuwa
2020-08-13 23:33:21 +05:30
committed by sys_ocldev
parent 649dfb93ee
commit 4b8d4285d7
30 changed files with 103 additions and 51 deletions

View File

@@ -31,9 +31,7 @@ std::string changeDirNLevelsUp(std::string realRootPath, uint8_t nLevel) {
}
return realRootPath;
}
void LinuxPciImp::setLmemSupport(bool val) {
isLmemSupported = val;
}
ze_result_t LinuxPciImp::getPciBdf(std::string &bdf) {
std::string bdfDir;
ze_result_t result = pSysfsAccess->readSymLink(deviceDir, bdfDir);
@@ -182,6 +180,8 @@ LinuxPciImp::LinuxPciImp(OsSysman *pOsSysman) {
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
pSysfsAccess = &pLinuxSysmanImp->getSysfsAccess();
pfsAccess = &pLinuxSysmanImp->getFsAccess();
Device *pDevice = pLinuxSysmanImp->getDeviceHandle();
isLmemSupported = pDevice->getDriverHandle()->getMemoryManager()->isLocalMemorySupported(pDevice->getRootDeviceIndex());
}
OsPci *OsPci::create(OsSysman *pOsSysman) {

View File

@@ -21,7 +21,6 @@ class LinuxPciImp : public OsPci, NEO::NonCopyableOrMovableClass {
ze_result_t getMaxLinkSpeed(double &maxLinkSpeed) override;
ze_result_t getMaxLinkWidth(int32_t &maxLinkwidth) override;
ze_result_t getLinkGen(int32_t &linkGen) override;
void setLmemSupport(bool val) override;
ze_result_t initializeBarProperties(std::vector<zes_pci_bar_properties_t *> &pBarProperties) override;
LinuxPciImp() = default;
LinuxPciImp(OsSysman *pOsSysman);

View File

@@ -14,6 +14,7 @@
#include <vector>
namespace L0 {
std::string changeDirNLevelsUp(std::string realRootPath, uint8_t nLevel);
class OsPci {
public:
@@ -21,7 +22,6 @@ class OsPci {
virtual ze_result_t getMaxLinkSpeed(double &maxLinkSpeed) = 0;
virtual ze_result_t getMaxLinkWidth(int32_t &maxLinkWidth) = 0;
virtual ze_result_t getLinkGen(int32_t &linkGen) = 0;
virtual void setLmemSupport(bool val) = 0;
virtual ze_result_t initializeBarProperties(std::vector<zes_pci_bar_properties_t *> &pBarProperties) = 0;
static OsPci *create(OsSysman *pOsSysman);
virtual ~OsPci() = default;

View File

@@ -66,8 +66,6 @@ void PciImp::init() {
pOsPci = OsPci::create(pOsSysman);
}
UNRECOVERABLE_IF(nullptr == pOsPci);
Device *device = L0::Device::fromHandle(hCoreDevice);
pOsPci->setLmemSupport(device->getDriverHandle()->getMemoryManager()->isLocalMemorySupported(device->getRootDeviceIndex()));
std::string bdf;
pOsPci->getPciBdf(bdf);
if (bdf.empty()) {

View File

@@ -26,13 +26,9 @@ class PciImp : public Pci, NEO::NonCopyableOrMovableClass {
ze_result_t pciGetInitializedBars(uint32_t *pCount, zes_pci_bar_properties_t *pProperties) override;
PciImp() = default;
PciImp(OsSysman *pOsSysman, ze_device_handle_t hDevice) : pOsSysman(pOsSysman) {
pOsPci = nullptr;
hCoreDevice = hDevice;
};
PciImp(OsSysman *pOsSysman) : pOsSysman(pOsSysman){};
~PciImp() override;
OsPci *pOsPci = nullptr;
ze_device_handle_t hCoreDevice = {};
private:
OsSysman *pOsSysman = nullptr;

View File

@@ -16,7 +16,6 @@ class WddmPciImp : public OsPci {
ze_result_t getMaxLinkSpeed(double &maxLinkSpeed) override;
ze_result_t getMaxLinkWidth(int32_t &maxLinkwidth) override;
ze_result_t getLinkGen(int32_t &linkGen) override;
void setLmemSupport(bool val) override;
ze_result_t initializeBarProperties(std::vector<zes_pci_bar_properties_t *> &pBarProperties) override;
~WddmPciImp() override = default;
};
@@ -37,8 +36,6 @@ ze_result_t WddmPciImp::getLinkGen(int32_t &linkGen) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
void WddmPciImp::setLmemSupport(bool val) {}
ze_result_t WddmPciImp::initializeBarProperties(std::vector<zes_pci_bar_properties_t *> &pBarProperties) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}