nvidia-gpu: add voltage sensor
This commit introduces a voltage sensor for the GPU.
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.137/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/voltage_NVIDIA_GB200_GPU_0_Voltage_0
{
"@odata.id": "/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/voltage_NVIDIA_GB200_GPU_0_Voltage_0",
"@odata.type": "#Sensor.v1_2_0.Sensor",
"Id": "voltage_NVIDIA_GB200_GPU_0_Voltage_0",
"Name": "NVIDIA GB200 GPU 0 Voltage 0",
"Reading": 0.735,
"ReadingRangeMax": 1.8446744073709552e+16,
"ReadingRangeMin": 0.0,
"ReadingType": "Voltage",
"ReadingUnits": "V",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}%
```
Change-Id: I3d98f3d7c11221a42460c6f8420c927c1b1711b2
Signed-off-by: Harshit Aghera <haghera@nvidia.com>
diff --git a/src/nvidia-gpu/NvidiaGpuDevice.cpp b/src/nvidia-gpu/NvidiaGpuDevice.cpp
index 5f3e83b..e966d57 100644
--- a/src/nvidia-gpu/NvidiaGpuDevice.cpp
+++ b/src/nvidia-gpu/NvidiaGpuDevice.cpp
@@ -17,6 +17,7 @@
#include <NvidiaGpuEnergySensor.hpp>
#include <NvidiaGpuPowerSensor.hpp>
#include <NvidiaGpuThresholds.hpp>
+#include <NvidiaGpuVoltageSensor.hpp>
#include <boost/asio/io_context.hpp>
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/asio/connection.hpp>
@@ -83,6 +84,10 @@
conn, mctpRequester, name + "_Energy_0", path, eid, gpuEnergySensorId,
objectServer, std::vector<thresholds::Threshold>{});
+ voltageSensor = std::make_shared<NvidiaGpuVoltageSensor>(
+ conn, mctpRequester, name + "_Voltage_0", path, eid, gpuVoltageSensorId,
+ objectServer, std::vector<thresholds::Threshold>{});
+
lg2::info("Added GPU {NAME} Sensors with chassis path: {PATH}.", "NAME",
name, "PATH", path);
@@ -98,6 +103,7 @@
}
powerSensor->update();
energySensor->update();
+ voltageSensor->update();
waitTimer.expires_after(std::chrono::milliseconds(sensorPollMs));
waitTimer.async_wait([this](const boost::system::error_code& ec) {