meta-gbmc-staging: move ipmi blob smbios handling to shared layer

Google-Bug-Id: 552182838
Tested: build
Fusion-Link:
platform5: https://fusion2.corp.google.com/600cbe10-c5f9-3313-812b-7a6e93ab61d8
platform15: https://fusion2.corp.google.com/f16de366-eb2e-3c2a-b53a-ab1c75527993
platform17: https://fusion2.corp.google.com/4bf33084-1de2-3420-867f-6b50027ee502
platform11+ext: https://fusion2.corp.google.com/c30d63ab-e6fa-371f-ae90-d336d1fa8039
platform11: https://fusion2.corp.google.com/d98cf902-57c5-37e0-a370-5ce3de2dc57c
Change-Id: Ia88c22dd5f689bde504479611f278380e12b8954
Signed-off-by: Alex Lai <alexlai@google.com>
diff --git a/recipes-phosphor/smbios/smbios-mdr/0001-smbios-mdr-signal-new-data-ready.patch b/recipes-phosphor/smbios/smbios-mdr/0001-smbios-mdr-signal-new-data-ready.patch
new file mode 100644
index 0000000..2aaee95
--- /dev/null
+++ b/recipes-phosphor/smbios/smbios-mdr/0001-smbios-mdr-signal-new-data-ready.patch
@@ -0,0 +1,109 @@
+From a089ccb0088b69d0648733fc5bcd632dc0cecdd8 Mon Sep 17 00:00:00 2001
+From: Rutu Patel <rutupatel@google.com>
+Date: Fri, 27 Feb 2026 22:35:11 +0000
+Subject: [PATCH] smbios-ipmi-blobs: signal SMBIOS ready on commit
+
+Introduce a mechanism to signal when fresh SMBIOS data is available.
+The `reportSmbiosDataReady()` method is added to `SmbiosBlobHandler`,
+which triggers after a successful commit to persistent storage.
+
+This ensures the `/run/smbios-mdr` directory exists and writes "NEW" to
+`/run/smbios-mdr/status`. This file serves as a synchronization latch
+for the Dual-File Handshake, notifying downstream services that the
+SMBIOS tables are safe to parse following a host reboot.
+
+Tested:
+- Built smbios-mdr and deployed libsmbiosstore.so to a target BMC.
+- Restarted phosphor-ipmi-host and triggered a host power cycle.
+- Verified directory creation and status file write in journal logs:
+  "Wrote NEW to /run/smbios-mdr/status"
+- Confirmed file content on BMC:
+  # cat /run/smbios-mdr/status
+  NEW
+- Ran 10 host reboot iterations; signaling remained consistent with an
+  average transfer delay of ~45s from OS state Standby to status NEW.
+
+gPaste: https://paste.googleplex.com/6463923281854464
+Google-Bug-Id: 487422760
+Signed-off-by: Rutu Patel <rutupatel@google.com>
+---
+ src/smbios-ipmi-blobs/handler.cpp | 46 +++++++++++++++++++++++++++++++
+ src/smbios-ipmi-blobs/handler.hpp |  2 ++
+ 2 files changed, 48 insertions(+)
+
+diff --git a/src/smbios-ipmi-blobs/handler.cpp b/src/smbios-ipmi-blobs/handler.cpp
+index fb8111a..b03fafa 100644
+--- a/src/smbios-ipmi-blobs/handler.cpp
++++ b/src/smbios-ipmi-blobs/handler.cpp
+@@ -253,9 +253,55 @@ bool SmbiosBlobHandler::commit(uint16_t session,
+     blobPtr->state &= ~blobs::StateFlags::committing;
+     blobPtr->state |= blobs::StateFlags::committed;
+ 
++    reportSmbiosDataReady();
++
+     return true;
+ }
+ 
++void SmbiosBlobHandler::reportSmbiosDataReady()
++{
++    phosphor::logging::log<phosphor::logging::level::INFO>(
++        "Attempting to signal NEW SMBIOS data ready");
++
++    std::error_code ec;
++    std::filesystem::path runDir("/run/smbios-mdr");
++    if (!std::filesystem::exists(runDir, ec))
++    {
++        if (!std::filesystem::create_directory(runDir, ec))
++        {
++            phosphor::logging::log<phosphor::logging::level::ERR>(
++                "Failed to create /run/smbios-mdr directory");
++            return;
++        }
++    }
++
++    std::string tmpFile = "/run/smbios-mdr/status.tmp.mdr";
++    std::string finalFile = "/run/smbios-mdr/status";
++    std::ofstream statusFile(tmpFile);
++    if (statusFile.good())
++    {
++        statusFile << "NEW";
++        statusFile.close();
++
++        std::filesystem::rename(tmpFile, finalFile, ec);
++        if (ec)
++        {
++            phosphor::logging::log<phosphor::logging::level::ERR>(
++                "Failed to atomically rename status.tmp.mdr to status");
++        }
++        else
++        {
++            phosphor::logging::log<phosphor::logging::level::INFO>(
++                "Wrote NEW to /run/smbios-mdr/status");
++        }
++    }
++    else
++    {
++        phosphor::logging::log<phosphor::logging::level::ERR>(
++            "Failed to write NEW to /run/smbios-mdr/status.tmp.mdr");
++    }
++}
++
+ bool SmbiosBlobHandler::close(uint16_t session)
+ {
+     if (!blobPtr || blobPtr->sessionId != session)
+diff --git a/src/smbios-ipmi-blobs/handler.hpp b/src/smbios-ipmi-blobs/handler.hpp
+index d97618a..f0c4a7f 100644
+--- a/src/smbios-ipmi-blobs/handler.hpp
++++ b/src/smbios-ipmi-blobs/handler.hpp
+@@ -64,6 +64,8 @@ class SmbiosBlobHandler : public GenericBlobInterface
+     bool stat(uint16_t session, struct BlobMeta* meta) override;
+     bool expire(uint16_t session) override;
+ 
++    void reportSmbiosDataReady();
++
+   private:
+     static constexpr char blobId[] = "/smbios";
+ 
+-- 
+2.53.0.473.g4a7958ca14-goog
+
diff --git a/recipes-phosphor/smbios/smbios-mdr_%.bbappend b/recipes-phosphor/smbios/smbios-mdr_%.bbappend
index 24eeefa..228e348 100644
--- a/recipes-phosphor/smbios/smbios-mdr_%.bbappend
+++ b/recipes-phosphor/smbios/smbios-mdr_%.bbappend
@@ -8,6 +8,7 @@
   file://0001-smbios-mdr-Add-support-to-get-SystemBootInfo.patch \
   file://0001-smbios-mdr-Add-association-to-the-presence-status.patch \
   file://0001-Get-system-inventory-path-dynamically.patch \
+  file://0001-smbios-mdr-signal-new-data-ready.patch \
 "
 
 EXTRA_OEMESON:append:gbmc = " -Ddimm-only-locator=enabled"