phosphor-ipmi-host: reduce the chance of the SDR cache reset

1) Enhance Support-packing-cable-presence-sensor-state-into-dis.patch,
   only reset sensorTreePtr when item.cable inventory interface is
   changed.
2) add dbus-sdr-Skip-certain-temperature-sensors.patch:
   Now we can use skip-temp-sensor-regex meson option to define a regex
   to skip certain temperature sensors.

Tested:
1) Build BMC image, ipmid starts and works normally after
   systemctl restart xyz.openbmc_project.hwmontempsensor:
   https://paste.googleplex.com/5478815565873152
2) Restart nvmesensor deamon, the sensorTree doesn't get reset.
3) Performance test about skip-temp-sensor-regex:
   https://paste.googleplex.com/4900766923358208

Google-Bug-Id: 325468059
Google-Bug-Id: 317759042
Change-Id: Iebbf54229e084a88df48e4d7b33c81285ef0ce56
Signed-off-by: Jinliang Wang <jinliangw@google.com>
diff --git a/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Support-packing-cable-presence-sensor-state-into-dis.patch b/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Support-packing-cable-presence-sensor-state-into-dis.patch
index c640269..070f3bc 100644
--- a/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Support-packing-cable-presence-sensor-state-into-dis.patch
+++ b/recipes-phosphor/ipmi/phosphor-ipmi-host/0002-Support-packing-cable-presence-sensor-state-into-dis.patch
@@ -1,4 +1,4 @@
-From 8bb6b124cf58e5051ccacee13d9787ece26b4765 Mon Sep 17 00:00:00 2001
+From b1848753fc1fb160c299deee63075d026751ce6d Mon Sep 17 00:00:00 2001
 From: Vlad Sytchenko <vsytch@google.com>
 Date: Thu, 2 Nov 2023 21:46:43 +0000
 Subject: [PATCH] Support packing cable presence sensor state into discrete
@@ -22,17 +22,18 @@
 
 Signed-off-by: Chu Lin <linchuyuan@google.com>
 Change-Id: I30970fd40c210cd5ee05acc8a8b60661dff60db7
+Signed-off-by: Jinliang Wang <jinliangw@google.com>
 ---
- dbus-sdr/sdrutils.cpp         | 143 ++++++++++++++++++++++++++++++++--
- dbus-sdr/sensorcommands.cpp   | 139 +++++++++++++++++++++++----------
- include/dbus-sdr/sdrutils.hpp |   7 ++
- 3 files changed, 242 insertions(+), 47 deletions(-)
+ dbus-sdr/sdrutils.cpp         | 220 +++++++++++++++++++++++++++++++++-
+ dbus-sdr/sensorcommands.cpp   | 143 +++++++++++++++-------
+ include/dbus-sdr/sdrutils.hpp |  10 ++
+ 3 files changed, 326 insertions(+), 47 deletions(-)
 
 diff --git a/dbus-sdr/sdrutils.cpp b/dbus-sdr/sdrutils.cpp
-index 3e7b966..b499745 100644
+index d148d9a..249176e 100644
 --- a/dbus-sdr/sdrutils.cpp
 +++ b/dbus-sdr/sdrutils.cpp
-@@ -16,22 +16,64 @@
+@@ -16,24 +16,135 @@
  
  #include "dbus-sdr/sdrutils.hpp"
  
