diff options
author | jmbills <jason.m.bills@intel.com> | 2021-10-04 22:42:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-04 22:42:48 +0300 |
commit | 0c9e31989c615598b5d042ffab385606660c93c0 (patch) | |
tree | 8019999b0ca042482e5193d6cabc06220c71d776 /meta-openbmc-mods/meta-common/recipes-phosphor/sensors | |
parent | 04cd92067d2481643df5010cb39b2134b648cf4d (diff) | |
parent | ffe6d597d9e3d4407cf8062b5d6505a80ce08f41 (diff) | |
download | openbmc-0c9e31989c615598b5d042ffab385606660c93c0.tar.xz |
Update
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/sensors')
3 files changed, 174 insertions, 11 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Fix-missing-threshold-de-assert-event-when-threshold.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Fix-missing-threshold-de-assert-event-when-threshold.patch index 6815b5563..1cba1095d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Fix-missing-threshold-de-assert-event-when-threshold.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0003-Fix-missing-threshold-de-assert-event-when-threshold.patch @@ -1,4 +1,4 @@ -From 235bb8a9b809c2449e3f5bf4e999db881012c144 Mon Sep 17 00:00:00 2001 +From db4353de222b51726c8e3c765cc8f1df4ad67687 Mon Sep 17 00:00:00 2001 From: Zhikui Ren <zhikui.ren@intel.com> Date: Tue, 22 Jun 2021 11:35:12 -0700 Subject: [PATCH] Fix missing de-assert event when threshold changes @@ -42,8 +42,8 @@ Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> --- include/Thresholds.hpp | 2 +- include/sensor.hpp | 2 ++ - src/Thresholds.cpp | 17 ++++++++++++++--- - 3 files changed, 17 insertions(+), 4 deletions(-) + src/Thresholds.cpp | 20 ++++++++++++++++---- + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/Thresholds.hpp b/include/Thresholds.hpp index af63f72..fd507d0 100644 @@ -79,7 +79,7 @@ index b98241b..6235674 100644 } diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp -index bbe8e20..78ded55 100644 +index 821083a..da0d650 100644 --- a/src/Thresholds.cpp +++ b/src/Thresholds.cpp @@ -418,10 +418,19 @@ bool checkThresholds(Sensor* sensor) @@ -103,7 +103,22 @@ index bbe8e20..78ded55 100644 if (change.threshold.level == thresholds::Level::CRITICAL && change.asserted) { -@@ -473,7 +482,7 @@ void checkThresholdsPowerDelay(const std::weak_ptr<Sensor>& weakSensor, +@@ -443,6 +452,7 @@ void checkThresholdsPowerDelay(const std::weak_ptr<Sensor>& weakSensor, + + Sensor* sensor = sensorPtr.get(); + std::vector<ChangeParam> changes = checkThresholds(sensor, sensor->value); ++ bool forceAssert = !sensor->hadValidValue; + for (const auto& change : changes) + { + // When CPU is powered off, some volatges are expected to +@@ -467,13 +477,13 @@ void checkThresholdsPowerDelay(const std::weak_ptr<Sensor>& weakSensor, + } + } + assertThresholds(sensor, change.assertValue, change.threshold.level, +- change.threshold.direction, change.asserted); ++ change.threshold.direction, change.asserted, forceAssert); + } + } void assertThresholds(Sensor* sensor, double assertValue, thresholds::Level level, thresholds::Direction direction, @@ -112,7 +127,7 @@ index bbe8e20..78ded55 100644 { std::string property; std::shared_ptr<sdbusplus::asio::dbus_interface> interface; -@@ -513,7 +522,9 @@ void assertThresholds(Sensor* sensor, double assertValue, +@@ -513,7 +523,9 @@ void assertThresholds(Sensor* sensor, double assertValue, return; } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0009-CPUSensor-Create-CPUConfig-for-each-PECI-adapter.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0009-CPUSensor-Create-CPUConfig-for-each-PECI-adapter.patch new file mode 100644 index 000000000..737ba9128 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0009-CPUSensor-Create-CPUConfig-for-each-PECI-adapter.patch @@ -0,0 +1,147 @@ +From 262682632ee493d0b6593540cfc902d11286b7c3 Mon Sep 17 00:00:00 2001 +From: Iwona Winiarska <iwona.winiarska@intel.com> +Date: Tue, 13 Jul 2021 15:16:16 +0200 +Subject: [PATCH] CPUSensor: Create CPUConfig for each PECI adapter + +Currently CPUSensor is based on configuration that defines CPUs for the +specific PECI adapter (usually peci-wire). As a consequence, MFD devices +are created only for the defined adapter. + +Since duplicating static CPU records in configuration file for other +PECI adapters may be confusing to users, let's add CPUConfig for other +PECI adapters dynamically by detecting if there is more than one PECI +adapter driver bound in the system. + +Please note, that this change is limited to enabling HWMON driver, +sensors for all adapters will not be exposed on D-Bus. + +Tested: +No changes if only one PECI interface is available, HWMON drivers +creation will be based on provided configuration. +When both peci-aspeed (peci-wire) and peci-mctp are bound in the system, +HWMON drivers are created for each PECI interface. + +Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com> +--- + src/CPUSensorMain.cpp | 90 +++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 90 insertions(+) + +diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp +index 744ca50..6850df7 100644 +--- a/src/CPUSensorMain.cpp ++++ b/src/CPUSensorMain.cpp +@@ -33,6 +33,7 @@ + #include <fstream> + #include <functional> + #include <memory> ++#include <optional> + #include <regex> + #include <sstream> + #include <stdexcept> +@@ -658,6 +659,91 @@ void detectCpuAsync( + }); + } + ++std::optional<uint64_t> getPeciDeviceNum(const fs::path& peciAdapterNamePath) ++{ ++ fs::path::iterator it = peciAdapterNamePath.begin(); ++ std::advance(it, 5); // /sys/bus/peci/devices/peci-xxxx ++ std::string peciDeviceName = *it; ++ auto pos = peciDeviceName.find('-'); ++ if (pos == std::string::npos) ++ { ++ std::cerr << "Incorrect PECI device name: " << peciDeviceName << "\n"; ++ return std::nullopt; ++ } ++ ++ try ++ { ++ return std::stoull(peciDeviceName.substr(pos + 1, 1)); ++ } ++ catch (std::logic_error&) ++ { ++ return std::nullopt; ++ } ++} ++ ++std::optional<std::string> ++ readPeciAdapterNameFromFile(const fs::path& peciAdapterNamePath) ++{ ++ std::ifstream nameFile(peciAdapterNamePath); ++ if (!nameFile.good()) ++ { ++ std::cerr << "Cannot read: " << peciAdapterNamePath << "\n"; ++ return std::nullopt; ++ } ++ ++ std::string peciAdapterName; ++ std::getline(nameFile, peciAdapterName); ++ nameFile.close(); ++ if (peciAdapterName.empty()) ++ { ++ return std::nullopt; ++ } ++ ++ auto pos = peciAdapterName.find('-'); ++ peciAdapterName = peciAdapterName.substr(pos + 1); ++ ++ return peciAdapterName; ++} ++ ++void addConfigsForOtherPeciAdapters( ++ boost::container::flat_set<CPUConfig>& cpuConfigs, uint64_t& bus, ++ uint64_t& addr, std::string& name, const State& state) ++{ ++ std::vector<fs::path> peciAdapterNamePaths; ++ if (!findFiles(fs::path(peciDevPath), R"(peci-\d+/name$)", ++ peciAdapterNamePaths, 1)) ++ { ++ std::cerr << "No PECI adapters in system\n"; ++ return; ++ } ++ ++ for (const fs::path& peciAdapterNamePath : peciAdapterNamePaths) ++ { ++ std::optional<uint64_t> peciDeviceNum = ++ getPeciDeviceNum(peciAdapterNamePath); ++ if (!peciDeviceNum || peciDeviceNum == bus) ++ { ++ continue; ++ } ++ ++ std::optional<std::string> peciAdapterName = ++ readPeciAdapterNameFromFile(peciAdapterNamePath); ++ if (!peciAdapterName) ++ { ++ continue; ++ } ++ ++ // Change result for peci-aspeed ++ if (peciAdapterName->compare("bus") == 0) ++ { ++ peciAdapterName = "wire"; ++ } ++ ++ cpuConfigs.emplace(*peciDeviceNum, addr, name + "_" + *peciAdapterName, ++ state); ++ } ++} ++ + bool getCpuConfig(std::shared_ptr<sdbusplus::asio::connection>& systemBus, + boost::container::flat_set<CPUConfig>& cpuConfigs, + ManagedObjectType& sensorConfigs, boost::asio::io_service& io, +@@ -789,7 +875,11 @@ bool getCpuConfig(std::shared_ptr<sdbusplus::asio::connection>& systemBus, + std::cout << "name: " << name << "\n"; + std::cout << "type: " << type << "\n"; + } ++ + cpuConfigs.emplace(bus, addr, name, State::OFF); ++ ++ addConfigsForOtherPeciAdapters(cpuConfigs, bus, addr, name, ++ State::OFF); + } + } + } +-- +2.31.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend index fbaf497b3..b54b8e974 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -1,7 +1,7 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" -SRCREV = "5cf0f99210890d0cd52d5929e919316d238a5701" +SRCREV = "5ab424a6a4ea56e5fbfad5a1813bed7bfabbd399" #SRC_URI = "git://github.com/openbmc/dbus-sensors.git" SRC_URI += "\ @@ -14,9 +14,10 @@ SRC_URI += "\ file://0006-CPUSensor-create-RequirediTempSensor-if-defined.patch \ file://0007-Add-support-for-the-energy-hwmon-type.patch \ file://0008-CPUSensor-additional-debug-message.patch \ + file://0009-CPUSensor-Create-CPUConfig-for-each-PECI-adapter.patch \ " -DEPENDS_append = " libgpiod libmctp" +DEPENDS:append = " libgpiod libmctp" PACKAGECONFIG += " \ adcsensor \ @@ -35,11 +36,11 @@ PACKAGECONFIG[nvmesensor] = "-Dnvme=enabled, -Dnvme=disabled" # Enable Validation unsecure based on IMAGE_FEATURES EXTRA_OEMESON += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-Dvalidate-unsecure-feature=enabled', '', d)}" -SYSTEMD_SERVICE_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'nvmesensor', \ +SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'nvmesensor', \ 'xyz.openbmc_project.nvmesensor.service', \ '', d)}" -do_install_append() { +do_install:append() { svc="xyz.openbmc_project.intrusionsensor.service" srcf="${WORKDIR}/intrusionsensor-depend-on-networkd.conf" dstf="${D}/etc/systemd/system/${svc}.d/10-depend-on-networkd.conf" |