feature(sysman): supports new device UUID mapping APIs
Related-To: NEO-10236 Signed-off-by: Kulkarni, Ashwin Kumar <ashwin.kumar.kulkarni@intel.com>
This commit is contained in:
parent
5d15c80fad
commit
a1c15371c1
|
@ -87,6 +87,28 @@ ze_result_t zesDeviceGetState(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ze_result_t zesDeviceGetSubDevicePropertiesExp(zes_device_handle_t hDevice,
|
||||||
|
uint32_t *pCount,
|
||||||
|
zes_subdevice_exp_properties_t *pSubdeviceProps) {
|
||||||
|
if (L0::sysmanInitFromCore) {
|
||||||
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||||
|
} else if (L0::Sysman::sysmanOnlyInit) {
|
||||||
|
return L0::Sysman::SysmanDevice::deviceGetSubDeviceProperties(hDevice, pCount, pSubdeviceProps);
|
||||||
|
} else {
|
||||||
|
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ze_result_t zesDriverGetDeviceByUuidExp(zes_driver_handle_t hDriver, zes_uuid_t uuid, zes_device_handle_t *phDevice, ze_bool_t *onSubdevice, uint32_t *subdeviceId) {
|
||||||
|
if (L0::sysmanInitFromCore) {
|
||||||
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||||
|
} else if (L0::Sysman::sysmanOnlyInit) {
|
||||||
|
return L0::Sysman::SysmanDriverHandle::fromHandle(hDriver)->getDeviceByUuid(uuid, phDevice, onSubdevice, subdeviceId);
|
||||||
|
} else {
|
||||||
|
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ze_result_t zesDeviceEnumSchedulers(
|
ze_result_t zesDeviceEnumSchedulers(
|
||||||
zes_device_handle_t hDevice,
|
zes_device_handle_t hDevice,
|
||||||
uint32_t *pCount,
|
uint32_t *pCount,
|
||||||
|
@ -793,34 +815,6 @@ ze_result_t zesFirmwareGetConsoleLogs(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ze_result_t zesDeviceGetSubDevicePropertiesExp(
|
|
||||||
zes_device_handle_t hDevice,
|
|
||||||
uint32_t *pCount,
|
|
||||||
zes_subdevice_exp_properties_t *pSubdeviceProps) {
|
|
||||||
if (L0::sysmanInitFromCore) {
|
|
||||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
||||||
} else if (L0::Sysman::sysmanOnlyInit) {
|
|
||||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
||||||
} else {
|
|
||||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ze_result_t zesDriverGetDeviceByUuidExp(
|
|
||||||
zes_driver_handle_t hDriver,
|
|
||||||
zes_uuid_t uuid,
|
|
||||||
zes_device_handle_t *phDevice,
|
|
||||||
ze_bool_t *onSubdevice,
|
|
||||||
uint32_t *subdeviceId) {
|
|
||||||
if (L0::sysmanInitFromCore) {
|
|
||||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
||||||
} else if (L0::Sysman::sysmanOnlyInit) {
|
|
||||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
||||||
} else {
|
|
||||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ze_result_t zesDeviceEnumActiveVFExp(
|
ze_result_t zesDeviceEnumActiveVFExp(
|
||||||
zes_device_handle_t hDevice,
|
zes_device_handle_t hDevice,
|
||||||
uint32_t *pCount,
|
uint32_t *pCount,
|
||||||
|
|
|
@ -162,7 +162,7 @@ void LinuxGlobalOperationsImp::getDriverVersion(char (&driverVersion)[ZES_STRING
|
||||||
pSysmanKmdInterface->getDriverVersion(driverVersion);
|
pSysmanKmdInterface->getDriverVersion(driverVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LinuxGlobalOperationsImp::generateUuidFromPciBusInfo(const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) {
|
bool LinuxGlobalOperationsImp::generateUuidFromPciAndSubDeviceInfo(uint32_t subDeviceID, const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) {
|
||||||
if (pciBusInfo.pciDomain != NEO::PhysicalDevicePciBusInfo::invalidValue) {
|
if (pciBusInfo.pciDomain != NEO::PhysicalDevicePciBusInfo::invalidValue) {
|
||||||
uuid.fill(0);
|
uuid.fill(0);
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ bool LinuxGlobalOperationsImp::generateUuidFromPciBusInfo(const NEO::PhysicalDev
|
||||||
deviceUUID.pciBus = static_cast<uint8_t>(pciBusInfo.pciBus);
|
deviceUUID.pciBus = static_cast<uint8_t>(pciBusInfo.pciBus);
|
||||||
deviceUUID.pciDev = static_cast<uint8_t>(pciBusInfo.pciDevice);
|
deviceUUID.pciDev = static_cast<uint8_t>(pciBusInfo.pciDevice);
|
||||||
deviceUUID.pciFunc = static_cast<uint8_t>(pciBusInfo.pciFunction);
|
deviceUUID.pciFunc = static_cast<uint8_t>(pciBusInfo.pciFunction);
|
||||||
deviceUUID.subDeviceID = 0;
|
deviceUUID.subDeviceID = subDeviceID;
|
||||||
|
|
||||||
static_assert(sizeof(DeviceUUID) == NEO::ProductHelper::uuidSize);
|
static_assert(sizeof(DeviceUUID) == NEO::ProductHelper::uuidSize);
|
||||||
|
|
||||||
|
@ -211,7 +211,20 @@ bool LinuxGlobalOperationsImp::generateUuidFromPciBusInfo(const NEO::PhysicalDev
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LinuxGlobalOperationsImp::generateUuidFromPciBusInfo(const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) {
|
||||||
|
return generateUuidFromPciAndSubDeviceInfo(0, pciBusInfo, uuid);
|
||||||
|
}
|
||||||
|
|
||||||
bool LinuxGlobalOperationsImp::getUuid(std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) {
|
bool LinuxGlobalOperationsImp::getUuid(std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) {
|
||||||
|
return this->getUuidFromSubDeviceInfo(0, uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LinuxGlobalOperationsImp::getUuidFromSubDeviceInfo(uint32_t subDeviceID, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) {
|
||||||
|
if (this->uuid[subDeviceID].isValid) {
|
||||||
|
uuid = this->uuid[subDeviceID].id;
|
||||||
|
return this->uuid[subDeviceID].isValid;
|
||||||
|
}
|
||||||
|
if (pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceEnvironment().osInterface != nullptr) {
|
||||||
auto driverModel = pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceEnvironment().osInterface->getDriverModel();
|
auto driverModel = pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceEnvironment().osInterface->getDriverModel();
|
||||||
auto &gfxCoreHelper = pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceEnvironment().getHelper<NEO::GfxCoreHelper>();
|
auto &gfxCoreHelper = pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceEnvironment().getHelper<NEO::GfxCoreHelper>();
|
||||||
auto &productHelper = pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceEnvironment().getHelper<NEO::ProductHelper>();
|
auto &productHelper = pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceEnvironment().getHelper<NEO::ProductHelper>();
|
||||||
|
@ -219,20 +232,60 @@ bool LinuxGlobalOperationsImp::getUuid(std::array<uint8_t, NEO::ProductHelper::u
|
||||||
if (NEO::debugManager.flags.EnableChipsetUniqueUUID.get() != 0) {
|
if (NEO::debugManager.flags.EnableChipsetUniqueUUID.get() != 0) {
|
||||||
if (gfxCoreHelper.isChipsetUniqueUUIDSupported()) {
|
if (gfxCoreHelper.isChipsetUniqueUUIDSupported()) {
|
||||||
auto hwDeviceId = pLinuxSysmanImp->getSysmanHwDeviceIdInstance();
|
auto hwDeviceId = pLinuxSysmanImp->getSysmanHwDeviceIdInstance();
|
||||||
this->uuid.isValid = productHelper.getUuid(driverModel, subDeviceCount, 0u, this->uuid.id);
|
this->uuid[subDeviceID].isValid = productHelper.getUuid(driverModel, subDeviceCount, subDeviceID, this->uuid[subDeviceID].id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->uuid.isValid && pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceEnvironment().osInterface != nullptr) {
|
if (!this->uuid[subDeviceID].isValid) {
|
||||||
NEO::PhysicalDevicePciBusInfo pciBusInfo = driverModel->getPciBusInfo();
|
NEO::PhysicalDevicePciBusInfo pciBusInfo = driverModel->getPciBusInfo();
|
||||||
this->uuid.isValid = generateUuidFromPciBusInfo(pciBusInfo, this->uuid.id);
|
this->uuid[subDeviceID].isValid = generateUuidFromPciAndSubDeviceInfo(subDeviceID, pciBusInfo, this->uuid[subDeviceID].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->uuid.isValid) {
|
if (this->uuid[subDeviceID].isValid) {
|
||||||
uuid = this->uuid.id;
|
uuid = this->uuid[subDeviceID].id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this->uuid.isValid;
|
return this->uuid[subDeviceID].isValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
ze_bool_t LinuxGlobalOperationsImp::getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) {
|
||||||
|
auto subDeviceCount = pLinuxSysmanImp->getSubDeviceCount();
|
||||||
|
for (uint32_t index = 0; index < (subDeviceCount + 1); index++) {
|
||||||
|
std::array<uint8_t, NEO::ProductHelper::uuidSize> deviceUuid;
|
||||||
|
bool uuidValid = getUuidFromSubDeviceInfo(index, deviceUuid);
|
||||||
|
if (uuidValid) {
|
||||||
|
if (0 == std::memcmp(uuid.id, deviceUuid.data(), ZE_MAX_DEVICE_UUID_SIZE)) {
|
||||||
|
*onSubdevice = (index > 0);
|
||||||
|
*subdeviceId = (*onSubdevice == true) ? (index - 1) : 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ze_result_t LinuxGlobalOperationsImp::getSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) {
|
||||||
|
auto subDeviceCount = pLinuxSysmanImp->getSubDeviceCount();
|
||||||
|
if (*pCount == 0) {
|
||||||
|
*pCount = subDeviceCount;
|
||||||
|
return ZE_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
if (*pCount > subDeviceCount) {
|
||||||
|
*pCount = subDeviceCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t subDeviceIndex = 0; subDeviceIndex < *pCount; subDeviceIndex++) {
|
||||||
|
pSubdeviceProps[subDeviceIndex].subdeviceId = subDeviceIndex;
|
||||||
|
std::array<uint8_t, NEO::ProductHelper::uuidSize> subDeviceUuid;
|
||||||
|
bool uuidValid = getUuidFromSubDeviceInfo(subDeviceIndex + 1, subDeviceUuid);
|
||||||
|
if (uuidValid) {
|
||||||
|
std::copy_n(std::begin(subDeviceUuid), ZE_MAX_DEVICE_UUID_SIZE, std::begin(pSubdeviceProps[subDeviceIndex].uuid.id));
|
||||||
|
} else {
|
||||||
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ZE_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
|
ze_result_t LinuxGlobalOperationsImp::reset(ze_bool_t force) {
|
||||||
|
@ -715,7 +768,6 @@ LinuxGlobalOperationsImp::LinuxGlobalOperationsImp(OsSysman *pOsSysman) {
|
||||||
pFsAccess = &pLinuxSysmanImp->getFsAccess();
|
pFsAccess = &pLinuxSysmanImp->getFsAccess();
|
||||||
devicePciBdf = pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Drm>()->getPciPath();
|
devicePciBdf = pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Drm>()->getPciPath();
|
||||||
rootDeviceIndex = pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceIndex();
|
rootDeviceIndex = pLinuxSysmanImp->getParentSysmanDeviceImp()->getRootDeviceIndex();
|
||||||
uuid.isValid = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OsGlobalOperations *OsGlobalOperations::create(OsSysman *pOsSysman) {
|
OsGlobalOperations *OsGlobalOperations::create(OsSysman *pOsSysman) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ class SysFsAccessInterface;
|
||||||
class FsAccessInterface;
|
class FsAccessInterface;
|
||||||
class ProcFsAccessInterface;
|
class ProcFsAccessInterface;
|
||||||
class SysmanKmdInterface;
|
class SysmanKmdInterface;
|
||||||
|
constexpr uint32_t maxUuidsPerDevice = 3;
|
||||||
|
|
||||||
class LinuxGlobalOperationsImp : public OsGlobalOperations, NEO::NonCopyableOrMovableClass {
|
class LinuxGlobalOperationsImp : public OsGlobalOperations, NEO::NonCopyableOrMovableClass {
|
||||||
public:
|
public:
|
||||||
|
@ -37,6 +38,9 @@ class LinuxGlobalOperationsImp : public OsGlobalOperations, NEO::NonCopyableOrMo
|
||||||
ze_result_t resetExt(zes_reset_properties_t *pProperties) override;
|
ze_result_t resetExt(zes_reset_properties_t *pProperties) override;
|
||||||
bool getUuid(std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) override;
|
bool getUuid(std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) override;
|
||||||
bool generateUuidFromPciBusInfo(const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) override;
|
bool generateUuidFromPciBusInfo(const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) override;
|
||||||
|
ze_bool_t getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) override;
|
||||||
|
bool generateUuidFromPciAndSubDeviceInfo(uint32_t subDeviceID, const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid);
|
||||||
|
ze_result_t getSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) override;
|
||||||
LinuxGlobalOperationsImp() = default;
|
LinuxGlobalOperationsImp() = default;
|
||||||
LinuxGlobalOperationsImp(OsSysman *pOsSysman);
|
LinuxGlobalOperationsImp(OsSysman *pOsSysman);
|
||||||
~LinuxGlobalOperationsImp() override = default;
|
~LinuxGlobalOperationsImp() override = default;
|
||||||
|
@ -44,7 +48,7 @@ class LinuxGlobalOperationsImp : public OsGlobalOperations, NEO::NonCopyableOrMo
|
||||||
struct {
|
struct {
|
||||||
bool isValid = false;
|
bool isValid = false;
|
||||||
std::array<uint8_t, NEO::ProductHelper::uuidSize> id;
|
std::array<uint8_t, NEO::ProductHelper::uuidSize> id;
|
||||||
} uuid;
|
} uuid[maxUuidsPerDevice];
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct DeviceMemStruct {
|
struct DeviceMemStruct {
|
||||||
|
@ -82,6 +86,7 @@ class LinuxGlobalOperationsImp : public OsGlobalOperations, NEO::NonCopyableOrMo
|
||||||
ze_result_t getListOfEnginesUsedByProcess(std::vector<std::string> &fdFileContents, uint32_t &activeEngines);
|
ze_result_t getListOfEnginesUsedByProcess(std::vector<std::string> &fdFileContents, uint32_t &activeEngines);
|
||||||
ze_result_t getMemoryStatsUsedByProcess(std::vector<std::string> &fdFileContents, uint64_t &memSize, uint64_t &sharedSize);
|
ze_result_t getMemoryStatsUsedByProcess(std::vector<std::string> &fdFileContents, uint64_t &memSize, uint64_t &sharedSize);
|
||||||
ze_result_t resetImpl(ze_bool_t force, zes_reset_type_t resetType);
|
ze_result_t resetImpl(ze_bool_t force, zes_reset_type_t resetType);
|
||||||
|
bool getUuidFromSubDeviceInfo(uint32_t subDeviceID, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Sysman
|
} // namespace Sysman
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2023 Intel Corporation
|
* Copyright (C) 2023-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -16,6 +16,8 @@ class GlobalOperations {
|
||||||
virtual ~GlobalOperations(){};
|
virtual ~GlobalOperations(){};
|
||||||
virtual ze_result_t reset(ze_bool_t force) = 0;
|
virtual ze_result_t reset(ze_bool_t force) = 0;
|
||||||
virtual ze_result_t deviceGetProperties(zes_device_properties_t *pProperties) = 0;
|
virtual ze_result_t deviceGetProperties(zes_device_properties_t *pProperties) = 0;
|
||||||
|
virtual bool getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) = 0;
|
||||||
|
virtual ze_result_t deviceGetSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) = 0;
|
||||||
virtual ze_result_t processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) = 0;
|
virtual ze_result_t processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) = 0;
|
||||||
virtual ze_result_t deviceGetState(zes_device_state_t *pState) = 0;
|
virtual ze_result_t deviceGetState(zes_device_state_t *pState) = 0;
|
||||||
virtual ze_result_t resetExt(zes_reset_properties_t *pProperties) = 0;
|
virtual ze_result_t resetExt(zes_reset_properties_t *pProperties) = 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2023 Intel Corporation
|
* Copyright (C) 2023-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -101,6 +101,16 @@ ze_result_t GlobalOperationsImp::deviceGetProperties(zes_device_properties_t *pP
|
||||||
return ZE_RESULT_SUCCESS;
|
return ZE_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GlobalOperationsImp::getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) {
|
||||||
|
initGlobalOperations();
|
||||||
|
return pOsGlobalOperations->getDeviceInfoByUuid(uuid, onSubdevice, subdeviceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
ze_result_t GlobalOperationsImp::deviceGetSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) {
|
||||||
|
initGlobalOperations();
|
||||||
|
return pOsGlobalOperations->getSubDeviceProperties(pCount, pSubdeviceProps);
|
||||||
|
}
|
||||||
|
|
||||||
ze_result_t GlobalOperationsImp::reset(ze_bool_t force) {
|
ze_result_t GlobalOperationsImp::reset(ze_bool_t force) {
|
||||||
initGlobalOperations();
|
initGlobalOperations();
|
||||||
return pOsGlobalOperations->reset(force);
|
return pOsGlobalOperations->reset(force);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2023 Intel Corporation
|
* Copyright (C) 2023-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -21,6 +21,8 @@ class GlobalOperationsImp : public GlobalOperations, NEO::NonCopyableOrMovableCl
|
||||||
void init() override;
|
void init() override;
|
||||||
ze_result_t reset(ze_bool_t force) override;
|
ze_result_t reset(ze_bool_t force) override;
|
||||||
ze_result_t deviceGetProperties(zes_device_properties_t *pProperties) override;
|
ze_result_t deviceGetProperties(zes_device_properties_t *pProperties) override;
|
||||||
|
ze_result_t deviceGetSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) override;
|
||||||
|
bool getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) override;
|
||||||
ze_result_t processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) override;
|
ze_result_t processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) override;
|
||||||
ze_result_t deviceGetState(zes_device_state_t *pState) override;
|
ze_result_t deviceGetState(zes_device_state_t *pState) override;
|
||||||
ze_result_t resetExt(zes_reset_properties_t *pProperties) override;
|
ze_result_t resetExt(zes_reset_properties_t *pProperties) override;
|
||||||
|
|
|
@ -31,6 +31,8 @@ class OsGlobalOperations {
|
||||||
virtual void getRepairStatus(zes_device_state_t *pState) = 0;
|
virtual void getRepairStatus(zes_device_state_t *pState) = 0;
|
||||||
virtual bool getUuid(std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) = 0;
|
virtual bool getUuid(std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) = 0;
|
||||||
virtual bool generateUuidFromPciBusInfo(const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) = 0;
|
virtual bool generateUuidFromPciBusInfo(const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) = 0;
|
||||||
|
virtual ze_bool_t getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) = 0;
|
||||||
|
virtual ze_result_t getSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) = 0;
|
||||||
virtual ze_result_t reset(ze_bool_t force) = 0;
|
virtual ze_result_t reset(ze_bool_t force) = 0;
|
||||||
virtual ze_result_t scanProcessesState(std::vector<zes_process_state_t> &pProcessList) = 0;
|
virtual ze_result_t scanProcessesState(std::vector<zes_process_state_t> &pProcessList) = 0;
|
||||||
virtual ze_result_t deviceGetState(zes_device_state_t *pState) = 0;
|
virtual ze_result_t deviceGetState(zes_device_state_t *pState) = 0;
|
||||||
|
|
|
@ -99,6 +99,24 @@ bool WddmGlobalOperationsImp::generateUuidFromPciBusInfo(const NEO::PhysicalDevi
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ze_bool_t WddmGlobalOperationsImp::getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) {
|
||||||
|
std::array<uint8_t, NEO::ProductHelper::uuidSize> deviceUuid;
|
||||||
|
bool uuidValid = getUuid(deviceUuid);
|
||||||
|
if (uuidValid) {
|
||||||
|
if (0 == std::memcmp(uuid.id, deviceUuid.data(), ZE_MAX_DEVICE_UUID_SIZE)) {
|
||||||
|
*onSubdevice = false;
|
||||||
|
*subdeviceId = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ze_result_t WddmGlobalOperationsImp::getSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) {
|
||||||
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||||
|
}
|
||||||
|
|
||||||
ze_result_t WddmGlobalOperationsImp::reset(ze_bool_t force) {
|
ze_result_t WddmGlobalOperationsImp::reset(ze_bool_t force) {
|
||||||
uint32_t value = 0;
|
uint32_t value = 0;
|
||||||
KmdSysman::RequestProperty request;
|
KmdSysman::RequestProperty request;
|
||||||
|
|
|
@ -30,7 +30,8 @@ class WddmGlobalOperationsImp : public OsGlobalOperations, NEO::NonCopyableOrMov
|
||||||
ze_result_t resetExt(zes_reset_properties_t *pProperties) override;
|
ze_result_t resetExt(zes_reset_properties_t *pProperties) override;
|
||||||
bool getUuid(std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) override;
|
bool getUuid(std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) override;
|
||||||
bool generateUuidFromPciBusInfo(const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) override;
|
bool generateUuidFromPciBusInfo(const NEO::PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, NEO::ProductHelper::uuidSize> &uuid) override;
|
||||||
|
ze_bool_t getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) override;
|
||||||
|
ze_result_t getSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) override;
|
||||||
WddmGlobalOperationsImp(OsSysman *pOsSysman);
|
WddmGlobalOperationsImp(OsSysman *pOsSysman);
|
||||||
WddmGlobalOperationsImp() = default;
|
WddmGlobalOperationsImp() = default;
|
||||||
~WddmGlobalOperationsImp() override = default;
|
~WddmGlobalOperationsImp() override = default;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2023 Intel Corporation
|
* Copyright (C) 2023-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -93,7 +93,12 @@ ze_result_t SysmanDevice::deviceGetState(zes_device_handle_t hDevice, zes_device
|
||||||
auto pSysmanDevice = L0::Sysman::SysmanDevice::fromHandle(hDevice);
|
auto pSysmanDevice = L0::Sysman::SysmanDevice::fromHandle(hDevice);
|
||||||
return pSysmanDevice->deviceGetState(pState);
|
return pSysmanDevice->deviceGetState(pState);
|
||||||
}
|
}
|
||||||
|
ze_result_t SysmanDevice::deviceGetSubDeviceProperties(zes_device_handle_t hDevice,
|
||||||
|
uint32_t *pCount,
|
||||||
|
zes_subdevice_exp_properties_t *pSubdeviceProps) {
|
||||||
|
auto pSysmanDevice = L0::Sysman::SysmanDevice::fromHandle(hDevice);
|
||||||
|
return pSysmanDevice->deviceGetSubDeviceProperties(pCount, pSubdeviceProps);
|
||||||
|
}
|
||||||
ze_result_t SysmanDevice::standbyGet(zes_device_handle_t hDevice, uint32_t *pCount, zes_standby_handle_t *phStandby) {
|
ze_result_t SysmanDevice::standbyGet(zes_device_handle_t hDevice, uint32_t *pCount, zes_standby_handle_t *phStandby) {
|
||||||
auto pSysmanDevice = L0::Sysman::SysmanDevice::fromHandle(hDevice);
|
auto pSysmanDevice = L0::Sysman::SysmanDevice::fromHandle(hDevice);
|
||||||
return pSysmanDevice->standbyGet(pCount, phStandby);
|
return pSysmanDevice->standbyGet(pCount, phStandby);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2023 Intel Corporation
|
* Copyright (C) 2023-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -75,6 +75,10 @@ struct SysmanDevice : _ze_device_handle_t {
|
||||||
static ze_result_t deviceGetProperties(zes_device_handle_t hDevice, zes_device_properties_t *pProperties);
|
static ze_result_t deviceGetProperties(zes_device_handle_t hDevice, zes_device_properties_t *pProperties);
|
||||||
virtual ze_result_t deviceGetProperties(zes_device_properties_t *pProperties) = 0;
|
virtual ze_result_t deviceGetProperties(zes_device_properties_t *pProperties) = 0;
|
||||||
|
|
||||||
|
static ze_result_t deviceGetSubDeviceProperties(zes_device_handle_t hDevice, uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps);
|
||||||
|
virtual ze_result_t deviceGetSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) = 0;
|
||||||
|
virtual ze_bool_t getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) = 0;
|
||||||
|
|
||||||
static ze_result_t deviceGetState(zes_device_handle_t hDevice, zes_device_state_t *pState);
|
static ze_result_t deviceGetState(zes_device_handle_t hDevice, zes_device_state_t *pState);
|
||||||
virtual ze_result_t deviceGetState(zes_device_state_t *pState) = 0;
|
virtual ze_result_t deviceGetState(zes_device_state_t *pState) = 0;
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,14 @@ ze_result_t SysmanDeviceImp::deviceGetProperties(zes_device_properties_t *pPrope
|
||||||
return pGlobalOperations->deviceGetProperties(pProperties);
|
return pGlobalOperations->deviceGetProperties(pProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ze_result_t SysmanDeviceImp::deviceGetSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) {
|
||||||
|
return pGlobalOperations->deviceGetSubDeviceProperties(pCount, pSubdeviceProps);
|
||||||
|
}
|
||||||
|
|
||||||
|
ze_bool_t SysmanDeviceImp::getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) {
|
||||||
|
return pGlobalOperations->getDeviceInfoByUuid(uuid, onSubdevice, subdeviceId);
|
||||||
|
}
|
||||||
|
|
||||||
ze_result_t SysmanDeviceImp::processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) {
|
ze_result_t SysmanDeviceImp::processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) {
|
||||||
return pGlobalOperations->processesGetState(pCount, pProcesses);
|
return pGlobalOperations->processesGetState(pCount, pProcesses);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2023 Intel Corporation
|
* Copyright (C) 2023-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -69,6 +69,8 @@ struct SysmanDeviceImp : SysmanDevice, NEO::NonCopyableOrMovableClass {
|
||||||
ze_result_t rasGet(uint32_t *pCount, zes_ras_handle_t *phRas) override;
|
ze_result_t rasGet(uint32_t *pCount, zes_ras_handle_t *phRas) override;
|
||||||
ze_result_t diagnosticsGet(uint32_t *pCount, zes_diag_handle_t *phFirmware) override;
|
ze_result_t diagnosticsGet(uint32_t *pCount, zes_diag_handle_t *phFirmware) override;
|
||||||
ze_result_t deviceGetProperties(zes_device_properties_t *pProperties) override;
|
ze_result_t deviceGetProperties(zes_device_properties_t *pProperties) override;
|
||||||
|
ze_result_t deviceGetSubDeviceProperties(uint32_t *pCount, zes_subdevice_exp_properties_t *pSubdeviceProps) override;
|
||||||
|
ze_bool_t getDeviceInfoByUuid(zes_uuid_t uuid, ze_bool_t *onSubdevice, uint32_t *subdeviceId) override;
|
||||||
ze_result_t processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) override;
|
ze_result_t processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) override;
|
||||||
ze_result_t deviceReset(ze_bool_t force) override;
|
ze_result_t deviceReset(ze_bool_t force) override;
|
||||||
ze_result_t deviceGetState(zes_device_state_t *pState) override;
|
ze_result_t deviceGetState(zes_device_state_t *pState) override;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2023 Intel Corporation
|
* Copyright (C) 2023-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -23,6 +23,7 @@ struct SysmanDriverHandle : BaseDriver {
|
||||||
SysmanDriverHandle &operator=(SysmanDriverHandle &&) = delete;
|
SysmanDriverHandle &operator=(SysmanDriverHandle &&) = delete;
|
||||||
|
|
||||||
static SysmanDriverHandle *create(NEO::ExecutionEnvironment &executionEnvironment, ze_result_t *returnValue);
|
static SysmanDriverHandle *create(NEO::ExecutionEnvironment &executionEnvironment, ze_result_t *returnValue);
|
||||||
|
virtual ze_result_t getDeviceByUuid(zes_uuid_t uuid, zes_device_handle_t *phDevice, ze_bool_t *onSubdevice, uint32_t *subdeviceId) = 0;
|
||||||
virtual ze_result_t getDevice(uint32_t *pCount, zes_device_handle_t *phDevices) = 0;
|
virtual ze_result_t getDevice(uint32_t *pCount, zes_device_handle_t *phDevices) = 0;
|
||||||
virtual ze_result_t getExtensionProperties(uint32_t *pCount, zes_driver_extension_properties_t *pExtensionProperties) = 0;
|
virtual ze_result_t getExtensionProperties(uint32_t *pCount, zes_driver_extension_properties_t *pExtensionProperties) = 0;
|
||||||
virtual ze_result_t sysmanEventsListen(uint32_t timeout, uint32_t count, zes_device_handle_t *phDevices,
|
virtual ze_result_t sysmanEventsListen(uint32_t timeout, uint32_t count, zes_device_handle_t *phDevices,
|
||||||
|
|
|
@ -94,6 +94,17 @@ ze_result_t SysmanDriverHandleImp::getDevice(uint32_t *pCount, zes_device_handle
|
||||||
return ZE_RESULT_SUCCESS;
|
return ZE_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ze_result_t SysmanDriverHandleImp::getDeviceByUuid(zes_uuid_t uuid, zes_device_handle_t *phDevice, ze_bool_t *onSubdevice, uint32_t *subdeviceId) {
|
||||||
|
for (uint32_t index = 0; index < this->numDevices; index++) {
|
||||||
|
ze_bool_t deviceFound = this->sysmanDevices[index]->getDeviceInfoByUuid(uuid, onSubdevice, subdeviceId);
|
||||||
|
if (deviceFound) {
|
||||||
|
*phDevice = this->sysmanDevices[index];
|
||||||
|
return ZE_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
ze_result_t SysmanDriverHandleImp::getExtensionProperties(uint32_t *pCount, zes_driver_extension_properties_t *pExtensionProperties) {
|
ze_result_t SysmanDriverHandleImp::getExtensionProperties(uint32_t *pCount, zes_driver_extension_properties_t *pExtensionProperties) {
|
||||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ struct SysmanDriverHandleImp : SysmanDriverHandle {
|
||||||
SysmanDriverHandleImp();
|
SysmanDriverHandleImp();
|
||||||
ze_result_t initialize(NEO::ExecutionEnvironment &executionEnvironment);
|
ze_result_t initialize(NEO::ExecutionEnvironment &executionEnvironment);
|
||||||
ze_result_t getDevice(uint32_t *pCount, zes_device_handle_t *phDevices) override;
|
ze_result_t getDevice(uint32_t *pCount, zes_device_handle_t *phDevices) override;
|
||||||
|
ze_result_t getDeviceByUuid(zes_uuid_t uuid, zes_device_handle_t *phDevice, ze_bool_t *onSubdevice, uint32_t *subdeviceId) override;
|
||||||
ze_result_t getExtensionProperties(uint32_t *pCount, zes_driver_extension_properties_t *pExtensionProperties) override;
|
ze_result_t getExtensionProperties(uint32_t *pCount, zes_driver_extension_properties_t *pExtensionProperties) override;
|
||||||
ze_result_t sysmanEventsListen(uint32_t timeout, uint32_t count, zes_device_handle_t *phDevices,
|
ze_result_t sysmanEventsListen(uint32_t timeout, uint32_t count, zes_device_handle_t *phDevices,
|
||||||
uint32_t *pNumDeviceEvents, zes_event_type_flags_t *pEvents) override;
|
uint32_t *pNumDeviceEvents, zes_event_type_flags_t *pEvents) override;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "shared/source/os_interface/linux/pci_path.h"
|
#include "shared/source/os_interface/linux/pci_path.h"
|
||||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||||
|
#include "shared/test/common/mocks/mock_driver_model.h"
|
||||||
#include "shared/test/common/mocks/mock_product_helper.h"
|
#include "shared/test/common/mocks/mock_product_helper.h"
|
||||||
#include "shared/test/common/os_interface/linux/sys_calls_linux_ult.h"
|
#include "shared/test/common/os_interface/linux/sys_calls_linux_ult.h"
|
||||||
|
|
||||||
|
@ -1331,6 +1332,13 @@ class SysmanGlobalOperationsUuidFixture : public SysmanDeviceFixture {
|
||||||
SysmanDeviceFixture::TearDown();
|
SysmanDeviceFixture::TearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setPciBusInfo(NEO::ExecutionEnvironment *executionEnvironment, const NEO::PhysicalDevicePciBusInfo &pciBusInfo, const uint32_t rootDeviceIndex) {
|
||||||
|
auto driverModel = std::make_unique<NEO::MockDriverModel>();
|
||||||
|
driverModel->pciSpeedInfo = {1, 1, 1};
|
||||||
|
driverModel->pciBusInfo = pciBusInfo;
|
||||||
|
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::move(driverModel));
|
||||||
|
}
|
||||||
|
|
||||||
void initGlobalOps() {
|
void initGlobalOps() {
|
||||||
zes_device_state_t deviceState;
|
zes_device_state_t deviceState;
|
||||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceGetState(device, &deviceState));
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceGetState(device, &deviceState));
|
||||||
|
@ -1364,6 +1372,130 @@ TEST_F(SysmanGlobalOperationsUuidFixture, GivenValidDeviceFDWhenRetrievingUuidTh
|
||||||
std::swap(rootDeviceEnvironment.productHelper, mockProductHelper);
|
std::swap(rootDeviceEnvironment.productHelper, mockProductHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using SysmanSubDevicePropertiesExperimentalTestMultiDevice = SysmanMultiDeviceFixture;
|
||||||
|
HWTEST2_F(SysmanSubDevicePropertiesExperimentalTestMultiDevice,
|
||||||
|
GivenValidDeviceHandleWhenCallingGetSubDevicePropertiesThenApiSucceeds, IsXeHpcCore) {
|
||||||
|
uint32_t count = 0;
|
||||||
|
ze_result_t result = zesDeviceGetSubDevicePropertiesExp(pSysmanDevice, &count, nullptr);
|
||||||
|
EXPECT_TRUE(count > 0);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
std::vector<zes_subdevice_exp_properties_t> subDeviceProps(count);
|
||||||
|
result = zesDeviceGetSubDevicePropertiesExp(pSysmanDevice, &count, subDeviceProps.data());
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(SysmanSubDevicePropertiesExperimentalTestMultiDevice,
|
||||||
|
GivenValidDeviceHandleWhenCallingGetSubDevicePropertiesTwiceThenApiResultsMatch, IsXeHpcCore) {
|
||||||
|
uint32_t count = 0;
|
||||||
|
ze_result_t result = zesDeviceGetSubDevicePropertiesExp(pSysmanDevice, &count, nullptr);
|
||||||
|
EXPECT_EQ(true, (count > 0));
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
std::vector<zes_subdevice_exp_properties_t> subDeviceProps(count);
|
||||||
|
result = zesDeviceGetSubDevicePropertiesExp(pSysmanDevice, &count, subDeviceProps.data());
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
std::vector<zes_subdevice_exp_properties_t> subDeviceProps2(count);
|
||||||
|
result = zesDeviceGetSubDevicePropertiesExp(pSysmanDevice, &count, subDeviceProps2.data());
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
|
EXPECT_EQ(subDeviceProps[i].subdeviceId, subDeviceProps2[i].subdeviceId);
|
||||||
|
EXPECT_EQ(0, memcmp(subDeviceProps[i].uuid.id, subDeviceProps2[i].uuid.id, ZES_MAX_UUID_SIZE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
using SysmanDeviceGetByUuidExperimentalTestMultiDevice = SysmanMultiDeviceFixture;
|
||||||
|
HWTEST2_F(SysmanDeviceGetByUuidExperimentalTestMultiDevice,
|
||||||
|
GivenValidDriverHandleWhenCallingGetDeviceByUuidWithInvalidUuidThenErrorResultIsReturned, IsXeHpcCore) {
|
||||||
|
zes_uuid_t uuid = {};
|
||||||
|
zes_device_handle_t phDevice;
|
||||||
|
ze_bool_t onSubdevice;
|
||||||
|
uint32_t subdeviceId;
|
||||||
|
|
||||||
|
ze_result_t result = zesDriverGetDeviceByUuidExp(driverHandle.get(), uuid, &phDevice, &onSubdevice, &subdeviceId);
|
||||||
|
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST2_F(SysmanDeviceGetByUuidExperimentalTestMultiDevice,
|
||||||
|
GivenValidDriverHandleWhenCallingGetDeviceByUuidWithValidUuidThenCorrectDeviceIsReturned, IsXeHpcCore) {
|
||||||
|
|
||||||
|
zes_device_properties_t properties = {};
|
||||||
|
ze_result_t result = zesDeviceGetProperties(pSysmanDevice, &properties);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
zes_uuid_t uuid = {};
|
||||||
|
std::copy_n(std::begin(properties.core.uuid.id), ZE_MAX_DEVICE_UUID_SIZE, std::begin(uuid.id));
|
||||||
|
zes_device_handle_t phDevice;
|
||||||
|
ze_bool_t onSubdevice;
|
||||||
|
uint32_t subdeviceId;
|
||||||
|
|
||||||
|
result = zesDriverGetDeviceByUuidExp(driverHandle.get(), uuid, &phDevice, &onSubdevice, &subdeviceId);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
EXPECT_EQ(phDevice, pSysmanDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanGlobalOperationsUuidFixture, GivenValidDeviceHandleWhenCallingGenerateUuidFromPciBusInfoThenValidUuidIsReturned) {
|
||||||
|
initGlobalOps();
|
||||||
|
|
||||||
|
auto pHwInfo = pLinuxSysmanImp->getSysmanDeviceImp()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||||
|
pHwInfo->platform.usDeviceID = 0x1234;
|
||||||
|
pHwInfo->platform.usRevId = 0x1;
|
||||||
|
|
||||||
|
std::array<uint8_t, NEO::ProductHelper::uuidSize> uuid;
|
||||||
|
NEO::PhysicalDevicePciBusInfo pciBusInfo = {};
|
||||||
|
pciBusInfo.pciDomain = 0x5678;
|
||||||
|
pciBusInfo.pciBus = 0x9;
|
||||||
|
pciBusInfo.pciDevice = 0xA;
|
||||||
|
pciBusInfo.pciFunction = 0xB;
|
||||||
|
|
||||||
|
bool result = pGlobalOperationsImp->pOsGlobalOperations->generateUuidFromPciBusInfo(pciBusInfo, uuid);
|
||||||
|
EXPECT_EQ(true, result);
|
||||||
|
uint8_t *pUuid = (uint8_t *)uuid.data();
|
||||||
|
EXPECT_EQ(*((uint16_t *)pUuid), (uint16_t)0x8086);
|
||||||
|
EXPECT_EQ(*((uint16_t *)(pUuid + 2)), (uint16_t)pHwInfo->platform.usDeviceID);
|
||||||
|
EXPECT_EQ(*((uint16_t *)(pUuid + 4)), (uint16_t)pHwInfo->platform.usRevId);
|
||||||
|
EXPECT_EQ(*((uint16_t *)(pUuid + 6)), (uint16_t)pciBusInfo.pciDomain);
|
||||||
|
EXPECT_EQ((*(pUuid + 8)), (uint8_t)pciBusInfo.pciBus);
|
||||||
|
EXPECT_EQ((*(pUuid + 9)), (uint8_t)pciBusInfo.pciDevice);
|
||||||
|
EXPECT_EQ((*(pUuid + 10)), (uint8_t)pciBusInfo.pciFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanGlobalOperationsUuidFixture, GivenValidDeviceHandleWithInvalidPciDomainWhenCallingGenerateUuidFromPciBusInfoThenFalseIsReturned) {
|
||||||
|
initGlobalOps();
|
||||||
|
|
||||||
|
std::array<uint8_t, NEO::ProductHelper::uuidSize> uuid;
|
||||||
|
NEO::PhysicalDevicePciBusInfo pciBusInfo = {};
|
||||||
|
pciBusInfo.pciDomain = std::numeric_limits<uint32_t>::max();
|
||||||
|
|
||||||
|
bool result = pGlobalOperationsImp->pOsGlobalOperations->generateUuidFromPciBusInfo(pciBusInfo, uuid);
|
||||||
|
EXPECT_EQ(false, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanGlobalOperationsUuidFixture, GivenNullOsInterfaceObjectWhenRetrievingUuidThenFalseIsReturned) {
|
||||||
|
initGlobalOps();
|
||||||
|
|
||||||
|
auto &rootDeviceEnvironment = (pLinuxSysmanImp->getSysmanDeviceImp()->getRootDeviceEnvironmentRef());
|
||||||
|
auto prevOsInterface = std::move(rootDeviceEnvironment.osInterface);
|
||||||
|
rootDeviceEnvironment.osInterface = nullptr;
|
||||||
|
|
||||||
|
std::array<uint8_t, NEO::ProductHelper::uuidSize> uuid;
|
||||||
|
bool result = pGlobalOperationsImp->pOsGlobalOperations->getUuid(uuid);
|
||||||
|
EXPECT_EQ(false, result);
|
||||||
|
rootDeviceEnvironment.osInterface = std::move(prevOsInterface);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanGlobalOperationsUuidFixture, GivenInvalidPciBusInfoWhenRetrievingUuidThenFalseIsReturned) {
|
||||||
|
initGlobalOps();
|
||||||
|
auto prevFlag = debugManager.flags.EnableChipsetUniqueUUID.get();
|
||||||
|
debugManager.flags.EnableChipsetUniqueUUID.set(0);
|
||||||
|
|
||||||
|
PhysicalDevicePciBusInfo pciBusInfo = {};
|
||||||
|
pciBusInfo.pciDomain = std::numeric_limits<uint32_t>::max();
|
||||||
|
setPciBusInfo(execEnv, pciBusInfo, 0);
|
||||||
|
std::array<uint8_t, NEO::ProductHelper::uuidSize> uuid;
|
||||||
|
bool result = pGlobalOperationsImp->pOsGlobalOperations->getUuid(uuid);
|
||||||
|
EXPECT_EQ(false, result);
|
||||||
|
debugManager.flags.EnableChipsetUniqueUUID.set(prevFlag);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ult
|
} // namespace ult
|
||||||
} // namespace Sysman
|
} // namespace Sysman
|
||||||
} // namespace L0
|
} // namespace L0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2023 Intel Corporation
|
* Copyright (C) 2023-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -83,6 +83,37 @@ TEST_F(SysmanGlobalOperationsFixture, GivenDeviceInUseWhenCallingzesDeviceResetE
|
||||||
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result);
|
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingzesDeviceGetSubDevicePropertiesExpThenUnsupportedIsReturned) {
|
||||||
|
init(true);
|
||||||
|
uint32_t count = 0;
|
||||||
|
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zesDeviceGetSubDevicePropertiesExp(pSysmanDevice->toHandle(), &count, nullptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingzesDriverGetDeviceByUuidExpWithInvalidUuidThenInvalidArgumentErrorIsReturned) {
|
||||||
|
init(true);
|
||||||
|
zes_uuid_t uuid = {};
|
||||||
|
zes_device_handle_t phDevice;
|
||||||
|
ze_bool_t onSubdevice;
|
||||||
|
uint32_t subdeviceId;
|
||||||
|
ze_result_t result = zesDriverGetDeviceByUuidExp(driverHandle.get(), uuid, &phDevice, &onSubdevice, &subdeviceId);
|
||||||
|
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingzesDriverGetDeviceByUuidExpWithValidUuidThenSuccessIsReturned) {
|
||||||
|
init(true);
|
||||||
|
zes_device_properties_t properties = {ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES};
|
||||||
|
ze_result_t result = zesDeviceGetProperties(pSysmanDevice->toHandle(), &properties);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
|
||||||
|
zes_uuid_t uuid;
|
||||||
|
zes_device_handle_t phDevice;
|
||||||
|
ze_bool_t onSubdevice;
|
||||||
|
uint32_t subdeviceId;
|
||||||
|
std::copy_n(std::begin(properties.core.uuid.id), ZE_MAX_DEVICE_UUID_SIZE, std::begin(uuid.id));
|
||||||
|
result = zesDriverGetDeviceByUuidExp(driverHandle.get(), uuid, &phDevice, &onSubdevice, &subdeviceId);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
}
|
||||||
|
|
||||||
class SysmanGlobalOperationsUuidFixture : public SysmanDeviceFixture {
|
class SysmanGlobalOperationsUuidFixture : public SysmanDeviceFixture {
|
||||||
public:
|
public:
|
||||||
L0::Sysman::GlobalOperationsImp *pGlobalOperationsImp;
|
L0::Sysman::GlobalOperationsImp *pGlobalOperationsImp;
|
||||||
|
@ -180,6 +211,20 @@ TEST_F(SysmanGlobalOperationsUuidFixture, GivenNullOsInterfaceObjectWhenRetrievi
|
||||||
rootDeviceEnvironment.osInterface = std::move(prevOsInterface);
|
rootDeviceEnvironment.osInterface = std::move(prevOsInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanGlobalOperationsUuidFixture, GivenNullOsInterfaceObjectWhenRetrievingDeviceInfoByUuidThenFalseIsReturned) {
|
||||||
|
initGlobalOps();
|
||||||
|
|
||||||
|
auto &rootDeviceEnvironment = (pWddmSysmanImp->getSysmanDeviceImp()->getRootDeviceEnvironmentRef());
|
||||||
|
auto prevOsInterface = std::move(rootDeviceEnvironment.osInterface);
|
||||||
|
rootDeviceEnvironment.osInterface = nullptr;
|
||||||
|
zes_uuid_t uuid = {};
|
||||||
|
ze_bool_t onSubdevice = false;
|
||||||
|
uint32_t subdeviceId = 0;
|
||||||
|
bool result = pGlobalOperationsImp->pOsGlobalOperations->getDeviceInfoByUuid(uuid, &onSubdevice, &subdeviceId);
|
||||||
|
EXPECT_FALSE(result);
|
||||||
|
rootDeviceEnvironment.osInterface = std::move(prevOsInterface);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(SysmanGlobalOperationsUuidFixture, GivenInvalidPciBusInfoWhenRetrievingUuidThenFalseIsReturned) {
|
TEST_F(SysmanGlobalOperationsUuidFixture, GivenInvalidPciBusInfoWhenRetrievingUuidThenFalseIsReturned) {
|
||||||
class SysmanMockWddm : public NEO::WddmMock {
|
class SysmanMockWddm : public NEO::WddmMock {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue