smbios-mdrv2: Support deviceLocator as Dimm object on config update
The use-device-locator-as-dimm-object-path feature is only handling the
scenario when creating the obejcts for the first time. But if the smbios
config gets updated and ther order of dimm in smbios is different from
before then it will look for the content from previous index which will
cause the content to be wrong.
The scenario can happen if we are updating BIOS which has different
order for DIMMs in the Smbios. When smbios-mdr2 first starts it will
process the old smbios data since the bios has not completed it's
process yet. After Bios sends the smbios with different dimm order, now
the smbios-mdr will try to update the properties of each dimm assuming
the previous index is still same but which may not be true.
Tested: Updated BMC with different BIOS order and checked the DIMMs are
showing correct value.
Fusion-Link: fusion2 link in comment
Google-Bug-Id: 442451039
Change-Id: Ib1689f6e074b929ad20b5d734a0b98445e81c701
Signed-off-by: Munawar Hussain <munawarhussain@google.com>
diff --git a/recipes-phosphor/smbios/smbios-mdr/0001-Use-Device-Locator-as-DIMM-Object-Path-if-Enabled.patch b/recipes-phosphor/smbios/smbios-mdr/0001-Use-Device-Locator-as-DIMM-Object-Path-if-Enabled.patch
index 731dc5a..ab4cfbc 100644
--- a/recipes-phosphor/smbios/smbios-mdr/0001-Use-Device-Locator-as-DIMM-Object-Path-if-Enabled.patch
+++ b/recipes-phosphor/smbios/smbios-mdr/0001-Use-Device-Locator-as-DIMM-Object-Path-if-Enabled.patch
@@ -1,6 +1,6 @@
-From 43232fc4f3f15144e6194590ddb3c12f58690ea7 Mon Sep 17 00:00:00 2001
-From: Edward Lee <edwarddl@google.com>
-Date: Tue, 13 Feb 2024 22:39:04 +0000
+From ece455705ae335d2a775d2beee24cbfdf1943264 Mon Sep 17 00:00:00 2001
+From: Munawar Hussain <munawarhussain@google.com>
+Date: Tue, 9 Sep 2025 09:00:49 +0000
Subject: [PATCH] Use Device Locator as DIMM Object Path if Enabled
Adding new feature which uses deviceLocator property as the index for
@@ -19,13 +19,34 @@
Signed-off-by: Edward Lee <edwarddl@google.com>
---
+ include/dimm.hpp | 5 +--
include/mdrv2.hpp | 3 ++
include/smbios_mdrv2.hpp | 2 ++
meson.options | 7 ++++
- src/mdrv2.cpp | 72 ++++++++++++++++++++++++++++++++++++++++
+ src/dimm.cpp | 4 ++-
+ src/mdrv2.cpp | 74 +++++++++++++++++++++++++++++++++++++++-
src/meson.build | 4 +++
- 5 files changed, 88 insertions(+)
+ 7 files changed, 95 insertions(+), 4 deletions(-)
+diff --git a/include/dimm.hpp b/include/dimm.hpp
+index a3a48be..2848c8d 100644
+--- a/include/dimm.hpp
++++ b/include/dimm.hpp
+@@ -97,11 +97,12 @@ class Dimm :
+ bus, objPath.c_str()),
+ dimmNum(dimmId)
+ {
+- memoryInfoUpdate(smbiosTableStorage, motherboard);
++ memoryInfoUpdate(smbiosTableStorage, motherboard, dimmId);
+ }
+
+ void memoryInfoUpdate(uint8_t* smbiosTableStorage,
+- const std::string& motherboard);
++ const std::string& motherboard,
++ const uint8_t& newDimmNum);
+
+ uint16_t memoryDataWidth(uint16_t value) override;
+ uint16_t memoryTotalWidth(uint16_t value) override;
diff --git a/include/mdrv2.hpp b/include/mdrv2.hpp
index 818b0ab..5ccbb49 100644
--- a/include/mdrv2.hpp
@@ -68,8 +89,24 @@
+ value: 'disabled',
+ description: 'SMBIOS creates DIMM Dbus objects as filepath dimmX. If this feature is enabled, then the deviceLocator index will be the X. If the feature is disabled, the order of dimm in SMBIOS table will be the X.'
+)
+diff --git a/src/dimm.cpp b/src/dimm.cpp
+index 14a4984..79f392e 100644
+--- a/src/dimm.cpp
++++ b/src/dimm.cpp
+@@ -42,8 +42,10 @@ using EccType =
+
+ static constexpr uint16_t maxOldDimmSize = 0x7fff;
+ void Dimm::memoryInfoUpdate(uint8_t* smbiosTableStorage,
+- const std::string& motherboard)
++ const std::string& motherboard,
++ const uint8_t& newDimmNum)
+ {
++ dimmNum = newDimmNum;
+ storage = smbiosTableStorage;
+ motherboardPath = motherboard;
+
diff --git a/src/mdrv2.cpp b/src/mdrv2.cpp
-index dbce1c3..3a7c673 100644
+index dbce1c3..60943f3 100644
--- a/src/mdrv2.cpp
+++ b/src/mdrv2.cpp
@@ -20,6 +20,7 @@
@@ -118,7 +155,7 @@
+ else
+ {
+ dimms[index]->memoryInfoUpdate(
-+ smbiosDir.dir[smbiosDirIndex].dataStorage, motherboardPath);
++ smbiosDir.dir[smbiosDirIndex].dataStorage, motherboardPath, index);
+ }
+
+ ++dimmsIndex;
@@ -127,8 +164,12 @@
for (unsigned int index = 0; index < *num; index++)
{
std::string path = smbiosInventoryPath + dimmSuffix +
-@@ -638,6 +679,7 @@ void MDRV2::systemInfoUpdate()
- smbiosDir.dir[smbiosDirIndex].dataStorage, motherboardPath);
+@@ -635,9 +676,10 @@ void MDRV2::systemInfoUpdate()
+ else
+ {
+ dimms[index]->memoryInfoUpdate(
+- smbiosDir.dir[smbiosDirIndex].dataStorage, motherboardPath);
++ smbiosDir.dir[smbiosDirIndex].dataStorage, motherboardPath, index);
}
}
+#endif
@@ -187,5 +228,5 @@
'mdrv2.cpp',
'mdrv2_main.cpp',
--
-2.49.0.504.g3bcea36a83-goog
+2.51.0.384.g4c02a37b29-goog