diff --git a/level_zero/core/test/unit_tests/sources/device/linux/test_device_uuid.cpp b/level_zero/core/test/unit_tests/sources/device/linux/test_device_uuid.cpp index 0e2d4b5a8b..feaffae684 100644 --- a/level_zero/core/test/unit_tests/sources/device/linux/test_device_uuid.cpp +++ b/level_zero/core/test/unit_tests/sources/device/linux/test_device_uuid.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,6 +26,7 @@ namespace ult { struct TestDeviceUuid : public ::testing::Test { void SetUp() override {} void TearDown() override {} + DebugManagerStateRestore restorer; }; HWTEST2_F(TestDeviceUuid, GivenCorrectTelemetryNodesAreAvailableWhenRetrievingDeviceAndSubDevicePropertiesThenCorrectUuidIsReceived, IsXEHP) { @@ -82,7 +83,7 @@ HWTEST2_F(TestDeviceUuid, GivenCorrectTelemetryNodesAreAvailableWhenRetrievingDe return -1; }); - DebugManagerStateRestore restore; + DebugManager.flags.EnableChipsetUniqueUUID.set(1); DebugManager.flags.CreateMultipleSubDevices.set(2); std::unique_ptr> driverHandle; @@ -132,5 +133,23 @@ HWTEST2_F(TestDeviceUuid, GivenCorrectTelemetryNodesAreAvailableWhenRetrievingDe EXPECT_TRUE(0 == std::memcmp(deviceProps.uuid.id, expectedUuid, sizeof(expectedUuid))); } +TEST_F(TestDeviceUuid, GivenEnableChipsetUniqueUuidIsSetWhenOsInterfaceIsNotSetThenUuidOfFallbackPathIsReceived) { + + DebugManager.flags.EnableChipsetUniqueUUID.set(1); + auto neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment(NEO::defaultHwInfo.get()); + NEO::DeviceVector devices; + devices.push_back(std::unique_ptr(neoDevice)); + auto driverHandle = std::make_unique>(); + driverHandle->initialize(std::move(devices)); + auto device = driverHandle->devices[0]; + + ze_device_properties_t deviceProperties, devicePropertiesBefore; + deviceProperties = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES}; + memset(&deviceProperties.uuid, std::numeric_limits::max(), sizeof(deviceProperties.uuid)); + devicePropertiesBefore = deviceProperties; + EXPECT_EQ(ZE_RESULT_SUCCESS, device->getProperties(&deviceProperties)); + EXPECT_NE(0, memcmp(&deviceProperties.uuid, &devicePropertiesBefore.uuid, sizeof(devicePropertiesBefore.uuid))); +} + } // namespace ult } // namespace L0 \ No newline at end of file diff --git a/opencl/test/unit_test/test_files/igdrcl.config b/opencl/test/unit_test/test_files/igdrcl.config index 0242fc9898..fbe9a3a779 100644 --- a/opencl/test/unit_test/test_files/igdrcl.config +++ b/opencl/test/unit_test/test_files/igdrcl.config @@ -368,4 +368,5 @@ UseDrmCompletionFenceForAllAllocations = -1 ExperimentalEnableSourceLevelDebugger = 0 Force2dImageAsArray = -1 ForceExtendedBufferSize = -1 -MakeIndirectAllocationsResidentAsPack = -1 \ No newline at end of file +MakeIndirectAllocationsResidentAsPack = -1 +EnableChipsetUniqueUUID = -1 diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index 4c7ec924eb..7058798c9a 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -344,6 +344,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") /*EXPERIMENTAL TOGGLES*/ DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalSetWalkerPartitionCount, 0, "Experimental implementation: Set number of COMPUTE_WALKERs for a given Partition Type, 0 - do not set the feature.") diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 7b9f40e1a4..e015803b81 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -270,7 +270,11 @@ bool Device::createDeviceImpl() { createBindlessHeapsHelper(); if (!isEngineInstanced()) { auto hardwareInfo = getRootDeviceEnvironment().getMutableHardwareInfo(); - uuid.isValid = HwInfoConfig::get(hardwareInfo->platform.eProductFamily)->getUuid(this, uuid.id); + uuid.isValid = false; + + if (DebugManager.flags.EnableChipsetUniqueUUID.get() == 1) { + uuid.isValid = HwInfoConfig::get(hardwareInfo->platform.eProductFamily)->getUuid(this, uuid.id); + } if (!uuid.isValid && getRootDeviceEnvironment().osInterface != nullptr) { PhysicalDevicePciBusInfo pciBusInfo = getRootDeviceEnvironment().osInterface->getDriverModel()->getPciBusInfo(); 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 e479f3ae69..4ceee50cad 100644 --- a/shared/test/unit_test/os_interface/device_uuid_tests.cpp +++ b/shared/test/unit_test/os_interface/device_uuid_tests.cpp @@ -170,4 +170,65 @@ HWTEST2_F(MultipleDeviceBdfUuidTest, GivenValidBdfWithOneBitEnabledInAffinityMas expectedUuid[15] = 4; EXPECT_TRUE(0 == std::memcmp(uuid.data(), expectedUuid, sizeof(expectedUuid))); } + +using DeviceUuidEnablementTest = MultipleDeviceBdfUuidTest; + +template +class MockHwInfoConfigHwUuidEnablementTest : public HwInfoConfigHw { + public: + const bool returnStatus; + MockHwInfoConfigHwUuidEnablementTest(bool returnStatus) : returnStatus(returnStatus) {} + bool getUuid(Device *device, std::array &uuid) const override { + uuid.fill(255u); + return returnStatus; + } +}; + +HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsDefaultWhenDeviceIsCreatedThenChipsetUniqueUuidUsingTelemetryIsNotUsed, MatchAny) { + + mockHwInfoConfig.reset(new MockHwInfoConfigHwUuidEnablementTest(true)); + VariableBackup backupHwInfoConfig(&hwInfoConfigFactory[productFamily], mockHwInfoConfig.get()); + std::array uuid, expectedUuid; + uuid.fill(0u); + expectedUuid.fill(255u); + + PhysicalDevicePciBusInfo pciBusInfo(0x00, 0x34, 0xab, 0xcd); + const auto deviceFactory = createDevices(pciBusInfo, 2); + + EXPECT_EQ(true, deviceFactory->rootDevices[0]->getUuid(uuid)); + EXPECT_FALSE(0 == std::memcmp(uuid.data(), expectedUuid.data(), 16)); +} + +HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsEnabledWhenDeviceIsCreatedThenChipsetUniqueUuidUsingTelemetryIsUsed, MatchAny) { + + mockHwInfoConfig.reset(new MockHwInfoConfigHwUuidEnablementTest(true)); + VariableBackup backupHwInfoConfig(&hwInfoConfigFactory[productFamily], mockHwInfoConfig.get()); + DebugManager.flags.EnableChipsetUniqueUUID.set(1); + std::array uuid, expectedUuid; + uuid.fill(0u); + expectedUuid.fill(255u); + + PhysicalDevicePciBusInfo pciBusInfo(0x00, 0x34, 0xab, 0xcd); + const auto deviceFactory = createDevices(pciBusInfo, 2); + + EXPECT_EQ(true, deviceFactory->rootDevices[0]->getUuid(uuid)); + EXPECT_TRUE(0 == std::memcmp(uuid.data(), expectedUuid.data(), 16)); +} + +HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsDisabledWhenDeviceIsCreatedThenChipsetUniqueUuidUsingTelemetryIsNotUsed, MatchAny) { + + mockHwInfoConfig.reset(new MockHwInfoConfigHwUuidEnablementTest(true)); + VariableBackup backupHwInfoConfig(&hwInfoConfigFactory[productFamily], mockHwInfoConfig.get()); + DebugManager.flags.EnableChipsetUniqueUUID.set(0); + std::array uuid, expectedUuid; + uuid.fill(0u); + expectedUuid.fill(255u); + + PhysicalDevicePciBusInfo pciBusInfo(0x00, 0x34, 0xab, 0xcd); + const auto deviceFactory = createDevices(pciBusInfo, 2); + + EXPECT_EQ(true, deviceFactory->rootDevices[0]->getUuid(uuid)); + EXPECT_FALSE(0 == std::memcmp(uuid.data(), expectedUuid.data(), 16)); +} + } // namespace NEO \ No newline at end of file