@@ -100,8 +101,79 @@
 +
  namespace details
  {
++
++const static constexpr char* itemCableInterface =
++    "xyz.openbmc_project.Inventory.Item.Cable";
++
++bool isExpectedInventoryInterfacesRemoved(sdbusplus::message_t& message)
++{
++    // InterfacesRemoved (OBJPATH object_path,
++    //                    ARRAY<STRING> interfaces);
++    sdbusplus::message::object_path path;
++    std::vector<std::string> interfaces;
++    try
++    {
++        message.read(path);
++        // std::cerr << "Removed: " << path.str << std::endl;
++        message.read(interfaces);
++    }
++    catch (const std::exception& e)
++    {
++        std::cerr << e.what() << " at " << __func__ << std::endl;
++        return false;
++    }
++
++    for (const std::string& interface : interfaces)
++    {
++        // We only cares about Item.Cable interface for now
++        // Even though, in most cases, the InterfacesRemoved
++        // signal won't be emitted if daemon crashes or
++        // restarts.
++        if (interface == itemCableInterface)
++        {
++            return true;
++        }
++    }
++    return false;
++}
++
++using DBusPropertiesMap = std::vector<std::pair<std::string, ipmi::Value>>;
++using DBusInteracesMap = std::vector<std::pair<std::string, DBusPropertiesMap>>;
++
++bool isExpectedInventoryInterfacesAdded(sdbusplus::message_t& message)
++{
++    // InterfacesAdded ( OBJPATH object_path,
++    //     ARRAY of DICT_ENTRY<STRING, ARRAY of DICT_ENTRY<STRING,VARIANT>>
++    //                                         interfaces_and_properties);
++    sdbusplus::message::object_path path;
++    DBusInteracesMap interfaces_and_properties;
++    try
++    {
++        message.read(path);
++        // std::cerr << "Added: " << path.str << std::endl;
++        message.read(interfaces_and_properties);
++    }
++    catch (const std::exception& e)
++    {
++        std::cerr << e.what() << " at " << __func__ << std::endl;
++        return false;
++    }
++
++    for (const auto& pair : interfaces_and_properties)
++    {
++        // Only expects Item.Cable interface for now
++        if (pair.first == itemCableInterface)
++        {
++            return true;
++        }
++    }
++    return false;
++}
++
  uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
-@@ -51,6 +93,20 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
+ {
+     static std::shared_ptr<SensorSubTree> sensorTreePtr;
+@@ -51,6 +162,28 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
          "openbmc_project/sensors/'",
          [](sdbusplus::message_t&) { sensorTreePtr.reset(); });
  
@@ -110,19 +182,27 @@
 +        sdbusplus::bus::match::rules::interfacesAdded() +
 +            sdbusplus::bus::match::rules::argNpath(
 +                0, "/xyz/openbmc_project/inventory/"),
-+        [](sdbusplus::message::message&) { sensorTreePtr.reset(); });
++        [](sdbusplus::message::message& msg) {
++        if (!isExpectedInventoryInterfacesAdded(msg))
++            return;
++        sensorTreePtr.reset();
++    });
 +
 +    static sdbusplus::bus::match::match inventoryRemoved(
 +        *dbus,
 +        sdbusplus::bus::match::rules::interfacesRemoved() +
 +            sdbusplus::bus::match::rules::argNpath(
 +                0, "/xyz/openbmc_project/inventory/"),
-+        [](sdbusplus::message::message&) { sensorTreePtr.reset(); });
++        [](sdbusplus::message::message& msg) {
++        if (!isExpectedInventoryInterfacesRemoved(msg))
++            return;
++        sensorTreePtr.reset();
++    });
 +
      if (sensorTreePtr)
      {
          subtree = sensorTreePtr;
-@@ -62,7 +118,8 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
+@@ -62,7 +195,8 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
      static constexpr const int32_t depth = 2;
  
      auto lbdUpdateSensorTree = [&dbus](const char* path,
@@ -132,7 +212,7 @@
          auto mapperCall = dbus->new_method_call(
              "xyz.openbmc_project.ObjectMapper",
              "/xyz/openbmc_project/object_mapper",
-@@ -89,7 +146,75 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
+@@ -89,7 +223,75 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
              std::fprintf(stderr, "IPMI updated: %zu sensors under %s\n",
                           sensorTreePartial.size(), path);
          }
@@ -209,16 +289,16 @@
          return true;
      };
  
-@@ -101,6 +226,8 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
+@@ -101,6 +303,8 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
          "xyz.openbmc_project.Sensor.Threshold.Critical"};
      static constexpr const std::array vrInterfaces = {
          "xyz.openbmc_project.Control.VoltageRegulatorMode"};
 +    static constexpr const std::array discreteCableInterface = {
-+        "xyz.openbmc_project.Inventory.Item.Cable"};
++        itemCableInterface};
  
      bool sensorRez = lbdUpdateSensorTree("/xyz/openbmc_project/sensors",
                                           sensorInterfaces);
-@@ -139,6 +266,10 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
+@@ -139,6 +343,10 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
      // Add VR control as optional search path.
      (void)lbdUpdateSensorTree("/xyz/openbmc_project/vr", vrInterfaces);
  
@@ -230,10 +310,10 @@
      sensorUpdatedIndex++;
      // The SDR is being regenerated, wipe the old stats
 diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
