feature: Add support for ecc default state

Related-To: NEO-15058

Signed-off-by: shubham kumar <shubham.kumar@intel.com>
This commit is contained in:
shubham kumar
2025-06-18 11:16:55 +00:00
committed by Compute-Runtime-Automation
parent 10db31afa2
commit d988763c0f
22 changed files with 121 additions and 35 deletions

View File

@@ -65,7 +65,8 @@ ze_result_t EccImp::getEccState(zes_device_ecc_properties_t *pState) {
uint8_t currentState = 0xff;
uint8_t pendingState = 0xff;
ze_result_t result = pFwInterface->fwGetEccConfig(&currentState, &pendingState);
uint8_t defaultState = 0xff;
ze_result_t result = pFwInterface->fwGetEccConfig(&currentState, &pendingState, &defaultState);
pState->currentState = getEccState(currentState);
pState->pendingState = getEccState(pendingState);
@@ -74,6 +75,16 @@ ze_result_t EccImp::getEccState(zes_device_ecc_properties_t *pState) {
return result;
}
void *pNext = pState->pNext;
while (pNext) {
zes_device_ecc_default_properties_ext_t *pExtProps = reinterpret_cast<zes_device_ecc_default_properties_ext_t *>(pNext);
if (pExtProps->stype == ZES_STRUCTURE_TYPE_DEVICE_ECC_DEFAULT_PROPERTIES_EXT) {
pExtProps->defaultState = getEccState(defaultState);
break;
}
pNext = pExtProps->pNext;
}
pState->pendingAction = ZES_DEVICE_ACTION_WARM_CARD_RESET;
if (pState->currentState == pState->pendingState) {
pState->pendingAction = ZES_DEVICE_ACTION_NONE;

View File

@@ -32,7 +32,7 @@ class FirmwareUtil {
virtual ze_result_t fwGetMemoryErrorCount(zes_ras_error_type_t type, uint32_t subDeviceCount, uint32_t subDeviceId, uint64_t &count) = 0;
virtual ze_result_t fwGetEccAvailable(ze_bool_t *pAvailable) = 0;
virtual ze_result_t fwGetEccConfigurable(ze_bool_t *pConfigurable) = 0;
virtual ze_result_t fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState) = 0;
virtual ze_result_t fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState, uint8_t *defaultState) = 0;
virtual ze_result_t fwSetEccConfig(uint8_t newState, uint8_t *currentState, uint8_t *pendingState) = 0;
virtual void getDeviceSupportedFwTypes(std::vector<std::string> &fwTypes) = 0;
virtual void fwGetMemoryHealthIndicator(zes_mem_health_t *health) = 0;

View File

@@ -146,7 +146,8 @@ enum GetEccCmd16BytePostition {
eccAvailable = 0,
eccCurrentState = 4,
eccConfigurable = 8,
eccPendingState = 12
eccPendingState = 12,
eccDefaultState = 16
};
enum GetEccCmd9BytePostition {
@@ -169,7 +170,7 @@ class FirmwareUtilImp : public FirmwareUtil, NEO::NonCopyableAndNonMovableClass
ze_result_t fwGetMemoryErrorCount(zes_ras_error_type_t type, uint32_t subDeviceCount, uint32_t subDeviceId, uint64_t &count) override;
ze_result_t fwGetEccAvailable(ze_bool_t *pAvailable) override;
ze_result_t fwGetEccConfigurable(ze_bool_t *pConfigurable) override;
ze_result_t fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState) override;
ze_result_t fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState, uint8_t *defaultState) override;
ze_result_t fwSetEccConfig(uint8_t newState, uint8_t *currentState, uint8_t *pendingState) override;
void getDeviceSupportedFwTypes(std::vector<std::string> &fwTypes) override;
void fwGetMemoryHealthIndicator(zes_mem_health_t *health) override;

View File

