11/*
2- * Copyright (C) 2022-2024 Intel Corporation
2+ * Copyright (C) 2022-2025 Intel Corporation
33 *
44 * SPDX-License-Identifier: MIT
55 *
2525#include " shared/test/common/mocks/mock_sip.h"
2626#include " shared/test/common/mocks/ult_device_factory.h"
2727#include " shared/test/common/os_interface/linux/sys_calls_linux_ult.h"
28+ #include " shared/test/common/test_macros/hw_test.h"
2829#include " shared/test/common/test_macros/test.h"
2930
3031#include " level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
@@ -7882,7 +7883,7 @@ TEST_F(DebugApiRegistersAccessTest, givenReadModeRegisterCalledThenSuccessIsRetu
78827883
78837884using DebugApiLinuxMultitileTest = Test<DebugApiLinuxMultiDeviceFixture>;
78847885
7885- TEST_F (DebugApiLinuxMultitileTest, GivenRootDeviceAndTileAttachDisabledWhenDebugSessionInitializedThenEuThreadsAreCreated) {
7886+ HWTEST2_F (DebugApiLinuxMultitileTest, GivenRootDeviceAndTileAttachDisabledWhenDebugSessionInitializedThenEuThreadsAreCreated, IsAtLeastGen12lp ) {
78867887 DebugManagerStateRestore restorer;
78877888 NEO::debugManager.flags .ExperimentalEnableTileAttach .set (0 );
78887889
@@ -7910,7 +7911,7 @@ TEST_F(DebugApiLinuxMultitileTest, GivenRootDeviceAndTileAttachDisabledWhenDebug
79107911 EXPECT_FALSE (session->tileSessionsEnabled );
79117912}
79127913
7913- TEST_F (DebugApiLinuxMultitileTest, GivenRootDeviceAndRootAttachModeWhenDebugSessionInitializedThenEuThreadsAreCreated) {
7914+ HWTEST2_F (DebugApiLinuxMultitileTest, GivenRootDeviceAndRootAttachModeWhenDebugSessionInitializedThenEuThreadsAreCreated, IsAtLeastGen12lp ) {
79147915 zet_debug_config_t config = {};
79157916
79167917 auto session = std::make_unique<MockDebugSessionLinuxi915>(config, deviceImp, 1 );
@@ -7936,7 +7937,7 @@ TEST_F(DebugApiLinuxMultitileTest, GivenRootDeviceAndRootAttachModeWhenDebugSess
79367937 EXPECT_FALSE (session->tileSessionsEnabled );
79377938}
79387939
7939- TEST_F (DebugApiLinuxMultitileTest, GivenRootDeviceWhenDebugAttachCalledThenRootSessionIsCreatedAndTileAttachDisabled) {
7940+ HWTEST2_F (DebugApiLinuxMultitileTest, GivenRootDeviceWhenDebugAttachCalledThenRootSessionIsCreatedAndTileAttachDisabled, IsAtLeastGen12lp ) {
79407941 zet_debug_config_t config = {};
79417942 config.pid = 0x1234 ;
79427943 zet_debug_session_handle_t debugSession = nullptr ;
@@ -7962,7 +7963,7 @@ TEST_F(DebugApiLinuxMultitileTest, GivenRootDeviceWhenDebugAttachCalledThenRootS
79627963 zetDebugDetach (debugSession);
79637964}
79647965
7965- TEST_F (DebugApiLinuxMultitileTest, GivenSubDeviceWhenDebugAttachCalledThenTileSessionsAreCreatedAndRootCannotBeAttached) {
7966+ HWTEST2_F (DebugApiLinuxMultitileTest, GivenSubDeviceWhenDebugAttachCalledThenTileSessionsAreCreatedAndRootCannotBeAttached, IsAtLeastGen12lp ) {
79667967 zet_debug_config_t config = {};
79677968 config.pid = 0x1234 ;
79687969 zet_debug_session_handle_t debugSession = nullptr ;
@@ -7990,7 +7991,7 @@ TEST_F(DebugApiLinuxMultitileTest, GivenSubDeviceWhenDebugAttachCalledThenTileSe
79907991 zetDebugDetach (debugSession);
79917992}
79927993
7993- TEST_F (DebugApiLinuxMultitileTest, GivenMultitileDeviceWhenCallingResumeThenThreadsFromBothTilesAreResumed) {
7994+ HWTEST2_F (DebugApiLinuxMultitileTest, GivenMultitileDeviceWhenCallingResumeThenThreadsFromBothTilesAreResumed, IsAtLeastGen12lp ) {
79947995 zet_debug_config_t config = {};
79957996 config.pid = 0x1234 ;
79967997
@@ -8036,7 +8037,7 @@ TEST_F(DebugApiLinuxMultitileTest, GivenMultitileDeviceWhenCallingResumeThenThre
80368037 EXPECT_EQ (thread.thread , sessionMock->resumedThreads [1 ][0 ].thread );
80378038}
80388039
8039- TEST_F (DebugApiLinuxMultitileTest, givenApiThreadAndMultipleTilesWhenGettingDeviceIndexThenCorrectValueReturned) {
8040+ HWTEST2_F (DebugApiLinuxMultitileTest, givenApiThreadAndMultipleTilesWhenGettingDeviceIndexThenCorrectValueReturned, IsAtLeastGen12lp ) {
80408041 zet_debug_config_t config = {};
80418042 config.pid = 0x1234 ;
80428043
@@ -8155,7 +8156,7 @@ struct DebugApiLinuxMultiDeviceVmBindFixture : public DebugApiLinuxMultiDeviceFi
81558156
81568157using DebugApiLinuxMultiDeviceVmBindTest = Test<DebugApiLinuxMultiDeviceVmBindFixture<false >>;
81578158
8158- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenHandlingVmBindCreateEventsThenModuleLoadIsTriggeredAfterAllInstancesEventsReceived) {
8159+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenHandlingVmBindCreateEventsThenModuleLoadIsTriggeredAfterAllInstancesEventsReceived, IsAtLeastGen12lp ) {
81598160
81608161 auto handler = new MockIoctlHandlerI915;
81618162 session->ioctlHandler .reset (handler);
@@ -8192,7 +8193,7 @@ TEST_F(DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenHandlingVmBi
81928193 EXPECT_EQ (isaGpuVa, event.info .module .load );
81938194}
81948195
8195- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenHandlingVmBindDestroyEventsThenModuleUnloadIsTriggeredAfterAllInstancesEventsReceived) {
8196+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenHandlingVmBindDestroyEventsThenModuleUnloadIsTriggeredAfterAllInstancesEventsReceived, IsAtLeastGen12lp ) {
81968197 auto handler = new MockIoctlHandlerI915;
81978198 session->ioctlHandler .reset (handler);
81988199
@@ -8237,7 +8238,7 @@ TEST_F(DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenHandlingVmBi
82378238 EXPECT_EQ (isaGpuVa, event.info .module .load );
82388239}
82398240
8240- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaAndZebinModuleWhenHandlingVmBindCreateEventsThenModuleLoadIsTriggeredAfterAllInstancesEventsReceived) {
8241+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaAndZebinModuleWhenHandlingVmBindCreateEventsThenModuleLoadIsTriggeredAfterAllInstancesEventsReceived, IsAtLeastGen12lp ) {
82418242
82428243 auto handler = new MockIoctlHandlerI915;
82438244 session->ioctlHandler .reset (handler);
@@ -8283,13 +8284,13 @@ TEST_F(DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaAndZebinModuleWh
82838284 EXPECT_EQ (isaGpuVa, event.info .module .load );
82848285}
82858286
8286- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaAndZebinModuleWhenHandlingVmBindDestroyEventsThenModuleUnloadIsTriggeredAfterAllInstancesEventsReceived) {
8287+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaAndZebinModuleWhenHandlingVmBindDestroyEventsThenModuleUnloadIsTriggeredAfterAllInstancesEventsReceived, IsAtLeastGen12lp ) {
82878288 givenTileInstancedIsaAndZebinModuleWhenHandlingVmBindDestroyEventsThenModuleUnloadIsTriggeredAfterAllInstancesEventsReceived ();
82888289}
82898290
82908291using DebugLinuxMultiDeviceVmBindBlockOnFenceTest = Test<DebugApiLinuxMultiDeviceVmBindFixture<true >>;
82918292
8292- TEST_F (DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebinModuleWhenHandlingVmBindCreateEventsThenModuleLoadIsTriggeredAfterAllInstancesEventsReceived) {
8293+ HWTEST2_F (DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebinModuleWhenHandlingVmBindCreateEventsThenModuleLoadIsTriggeredAfterAllInstancesEventsReceived, IsAtLeastGen12lp ) {
82938294
82948295 auto handler = new MockIoctlHandlerI915;
82958296 session->ioctlHandler .reset (handler);
@@ -8333,11 +8334,11 @@ TEST_F(DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebi
83338334 EXPECT_EQ (isaGpuVa, event.info .module .load );
83348335}
83358336
8336- TEST_F (DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebinModuleWhenHandlingVmBindDestroyEventsThenModuleUnloadIsTriggeredAfterAllInstancesEventsReceived) {
8337+ HWTEST2_F (DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebinModuleWhenHandlingVmBindDestroyEventsThenModuleUnloadIsTriggeredAfterAllInstancesEventsReceived, IsAtLeastGen12lp ) {
83378338 givenTileInstancedIsaAndZebinModuleWhenHandlingVmBindDestroyEventsThenModuleUnloadIsTriggeredAfterAllInstancesEventsReceived ();
83388339}
83398340
8340- TEST_F (DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebinModuleWhenAcknowledgingEventThenModuleFromBothTilesAreAcked) {
8341+ HWTEST2_F (DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebinModuleWhenAcknowledgingEventThenModuleFromBothTilesAreAcked, IsAtLeastGen12lp ) {
83418342
83428343 auto handler = new MockIoctlHandlerI915;
83438344 session->ioctlHandler .reset (handler);
@@ -8381,7 +8382,7 @@ TEST_F(DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebi
83818382 EXPECT_EQ (0u , session->clientHandleToConnection [MockDebugSessionLinuxi915::mockClientHandle]->uuidToModule [zebinModuleUUID].ackEvents [1 ].size ());
83828383}
83838384
8384- TEST_F (DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebinModuleWhenModuleUUIDIsNotFoundThenAcknowledgeCallsDebugBreakAndReturnsSuccess) {
8385+ HWTEST2_F (DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebinModuleWhenModuleUUIDIsNotFoundThenAcknowledgeCallsDebugBreakAndReturnsSuccess, IsAtLeastGen12lp ) {
83858386
83868387 auto handler = new MockIoctlHandlerI915;
83878388 session->ioctlHandler .reset (handler);
@@ -8421,7 +8422,7 @@ TEST_F(DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenTileInstancedIsaAndZebi
84218422 EXPECT_EQ (0u , handler->ackCount );
84228423}
84238424
8424- TEST_F (DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenZebinModuleForTileWithoutAckFlagWhenHandlingVmBindCreateEventsThenModuleLoadIsTriggeredAfterOneTileInstancesEventsReceived) {
8425+ HWTEST2_F (DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenZebinModuleForTileWithoutAckFlagWhenHandlingVmBindCreateEventsThenModuleLoadIsTriggeredAfterOneTileInstancesEventsReceived, IsAtLeastGen12lp ) {
84258426
84268427 auto handler = new MockIoctlHandlerI915;
84278428 session->ioctlHandler .reset (handler);
@@ -8458,7 +8459,7 @@ TEST_F(DebugLinuxMultiDeviceVmBindBlockOnFenceTest, givenZebinModuleForTileWitho
84588459 EXPECT_EQ (isaGpuVa, event.info .module .load );
84598460}
84608461
8461- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenWritingAndReadingIsaMemoryThenOnlyWritesAreMirrored) {
8462+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenWritingAndReadingIsaMemoryThenOnlyWritesAreMirrored, IsAtLeastGen12lp ) {
84628463 auto handler = new MockIoctlHandlerI915;
84638464 session->ioctlHandler .reset (handler);
84648465
@@ -8499,7 +8500,7 @@ TEST_F(DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenWritingAndRe
84998500 EXPECT_EQ (1 , handler->preadCalled );
85008501}
85018502
8502- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenWritingMemoryFailsThenErrorIsReturned) {
8503+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenWritingMemoryFailsThenErrorIsReturned, IsAtLeastGen12lp ) {
85038504 auto handler = new MockIoctlHandlerI915;
85048505 session->ioctlHandler .reset (handler);
85058506
@@ -8531,7 +8532,7 @@ TEST_F(DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenWritingMemor
85318532 EXPECT_EQ (1 , handler->pwriteCalled );
85328533}
85338534
8534- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenSingleIsaWithInvalidVmWhenReadingIsaMemoryThenErrorUninitializedIsReturned) {
8535+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenSingleIsaWithInvalidVmWhenReadingIsaMemoryThenErrorUninitializedIsReturned, IsAtLeastGen12lp ) {
85358536 auto handler = new MockIoctlHandlerI915;
85368537 session->ioctlHandler .reset (handler);
85378538
@@ -8586,7 +8587,7 @@ TEST_F(DebugApiLinuxMultiDeviceVmBindTest, givenSingleIsaWithInvalidVmWhenReadin
85868587 EXPECT_EQ (0 , handler->preadCalled );
85878588}
85888589
8589- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaAndSingleInstanceWhenGettingIsaInfoThenIsaTrueAndErrorUninitializedIsReturned) {
8590+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaAndSingleInstanceWhenGettingIsaInfoThenIsaTrueAndErrorUninitializedIsReturned, IsAtLeastGen12lp ) {
85908591 auto handler = new MockIoctlHandlerI915;
85918592 session->ioctlHandler .reset (handler);
85928593
@@ -8618,7 +8619,7 @@ TEST_F(DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaAndSingleInstanc
86188619 EXPECT_EQ (ZE_RESULT_ERROR_UNINITIALIZED, status);
86198620}
86208621
8621- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenNoIsaWhenGettingIsaInfoThenFalseReturned) {
8622+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenNoIsaWhenGettingIsaInfoThenFalseReturned, IsAtLeastGen12lp ) {
86228623 uint32_t devices = static_cast <uint32_t >(deviceImp->getNEODevice ()->getDeviceBitfield ().to_ulong ());
86238624
86248625 zet_debug_memory_space_desc_t desc;
@@ -8633,7 +8634,7 @@ TEST_F(DebugApiLinuxMultiDeviceVmBindTest, givenNoIsaWhenGettingIsaInfoThenFalse
86338634 EXPECT_EQ (ZE_RESULT_ERROR_UNINITIALIZED, status);
86348635}
86358636
8636- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenIsaWhenGettingIsaInfoForWrongAddressThenErrorUninitializedReturned) {
8637+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenIsaWhenGettingIsaInfoForWrongAddressThenErrorUninitializedReturned, IsAtLeastGen12lp ) {
86378638 auto handler = new MockIoctlHandlerI915;
86388639 session->ioctlHandler .reset (handler);
86398640
@@ -8670,7 +8671,7 @@ TEST_F(DebugApiLinuxMultiDeviceVmBindTest, givenIsaWhenGettingIsaInfoForWrongAdd
86708671 EXPECT_EQ (ZE_RESULT_ERROR_UNINITIALIZED, status);
86718672}
86728673
8673- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenWritingAndReadingWrongIsaRangeThenErrorInvalidArgReturned) {
8674+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenWritingAndReadingWrongIsaRangeThenErrorInvalidArgReturned, IsAtLeastGen12lp ) {
86748675 auto handler = new MockIoctlHandlerI915;
86758676 session->ioctlHandler .reset (handler);
86768677
@@ -8707,7 +8708,7 @@ TEST_F(DebugApiLinuxMultiDeviceVmBindTest, givenTileInstancedIsaWhenWritingAndRe
87078708 EXPECT_EQ (0 , handler->preadCalled );
87088709}
87098710
8710- TEST_F (DebugApiLinuxMultiDeviceVmBindTest, givenSingleMemoryIsaWhenWritingAndReadingThenOnlyOneInstanceIsWrittenAndRead) {
8711+ HWTEST2_F (DebugApiLinuxMultiDeviceVmBindTest, givenSingleMemoryIsaWhenWritingAndReadingThenOnlyOneInstanceIsWrittenAndRead, IsAtLeastGen12lp ) {
87118712 auto handler = new MockIoctlHandlerI915;
87128713 session->ioctlHandler .reset (handler);
87138714
@@ -8785,7 +8786,7 @@ struct AffinityMaskMultipleSubdevicesLinux : DebugApiLinuxMultiDeviceFixture {
87858786
87868787using AffinityMaskMultipleSubdevicesTestLinux = Test<AffinityMaskMultipleSubdevicesLinux>;
87878788
8788- TEST_F (AffinityMaskMultipleSubdevicesTestLinux, GivenEventWithAckFlagAndTileNotWithinBitfieldWhenHandlingEventForISAThenIsaIsNotStoredInMapAndEventIsAcked) {
8789+ HWTEST2_F (AffinityMaskMultipleSubdevicesTestLinux, GivenEventWithAckFlagAndTileNotWithinBitfieldWhenHandlingEventForISAThenIsaIsNotStoredInMapAndEventIsAcked, IsAtLeastGen12lp ) {
87898790 uint64_t isaGpuVa = 0x345000 ;
87908791 uint64_t isaSize = 0x2000 ;
87918792 uint64_t vmBindIsaData[sizeof (prelim_drm_i915_debug_event_vm_bind) / sizeof (uint64_t ) + 3 * sizeof (typeOfUUID)];
@@ -8819,7 +8820,7 @@ TEST_F(AffinityMaskMultipleSubdevicesTestLinux, GivenEventWithAckFlagAndTileNotW
88198820 EXPECT_EQ (vmBindIsa->base .seqno , handler->debugEventAcked .seqno );
88208821}
88218822
8822- TEST_F (AffinityMaskMultipleSubdevicesTestLinux, GivenPfEventForTileNotWithinBitfieldWhenHandlingEventThenEventIsSkipped) {
8823+ HWTEST2_F (AffinityMaskMultipleSubdevicesTestLinux, GivenPfEventForTileNotWithinBitfieldWhenHandlingEventThenEventIsSkipped, IsAtLeastGen12lp ) {
88238824 auto debugSession = std::make_unique<MockDebugSessionLinuxi915>(zet_debug_config_t {1234 }, deviceImp, 10 );
88248825
88258826 uint64_t ctxHandle = 2 ;
@@ -8850,7 +8851,7 @@ TEST_F(AffinityMaskMultipleSubdevicesTestLinux, GivenPfEventForTileNotWithinBitf
88508851 EXPECT_FALSE (debugSession->triggerEvents );
88518852}
88528853
8853- TEST_F (AffinityMaskMultipleSubdevicesTestLinux, GivenAttEventForTileNotWithinBitfieldWhenHandlingEventThenEventIsSkipped) {
8854+ HWTEST2_F (AffinityMaskMultipleSubdevicesTestLinux, GivenAttEventForTileNotWithinBitfieldWhenHandlingEventThenEventIsSkipped, IsAtLeastGen12lp ) {
88548855 auto debugSession = std::make_unique<MockDebugSessionLinuxi915>(zet_debug_config_t {1234 }, deviceImp, 10 );
88558856
88568857 uint64_t ctxHandle = 2 ;
0 commit comments