phosphor-debug-collector: Add DumpPrefix property to faultlog dump entry

Add support for the optional DumpPrefix parameter in FaultLog
CreateDump requests. Parse and validate DumpPrefix in
Manager::getAndCheckCreateDumpParams(), throwing InvalidArgument if the
parameter is not a string, and pass it to faultlog::Entry to populate
the D-Bus DumpPrefix property.

Platforms-Affected: All
Google-Bug-Id: 559785933
Tested: https://paste.googleplex.com/6159609547587584
Fusion-Link: fusion2 n/a this is not tested by fusion
Change-Id: I9d55c3934c9f60b3be01686aa9413bfe9684249e
Signed-off-by: Jasmine Cha <chajasmine@google.com>
diff --git a/recipes-phosphor/dump/phosphor-debug-collector/0008-Add-DumpPrefix-property-to-faultlog-dump.patch b/recipes-phosphor/dump/phosphor-debug-collector/0008-Add-DumpPrefix-property-to-faultlog-dump.patch
new file mode 100644
index 0000000..7c8e581
--- /dev/null
+++ b/recipes-phosphor/dump/phosphor-debug-collector/0008-Add-DumpPrefix-property-to-faultlog-dump.patch
@@ -0,0 +1,149 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jasmine Cha <chajasmine@google.com>
+Date: Tue, 15 Sep 2026 01:22:43 +0000
+Subject: [PATCH] Add DumpPrefix property to faultlog dump entry
+
+Add support for the optional DumpPrefix parameter in FaultLog
+CreateDump requests. Parse and validate DumpPrefix in
+Manager::getAndCheckCreateDumpParams(), throwing InvalidArgument if the
+parameter is not a string, and pass it to faultlog::Entry to populate
+the D-Bus DumpPrefix property.
+
+Patch-Tracking-Bug: b/559785933
+Upstream-info / review: N/A
+Upstream-Status: Pending
+Google-Bug-Id: 559785933
+Signed-off-by: Jasmine Cha <chajasmine@google.com>
+---
+ dump_manager_faultlog.cpp | 29 ++++++++++++++++++++++++++---
+ dump_manager_faultlog.hpp |  2 ++
+ faultlog_dump_entry.hpp   |  5 ++++-
+ 3 files changed, 32 insertions(+), 4 deletions(-)
+
+diff --git a/dump_manager_faultlog.cpp b/dump_manager_faultlog.cpp
+index 96393f7..5333e0f 100644
+--- a/dump_manager_faultlog.cpp
++++ b/dump_manager_faultlog.cpp
+@@ -60,13 +60,14 @@ sdbusplus::message::object_path
+     std::string primaryLogIdStr;
+     std::string prettyNameStr;
+     std::string logStr;
++    std::string dumpPrefixStr;
+     uint64_t faultId = 0;
+     uint64_t faultTimestamp = 0;
+ 
+     log<level::INFO>("In dump_manager_faultlog.cpp createDump");
+ 
+     getAndCheckCreateDumpParams(params, entryType, primaryLogIdStr,
+-                                prettyNameStr, logStr,
++                                prettyNameStr, logStr, dumpPrefixStr,
+                                 faultId, faultTimestamp);
+ 
+     // To stay within the limit of MAX_NUM_FAULT_LOG_ENTRIES we need to remove
+@@ -216,7 +217,7 @@ sdbusplus::message::object_path
+                                    phosphor::dump::OperationStatus::Completed,
+                                    originatorId, originatorType, entryType,
+                                    primaryLogIdStr, prettyNameStr, logStr,
+-                                   *this, &entries, faultId)));
++                                   dumpPrefixStr, *this, &entries, faultId)));
+     }
+     catch (const std::invalid_argument& e)
+     {
+@@ -704,6 +705,9 @@ void Manager::createDumpFromCrashdumpSignal(sdbusplus::message_t& msg)
+ 
+     crashdumpMap.insert(std::pair<std::string, std::string>("PrimaryLogId",
+                                                              filename));
++    crashdumpMap.emplace("DumpPrefix",
++                         (std::string(CRASHDUMP_FORMAT) == "AMD") ? "amd_"
++                                                                  : "intel_");
+ 
+     createDump(crashdumpMap);
+ }
+@@ -711,7 +715,8 @@ void Manager::createDumpFromCrashdumpSignal(sdbusplus::message_t& msg)
+ void Manager::getAndCheckCreateDumpParams(
+     const phosphor::dump::DumpCreateParams& params, FaultLogTypes& entryType,
+     std::string& primaryLogIdStr, std::string& prettyNameStr,
+-    std::string& logStr, uint64_t& faultId, uint64_t& faultTimestamp)
++    std::string& logStr, std::string& dumpPrefixStr, uint64_t& faultId,
++    uint64_t& faultTimestamp)
+ {
+     using InvalidArgument =
+         sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument;
+@@ -832,6 +837,25 @@ void Manager::getAndCheckCreateDumpParams(
+         }
+     }
+ 
++    iter = params.find("DumpPrefix");
++    if (iter != params.end())
++    {
++        try
++        {
++            dumpPrefixStr = std::get<std::string>(iter->second);
++        }
++        catch (const std::bad_variant_access& e)
++        {
++            log<level::ERR>(
++                std::format(
++                    "An invalid DumpPrefix string is passed errormsg({})",
++                    e.what())
++                    .c_str());
++            elog<InvalidArgument>(Argument::ARGUMENT_NAME("DUMPPREFIX"),
++                                  Argument::ARGUMENT_VALUE("INVALID INPUT"));
++        }
++    }
++
+     faultId = 0;
+     iter = params.find("Id");
+     if (iter != params.end())
+diff --git a/dump_manager_faultlog.hpp b/dump_manager_faultlog.hpp
+index 26aa131..d3d2bbb 100644
+--- a/dump_manager_faultlog.hpp
++++ b/dump_manager_faultlog.hpp
+@@ -185,6 +185,7 @@ class Manager :
+      *  @param[out] primaryLogIdStr - Id of primary fault data log
+      *  @param[out] prettyNameStr - Name of log entry (optional)
+      *  @param[out] logStr - Full file path of the log file (optional)
++     *  @param[out] dumpPrefixStr - Prefix of the dump file (optional)
+      *  @param[out] faultId - Id of primary fault data log (adopted only in
+      * server3 / multi-host platforms, defaults to 0 if absent)
+      *  @param[out] faultTimestamp - Timestamp of primary fault data log
+@@ -195,6 +196,7 @@ class Manager :
+         const phosphor::dump::DumpCreateParams& params,
+         FaultLogTypes& entryType, std::string& primaryLogIdStr,
+         std::string& prettyNameStr, std::string& logStr,
++        std::string& dumpPrefixStr,
+         uint64_t& faultId, uint64_t& faultTimestamp);
+ 
+     /** @brief Generate the current timestamp, adjusting as needed to ensure an
+diff --git a/faultlog_dump_entry.hpp b/faultlog_dump_entry.hpp
+index 25cc15d..33610d8 100644
+--- a/faultlog_dump_entry.hpp
++++ b/faultlog_dump_entry.hpp
+@@ -59,6 +59,7 @@ class Entry : virtual public phosphor::dump::Entry, virtual public EntryIfaces
+      *  @param[in] originatorType - Originator type
+      *  @param[in] prettyNameStr - The name of the log entry.
+      *  @param[in] logStr - The full path of the log file.
++     *  @param[in] dumpPrefixStr - The prefix of the dump file.
+      *  @param[in] parent - The dump entry's parent.
+      *  @param[in] faultId - Fault id (adopted only in server3 / multi-host
+      * platforms, defaults to 0 if not provided).
+@@ -69,7 +70,8 @@ class Entry : virtual public phosphor::dump::Entry, virtual public EntryIfaces
+           phosphor::dump::OperationStatus status, std::string originatorId,
+           originatorTypes originatorType, FaultLogTypes entryType,
+           const std::string& primaryLogIdStr, const std::string& prettyNameStr,
+-          const std::string& logStr, phosphor::dump::Manager& parent,
++          const std::string& logStr, const std::string& dumpPrefixStr,
++          phosphor::dump::Manager& parent,
+           std::map<uint32_t, std::unique_ptr<phosphor::dump::Entry>>* parentMap,
+           uint64_t faultId = 0) :
+         phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, fileSize,
+@@ -82,6 +84,7 @@ class Entry : virtual public phosphor::dump::Entry, virtual public EntryIfaces
+         primaryLogId(primaryLogIdStr);
+         prettyName(prettyNameStr);
+         log(logStr);
++        dumpPrefix(dumpPrefixStr);
+         if (faultId != 0)
+         {
+             faultIdTable.emplace(faultId, dumpId);
+-- 
+2.55.0.860.g4b6b3295ed-goog
diff --git a/recipes-phosphor/dump/phosphor-debug-collector_%.bbappend b/recipes-phosphor/dump/phosphor-debug-collector_%.bbappend
index a446243..2b40097 100644
--- a/recipes-phosphor/dump/phosphor-debug-collector_%.bbappend
+++ b/recipes-phosphor/dump/phosphor-debug-collector_%.bbappend
@@ -9,6 +9,7 @@
   file://0005-dump-harden-against-concurrent-file-deletions.patch \
   file://0006-use-sdbusplus-enum-converter-for-faultlog-types.patch \
   file://0007-Add-PrettyName-and-Log-property-to-faultlog-dump.patch \
+  file://0008-Add-DumpPrefix-property-to-faultlog-dump.patch \
 "
 
 SRC_URI:append = " \