@@ -145,7 +145,7 @@ void FirmwareUtilImp::fwGetMemoryHealthIndicator(zes_mem_health_t *health) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "Error@ %s(); Could not get memory health indicator from igsc\n", __FUNCTION__);
}
ze_result_t FirmwareUtilImp::fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState) {
ze_result_t FirmwareUtilImp::fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState, uint8_t *defaultState) {
const std::lock_guard<std::mutex> lock(this->fwLock);
gfspHeciCmd = reinterpret_cast<pIgscGfspHeciCmd>(libraryHandle->getProcAddress(fwGfspHeciCmd));
if (gfspHeciCmd != nullptr) {
@@ -157,6 +157,7 @@ ze_result_t FirmwareUtilImp::fwGetEccConfig(uint8_t *currentState, uint8_t *pend
if (ret == IGSC_SUCCESS) {
*currentState = outBuf[GfspHeciConstants::GetEccCmd16BytePostition::eccCurrentState] & 0x1;
*pendingState = outBuf[GfspHeciConstants::GetEccCmd16BytePostition::eccPendingState] & 0x1;
*defaultState = outBuf[GfspHeciConstants::GetEccCmd16BytePostition::eccDefaultState] & 0x1;
return ZE_RESULT_SUCCESS;
}
receivedSize = 0;
@@ -166,6 +167,7 @@ ze_result_t FirmwareUtilImp::fwGetEccConfig(uint8_t *currentState, uint8_t *pend
if (ret == IGSC_SUCCESS) {
*currentState = outBuf[GfspHeciConstants::GetEccCmd9BytePostition::currentState];
*pendingState = outBuf[GfspHeciConstants::GetEccCmd9BytePostition::pendingState];
*defaultState = 0xff;
return ZE_RESULT_SUCCESS;
}
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
@@ -250,7 +252,8 @@ ze_result_t FirmwareUtilImp::fwSetEccConfig(uint8_t newState, uint8_t *currentSt
if (ret == IGSC_SUCCESS) {
lock.unlock();
ze_result_t status = fwGetEccConfig(currentState, pendingState);
uint8_t defaultState = 0;
ze_result_t status = fwGetEccConfig(currentState, pendingState, &defaultState);
lock.lock();
if (status != ZE_RESULT_SUCCESS) {
return status;

View File

@@ -62,7 +62,7 @@ struct MockDiagnosticsFwInterface : public L0::Sysman::FirmwareUtil {
ADDMETHOD_NOBASE(fwGetMemoryErrorCount, ze_result_t, ZE_RESULT_SUCCESS, (zes_ras_error_type_t category, uint32_t subDeviceCount, uint32_t subDeviceId, uint64_t &count));
ADDMETHOD_NOBASE(fwGetEccAvailable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pAvailable));
ADDMETHOD_NOBASE(fwGetEccConfigurable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pConfigurable));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState, uint8_t *defaultState));
ADDMETHOD_NOBASE(fwSetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t newState, uint8_t *currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE_VOIDRETURN(getDeviceSupportedFwTypes, (std::vector<std::string> & fwTypes));
ADDMETHOD_NOBASE_VOIDRETURN(fwGetMemoryHealthIndicator, (zes_mem_health_t * health));

View File

@@ -28,14 +28,16 @@ struct MockEccFwInterface : public L0::Sysman::FirmwareUtil {
ze_bool_t mockEccConfigurable = true;
uint8_t mockCurrentState = 0;
uint8_t mockPendingState = 0;
uint8_t mockDefaultState = 0xff;
ze_result_t fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState) override {
ze_result_t fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState, uint8_t *defaultState) override {
if (mockFwGetEccConfigResult != ZE_RESULT_SUCCESS) {
return mockFwGetEccConfigResult;
}
*currentState = mockCurrentState;
*pendingState = mockPendingState;
*defaultState = mockDefaultState;
return ZE_RESULT_SUCCESS;
}

View File

@@ -39,7 +39,7 @@ class ZesEccFixture : public SysmanDeviceFixture {
}
};
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndEccUnsupportedWhenCallingzesDeviceEccAvailableThenVerifyApiCallFails) {
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndEccUnsupportedWhenCallingZesDeviceEccAvailableThenVerifyApiCallFails) {
struct MockSysmanProductHelperEcc : L0::Sysman::SysmanProductHelperHw<IGFX_UNKNOWN> {
MockSysmanProductHelperEcc() = default;
};

View File

@@ -28,18 +28,20 @@ struct EccFwInterface : public L0::Sysman::FirmwareUtil {
ze_bool_t mockEccConfigurable = true;
uint8_t mockCurrentState = 0;
uint8_t mockPendingState = 0;
uint8_t mockDefaultState = 0xff;
ze_result_t fwDeviceInit() override {
return mockFwDeviceInit;
}
ze_result_t fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState) override {
ze_result_t fwGetEccConfig(uint8_t *currentState, uint8_t *pendingState, uint8_t *defaultState) override {
if (mockFwGetEccConfigResult != ZE_RESULT_SUCCESS) {
return mockFwGetEccConfigResult;
}
*currentState = mockCurrentState;
*pendingState = mockPendingState;
*defaultState = mockDefaultState;
return ZE_RESULT_SUCCESS;
}

View File

@@ -109,6 +109,31 @@ TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZe
EXPECT_EQ(ZES_DEVICE_ACTION_NONE, props.pendingAction);
}
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceGetEccStateWithDefaultExtensionStructureThenApiCallSucceeds) {
zes_device_ecc_properties_t props = {};
zes_device_ecc_default_properties_ext_t extProps = {};
extProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_DEFAULT_PROPERTIES_EXT;
props.pNext = &extProps;
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceGetEccState(pSysmanDevice->toHandle(), &props));
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.currentState);
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.pendingState);
EXPECT_EQ(ZES_DEVICE_ECC_STATE_UNAVAILABLE, extProps.defaultState);
EXPECT_EQ(ZES_DEVICE_ACTION_NONE, props.pendingAction);
}
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceGetEccStateWithWrongDefaultExtensionStructureThenApiCallSucceeds) {
zes_device_ecc_properties_t props = {};
zes_device_ecc_default_properties_ext_t extProps = {};
extProps.stype = ZES_STRUCTURE_TYPE_FORCE_UINT32;
props.pNext = &extProps;
extProps.defaultState = ZES_DEVICE_ECC_STATE_FORCE_UINT32;
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceGetEccState(pSysmanDevice->toHandle(), &props));
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.currentState);
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.pendingState);
EXPECT_EQ(ZES_DEVICE_ECC_STATE_FORCE_UINT32, extProps.defaultState);
EXPECT_EQ(ZES_DEVICE_ACTION_NONE, props.pendingAction);
}
TEST_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingZesDeviceGetEccStateThenApiCallReturnFailure) {
zes_device_ecc_properties_t props = {};
pMockFwInterface->mockFwGetEccConfigResult = ZE_RESULT_ERROR_UNINITIALIZED;

View File

@@ -92,7 +92,7 @@ TEST_F(SysmanDeviceFixture, GivenComponentCountZeroAndOpenCallFailsWhenCallingZe
EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, zesDeviceEnumEngineGroups(device->toHandle(), &count, NULL));
}
TEST_F(ZesEngineFixturePrelim, GivenComponentCountZeroWhenCallingzesDeviceEnumEngineGroupsThenNonZeroCountIsReturnedAndVerifyCallSucceeds) {
TEST_F(ZesEngineFixturePrelim, GivenComponentCountZeroWhenCallingZesDeviceEnumEngineGroupsThenNonZeroCountIsReturnedAndVerifyCallSucceeds) {
uint32_t count = 0;
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceEnumEngineGroups(device->toHandle(), &count, NULL));
EXPECT_EQ(count, handleComponentCount);

View File

@@ -254,7 +254,7 @@ struct MockEventsFwInterface : public L0::Sysman::FirmwareUtil {
ADDMETHOD_NOBASE(fwGetMemoryErrorCount, ze_result_t, ZE_RESULT_SUCCESS, (zes_ras_error_type_t category, uint32_t subDeviceCount, uint32_t subDeviceId, uint64_t &count));
ADDMETHOD_NOBASE(fwGetEccAvailable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pAvailable));
ADDMETHOD_NOBASE(fwGetEccConfigurable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pConfigurable));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState, uint8_t *defaultState));
ADDMETHOD_NOBASE(fwSetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t newState, uint8_t *currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE_VOIDRETURN(getDeviceSupportedFwTypes, (std::vector<std::string> & fwTypes));
ADDMETHOD_NOBASE_VOIDRETURN(fwGetMemoryHealthIndicator, (zes_mem_health_t * health));

View File

@@ -120,7 +120,7 @@ struct MockFirmwareInterface : public FirmwareInterface {
ADDMETHOD_NOBASE(fwGetMemoryErrorCount, ze_result_t, ZE_RESULT_SUCCESS, (zes_ras_error_type_t category, uint32_t subDeviceCount, uint32_t subDeviceId, uint64_t &count));
ADDMETHOD_NOBASE(fwGetEccAvailable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pAvailable));
ADDMETHOD_NOBASE(fwGetEccConfigurable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pConfigurable));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState, uint8_t *defaultState));
ADDMETHOD_NOBASE(fwSetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t newState, uint8_t *currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE_VOIDRETURN(fwGetMemoryHealthIndicator, (zes_mem_health_t * health));
};

