Return Unsupported feature when sysfs nodes are absent

Change-Id: I69c1447bb65e2be074d338e910223c3b8c2e9c55
This commit is contained in:
mraghuwa
2020-08-20 20:26:19 +05:30
committed by sys_ocldev
parent eeb30f960a
commit 9f7a97ac5b
6 changed files with 98 additions and 13 deletions

View File

@@ -25,6 +25,9 @@ ze_result_t LinuxFrequencyImp::getMin(double &min) {
ze_result_t result = pSysfsAccess->read(minFreqFile, intval);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
min = intval;
@@ -34,6 +37,9 @@ ze_result_t LinuxFrequencyImp::getMin(double &min) {
ze_result_t LinuxFrequencyImp::setMin(double min) {
ze_result_t result = pSysfsAccess->write(minFreqFile, min);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
return ZE_RESULT_SUCCESS;
@@ -44,6 +50,9 @@ ze_result_t LinuxFrequencyImp::getMax(double &max) {
ze_result_t result = pSysfsAccess->read(maxFreqFile, intval);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
max = intval;
@@ -53,6 +62,9 @@ ze_result_t LinuxFrequencyImp::getMax(double &max) {
ze_result_t LinuxFrequencyImp::setMax(double max) {
ze_result_t result = pSysfsAccess->write(maxFreqFile, max);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
return ZE_RESULT_SUCCESS;
@@ -63,6 +75,9 @@ ze_result_t LinuxFrequencyImp::getRequest(double &request) {
ze_result_t result = pSysfsAccess->read(requestFreqFile, intval);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
request = intval;
@@ -74,6 +89,9 @@ ze_result_t LinuxFrequencyImp::getTdp(double &tdp) {
ze_result_t result = pSysfsAccess->read(tdpFreqFile, intval);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
tdp = intval;
@@ -85,6 +103,9 @@ ze_result_t LinuxFrequencyImp::getActual(double &actual) {
ze_result_t result = pSysfsAccess->read(actualFreqFile, intval);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
actual = intval;
@@ -96,6 +117,9 @@ ze_result_t LinuxFrequencyImp::getEfficient(double &efficient) {
ze_result_t result = pSysfsAccess->read(efficientFreqFile, intval);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
efficient = intval;
@@ -107,6 +131,9 @@ ze_result_t LinuxFrequencyImp::getMaxVal(double &maxVal) {
ze_result_t result = pSysfsAccess->read(maxValFreqFile, intval);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
maxVal = intval;
@@ -118,6 +145,9 @@ ze_result_t LinuxFrequencyImp::getMinVal(double &minVal) {
ze_result_t result = pSysfsAccess->read(minValFreqFile, intval);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
minVal = intval;

View File

@@ -30,6 +30,9 @@ ze_result_t LinuxSchedulerImp::getPreemptTimeout(uint64_t &timeout, ze_bool_t ge
if (result == ZE_RESULT_SUCCESS) {
timeout = timeout * milliSecsToMicroSecs;
}
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
@@ -43,6 +46,9 @@ ze_result_t LinuxSchedulerImp::getTimesliceDuration(uint64_t &timeslice, ze_bool
if (result == ZE_RESULT_SUCCESS) {
timeslice = timeslice * milliSecsToMicroSecs;
}
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
@@ -56,22 +62,37 @@ ze_result_t LinuxSchedulerImp::getHeartbeatInterval(uint64_t &heartbeat, ze_bool
if (result == ZE_RESULT_SUCCESS) {
heartbeat = heartbeat * milliSecsToMicroSecs;
}
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
ze_result_t LinuxSchedulerImp::setPreemptTimeout(uint64_t timeout) {
timeout = timeout / milliSecsToMicroSecs;
return pSysfsAccess->write(preemptTimeoutMilliSecs, timeout);
ze_result_t result = pSysfsAccess->write(preemptTimeoutMilliSecs, timeout);
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
ze_result_t LinuxSchedulerImp::setTimesliceDuration(uint64_t timeslice) {
timeslice = timeslice / milliSecsToMicroSecs;
return pSysfsAccess->write(timesliceDurationMilliSecs, timeslice);
ze_result_t result = pSysfsAccess->write(timesliceDurationMilliSecs, timeslice);
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
ze_result_t LinuxSchedulerImp::setHeartbeatInterval(uint64_t heartbeat) {
heartbeat = heartbeat / milliSecsToMicroSecs;
return pSysfsAccess->write(heartbeatIntervalMilliSecs, heartbeat);
ze_result_t result = pSysfsAccess->write(heartbeatIntervalMilliSecs, heartbeat);
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
ze_bool_t LinuxSchedulerImp::canControlScheduler() {

View File

@@ -23,6 +23,9 @@ ze_result_t LinuxStandbyImp::getMode(zes_standby_promo_mode_t &mode) {
int currentMode = -1;
ze_result_t result = pSysfsAccess->read(standbyModeFile, currentMode);
if (ZE_RESULT_SUCCESS != result) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
return result;
}
if (standbyModeDefault == currentMode) {