nvidia-gpu: fix GPU power PeakReading PDI usage
The GPU power peak reading, which uses the Telemetry.Report PDI, was
relying on a string ("PeakReading") to expose the reading. This string
is Redfish specific. Instead, use the OperationType.Maximum enum defined
in the PDI. Bmcweb code can map this to PeakReading.
Tested: Build an image for nvl32-obmc machine with the following patches
cherry picked.
https://gerrit.openbmc.org/c/openbmc/openbmc/+/85490
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/82449.
The patch cherry-picks the following patches that are currently under
review.
```
1. device tree
https://lore.kernel.org/all/aRbLqH8pLWCQryhu@molberding.nvidia.com/
2. mctpd patches
https://github.com/CodeConstruct/mctp/pull/85
3. u-boot changes
https://lore.kernel.org/openbmc/20251121-msx4-v1-0-fc0118b666c1@nvidia.com/T/#t
4. kernel changes as specified in the openbmc patch (for espi)
5. entity-manager changes
https://gerrit.openbmc.org/c/openbmc/entity-manager/+/85455
6. platform-init changes
https://gerrit.openbmc.org/c/openbmc/platform-init/+/85456
7. spi changes
https://lore.kernel.org/all/20251121-w25q01jv_fixup-v1-1-3d175050db73@nvidia.com/
```
The GPU Power PeakReading is correctly reported on DBus and on redfish.
Change-Id: I39b2b4987d845f878ffdedcfdb02cdfdc02a4499
Signed-off-by: Deepak Kodihalli <deepak.kodihalli.83@gmail.com>
Signed-off-by: Harshit Aghera <haghera@nvidia.com>
diff --git a/src/nvidia-gpu/NvidiaGpuPowerPeakReading.cpp b/src/nvidia-gpu/NvidiaGpuPowerPeakReading.cpp
index a2d2d3c..62ed30b 100644
--- a/src/nvidia-gpu/NvidiaGpuPowerPeakReading.cpp
+++ b/src/nvidia-gpu/NvidiaGpuPowerPeakReading.cpp
@@ -15,6 +15,7 @@
#include <OcpMctpVdm.hpp>
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/asio/object_server.hpp>
+#include <sdbusplus/message/native_types.hpp>
#include <cstdint>
#include <functional>
@@ -22,6 +23,8 @@
#include <span>
#include <string>
#include <system_error>
+#include <tuple>
+#include <vector>
using namespace std::literals;
@@ -36,12 +39,23 @@
telemetryReportInterface = objectServer.add_interface(
dbusPath, "xyz.openbmc_project.Telemetry.Report");
+ telemetryReportInterface->register_property("Persistency", false);
+ std::vector<std::tuple<
+ std::vector<std::tuple<sdbusplus::message::object_path, std::string>>,
+ std::string, std::string, uint64_t>>
+ readingParams{
+ {{{dbusPath, ""}},
+ "xyz.openbmc_project.Telemetry.Report.OperationType.Maximum",
+ "",
+ 0}};
+ telemetryReportInterface->register_property("ReadingParameters",
+ readingParams);
std::get<0>(readings) = 0;
// Reading from the device is in milliwatts and unit set on the dbus
// is watts.
std::get<1>(readings).emplace_back("PeakReading", "", 0.0, 0);
-
telemetryReportInterface->register_property("Readings", readings);
+ telemetryReportInterface->register_property("Enabled", true);
telemetryReportInterface->initialize();
}