View File

@@ -66,7 +66,7 @@ struct FirmwareInterface : public L0::Sysman::FirmwareUtil {
ADDMETHOD_NOBASE(fwGetMemoryErrorCount, ze_result_t, ZE_RESULT_SUCCESS, (zes_ras_error_type_t category, uint32_t subDeviceCount, uint32_t subDeviceId, uint64_t &count));
ADDMETHOD_NOBASE(fwGetEccAvailable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pAvailable));
ADDMETHOD_NOBASE(fwGetEccConfigurable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pConfigurable));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState, uint8_t *defaultState));
ADDMETHOD_NOBASE(fwSetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t newState, uint8_t *currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE_VOIDRETURN(fwGetMemoryHealthIndicator, (zes_mem_health_t * health));
};

View File

@@ -33,7 +33,7 @@ struct MockFwUtilInterface : public L0::Sysman::FirmwareUtil {
ADDMETHOD_NOBASE(fwGetMemoryErrorCount, ze_result_t, ZE_RESULT_SUCCESS, (zes_ras_error_type_t category, uint32_t subDeviceCount, uint32_t subDeviceId, uint64_t &count));
ADDMETHOD_NOBASE(fwGetEccAvailable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pAvailable));
ADDMETHOD_NOBASE(fwGetEccConfigurable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pConfigurable));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState, uint8_t *defaultState));
ADDMETHOD_NOBASE(fwSetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t newState, uint8_t *currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE_VOIDRETURN(getDeviceSupportedFwTypes, (std::vector<std::string> & fwTypes));
ADDMETHOD_NOBASE_VOIDRETURN(getLateBindingSupportedFwTypes, (std::vector<std::string> & fwTypes));

View File

@@ -34,6 +34,7 @@ std::vector<uint32_t>
mockSupportedHeciCmds = {GfspHeciConstants::Cmd::getEccConfigurationCmd16, GfspHeciConstants::Cmd::setEccConfigurationCmd15};
uint8_t mockEccCurrentState = 1;
uint8_t mockEccPendingState = 1;
uint8_t mockEccDefaultState = 1;
uint8_t mockEccHeciCmd16Val = 1;
void restoreEccMockVars() {
@@ -41,6 +42,7 @@ void restoreEccMockVars() {
mockSupportedHeciCmds.insert(mockSupportedHeciCmds.end(), {GfspHeciConstants::Cmd::getEccConfigurationCmd16, GfspHeciConstants::Cmd::setEccConfigurationCmd15});
mockEccCurrentState = 1;
mockEccPendingState = 1;
mockEccDefaultState = 1;
mockEccHeciCmd16Val = 1;
}
@@ -126,10 +128,12 @@ static int mockGetEccConfig(struct igsc_device_handle *handle, uint32_t gfspCmd,
case GfspHeciConstants::Cmd::getEccConfigurationCmd16:
outBuffer[GfspHeciConstants::GetEccCmd16BytePostition::eccCurrentState] = mockEccCurrentState;
outBuffer[GfspHeciConstants::GetEccCmd16BytePostition::eccPendingState] = mockEccPendingState;
outBuffer[GfspHeciConstants::GetEccCmd16BytePostition::eccDefaultState] = mockEccDefaultState;
return IGSC_SUCCESS;
case GfspHeciConstants::Cmd::getEccConfigurationCmd9:
outBuffer[GfspHeciConstants::GetEccCmd9BytePostition::currentState] = mockEccCurrentState;
outBuffer[GfspHeciConstants::GetEccCmd9BytePostition::pendingState] = mockEccPendingState;
outBuffer[GfspHeciConstants::GetEccCmd16BytePostition::eccDefaultState] = 0xff;
return IGSC_SUCCESS;
case GfspHeciConstants::Cmd::setEccConfigurationCmd15:
outBuffer[GfspHeciConstants::SetEccCmd15BytePostition::response] = inBuffer[GfspHeciConstants::SetEccCmd15BytePostition::request];
@@ -293,8 +297,9 @@ TEST(FwEccTest, GivenFwEccConfigCallFailsWhenCallingFirmwareUtilSetAndGetEccThen
pFwUtilImp->libraryHandle = static_cast<OsLibrary *>(new IgscEccMockOsLibrary());
uint8_t currentState = 0;
uint8_t pendingState = 0;
uint8_t defaultState = 0;
uint8_t newState = 0;
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState);
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState, &defaultState);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
ret = pFwUtilImp->fwSetEccConfig(newState, &currentState, &pendingState);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
@@ -334,8 +339,9 @@ TEST(LinuxFwEccTest, GivenValidFwUtilMethodWhenCallingFirmwareUtilSetAndGetEccTh
pFwUtilImp->libraryHandle = static_cast<OsLibrary *>(new IgscEccMockOsLibrary());
uint8_t currentState = 0;
uint8_t pendingState = 0;
uint8_t defaultState = 0;
uint8_t newState = 0;
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState);
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState, &defaultState);
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
ret = pFwUtilImp->fwSetEccConfig(newState, &currentState, &pendingState);
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
@@ -354,8 +360,9 @@ TEST(LinuxFwEccTest, GivenGetProcAddrCallFailsWhenFirmwareUtilChecksEccGetAndSet
pFwUtilImp->libraryHandle = static_cast<OsLibrary *>(new MockFwUtilOsLibrary());
uint8_t currentState = 0;
uint8_t pendingState = 0;
uint8_t defaultState = 0;
uint8_t newState = 0;
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState);
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState, &defaultState);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
ret = pFwUtilImp->fwSetEccConfig(newState, &currentState, &pendingState);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, ret);
@@ -763,12 +770,15 @@ TEST(LinuxFwEccTest, GivenHeciCmd16IsSupportedThenWhenCallingFwGetEccConfigSuces
mockSupportedHeciCmds.push_back(GfspHeciConstants::Cmd::getEccConfigurationCmd16);
mockEccCurrentState = 1;
mockEccPendingState = 1;
mockEccDefaultState = 1;
uint8_t currentState;
uint8_t pendingState;
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState);
uint8_t defaultState;
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState, &defaultState);
EXPECT_EQ(currentState, mockEccCurrentState);
EXPECT_EQ(pendingState, mockEccPendingState);
EXPECT_EQ(defaultState, mockEccDefaultState);
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
delete pFwUtilImp->libraryHandle;
@@ -786,6 +796,7 @@ TEST(LinuxFwEccTest, GivenHeciCmd16IsNotSupportedBut9IsSupportedThenWhenCallingF
mockSupportedHeciCmds.push_back(GfspHeciConstants::Cmd::getEccConfigurationCmd9);
uint8_t currentState;
uint8_t pendingState;
uint8_t defaultState;
std::vector<uint8_t> possibleEccStates = {0, 1, 0xff};
@@ -794,9 +805,10 @@ TEST(LinuxFwEccTest, GivenHeciCmd16IsNotSupportedBut9IsSupportedThenWhenCallingF
mockEccCurrentState = iterCurrentState;
mockEccPendingState = iterPendingState;
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState);
auto ret = pFwUtilImp->fwGetEccConfig(&currentState, &pendingState, &defaultState);
EXPECT_EQ(currentState, mockEccCurrentState);
EXPECT_EQ(pendingState, mockEccPendingState);
EXPECT_EQ(defaultState, 0xff);
EXPECT_EQ(ZE_RESULT_SUCCESS, ret);
}
}
@@ -820,7 +832,8 @@ TEST(LinuxFwEccTest, GivenUnavailableHeciFunctionPointersWhenCallingEccMethodsTh
uint8_t currentState;
uint8_t pendingState;
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pFwUtilImp->fwGetEccConfig(&currentState, &pendingState));
uint8_t defaultState;
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pFwUtilImp->fwGetEccConfig(&currentState, &pendingState, &defaultState));
uint8_t newState = 1;
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pFwUtilImp->fwSetEccConfig(newState, &currentState, &pendingState));