-index 55ba6d9..bb1f40a 100644
+index 5d23a19..a9deddd 100644
 --- a/dbus-sdr/sensorcommands.cpp
 +++ b/dbus-sdr/sensorcommands.cpp
-@@ -41,6 +41,7 @@
+@@ -42,6 +42,7 @@
  #include <map>
  #include <memory>
  #include <optional>
@@ -241,7 +321,7 @@
  #include <stdexcept>
  #include <string>
  #include <utility>
-@@ -153,6 +154,30 @@ static sdbusplus::bus::match_t sensorRemoved(
+@@ -154,6 +155,34 @@ static sdbusplus::bus::match_t sensorRemoved(
                          .count();
  });
  
@@ -250,7 +330,9 @@
 +                   sdbusplus::bus::match::rules::interfacesAdded() +
 +                       sdbusplus::bus::match::rules::argNpath(
 +                           0, "/xyz/openbmc_project/inventory/"),
-+                   [](sdbusplus::message::message&) {
++                   [](sdbusplus::message::message& msg) {
++    if (!details::isExpectedInventoryInterfacesAdded(msg))
++        return;
 +    getSensorTree().clear();
 +    sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
 +                     std::chrono::system_clock::now().time_since_epoch())
@@ -262,7 +344,9 @@
 +                     sdbusplus::bus::match::rules::interfacesRemoved() +
 +                         sdbusplus::bus::match::rules::argNpath(
 +                             0, "/xyz/openbmc_project/inventory/"),
-+                     [](sdbusplus::message::message&) {
++                     [](sdbusplus::message::message& msg) {
++    if (!details::isExpectedInventoryInterfacesRemoved(msg))
++        return;
 +    getSensorTree().clear();
 +    sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
 +                        std::chrono::system_clock::now().time_since_epoch())
@@ -272,7 +356,7 @@
  // this keeps track of deassertions for sensor event status command. A
  // deasertion can only happen if an assertion was seen first.
  static boost::container::flat_map<
-@@ -203,6 +228,8 @@ static sdbusplus::bus::match_t thresholdChanged(
+@@ -204,6 +233,8 @@ static sdbusplus::bus::match_t thresholdChanged(
  
  namespace sensor
  {
@@ -281,7 +365,7 @@
  static constexpr const char* vrInterface =
      "xyz.openbmc_project.Control.VoltageRegulatorMode";
  static constexpr const char* sensorInterface =
-@@ -296,6 +323,12 @@ static bool getSensorMap(ipmi::Context::ptr ctx, std::string sensorConnection,
+@@ -297,6 +328,12 @@ static bool getSensorMap(ipmi::Context::ptr ctx, std::string sensorConnection,
      }
  #endif
  
@@ -294,7 +378,7 @@
      static boost::container::flat_map<
          std::string, std::chrono::time_point<std::chrono::steady_clock>>
          updateTimeMap;
-@@ -472,43 +505,54 @@ static std::optional<double>
+@@ -473,43 +510,54 @@ static std::optional<double>
      return value;
  }
  
@@ -379,7 +463,7 @@
  }
  
  bool getVrEventStatus(ipmi::Context::ptr ctx, const std::string& connection,
-@@ -1498,6 +1542,17 @@ ipmi::RspType<uint8_t,         // sensorEventStatus
+@@ -1499,6 +1547,17 @@ ipmi::RspType<uint8_t,         // sensorEventStatus
      std::bitset<16> assertions = 0;
      std::bitset<16> deassertions = 0;
  
@@ -397,7 +481,7 @@
      // handle VR typed sensor
      auto vrInterface = sensorMap.find(sensor::vrInterface);
      if (vrInterface != sensorMap.end())
-@@ -1905,12 +1960,12 @@ void constructEventSdrHeaderKey(uint16_t sensorNum, uint16_t recordID,
+@@ -1906,12 +1965,12 @@ void constructEventSdrHeaderKey(uint16_t sensorNum, uint16_t recordID,
      record.body.entity_instance = 0x01;
  }
  
@@ -416,7 +500,7 @@
  {
      constructEventSdrHeaderKey(sensorNum, recordID, record);
  
-@@ -2145,9 +2200,11 @@ static int getSensorDataRecord(
+@@ -2146,9 +2205,11 @@ static int getSensorDataRecord(
      }
  #endif
  
@@ -431,7 +515,7 @@
      {
          get_sdr::SensorDataEventRecord record = {};
  
-@@ -2157,8 +2214,8 @@ static int getSensorDataRecord(
+@@ -2158,8 +2219,8 @@ static int getSensorDataRecord(
          {
              constructEventSdrHeaderKey(sensorNum, recordID, record);
          }
@@ -443,10 +527,20 @@
              return GENERAL_ERROR;
          }
 diff --git a/include/dbus-sdr/sdrutils.hpp b/include/dbus-sdr/sdrutils.hpp
-index 7a001a6..5e0c4f1 100644
+index 7a001a6..fc1e0e7 100644
 --- a/include/dbus-sdr/sdrutils.hpp
 +++ b/include/dbus-sdr/sdrutils.hpp
-@@ -385,4 +385,11 @@ void updateIpmiFromAssociation(
+@@ -282,6 +282,9 @@ inline IPMIWriteTable sdrWriteTable;
+ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree);
+ 
+ bool getSensorNumMap(std::shared_ptr<SensorNumMap>& sensorNumMap);
++
++bool isExpectedInventoryInterfacesRemoved(sdbusplus::message_t& message);
++bool isExpectedInventoryInterfacesAdded(sdbusplus::message_t& message);
+ } // namespace details
+ 
+ bool getSensorSubtree(SensorSubTree& subtree);
+@@ -385,4 +388,11 @@ void updateIpmiFromAssociation(
      const std::unordered_set<std::string>& ipmiDecoratorPaths,
      const DbusInterfaceMap& sensorMap, uint8_t& entityId,
      uint8_t& entityInstance);
@@ -459,5 +553,5 @@
 +
  } // namespace ipmi
 -- 
-2.43.0.rc2.451.g8631bc7472-goog
+2.44.0.278.ge034bb2e1d-goog
 
diff --git a/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-dbus-sdr-Skip-certain-temperature-sensors.patch b/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-dbus-sdr-Skip-certain-temperature-sensors.patch
new file mode 100644
index 0000000..8dfbb23
--- /dev/null
+++ b/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-dbus-sdr-Skip-certain-temperature-sensors.patch
@@ -0,0 +1,199 @@
+From 888df1c919c9b20aa6ac629e1a5a82f5b154802b Mon Sep 17 00:00:00 2001
+From: Jinliang Wang <jinliangw@google.com>
+Date: Fri, 10 Nov 2023 22:50:22 -0800
+Subject: [PATCH] dbus-sdr: Skip certain temperature sensors
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+We found the sensorTree will be reset whenever there is InterfacesAdded
+or InterfacesRemoved signal under DBus object path
+/xyz/openbmc_project/sensors or /xyz/openbmc_project/inventory.
+
+The regeneration of sensorTree cause below issues:
+1) The sdrWriteTable is wiped inside getSensorSubtree function, it won't
+   be repopulated until some external trigger such as futher
+   `ipmitool sensor` command.
+2) Also, even after the ipmi sensor table is re-generated, the ipmi
+   sensor ID may get changed when host software may still use the
+   old cached ipmi sensor ID.
+Both cases will cause sensors such as fleeting sensors unable to
+be updated. We need more investigation and design for a long term fix.
+
+This is a short-term workaround which attempts to skip some NVMe
+temperature sensors in the ipmi sensor table according to the
+SKIP_TEMP_SENSOR_REGEX meson configuration.
+It’s based on the below consideration:
+1) The nvmesensor has to handle various device reset use cases.
+   Its sensors may be destroyed and re-created during runtime.
+2) We still feed OOB NVMe temperature sensors into thermal control loops
+   and they are still exposed to Redfish. Therefore, there is no need
+   to include them into ipmi sensor sdr.
+
+Patch Tracking Bug: b/310392332
+Upstream info / review: N/A
+Upstream-Status: pending
+Justification: workaround for b/282196493
+
+Google-Bug-Id: 282196493
+Change-Id: I96dfcaa119556f6d932c79abd158f810b8b20523
+Signed-off-by: Jinliang Wang <jinliangw@google.com>
+
+%% original patch: 0003-dbus-sdr-Skip-certain-temperature-sensors.patch
+
+Signed-off-by: Jinliang Wang <jinliangw@google.com>
+---
+ dbus-sdr/sdrutils.cpp         | 39 +++++++++++++++++++++++++++++++++--
+ dbus-sdr/sensorcommands.cpp   | 12 +++++++++--
+ include/dbus-sdr/sdrutils.hpp |  1 +
+ meson.build                   |  1 +
+ meson.options                 |  3 +++
+ 5 files changed, 52 insertions(+), 4 deletions(-)
+
+diff --git a/dbus-sdr/sdrutils.cpp b/dbus-sdr/sdrutils.cpp
+index 249176e..d18fcc8 100644
+--- a/dbus-sdr/sdrutils.cpp
++++ b/dbus-sdr/sdrutils.cpp
+@@ -20,6 +20,8 @@
+ 
+ #include <ipmid/utils.hpp>
+ 
++#include <algorithm>
++#include <regex>
+ #include <optional>
+ #include <unordered_set>
+ 
+@@ -145,6 +147,18 @@ bool isExpectedInventoryInterfacesAdded(sdbusplus::message_t& message)
+     return false;
+ }
+ 
++bool isInSkipTempSensorRegex(std::string_view path)
++{
++    static std::string_view tempeartureSensorPrefix =
++        "/xyz/openbmc_project/sensors/temperature/";
++    static std::regex skipRegex{SKIP_TEMP_SENSOR_REGEX};
++
++    if (!path.starts_with(tempeartureSensorPrefix))
++        return false;
++    std::string sensorName{path.substr(tempeartureSensorPrefix.size())};
++    return std::regex_match(sensorName, skipRegex);
++}
++
+ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
+ {
+     static std::shared_ptr<SensorSubTree> sensorTreePtr;
+@@ -154,13 +168,25 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
+         *dbus,
+         "type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
+         "sensors/'",
+-        [](sdbusplus::message_t&) { sensorTreePtr.reset(); });
++        [](sdbusplus::message_t& msg) {
++        sdbusplus::message::object_path path;
++        msg.read(path);
++        if (isInSkipTempSensorRegex(path.str))
++            return;
++        sensorTreePtr.reset();
++    });
+ 
+     static sdbusplus::bus::match_t sensorRemoved(
+         *dbus,
+         "type='signal',member='InterfacesRemoved',arg0path='/xyz/"
+         "openbmc_project/sensors/'",
+-        [](sdbusplus::message_t&) { sensorTreePtr.reset(); });
++        [](sdbusplus::message_t& msg) {
++        sdbusplus::message::object_path path;
++        msg.read(path);
++        if (isInSkipTempSensorRegex(path.str))
++            return;
++        sensorTreePtr.reset();
++    });
+ 
+     static sdbusplus::bus::match::match inventoryAdded(
+         *dbus,
+@@ -218,6 +244,15 @@ uint16_t getSensorSubtree(std::shared_ptr<SensorSubTree>& subtree)
+                 phosphor::logging::entry("WHAT=%s", e.what()));
+             return false;
+         }
++
++        // Removes some skippped temperature sensors
++        sensorTreePartial.erase(std::remove_if(sensorTreePartial.begin(),
++                                               sensorTreePartial.end(),
++                                               [](const auto& pair) {
++            return isInSkipTempSensorRegex(pair.first);
++        }),
++                                sensorTreePartial.end());
++
+         if constexpr (debug)
+         {
+             std::fprintf(stderr, "IPMI updated: %zu sensors under %s\n",
+diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
+index a9deddd..7e39d1d 100644
+--- a/dbus-sdr/sensorcommands.cpp
++++ b/dbus-sdr/sensorcommands.cpp
+@@ -135,7 +135,11 @@ static sdbusplus::bus::match_t sensorAdded(
+     *getSdBus(),
+     "type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
+     "sensors/'",
+-    [](sdbusplus::message_t&) {
++    [](sdbusplus::message_t& msg) {
++    sdbusplus::message::object_path path;
++    msg.read(path);
++    if (details::isInSkipTempSensorRegex(path.str))
++        return;
+     getSensorTree().clear();
+     getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
+     sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
+@@ -147,7 +151,11 @@ static sdbusplus::bus::match_t sensorRemoved(
+     *getSdBus(),
+     "type='signal',member='InterfacesRemoved',arg0path='/xyz/openbmc_project/"
+     "sensors/'",
+-    [](sdbusplus::message_t&) {
++    [](sdbusplus::message_t& msg) {
++    sdbusplus::message::object_path path;
++    msg.read(path);
++    if (details::isInSkipTempSensorRegex(path.str))
++        return;
+     getSensorTree().clear();
+     getIpmiDecoratorPaths(/*ctx=*/std::nullopt).reset();
+     sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
+diff --git a/include/dbus-sdr/sdrutils.hpp b/include/dbus-sdr/sdrutils.hpp
+index fc1e0e7..1fa634a 100644
+--- a/include/dbus-sdr/sdrutils.hpp
++++ b/include/dbus-sdr/sdrutils.hpp
+@@ -285,6 +285,7 @@ bool getSensorNumMap(std::shared_ptr<SensorNumMap>& sensorNumMap);
+ 
+ bool isExpectedInventoryInterfacesRemoved(sdbusplus::message_t& message);
+ bool isExpectedInventoryInterfacesAdded(sdbusplus::message_t& message);
++bool isInSkipTempSensorRegex(std::string_view path);
+ } // namespace details
+ 
+ bool getSensorSubtree(SensorSubTree& subtree);
+diff --git a/meson.build b/meson.build
+index b8c34e2..8e370bc 100644
+--- a/meson.build
++++ b/meson.build
+@@ -33,6 +33,7 @@ conf_data.set_quoted('HOST_NAME', get_option('host-name'))
+ conf_data.set_quoted('POWER_READING_SENSOR', get_option('power-reading-sensor'))
+ conf_data.set_quoted('HOST_IPMI_LIB_PATH', get_option('host-ipmi-lib-path'))
+ conf_data.set_quoted('FW_VER_REGEX', get_option('fw-ver-regex'))
++conf_data.set_quoted('SKIP_TEMP_SENSOR_REGEX', get_option('skip-temp-sensor-regex'))
+ 
+ if get_option('shortname-remove-suffix').enabled()
+   conf_data.set_quoted('SHORTNAME_REMOVE_SUFFIX', '1')
+diff --git a/meson.options b/meson.options
+index c6d2425..e248268 100644
+--- a/meson.options
++++ b/meson.options
+@@ -60,6 +60,9 @@ option('hybrid-sensors', type: 'feature', value: 'disabled', description: 'Hybri
+ # Sensor Cache
+ option('sensors-cache', type: 'feature', value: 'disabled', description: 'Sensor cache stack is disabled by default; offer a way to enable it')
+ 
++# Skip certain tempearture sensors
++option('skip-temp-sensor-regex', type : 'string', value : '', description : 'Regular expressions for skipping certain tempearture sensors')
++
+ # Short Sensor Names for IPMI
+ option('shortname-remove-suffix', type: 'feature', value: 'enabled', description: 'shortname-remove-suffix is enabled by default')
+ option('shortname-replace-words', type: 'feature', value: 'disabled', description: 'shortname-replace-words is disabled by default')
+-- 
+2.44.0.278.ge034bb2e1d-goog
+
diff --git a/recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-ID-String-Type-Length-Code-byte-for-get-sdr-comm.patch b/recipes-phosphor/ipmi/phosphor-ipmi-host/0004-Fix-ID-String-Type-Length-Code-byte-for-get-sdr-comm.patch
similarity index 100%
rename from recipes-phosphor/ipmi/phosphor-ipmi-host/0003-Fix-ID-String-Type-Length-Code-byte-for-get-sdr-comm.patch
rename to recipes-phosphor/ipmi/phosphor-ipmi-host/0004-Fix-ID-String-Type-Length-Code-byte-for-get-sdr-comm.patch
diff --git a/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
index 3282fd0..79cff40 100644
--- a/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
+++ b/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend
@@ -5,5 +5,6 @@
 SRC_URI:append:gbmc = " \
   file://0001-sdr-dbus-Reduce-log-spam-on-bitmap-error.patch \
   file://0002-Support-packing-cable-presence-sensor-state-into-dis.patch \
-  file://0003-Fix-ID-String-Type-Length-Code-byte-for-get-sdr-comm.patch \
+  file://0003-dbus-sdr-Skip-certain-temperature-sensors.patch \
+  file://0004-Fix-ID-String-Type-Length-Code-byte-for-get-sdr-comm.patch \
 "