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>
This commit is contained in:
Vilvaraj, T J Vivek
2022-09-26 14:35:19 +00:00
committed by Compute-Runtime-Automation
parent f06ebef745
commit 0d23fa1a98
2 changed files with 22 additions and 3 deletions

View File

@ -327,8 +327,11 @@ ze_result_t LinuxSysmanImp::osWarmReset() {
if (ZE_RESULT_SUCCESS != result) {
return result;
}
this->pSleepFunctionSecs(10); // Sleep for 10seconds to make sure that the config spaces of all devices are saved correctly
if (diagnosticsReset) {
this->pSleepFunctionSecs(30); // Sleep for 30seconds to make sure that the config spaces of all devices are saved correctly after IFR
} else {
this->pSleepFunctionSecs(10); // Sleep for 10seconds to make sure that the config spaces of all devices are saved correctly
}
rootPortPath = getPciRootPortDirectoryPath(gtDevicePath);
int fd, ret = 0;
@ -355,7 +358,11 @@ ze_result_t LinuxSysmanImp::osWarmReset() {
if (ZE_RESULT_SUCCESS != result) {
return result;
}
this->pSleepFunctionSecs(10); // Sleep for 10seconds, allows the rescan to complete on all devices attached to the root port.
if (diagnosticsReset) {
this->pSleepFunctionSecs(30); // Sleep for 30seconds to make sure that the config spaces of all devices are saved correctly after IFR
} else {
this->pSleepFunctionSecs(10); // Sleep for 10seconds, allows the rescan to complete on all devices attached to the root port.
}
return result;
}

View File

@ -537,6 +537,18 @@ TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetThen
EXPECT_EQ(ZE_RESULT_SUCCESS, pLinuxSysmanImp->osWarmReset());
}
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetfromDiagnosticsThenCallSucceeds) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pLinuxSysmanImp->openFunction = openMockDiag;
pLinuxSysmanImp->closeFunction = closeMockDiag;
pLinuxSysmanImp->preadFunction = preadMockDiag;
pLinuxSysmanImp->pwriteFunction = pwriteMockDiag;
pLinuxSysmanImp->pSleepFunctionSecs = mockSleepFunctionSecs;
pLinuxSysmanImp->diagnosticsReset = true;
EXPECT_EQ(ZE_RESULT_SUCCESS, pLinuxSysmanImp->osWarmReset());
}
TEST_F(ZesDiagnosticsFixture, GivenValidSysmanImpPointerWhenCallingWarmResetAndRootPortConfigFileFailsToOpenThenCallFails) {
pLinuxSysmanImp->gtDevicePath = "/sys/devices/pci0000:89/0000:89:02.0/0000:8a:00.0/0000:8b:01.0/0000:8c:00.0";
pLinuxSysmanImp->openFunction = openMockDiagFail;