View File

@@ -605,7 +605,7 @@ struct MockGlobalOpsFwInterface : public L0::Sysman::FirmwareUtil {
ADDMETHOD_NOBASE(fwGetMemoryErrorCount, ze_result_t, ZE_RESULT_SUCCESS, (zes_ras_error_type_t category, uint32_t subDeviceCount, uint32_t subDeviceId, uint64_t &count));
ADDMETHOD_NOBASE(fwGetEccAvailable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pAvailable));
ADDMETHOD_NOBASE(fwGetEccConfigurable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pConfigurable));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState, uint8_t *defaultState));
ADDMETHOD_NOBASE(fwSetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t newState, uint8_t *currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE_VOIDRETURN(getDeviceSupportedFwTypes, (std::vector<std::string> & fwTypes));
ADDMETHOD_NOBASE_VOIDRETURN(fwGetMemoryHealthIndicator, (zes_mem_health_t * health));

View File

@@ -658,7 +658,7 @@ TEST_F(SysmanGlobalOperationsFixture,
}
TEST_F(SysmanGlobalOperationsFixture,
GivenValidDeviceHandleWhenCallingzesDeviceGetPropertiesForCheckingDriverVersionWhenDriverVersionFileReadFailsThenVerifyzesDeviceGetPropertiesCallSucceeds) {
GivenValidDeviceHandleWhenCallingZesDeviceGetPropertiesForCheckingDriverVersionWhenDriverVersionFileReadFailsThenVerifyzesDeviceGetPropertiesCallSucceeds) {
MockGlobalOperationsFsAccess *pFsAccess = new MockGlobalOperationsFsAccess();
MockGlobalOperationsSysfsAccess *pSysfsAccess = new MockGlobalOperationsSysfsAccess();
@@ -677,7 +677,7 @@ TEST_F(SysmanGlobalOperationsFixture,
}
TEST_F(SysmanGlobalOperationsFixture,
GivenValidDeviceHandleWhenCallingzesDeviceGetPropertiesForCheckingDevicePropertiesWhenVendorIsUnKnownThenVerifyzesDeviceGetPropertiesCallSucceeds) {
GivenValidDeviceHandleWhenCallingZesDeviceGetPropertiesForCheckingDevicePropertiesWhenVendorIsUnKnownThenVerifyzesDeviceGetPropertiesCallSucceeds) {
pSysfsAccess->mockReadVal[static_cast<int>(MockGlobalOperationsSysfsAccess::Index::mockSubsystemVendor)] = "0xa086";
pSysfsAccess->mockReadVal[static_cast<int>(MockGlobalOperationsSysfsAccess::Index::mockVendor)] = "0x1806"; // Unknown Vendor id
zes_device_properties_t properties = {ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES};
@@ -839,7 +839,7 @@ TEST_F(SysmanGlobalOperationsFixture, GivenGemCreateIoctlFailsWithEINVALWhenCall
EXPECT_EQ(0u, deviceState.reset);
}
TEST_F(SysmanGlobalOperationsFixture, GivenDeviceInUseWhenCallingzesDeviceResetExtThenResetExtCallReturnSuccess) {
TEST_F(SysmanGlobalOperationsFixture, GivenDeviceInUseWhenCallingZesDeviceResetExtThenResetExtCallReturnSuccess) {
init(true);
std::unique_ptr<SysmanProductHelper> pSysmanProductHelper = std::make_unique<MockSysmanProductHelper>();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023-2024 Intel Corporation
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -63,13 +63,13 @@ TEST_F(SysmanGlobalOperationsFixture, GivenForceTrueAndDeviceInUseWhenCallingRes
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
}
TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingzesDeviceGetStateThenFailureIsReturned) {
TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingZesDeviceGetStateThenFailureIsReturned) {
init(true);
zes_device_state_t pState = {};
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zesDeviceGetState(pSysmanDevice->toHandle(), &pState));
}
TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingzesDeviceProcessesGetStateThenFailureIsReturned) {
TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingZesDeviceProcessesGetStateThenFailureIsReturned) {
init(true);
uint32_t count = 0;
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zesDeviceProcessesGetState(pSysmanDevice->toHandle(), &count, nullptr));
@@ -81,13 +81,13 @@ TEST_F(SysmanGlobalOperationsFixture, GivenProcessStartsMidResetWhenCallingReset
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, result);
}
TEST_F(SysmanGlobalOperationsFixture, GivenDeviceInUseWhenCallingzesDeviceResetExtThenUnsupportedFeatureErrorIsReturned) {
TEST_F(SysmanGlobalOperationsFixture, GivenDeviceInUseWhenCallingZesDeviceResetExtThenUnsupportedFeatureErrorIsReturned) {
init(true);
ze_result_t result = zesDeviceResetExt(pSysmanDevice->toHandle(), nullptr);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result);
}
TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingzesDeviceGetSubDevicePropertiesExpThenUnsupportedIsReturned) {
TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingZesDeviceGetSubDevicePropertiesExpThenUnsupportedIsReturned) {
init(true);
uint32_t count = 0;
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zesDeviceGetSubDevicePropertiesExp(pSysmanDevice->toHandle(), &count, nullptr));

