Skip to content

Commit 0d23fa1

Browse files
Sysman: increase sleep duration in warm reset
warm reset needs to have a longer sleep duaration after remove to ensure that the PCIe state is save and restored safely. Signed-off-by: Vilvaraj, T J Vivek <t.j.vivek.vilvaraj@intel.com>
1 parent f06ebef commit 0d23fa1

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

level_zero/tools/source/sysman/linux/os_sysman_imp.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,11 @@ ze_result_t LinuxSysmanImp::osWarmReset() {
327327
if (ZE_RESULT_SUCCESS != result) {
328328
return result;
329329
}
330-
331-
this->pSleepFunctionSecs(10); // Sleep for 10seconds to make sure that the config spaces of all devices are saved correctly
330+
if (diagnosticsReset) {
331+
this->pSleepFunctionSecs(30); // Sleep for 30seconds to make sure that the config spaces of all devices are saved correctly after IFR
332+
} else {
333+
this->pSleepFunctionSecs(10); // Sleep for 10seconds to make sure that the config spaces of all devices are saved correctly
334+
}
332335
rootPortPath = getPciRootPortDirectoryPath(gtDevicePath);
333336

334337
int fd, ret = 0;
@@ -355,7 +358,11 @@ ze_result_t LinuxSysmanImp::osWarmReset() {
355358
if (ZE_RESULT_SUCCESS != result) {
356359
return result;
357360
}
358-
this->pSleepFunctionSecs(10); // Sleep for 10seconds, allows the rescan to complete on all devices attached to the root port.
361+
if (diagnosticsReset) {
362+
this->pSleepFunctionSecs(30); // Sleep for 30seconds to make sure that the config spaces of all devices are saved correctly after IFR
363+
} else {
364+
this->pSleepFunctionSecs(10); // Sleep for 10seconds, allows the rescan to complete on all devices attached to the root port.
365+
}
359366
return result;
360367
}
361368

level_zero/tools/test/unit_tests/sources/sysman/diagnostics/linux/test_zes_sysman_diagnostics.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,18 @@ TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetThen
537537
EXPECT_EQ(ZE_RESULT_SUCCESS, pLinuxSysmanImp->osWarmReset());
538538
}
539539

540+
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetfromDiagnosticsThenCallSucceeds) {
541+
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
542+
pLinuxSysmanImp->openFunction = openMockDiag;
543+
pLinuxSysmanImp->closeFunction = closeMockDiag;
544+
pLinuxSysmanImp->preadFunction = preadMockDiag;
545+
pLinuxSysmanImp->pwriteFunction = pwriteMockDiag;
546+
pLinuxSysmanImp->pSleepFunctionSecs = mockSleepFunctionSecs;
547+
pLinuxSysmanImp->diagnosticsReset = true;
548+
549+
EXPECT_EQ(ZE_RESULT_SUCCESS, pLinuxSysmanImp->osWarmReset());
550+
}
551+
540552
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndRootPortConfigFileFailsToOpenThenCallFails) {
541553
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
542554
pLinuxSysmanImp->openFunction = openMockDiagFail;

0 commit comments

Comments
 (0)