mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 06:23:01 +08:00
Implement UUID using pcie bdf
This patch implements the fallback method for Device UUID using the BDF of the device for all product families. Related-To: LOCI-2827 Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
40ea30be0b
commit
7fc9b2c3dc
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -271,6 +271,11 @@ bool Device::createDeviceImpl() {
|
||||
if (!isEngineInstanced()) {
|
||||
auto hardwareInfo = getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
uuid.isValid = HwInfoConfig::get(hardwareInfo->platform.eProductFamily)->getUuid(this, uuid.id);
|
||||
|
||||
if (!uuid.isValid && getRootDeviceEnvironment().osInterface != nullptr) {
|
||||
PhysicalDevicePciBusInfo pciBusInfo = getRootDeviceEnvironment().osInterface->getDriverModel()->getPciBusInfo();
|
||||
uuid.isValid = generateUuidFromPciBusInfo(pciBusInfo, uuid.id);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -646,8 +651,28 @@ OSTime *Device::getOSTime() const { return getRootDeviceEnvironment().osTime.get
|
||||
bool Device::getUuid(std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) {
|
||||
if (this->uuid.isValid) {
|
||||
uuid = this->uuid.id;
|
||||
|
||||
if (!isSubDevice() && deviceBitfield.count() == 1) {
|
||||
// In case of no sub devices created (bits set in affinity mask == 1), return the UUID of enabled sub-device.
|
||||
uint32_t subDeviceIndex = Math::log2(static_cast<uint32_t>(deviceBitfield.to_ulong()));
|
||||
uuid[HwInfoConfig::uuidSize - 1] = subDeviceIndex + 1;
|
||||
}
|
||||
}
|
||||
return this->uuid.isValid;
|
||||
}
|
||||
|
||||
bool Device::generateUuidFromPciBusInfo(const PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) {
|
||||
if (pciBusInfo.pciDomain != PhysicalDevicePciBusInfo::InvalidValue) {
|
||||
|
||||
uuid.fill(0);
|
||||
memcpy_s(&uuid[0], 2, &pciBusInfo.pciDomain, 2);
|
||||
memcpy_s(&uuid[2], 1, &pciBusInfo.pciBus, 1);
|
||||
memcpy_s(&uuid[3], 1, &pciBusInfo.pciDevice, 1);
|
||||
memcpy_s(&uuid[4], 1, &pciBusInfo.pciFunction, 1);
|
||||
uuid[HwInfoConfig::uuidSize - 1] = isSubDevice() ? static_cast<SubDevice *>(this)->getSubDeviceIndex() + 1 : 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -24,6 +24,7 @@ namespace NEO {
|
||||
class OSTime;
|
||||
class SourceLevelDebugger;
|
||||
class SubDevice;
|
||||
struct PhysicalDevicePciBusInfo;
|
||||
|
||||
struct SelectorCopyEngine : NonCopyableOrMovableClass {
|
||||
std::atomic<bool> isMainUsed = false;
|
||||
@@ -200,6 +201,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
bool isValid = false;
|
||||
std::array<uint8_t, HwInfoConfig::uuidSize> id;
|
||||
} uuid;
|
||||
bool generateUuidFromPciBusInfo(const PhysicalDevicePciBusInfo &pciBusInfo, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid);
|
||||
};
|
||||
|
||||
inline EngineControl &Device::getDefaultEngine() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -184,8 +184,8 @@ class MemoryManager {
|
||||
|
||||
const ExecutionEnvironment &peekExecutionEnvironment() const { return executionEnvironment; }
|
||||
|
||||
OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver,
|
||||
const EngineDescriptor &engineDescriptor);
|
||||
MOCKABLE_VIRTUAL OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver,
|
||||
const EngineDescriptor &engineDescriptor);
|
||||
uint32_t getRegisteredEnginesCount() const { return static_cast<uint32_t>(registeredEngines.size()); }
|
||||
EngineControlContainer &getRegisteredEngines();
|
||||
EngineControl *getRegisteredEngineForCsr(CommandStreamReceiver *commandStreamReceiver);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -83,6 +83,7 @@ class HwInfoConfig {
|
||||
virtual bool isDcFlushAllowed() const = 0;
|
||||
virtual uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool getUuid(Device *device, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) const = 0;
|
||||
MOCKABLE_VIRTUAL ~HwInfoConfig() = default;
|
||||
|
||||
protected:
|
||||
virtual LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
|
||||
|
||||
Reference in New Issue
Block a user