View File

@@ -669,7 +669,7 @@ struct MockRasFwInterface : public L0::Sysman::FirmwareUtil {
ADDMETHOD_NOBASE_VOIDRETURN(getDeviceSupportedFwTypes, (std::vector<std::string> & fwTypes));
ADDMETHOD_NOBASE(fwGetEccAvailable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pAvailable));
ADDMETHOD_NOBASE(fwGetEccConfigurable, ze_result_t, ZE_RESULT_SUCCESS, (ze_bool_t * pConfigurable));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE(fwGetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t * currentState, uint8_t *pendingState, uint8_t *defaultState));
ADDMETHOD_NOBASE(fwSetEccConfig, ze_result_t, ZE_RESULT_SUCCESS, (uint8_t newState, uint8_t *currentState, uint8_t *pendingState));
ADDMETHOD_NOBASE_VOIDRETURN(fwGetMemoryHealthIndicator, (zes_mem_health_t * health));
ADDMETHOD_NOBASE_VOIDRETURN(getLateBindingSupportedFwTypes, (std::vector<std::string> & fwTypes));

View File

@@ -105,7 +105,7 @@ class SysmanDeviceSchedulerFixtureI915 : public SysmanDeviceSchedulerFixture {
}
};
TEST_F(SysmanDeviceSchedulerFixtureI915, GivenComponentCountZeroWhenCallingzesDeviceEnumSchedulersAndSysfsCanReadReturnsErrorThenZeroCountIsReturned) {
TEST_F(SysmanDeviceSchedulerFixtureI915, GivenComponentCountZeroWhenCallingZesDeviceEnumSchedulersAndSysfsCanReadReturnsErrorThenZeroCountIsReturned) {
pSysfsAccess->mockGetScanDirEntryError = ZE_RESULT_ERROR_NOT_AVAILABLE;
auto pSchedulerHandleContextTest = std::make_unique<L0::Sysman::SchedulerHandleContext>(pOsSysman);
@@ -113,14 +113,14 @@ TEST_F(SysmanDeviceSchedulerFixtureI915, GivenComponentCountZeroWhenCallingzesDe
EXPECT_EQ(0u, static_cast<uint32_t>(pSchedulerHandleContextTest->handleList.size()));
}
TEST_F(SysmanDeviceSchedulerFixtureI915, GivenComponentCountZeroWhenCallingzesDeviceEnumSchedulersAndSysfsCanReadReturnsIncorrectPermissionThenZeroCountIsReturned) {
TEST_F(SysmanDeviceSchedulerFixtureI915, GivenComponentCountZeroWhenCallingZesDeviceEnumSchedulersAndSysfsCanReadReturnsIncorrectPermissionThenZeroCountIsReturned) {
pSysfsAccess->setEngineDirectoryPermission(0);
auto pSchedulerHandleContextTest = std::make_unique<L0::Sysman::SchedulerHandleContext>(pOsSysman);
pSchedulerHandleContextTest->init(pOsSysman->getSubDeviceCount());
EXPECT_EQ(0u, static_cast<uint32_t>(pSchedulerHandleContextTest->handleList.size()));
}
TEST_F(SysmanDeviceSchedulerFixtureI915, GivenComponentCountZeroWhenCallingzesDeviceEnumSchedulersThenNonZeroCountIsReturnedAndVerifyCallSucceeds) {
TEST_F(SysmanDeviceSchedulerFixtureI915, GivenComponentCountZeroWhenCallingZesDeviceEnumSchedulersThenNonZeroCountIsReturnedAndVerifyCallSucceeds) {
uint32_t count = 0;
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceEnumSchedulers(device->toHandle(), &count, NULL));
EXPECT_EQ(count, handleComponentCount);
@@ -135,7 +135,7 @@ TEST_F(SysmanDeviceSchedulerFixtureI915, GivenComponentCountZeroWhenCallingzesDe
EXPECT_EQ(count, handleComponentCount);
}
TEST_F(SysmanDeviceSchedulerFixtureI915, GivenComponentCountZeroAndKMDVersionIsPrelimWhenCallingzesDeviceEnumSchedulersThenNonZeroCountIsReturnedAndVerifyCallSucceeds) {
TEST_F(SysmanDeviceSchedulerFixtureI915, GivenComponentCountZeroAndKMDVersionIsPrelimWhenCallingZesDeviceEnumSchedulersThenNonZeroCountIsReturnedAndVerifyCallSucceeds) {
pLinuxSysmanImp->pSysmanKmdInterface.reset();
pLinuxSysmanImp->pSysmanKmdInterface = std::make_unique<SysmanKmdInterfaceI915Prelim>(pLinuxSysmanImp->getSysmanProductHelper());

View File

@@ -107,6 +107,31 @@ HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallin
EXPECT_EQ(ZES_DEVICE_ACTION_NONE, props.pendingAction);
}
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceGetEccStateWithDefaultExtensionStructureThenApiCallSucceeds, isDg2OrBmg) {
zes_device_ecc_properties_t props = {};
zes_device_ecc_default_properties_ext_t extProps = {};
extProps.stype = ZES_STRUCTURE_TYPE_DEVICE_ECC_DEFAULT_PROPERTIES_EXT;
props.pNext = &extProps;
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceGetEccState(pSysmanDevice->toHandle(), &props));
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.currentState);
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.pendingState);
EXPECT_EQ(ZES_DEVICE_ECC_STATE_UNAVAILABLE, extProps.defaultState);
EXPECT_EQ(ZES_DEVICE_ACTION_NONE, props.pendingAction);
}
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwInterfaceIsPresentWhenCallingZesDeviceGetEccStateWithWrongDefaultExtensionStructureThenApiCallSucceeds, isDg2OrBmg) {
zes_device_ecc_properties_t props = {};
zes_device_ecc_default_properties_ext_t extProps = {};
extProps.stype = ZES_STRUCTURE_TYPE_FORCE_UINT32;
props.pNext = &extProps;
extProps.defaultState = ZES_DEVICE_ECC_STATE_FORCE_UINT32;
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDeviceGetEccState(pSysmanDevice->toHandle(), &props));
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.currentState);
EXPECT_EQ(ZES_DEVICE_ECC_STATE_DISABLED, props.pendingState);
EXPECT_EQ(ZES_DEVICE_ECC_STATE_FORCE_UINT32, extProps.defaultState);
EXPECT_EQ(ZES_DEVICE_ACTION_NONE, props.pendingAction);
}
HWTEST2_F(ZesEccFixture, GivenValidSysmanHandleAndFwGetEccConfigFailsWhenCallingZesDeviceGetEccStateThenApiCallReturnFailure, isDg2OrBmg) {
zes_device_ecc_properties_t props = {};
pMockFwInterface->mockFwGetEccConfigResult = ZE_RESULT_ERROR_UNINITIALIZED;