From 6944baaca89194f5b9ea2ad61fcdd0729485e8bc Mon Sep 17 00:00:00 2001 From: Joshua Santosh Ranjan Date: Tue, 11 Oct 2022 12:12:47 +0000 Subject: [PATCH] Add check to verify UUID platform support Related-To: LOCI-3495 Signed-off-by: Joshua Santosh Ranjan --- .../device/test_device_pci_speed_info.cpp | 1 + .../debug_settings/debug_variables_base.inl | 2 +- shared/source/device/device.cpp | 6 ++++-- shared/source/helpers/hw_helper.h | 2 ++ shared/source/helpers/hw_helper_base.inl | 4 ++++ .../helpers/hw_helper_xehp_and_later.inl | 5 +++++ .../os_interface/device_uuid_tests.cpp | 18 +++++++++++++----- 7 files changed, 30 insertions(+), 8 deletions(-) diff --git a/level_zero/core/test/unit_tests/sources/device/test_device_pci_speed_info.cpp b/level_zero/core/test/unit_tests/sources/device/test_device_pci_speed_info.cpp index 5681efc140..e7ade83c6d 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device_pci_speed_info.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device_pci_speed_info.cpp @@ -21,6 +21,7 @@ namespace ult { std::unique_ptr PciSpeedInfoTest::createDevices(uint32_t numSubDevices, const NEO::PhyicalDevicePciSpeedInfo &pciSpeedInfo) { DebugManager.flags.CreateMultipleSubDevices.set(numSubDevices); + DebugManager.flags.EnableChipsetUniqueUUID.set(0); NEO::ExecutionEnvironment *executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get(), false, 1); executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new OSInterface); executionEnvironment->memoryManager.reset(new MockMemoryManagerOsAgnosticContext(*executionEnvironment)); diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index 7818bf9b8f..3b63a3129e 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -410,7 +410,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideSystolicInComputeWalker, -1, "set SYSTOL DECLARE_DEBUG_VARIABLE(int32_t, AddStatePrefetchCmdToMemoryPrefetchAPI, -1, "Add STATE_PREFETCH to zeCommandListAppendMemoryPrefetch, -1:default, 0:disable, 1:enable") DECLARE_DEBUG_VARIABLE(int32_t, EnableDrmCompletionFence, -1, "Enables DRM completion fence, -1:default (disabled), 0:disable, 1:enable") DECLARE_DEBUG_VARIABLE(int32_t, UseDrmCompletionFenceForAllAllocations, -1, "Uses DRM completion fence for all allocations, -1:default (disabled), 0:disable, 1:enable") -DECLARE_DEBUG_VARIABLE(int32_t, EnableChipsetUniqueUUID, -1, "Enables retrieving chipset unique UUID using telemetry, -1:default (disabled), 0:disable, 1:enable") +DECLARE_DEBUG_VARIABLE(int32_t, EnableChipsetUniqueUUID, -1, "Enables retrieving chipset unique UUID using telemetry, -1:default (enabled), 0:disable, 1:enable") DECLARE_DEBUG_VARIABLE(int32_t, EnableFlushTaskSubmission, -1, "Driver uses csr flushTask for immediate commandlist submissions, -1:default (enabled), 0:disabled, 1:enabled") DECLARE_DEBUG_VARIABLE(int32_t, EnableImmediateCmdListHeapSharing, -1, "Immediate command lists using flush task use current csr heap instead private cmd list heap, -1:default (disabled), 0:disabled, 1:enabled") DECLARE_DEBUG_VARIABLE(int32_t, EnableBcsSwControlWa, -1, "Enable BCS WA via BCSSWCONTROL MMIO. -1: default, 0: disabled, 1: if src in system mem, 2: if dst in system mem, 3: if src and dst in system mem, 4: always") diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 895ef8b7be..bc378ca0d7 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -266,8 +266,10 @@ bool Device::createDeviceImpl() { auto hardwareInfo = getRootDeviceEnvironment().getMutableHardwareInfo(); uuid.isValid = false; - if (DebugManager.flags.EnableChipsetUniqueUUID.get() == 1) { - uuid.isValid = HwInfoConfig::get(hardwareInfo->platform.eProductFamily)->getUuid(this, uuid.id); + if (DebugManager.flags.EnableChipsetUniqueUUID.get() != 0) { + if (HwHelper::get(hwInfo.platform.eRenderCoreFamily).isChipsetUniqueUUIDSupported()) { + uuid.isValid = HwInfoConfig::get(hardwareInfo->platform.eProductFamily)->getUuid(this, uuid.id); + } } if (!uuid.isValid && getRootDeviceEnvironment().osInterface != nullptr) { diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index aaf7cd7f1e..57fc8eda28 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -161,6 +161,7 @@ class HwHelper { virtual uint32_t getMinimalScratchSpaceSize() const = 0; virtual bool copyThroughLockedPtrEnabled() const = 0; virtual uint32_t getAmountOfAllocationsToFill() const = 0; + virtual bool isChipsetUniqueUUIDSupported() const = 0; protected: HwHelper() = default; @@ -404,6 +405,7 @@ class HwHelperHw : public HwHelper { uint32_t getMinimalScratchSpaceSize() const override; bool copyThroughLockedPtrEnabled() const override; uint32_t getAmountOfAllocationsToFill() const override; + bool isChipsetUniqueUUIDSupported() const override; protected: static const AuxTranslationMode defaultAuxTranslationMode; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 43ef0dc9e7..7d720e0ac8 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -734,4 +734,8 @@ uint32_t HwHelperHw::getAmountOfAllocationsToFill() const { return 0u; } +template +bool HwHelperHw::isChipsetUniqueUUIDSupported() const { + return false; +} } // namespace NEO diff --git a/shared/source/helpers/hw_helper_xehp_and_later.inl b/shared/source/helpers/hw_helper_xehp_and_later.inl index 450ce5989d..7be162a10f 100644 --- a/shared/source/helpers/hw_helper_xehp_and_later.inl +++ b/shared/source/helpers/hw_helper_xehp_and_later.inl @@ -225,4 +225,9 @@ uint32_t HwHelperHw::getMinimalScratchSpaceSize() const { return 64U; } +template <> +bool HwHelperHw::isChipsetUniqueUUIDSupported() const { + return true; +} + } // namespace NEO diff --git a/shared/test/unit_test/os_interface/device_uuid_tests.cpp b/shared/test/unit_test/os_interface/device_uuid_tests.cpp index 9088b7a918..9759a1b4ef 100644 --- a/shared/test/unit_test/os_interface/device_uuid_tests.cpp +++ b/shared/test/unit_test/os_interface/device_uuid_tests.cpp @@ -165,7 +165,7 @@ class MockHwInfoConfigHwUuidEnablementTest : public HwInfoConfigHw { } }; -HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsDefaultWhenDeviceIsCreatedThenChipsetUniqueUuidUsingTelemetryIsNotUsed, MatchAny) { +HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsDefaultWhenDeviceIsCreatedThenChipsetUniqueUuidUsingTelemetryIstUsed, MatchAny) { mockHwInfoConfig.reset(new MockHwInfoConfigHwUuidEnablementTest(true)); VariableBackup backupHwInfoConfig(&hwInfoConfigFactory[productFamily], mockHwInfoConfig.get()); @@ -177,7 +177,12 @@ HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsDefaultWhenDev const auto deviceFactory = createDevices(pciBusInfo, 2); EXPECT_EQ(true, deviceFactory->rootDevices[0]->getUuid(uuid)); - EXPECT_FALSE(0 == std::memcmp(uuid.data(), expectedUuid.data(), 16)); + + if (HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).isChipsetUniqueUUIDSupported()) { + EXPECT_TRUE(0 == std::memcmp(uuid.data(), expectedUuid.data(), 16)); + } else { + EXPECT_FALSE(0 == std::memcmp(uuid.data(), expectedUuid.data(), 16)); + } } HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsEnabledWhenDeviceIsCreatedThenChipsetUniqueUuidUsingTelemetryIsUsed, MatchAny) { @@ -188,12 +193,15 @@ HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsEnabledWhenDev std::array uuid, expectedUuid; uuid.fill(0u); expectedUuid.fill(255u); - PhysicalDevicePciBusInfo pciBusInfo(0x00, 0x34, 0xab, 0xcd); - const auto deviceFactory = createDevices(pciBusInfo, 2); + const auto deviceFactory = createDevices(pciBusInfo, 2); EXPECT_EQ(true, deviceFactory->rootDevices[0]->getUuid(uuid)); - EXPECT_TRUE(0 == std::memcmp(uuid.data(), expectedUuid.data(), 16)); + if (HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).isChipsetUniqueUUIDSupported()) { + EXPECT_TRUE(0 == std::memcmp(uuid.data(), expectedUuid.data(), 16)); + } else { + EXPECT_FALSE(0 == std::memcmp(uuid.data(), expectedUuid.data(), 16)); + } } HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsDisabledWhenDeviceIsCreatedThenChipsetUniqueUuidUsingTelemetryIsNotUsed, MatchAny) {