nvidia-gpu: add SMA Temperature Sensor
Add support for device type SMA (System Management Agent) and its
temperature sensor. It is typically an MCU device.
Tested: Build an image for gb200nvl-obmc machine with the following
patches cherry picked. This patches are needed to enable the mctp stack.
https://gerrit.openbmc.org/c/openbmc/openbmc/+/79422
```
$ curl -s -k -u 'root:0penBmc' https://10.137.203.193/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/temperature_NVIDIA_GB200_GPU_SMA_255_TEMP_0
{
"@odata.id": "/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/temperature_NVIDIA_GB200_GPU_SMA_255_TEMP_0",
"@odata.type": "#Sensor.v1_2_0.Sensor",
"Id": "temperature_NVIDIA_GB200_GPU_SMA_255_TEMP_0",
"Name": "NVIDIA GB200 GPU SMA 255 TEMP 0",
"Reading": 34.0,
"ReadingRangeMax": 127.0,
"ReadingRangeMin": -128.0,
"ReadingType": "Temperature",
"ReadingUnits": "Cel",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}%
```
Change-Id: I560864758036a5b6ea6c1745145736c7bfa0a1c5
Signed-off-by: Harshit Aghera <haghera@nvidia.com>
diff --git a/src/nvidia-gpu/NvidiaGpuSensorMain.cpp b/src/nvidia-gpu/NvidiaGpuSensorMain.cpp
index 6ccbb05..7e404f5 100644
--- a/src/nvidia-gpu/NvidiaGpuSensorMain.cpp
+++ b/src/nvidia-gpu/NvidiaGpuSensorMain.cpp
@@ -8,6 +8,7 @@
#include "Utils.hpp"
#include <NvidiaDeviceDiscovery.hpp>
+#include <NvidiaSmaDevice.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>
@@ -27,6 +28,7 @@
#include <vector>
boost::container::flat_map<std::string, std::shared_ptr<GpuDevice>> gpuDevices;
+boost::container::flat_map<std::string, std::shared_ptr<SmaDevice>> smaDevices;
void configTimerExpiryCallback(
boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
@@ -37,7 +39,8 @@
{
return; // we're being canceled
}
- createSensors(io, objectServer, gpuDevices, dbusConnection, mctpRequester);
+ createSensors(io, objectServer, gpuDevices, smaDevices, dbusConnection,
+ mctpRequester);
}
int main()
@@ -51,7 +54,8 @@
mctp::MctpRequester mctpRequester(io);
boost::asio::post(io, [&]() {
- createSensors(io, objectServer, gpuDevices, systemBus, mctpRequester);
+ createSensors(io, objectServer, gpuDevices, smaDevices, systemBus,
+ mctpRequester);
});
boost::asio::steady_timer configTimer(io);
@@ -76,7 +80,9 @@
static_cast<sdbusplus::bus_t&>(*systemBus),
sdbusplus::bus::match::rules::interfacesRemovedAtPath(
std::string(inventoryPath)),
- [](sdbusplus::message_t& msg) { interfaceRemoved(msg, gpuDevices); });
+ [](sdbusplus::message_t& msg) {
+ interfaceRemoved(msg, gpuDevices, smaDevices);
+ });
io.run();
return 0;