Crash if no hwmon sysfs
Return NOT_SUPPORTED if no hwmon sysfs.
Change-Id: I8f4bea0d74619150aee7dfc21fe62d24018e2994
[ROCm/amdsmi commit: b39a56fc52]
此提交包含在:
@@ -4,7 +4,7 @@ The AMD System Management Interface Library, or AMD SMI library, is a C library
|
||||
|
||||
## Supported platforms
|
||||
|
||||
At initial release, the AMD SMI library will support Linux bear metal and Linux virtual machine guest for AMD GPUs. In the future release, the library will be extended to support AMD EPYC™ CPUs.
|
||||
At initial release, the AMD SMI library will support Linux bare metal and Linux virtual machine guest for AMD GPUs. In the future release, the library will be extended to support AMD EPYC™ CPUs.
|
||||
|
||||
AMD SMI library can run on AMD ROCm supported platforms, please refer to [List of Supported Operating Systems and GPUs](https://docs.amd.com/bundle/ROCm-Getting-Started-Guide-v5.3/page/Introduction_to_ROCm_Getting_Started_Guide_for_Linux.html)
|
||||
|
||||
|
||||
@@ -336,7 +336,9 @@ static rsmi_status_t get_dev_mon_value(amd::smi::MonitorTypes type,
|
||||
}
|
||||
GET_DEV_FROM_INDX
|
||||
|
||||
assert(dev->monitor() != nullptr);
|
||||
if (dev->monitor() == nullptr) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
std::string val_str;
|
||||
|
||||
@@ -364,7 +366,9 @@ static rsmi_status_t get_dev_mon_value(amd::smi::MonitorTypes type,
|
||||
}
|
||||
|
||||
GET_DEV_FROM_INDX
|
||||
assert(dev->monitor() != nullptr);
|
||||
if (dev->monitor() == nullptr) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
std::string val_str;
|
||||
|
||||
@@ -389,7 +393,9 @@ static rsmi_status_t set_dev_mon_value(amd::smi::MonitorTypes type,
|
||||
uint32_t dv_ind, uint32_t sensor_ind, T val) {
|
||||
GET_DEV_FROM_INDX
|
||||
|
||||
assert(dev->monitor() != nullptr);
|
||||
if (dev->monitor() == nullptr) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int ret = dev->monitor()->writeMonitor(type, sensor_ind,
|
||||
std::to_string(val));
|
||||
@@ -411,8 +417,9 @@ static rsmi_status_t get_power_mon_value(amd::smi::PowerMonTypes type,
|
||||
}
|
||||
|
||||
std::shared_ptr<amd::smi::Device> dev = smi.devices()[dv_ind];
|
||||
assert(dev != nullptr);
|
||||
assert(dev->monitor() != nullptr);
|
||||
if (dev == nullptr || dev->monitor() == nullptr) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
ret = dev->power_monitor()->readPowerValue(type, val);
|
||||
|
||||
@@ -2223,7 +2230,9 @@ rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_type,
|
||||
|
||||
GET_DEV_FROM_INDX
|
||||
|
||||
assert(dev->monitor() != nullptr);
|
||||
if (dev->monitor() == nullptr) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
std::shared_ptr<amd::smi::Monitor> m = dev->monitor();
|
||||
|
||||
// getTempSensorIndex will throw an out of range exception if sensor_type is
|
||||
@@ -2281,7 +2290,9 @@ rsmi_dev_volt_metric_get(uint32_t dv_ind, rsmi_voltage_type_t sensor_type,
|
||||
|
||||
GET_DEV_FROM_INDX
|
||||
|
||||
assert(dev->monitor() != nullptr);
|
||||
if (dev->monitor() == nullptr) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
std::shared_ptr<amd::smi::Monitor> m = dev->monitor();
|
||||
|
||||
// getVoltSensorIndex will throw an out of range exception if sensor_type is
|
||||
|
||||
@@ -974,6 +974,9 @@ void Device::fillSupportedFuncs(void) {
|
||||
if (supported_funcs_.size() != 0) {
|
||||
return;
|
||||
}
|
||||
if (monitor() == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<const char *, dev_depends_t>::const_iterator it =
|
||||
kDevFuncDependsMap.begin();
|
||||
|
||||
新增問題並參考
封鎖使用者