diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor')
46 files changed, 1540 insertions, 360 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb index b91cc5e9e..7426dc6de 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/biosconfig-manager/biosconfig-manager_git.bb @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fe inherit meson systemd SRC_URI = "git://github.com/openbmc/bios-settings-mgr.git" -SRCREV = "c0f926d6cbf9636a42f4bc3d33b9602e4633c478" +SRCREV = "5e2cb7206e695662f09c7cb4e0c73ba11686acaa" SYSTEMD_SERVICE_${PN} += " \ xyz.openbmc_project.biosconfig_manager.service \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0004-Adding-MUX-and-Drives-present-in-HSBP-in-json-config.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0004-Adding-MUX-and-Drives-present-in-HSBP-in-json-config.patch new file mode 100644 index 000000000..4f6679dde --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0004-Adding-MUX-and-Drives-present-in-HSBP-in-json-config.patch @@ -0,0 +1,149 @@ +From 95a1f9e5f65d35adc3cf8d3b3095d92b63c17f85 Mon Sep 17 00:00:00 2001 +From: AKSHAY RAVEENDRAN K <akshay.raveendran.k@intel.com> +Date: Sun, 20 Jun 2021 18:22:34 +0000 +Subject: [PATCH] Add MUX and Drives present in HSBP in json configuration + +Added Mux addresses for all 3 HSBP configuration and the drive +names to be exposed via entity manager when the HSBP is connected + +Added board instance to separate each HSBP board. + +Tested: +After this addition, detected the MUXes in entity manager +tree as well as in /dev/i2c-mux location. Also able to detect +the drive address. + +Change-Id: Ic07e3880cf5b6f8a47ee7b8f1f98e12042765da8 +Signed-off-by: AKSHAY RAVEENDRAN K <akshay.raveendran.k@intel.com> + +--- + configurations/F2U8X25 HSBP.json | 78 ++++++++++++++++++++++++++++++-- + 1 file changed, 75 insertions(+), 3 deletions(-) + +diff --git a/configurations/F2U8X25 HSBP.json b/configurations/F2U8X25 HSBP.json +index c6c7678..e2eedfa 100644 +--- a/configurations/F2U8X25 HSBP.json ++++ b/configurations/F2U8X25 HSBP.json +@@ -7,6 +7,30 @@ + "Name": "F2U8X25 HSBP1 FRU", + "Type": "EEPROM" + }, ++ { ++ "Address": "0x70", ++ "Bus": "$bus", ++ "ChannelNames": [ ++ "Drive_1", ++ "Drive_2", ++ "Drive_3", ++ "Drive_4" ++ ], ++ "Name": "Drive Mux 1", ++ "Type": "PCA9546Mux" ++ }, ++ { ++ "Address": "0x74", ++ "Bus": "$bus", ++ "ChannelNames": [ ++ "Drive_5", ++ "Drive_6", ++ "Drive_7", ++ "Drive_8" ++ ], ++ "Name": "Drive Mux 2", ++ "Type": "PCA9546Mux" ++ }, + { + "Address": "0x48", + "Bus": "$bus", +@@ -40,7 +64,7 @@ + "Type": "TMP75" + } + ], +- "Name": "F2U8X25 HSBP", ++ "Name": "F2U8X25 HSBP 1", + "Probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'F2U8X25PCIHSBP', 'ADDRESS': 80})", + "Type": "Board", + "xyz.openbmc_project.Inventory.Decorator.Asset": { +@@ -58,6 +82,30 @@ + "Name": "F2U8X25 HSBP2 FRU", + "Type": "EEPROM" + }, ++ { ++ "Address": "0x73", ++ "Bus": "$bus", ++ "ChannelNames": [ ++ "Drive_9", ++ "Drive_10", ++ "Drive_11", ++ "Drive_12" ++ ], ++ "Name": "Drive Mux 3", ++ "Type": "PCA9546Mux" ++ }, ++ { ++ "Address": "0x77", ++ "Bus": "$bus", ++ "ChannelNames": [ ++ "Drive_13", ++ "Drive_14", ++ "Drive_15", ++ "Drive_16" ++ ], ++ "Name": "Drive Mux 4", ++ "Type": "PCA9546Mux" ++ }, + { + "Address": "0x4B", + "Bus": "$bus", +@@ -91,7 +139,7 @@ + "Type": "TMP75" + } + ], +- "Name": "F2U8X25 HSBP", ++ "Name": "F2U8X25 HSBP 2", + "Probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'F2U8X25PCIHSBP', 'ADDRESS': 83})", + "Type": "Board", + "xyz.openbmc_project.Inventory.Decorator.Asset": { +@@ -109,6 +157,30 @@ + "Name": "F2U8X25 HSBP3 FRU", + "Type": "EEPROM" + }, ++ { ++ "Address": "0x72", ++ "Bus": "$bus", ++ "ChannelNames": [ ++ "Drive_17", ++ "Drive_18", ++ "Drive_19", ++ "Drive_20" ++ ], ++ "Name": "Drive Mux 5", ++ "Type": "PCA9546Mux" ++ }, ++ { ++ "Address": "0x76", ++ "Bus": "$bus", ++ "ChannelNames": [ ++ "Drive_21", ++ "Drive_22", ++ "Drive_23", ++ "Drive_24" ++ ], ++ "Name": "Drive Mux 6", ++ "Type": "PCA9546Mux" ++ }, + { + "Address": "0x4A", + "Bus": "$bus", +@@ -142,7 +214,7 @@ + "Type": "TMP75" + } + ], +- "Name": "F2U8X25 HSBP", ++ "Name": "F2U8X25 HSBP 3", + "Probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'F2U8X25PCIHSBP', 'ADDRESS': 82})", + "Type": "Board", + "xyz.openbmc_project.Inventory.Decorator.Asset": { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend index a7448a84b..9447fb3cb 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend @@ -1,10 +1,11 @@ # this is here just to bump faster than upstream # SRC_URI = "git://github.com/openbmc/entity-manager.git" -SRCREV = "cda147301b0fa7eac99eee3a7565604dbd6f74dd" +SRCREV = "c02d8cbbe8ded5368014d66bcf3279de758011d9" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += " file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ file://0003-Add-logs-to-fwVersionIsSame.patch \ + file://0004-Adding-MUX-and-Drives-present-in-HSBP-in-json-config.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp b/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp index 00e2b53fe..454bdc1db 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/datetime/pch-time-sync/pch-time-sync.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#include <systemd/sd-journal.h> #include <time.h> #include <boost/asio/io_service.hpp> @@ -323,9 +324,22 @@ class PCHSync { return false; } - phosphor::logging::log<phosphor::logging::level::INFO>( - "Update BMC time to: ", - phosphor::logging::entry("TIME=%s", dateString.c_str())); + char newDateString[32] = {0}; + strftime(newDateString, sizeof(newDateString), "%F %T", + gmtime(&PCHTimeSeconds)); + + struct tm* timeinfo; + char oldDateString[32] = {0}; + timeinfo = gmtime(&BMCTimeSeconds); + strftime(oldDateString, sizeof(oldDateString), "%F %T", timeinfo); + + // Log event about BMC time update via PCH + sd_journal_send( + "MESSAGE=BMC time updated via PCH: New time=%s, Old time=%s", + newDateString, oldDateString, "PRIORITY=%i", LOG_INFO, + "REDFISH_MESSAGE_ID=%s", "OpenBMC.0.1.BMCTimeUpdatedViaHost", + "REDFISH_MESSAGE_ARGS=%s,%s", newDateString, oldDateString, + NULL); } // During the boot time, systemd-timesyncd.service checks diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0034-Add-username-property-to-SessionInfo-interface.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0034-Add-username-property-to-SessionInfo-interface.patch new file mode 100644 index 000000000..29c49874a --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces/0034-Add-username-property-to-SessionInfo-interface.patch @@ -0,0 +1,64 @@ +From 3a507873ed733ed0e313f6efb89f7a491577e015 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> +Date: Tue, 1 Jun 2021 12:27:50 +0000 +Subject: [PATCH] Add username property to SessionInfo interface + +Add username property to SessionInfo interface to get username info on +individual IPMI session Id's on Redfish + +Tested: +Verified on SessionInfo D-bus interface. + +busctl introspect xyz.openbmc_project.Ipmi.Channel.eth0 + /xyz/openbmc_project/ipmi/session/eth0/0 +NAME TYPE SIGNATURE RESULT/VALUE FLAGS +...... +xyz.openbmc_project.Ipmi.SessionInfo interface - - - +.ChannelNum property y 0 emits-change writable +.CurrentPrivilege property y 0 emits-change writable +.RemoteIPAddr property u 2225389066 emits-change writable +.RemoteMACAddress property ay 0 emits-change writable +.RemotePort property q 35749 emits-change writable +.SessionHandle property y 0 emits-change writable +.State property y 0 emits-change writable +.UserID property y 0 emits-change writable +.Username property s "" emits-change writable + +Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> +--- + xyz/openbmc_project/Ipmi/SESSION_README.md | 1 + + xyz/openbmc_project/Ipmi/SessionInfo.interface.yaml | 6 ++++++ + 2 files changed, 7 insertions(+) + +diff --git a/xyz/openbmc_project/Ipmi/SESSION_README.md b/xyz/openbmc_project/Ipmi/SESSION_README.md +index c59b251..18ae66a 100644 +--- a/xyz/openbmc_project/Ipmi/SESSION_README.md ++++ b/xyz/openbmc_project/Ipmi/SESSION_README.md +@@ -16,6 +16,7 @@ so that both phosphor-ipmi-host & phosphr-ipmi-net will be in sync. + * RemotePort - Remote port address. + * RemoteMACAddress -Remote MAC Address. + * UserID - Session created by given user id. ++* Username - Session created by given username. + + + +diff --git a/xyz/openbmc_project/Ipmi/SessionInfo.interface.yaml b/xyz/openbmc_project/Ipmi/SessionInfo.interface.yaml +index 0ddc025..a7c3a90 100644 +--- a/xyz/openbmc_project/Ipmi/SessionInfo.interface.yaml ++++ b/xyz/openbmc_project/Ipmi/SessionInfo.interface.yaml +@@ -46,6 +46,12 @@ properties: + Session created by given user ID. + errors: + - xyz.openbmc_project.Common.Error.InternalFailure ++ - name: Username ++ type: string ++ description: > ++ Session created by given username. ++ errors: ++ - xyz.openbmc_project.Common.Error.InternalFailure + - name: State + type: byte + default: 0 +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend index e935531ee..a90647b14 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/dbus/phosphor-dbus-interfaces_%.bbappend @@ -1,7 +1,7 @@ # Keep this as a comment to enable the auto-bump script without # stomping on SRC_URI from previous .bbappend files #SRC_URI = "git://github.com/openbmc/phosphor-dbus-interfaces.git" -SRCREV = "33458d4432a8323616622881f314a73cf0b04d97" +SRCREV = "28dcc9a3bd3cf2e0f99f8d225dfd47b85815720e" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" @@ -18,4 +18,5 @@ SRC_URI += "file://0007-ipmi-set-BIOS-id.patch \ file://0030-Add-PLDM-version-purpose-enumeration.patch \ file://0032-update-meson-build-for-MCTP-interfaces.patch \ file://0033-update-meson-build-for-PLDM-FWU-interfaces.patch \ + file://0034-Add-username-property-to-SessionInfo-interface.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch index 0a47e3278..b8df3e07c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch @@ -1,4 +1,4 @@ -From 6ce336adafd723319befc4ce918ba67a0ad3492c Mon Sep 17 00:00:00 2001 +From 6e95f4a761021e3204912e3a7c5b80a18d9f16cf Mon Sep 17 00:00:00 2001 From: Jennifer Lee <jennifer1.lee@intel.com> Date: Mon, 10 Dec 2018 10:36:44 -0800 Subject: [PATCH] Modified firmware activation to launch fwupd.sh through @@ -11,35 +11,43 @@ Subject: [PATCH] Modified firmware activation to launch fwupd.sh through Signed-off-by: Jennifer Lee <jennifer1.lee@intel.com> Signed-off-by: James Feist <james.feist@linux.intel.com> --- - activation.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- + activation.cpp | 50 +++++++++++++++++++++++++++++++++++++---------- meson.build | 2 ++ meson_options.txt | 3 +++ - static/flash.cpp | 42 ++++++++++++++++++++++++++++++++++++++++-- + static/flash.cpp | 42 +++++++++++++++++++++++++++++++++++++-- ubi/flash.cpp | 9 +++------ - 5 files changed, 92 insertions(+), 9 deletions(-) + 5 files changed, 88 insertions(+), 18 deletions(-) diff --git a/activation.cpp b/activation.cpp -index c82e297..d690a39 100644 +index 5490cd9974b3..e43959d78ed2 100644 --- a/activation.cpp +++ b/activation.cpp -@@ -88,7 +88,50 @@ auto Activation::activation(Activations value) -> Activations - +@@ -88,20 +88,50 @@ auto Activation::activation(Activations value) -> Activations + if (value == softwareServer::Activation::Activations::Activating) { +-#ifdef WANT_SIGNATURE_VERIFY +- fs::path uploadDir(IMG_UPLOAD_DIR); +- if (!verifySignature(uploadDir / versionId, SIGNED_IMAGE_CONF_PATH)) +#ifdef FWUPD_SCRIPT + if (!activationProgress) -+ { + { +- onVerifyFailed(); +- // Stop the activation process, if fieldMode is enabled. +- if (parent.control::FieldMode::fieldModeEnabled()) + // Enable systemd signals + Activation::subscribeToSystemdSignals(); + parent.freeSpace(*this); + + activationProgress = + std::make_unique<ActivationProgress>(bus, path); - ++ +#ifdef WANT_SIGNATURE_VERIFY + fs::path uploadDir(IMG_UPLOAD_DIR); + if (!verifySignature(uploadDir / versionId, SIGNED_IMAGE_CONF_PATH)) -+ { + { +- return softwareServer::Activation::activation( +- softwareServer::Activation::Activations::Failed); + onVerifyFailed(); + // Stop the activation process, if fieldMode is enabled. + if (parent.control::FieldMode::fieldModeEnabled()) @@ -47,8 +55,9 @@ index c82e297..d690a39 100644 + return softwareServer::Activation::activation( + softwareServer::Activation::Activations::Failed); + } -+ } -+#endif + } +- } + #endif + flashWrite(); + } + else if (activationProgress->progress() == 100) @@ -62,7 +71,7 @@ index c82e297..d690a39 100644 + + // Remove version object from image manager + Activation::deleteImageManagerObject(); -+ + + // Create active association + parent.createActiveAssociation(path); + @@ -73,7 +82,7 @@ index c82e297..d690a39 100644 #ifdef HOST_BIOS_UPGRADE auto purpose = parent.versions.find(versionId)->second->purpose(); if (purpose == VersionPurpose::Host) -@@ -111,7 +154,6 @@ auto Activation::activation(Activations value) -> Activations +@@ -124,7 +154,6 @@ auto Activation::activation(Activations value) -> Activations return softwareServer::Activation::activation(value); } #endif @@ -81,7 +90,7 @@ index c82e297..d690a39 100644 auto versionStr = parent.versions.find(versionId)->second->version(); if (!minimum_ship_level::verify(versionStr)) -@@ -175,6 +217,7 @@ auto Activation::activation(Activations value) -> Activations +@@ -174,6 +203,7 @@ auto Activation::activation(Activations value) -> Activations return softwareServer::Activation::activation( softwareServer::Activation::Activations::Active); #endif @@ -90,7 +99,7 @@ index c82e297..d690a39 100644 else { diff --git a/meson.build b/meson.build -index a6ebcc4..5c79009 100644 +index a6ebcc43c0ec..5c7900924959 100644 --- a/meson.build +++ b/meson.build @@ -59,6 +59,8 @@ conf.set('WANT_SIGNATURE_VERIFY', \ @@ -103,7 +112,7 @@ index a6ebcc4..5c79009 100644 conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name')) diff --git a/meson_options.txt b/meson_options.txt -index 0877798..da257b7 100644 +index 4def7f982809..74e757b75f01 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -25,6 +25,9 @@ option('verify-signature', type: 'feature', @@ -117,7 +126,7 @@ index 0877798..da257b7 100644 option( 'active-bmc-max-allowed', type: 'integer', diff --git a/static/flash.cpp b/static/flash.cpp -index 101828b..5506a59 100644 +index 101828b1ade5..5506a59ac499 100644 --- a/static/flash.cpp +++ b/static/flash.cpp @@ -22,9 +22,11 @@ namespace updater @@ -183,7 +192,7 @@ index 101828b..5506a59 100644 } // namespace updater diff --git a/ubi/flash.cpp b/ubi/flash.cpp -index a263bfb..c58eefc 100644 +index a263bfb81116..c58eefc4ec48 100644 --- a/ubi/flash.cpp +++ b/ubi/flash.cpp @@ -15,13 +15,10 @@ void Activation::flashWrite() diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0018-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0018-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch index 587421044..eb5a40fbf 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0018-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0018-Fix-delete-image-by-ID-and-inhibit-removal-of-bmc_ac.patch @@ -13,8 +13,8 @@ Also, there was a logic error in deleting images that would delete the active BMC image. This fixes up that error. Tested: run multiple back-to back updates and see that when the fwupd - script calls delete on the seamless images, the interfaces are - deleted and that the bmc_active interface is not deleted. + script calls delete, the interfaces are deleted and that the + bmc_active interface is not deleted. Signed-off-by: Vernon Mauery <vernon.mauery@intel.com> Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch new file mode 100644 index 000000000..829384305 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch @@ -0,0 +1,77 @@ +From 3ec1f79d1cb29724e345586f0baefca81d98d3ae Mon Sep 17 00:00:00 2001 +From: mansijos <mansi.joshi@intel.com> +Date: Wed, 26 May 2021 17:40:04 +0530 +Subject: [PATCH] [bmcweb] Add BMC Time update log to the registry + +Add message in registry to log an event that indicates BMC time +is set via NTP, Host or Manually. +During early stage of system boot if any critical events occur, +they are getting logged with 1970 timestamp till the time BMC +time update happens. This is expected behavior, but to call it out +explicitly it is good to log when BMC time is updated. + +Tested: +Built and validator passes. +Confirmed that the event is getting logged correctly in Redfish. + +Signed-off-by: mansijos <mansi.joshi@intel.com> +--- + .../registries/openbmc_message_registry.hpp | 35 ++++++++++++++++++- + 1 file changed, 34 insertions(+), 1 deletion(-) + +diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp +index 2f981db..a00d235 100644 +--- a/redfish-core/include/registries/openbmc_message_registry.hpp ++++ b/redfish-core/include/registries/openbmc_message_registry.hpp +@@ -29,7 +29,7 @@ const Header header = { + "0.2.0", + "OpenBMC", + }; +-constexpr std::array<MessageEntry, 193> registry = { ++constexpr std::array<MessageEntry, 196> registry = { + MessageEntry{ + "ADDDCCorrectable", + { +@@ -286,6 +286,39 @@ constexpr std::array<MessageEntry, 193> registry = { + {}, + "None.", + }}, ++ MessageEntry{"BMCTimeUpdatedViaHost", ++ { ++ "Indicates that BMC time has been set via Host.", ++ "BMC time has been set via Host. " ++ "Date Time is set to %1 from %2.", ++ "OK", ++ "OK", ++ 2, ++ {"string", "string"}, ++ "None.", ++ }}, ++ MessageEntry{"BMCTimeUpdatedManually", ++ { ++ "Indicates that BMC time has been set Manually.", ++ "BMC time has been set Manually. " ++ "Date Time is set to %1 from %2.", ++ "OK", ++ "OK", ++ 2, ++ {"string", "string"}, ++ "None.", ++ }}, ++ MessageEntry{"BMCTimeUpdatedViaNTP", ++ { ++ "Indicates that BMC time has been set via NTP.", ++ "BMC time has been set via NTP. " ++ "Date Time is set to %1 from %2.", ++ "OK", ++ "OK", ++ 2, ++ {"string", "string"}, ++ "None.", ++ }}, + MessageEntry{"ChassisIntrusionDetected", + { + "Indicates that a physical security event " +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch new file mode 100644 index 000000000..756ea24d7 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0019-Add-generic-message-PropertySizeExceeded.patch @@ -0,0 +1,118 @@ +From da893566ec02aefe235685f1b6742269aab37909 Mon Sep 17 00:00:00 2001 +From: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com> +Date: Thu, 24 Jun 2021 15:29:24 +0000 +Subject: [PATCH] Add generic message - PropertySizeExceeded + +Adding a generic error message "PropertySizeExceeded" +to address properties which exceed there defined size limit. + +Tested: +No functional change. Build passed. +Verified by explicitly sending this message as a response. + +Change-Id: I0e9f85f82a69c598e169fc8e9a68c3f66c0084d8 +Signed-off-by: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com> +--- + redfish-core/include/error_messages.hpp | 12 +++++++++ + .../registries/base_message_registry.hpp | 17 +++++++++++- + redfish-core/src/error_messages.cpp | 27 +++++++++++++++++++ + 3 files changed, 55 insertions(+), 1 deletion(-) + +diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp +index 922dae9..586246c 100644 +--- a/redfish-core/include/error_messages.hpp ++++ b/redfish-core/include/error_messages.hpp +@@ -222,6 +222,18 @@ nlohmann::json propertyValueFormatError(const std::string& arg1, + void propertyValueFormatError(crow::Response& res, const std::string& arg1, + const std::string& arg2); + ++/** ++ * @brief Formats PropertySizeExceeded message into JSON ++ * Message body: "The property <arg1> is too long. The value exceeds its size ++ * limit." ++ * ++ * @param[in] arg1 Parameter of message that will replace %1 in its body. ++ * ++ * @returns Message PropertySizeExceeded formatted to JSON */ ++nlohmann::json propertySizeExceeded(const std::string& arg1); ++ ++void propertySizeExceeded(crow::Response& res, const std::string& arg1); ++ + /** + * @brief Formats PropertyValueNotInList message into JSON + * Message body: "The value <arg1> for the property <arg2> is not in the list of +diff --git a/redfish-core/include/registries/base_message_registry.hpp b/redfish-core/include/registries/base_message_registry.hpp +index 7c385a0..79d324e 100644 +--- a/redfish-core/include/registries/base_message_registry.hpp ++++ b/redfish-core/include/registries/base_message_registry.hpp +@@ -36,7 +36,7 @@ const Header header = { + constexpr const char* url = + "https://redfish.dmtf.org/registries/Base.1.8.1.json"; + +-constexpr std::array<MessageEntry, 74> registry = { ++constexpr std::array<MessageEntry, 75> registry = { + MessageEntry{ + "AccessDenied", + { +@@ -592,6 +592,21 @@ constexpr std::array<MessageEntry, 74> registry = { + "Remove the property from the request body and resubmit " + "the request if the operation failed.", + }}, ++ MessageEntry{"PropertySizeExceeded", ++ { ++ "Indicates that a given property exceeds the size " ++ "limit imposed.", ++ "The property %1 is too long. The value exceeds " ++ "its size limit.", ++ "Warning", ++ "Warning", ++ 1, ++ { ++ "string", ++ }, ++ "Correct the value for the property in the request body " ++ "and resubmit the request if the operation failed.", ++ }}, + MessageEntry{"PropertyUnknown", + { + "Indicates that an unknown property was included in the " +diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp +index 409adb1..11e59be 100644 +--- a/redfish-core/src/error_messages.cpp ++++ b/redfish-core/src/error_messages.cpp +@@ -514,6 +514,33 @@ void propertyValueFormatError(crow::Response& res, const std::string& arg1, + addMessageToJson(res.jsonValue, propertyValueFormatError(arg1, arg2), arg2); + } + ++/** ++ * @internal ++ * @brief Formats PropertySizeExceeded message into JSON for the specified ++ * property ++ * ++ * See header file for more information ++ * @endinternal ++ */ ++nlohmann::json propertySizeExceeded(const std::string& arg1) ++{ ++ return nlohmann::json{ ++ {"@odata.type", "#Message.v1_1_1.Message"}, ++ {"MessageId", "Base.1.8.1.PropertySizeExceeded"}, ++ {"Message", "The property " + arg1 + ++ " is too long. The value exceeds its size limit."}, ++ {"MessageArgs", {arg1}}, ++ {"MessageSeverity", "Warning"}, ++ {"Resolution", "Correct the value for the property in the request body " ++ "and resubmit the request if the operation failed."}}; ++} ++ ++void propertySizeExceeded(crow::Response& res, const std::string& arg1) ++{ ++ res.result(boost::beast::http::status::bad_request); ++ addMessageToJson(res.jsonValue, propertySizeExceeded(arg1), arg1); ++} ++ + /** + * @internal + * @brief Formats PropertyValueNotInList message into JSON for the specified +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch index 16e8affa5..c3e3acbca 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch @@ -1,4 +1,4 @@ -From dda3c7a46391ef88e7c6a6f61fba7fe9133336bf Mon Sep 17 00:00:00 2001 +From 3dc6f6d807060cf3b38486e4190fd1ba9c66c66b Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Wed, 17 Mar 2021 01:16:50 +0000 Subject: [PATCH] Add EventService SSE filter support @@ -25,25 +25,26 @@ Tested: - To get all Redfish events, URI: /redfish/v1/EventService/Subscriptions/SSE?$filter=(EventFormatType%20eq%20Event) - To get Redfish events with RegistryPrefix "OpenBMC" - URi: /redfish/v1/EventService/Subscriptions/SSE?$filter=(RegistryPrefix%20eq%20OpenBMC) + URI: /redfish/v1/EventService/Subscriptions/SSE?$filter=(RegistryPrefix%20eq%20OpenBMC) - To get only DC power of Events, URI: /redfish/v1/EventService/Subscriptions/SSE?$filter=(EventFormatType%20eq%20Event)%20and%20(MessageId%20eq%20DCPowerOff) Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> Change-Id: I55c6f53bb5e57aa1f2d1601f1a16525a33b13bd2 --- - include/eventservice_sse.hpp | 94 ++++++++++++++++++- - redfish-core/include/error_messages.hpp | 9 ++ - .../include/event_service_manager.hpp | 5 + - redfish-core/lib/event_service.hpp | 5 - - redfish-core/src/error_messages.cpp | 26 +++++ - 5 files changed, 130 insertions(+), 9 deletions(-) + include/eventservice_sse.hpp | 141 +++++++++++++++++- + redfish-core/include/error_messages.hpp | 9 ++ + .../include/event_service_manager.hpp | 5 + + redfish-core/lib/event_service.hpp | 5 - + redfish-core/src/error_messages.cpp | 26 ++++ + 5 files changed, 177 insertions(+), 9 deletions(-) diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp -index 6c98e6e..ff72c4d 100644 +index 6c98e6e..01e4126 100644 --- a/include/eventservice_sse.hpp +++ b/include/eventservice_sse.hpp -@@ -23,16 +23,102 @@ static bool createSubscription(std::shared_ptr<crow::SseConnection>& conn, +@@ -23,16 +23,149 @@ static bool createSubscription(std::shared_ptr<crow::SseConnection>& conn, } BMCWEB_LOG_DEBUG << "Request query param size: " << req.urlParams.size(); @@ -130,6 +131,53 @@ index 6c98e6e..ff72c4d 100644 + } + } + } ++ ++ if (!msgIds.empty()) ++ { ++ std::vector<std::string> registryPrefix; ++ ++ // If no registry prefixes are mentioned, consider all supported ++ // prefixes to validate message ID ++ if (regPrefixes.empty()) ++ { ++ registryPrefix.assign(supportedRegPrefixes.begin(), ++ supportedRegPrefixes.end()); ++ } ++ ++ for (const std::string& id : msgIds) ++ { ++ bool validId = false; ++ ++ // Check for Message ID in each of the selected Registry ++ for (const std::string& it : registryPrefix) ++ { ++ const boost::beast::span< ++ const redfish::message_registries::MessageEntry> ++ registry = ++ redfish::message_registries::getRegistryFromPrefix( ++ it); ++ ++ if (std::any_of( ++ registry.cbegin(), registry.cend(), ++ [&id]( ++ const redfish::message_registries::MessageEntry& ++ messageEntry) { ++ return !id.compare(messageEntry.first); ++ })) ++ { ++ validId = true; ++ break; ++ } ++ } ++ ++ if (!validId) ++ { ++ messages::propertyValueNotInList(res, id, "MessageId"); ++ res.end(); ++ return false; ++ } ++ } ++ } + } + std::shared_ptr<redfish::Subscription> subValue = @@ -171,7 +219,7 @@ index 7dfdc80..922dae9 100644 } // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index ac644c1..3661fed 100644 +index e826207..f201134 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -55,6 +55,11 @@ static constexpr const char* eventServiceFile = @@ -203,7 +251,7 @@ index 7c9bb7a..297a4ea 100644 "TerminateAfterRetries", "SuspendRetries", "RetryForever"}; diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp -index 7059a38..1e3ef2f 100644 +index ad5f819..409adb1 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp @@ -2147,6 +2147,32 @@ void mutualExclusiveProperties(crow::Response& res, const std::string& arg1, diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch new file mode 100644 index 000000000..874c82e2f --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch @@ -0,0 +1,85 @@ +From b43da33c7bc9ad4d5eea35c9ba68efdd6ed6d34d Mon Sep 17 00:00:00 2001 +From: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com> +Date: Mon, 28 Jun 2021 19:59:57 +0000 +Subject: [PATCH] Add checks on Event Subscription input parameters + +There is no check on the size of input parameters(Context, +Destination and Header) during Event Subscription.This +creates out of memory situation. +This commit checks for the size of input parameters and +rejects if it is exceeding the input size limits. + +Tested + - Validated using POST on Event Subscription. + - When Context, Destination and Headers were too long, + received a error message denoting the same. + +Change-Id: Iec2cd766c0e137b72706fc2da468d4fefd8fbaae +Signed-off-by: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com> +--- + redfish-core/lib/event_service.hpp | 30 +++++++++++++++++++++++++++++- + 1 file changed, 29 insertions(+), 1 deletion(-) + +diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp +index ed4955e..0cb0f00 100644 +--- a/redfish-core/lib/event_service.hpp ++++ b/redfish-core/lib/event_service.hpp +@@ -16,6 +16,10 @@ + #pragma once + #include "event_service_manager.hpp" + ++#define MAX_CONTEXT_SIZE 256 ++#define MAX_DESTINATION_SIZE 1024 ++#define MAX_HEADER_SIZE 8096 ++ + namespace redfish + { + static constexpr const std::array<const char*, 3> supportedRetryPolicies = { +@@ -243,7 +247,11 @@ class EventDestinationCollection : public Node + { + return; + } +- ++ if (destUrl.size() > MAX_DESTINATION_SIZE) ++ { ++ messages::propertySizeExceeded(asyncResp->res, "Destination"); ++ return; ++ } + if (regPrefixes && msgIds) + { + if (regPrefixes->size() && msgIds->size()) +@@ -350,11 +358,31 @@ class EventDestinationCollection : public Node + + if (context) + { ++ if (context->size() > MAX_CONTEXT_SIZE) ++ { ++ messages::propertySizeExceeded(asyncResp->res, "Context"); ++ return; ++ } + subValue->customText = *context; + } + + if (headers) + { ++ size_t cumulativeLen = 0; ++ ++ for (nlohmann::json& itr : *headers) ++ { ++ std::string hdr{itr.dump( ++ -1, ' ', true, nlohmann::json::error_handler_t::replace)}; ++ cumulativeLen += hdr.length(); ++ ++ if (cumulativeLen > MAX_HEADER_SIZE) ++ { ++ messages::propertySizeExceeded(asyncResp->res, ++ "HttpHeaders"); ++ return; ++ } ++ } + subValue->httpHeaders = *headers; + } + +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch index 8b08c6c5e..f03e49223 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch @@ -1,38 +1,39 @@ -From d664a145a96a642597c74819c183410d4a04fce0 Mon Sep 17 00:00:00 2001 +From 6acffea563905c00f4b6d00c738fe7516e03c724 Mon Sep 17 00:00:00 2001 From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Date: Tue, 13 Apr 2021 13:00:18 +0000 Subject: [PATCH] Add support for MetricDefinition scheme -Added MetricDefinition node to Redfish code. Now user is able -to list all available metrics in OpenBMC that are supported -by Telemetry service. Metrics are grouped by following -categories: temperature, power, voltage, current, fan_tach, -fan_pwm, utilization. +Added MetricDefinition node to Redfish code. Now user is able to list +all available metrics in OpenBMC that are supported by Telemetry +service. Metrics are grouped by following categories: temperature, +power, voltage, current, fan_tach, fan_pwm, utilization. Tested: - - MetricDefinitions response is filled with existing sensors, - it works with and without Telemetry service - - Validated a presence of MetricDefinition members and it - attributes - - Succesfully passed RedfishServiceValidator.py using - witherspoon image on QEMU + - MetricDefinitions response is filled with existing sensors, it works + with and without Telemetry service + - Validated a presence of MetricDefinition members and its attributes + - Successfully passed RedfishServiceValidator.py using witherspoon image + on QEMU Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00 --- redfish-core/include/redfish.hpp | 3 + + .../include/utils/get_chassis_names.hpp | 58 ++++ .../include/utils/telemetry_utils.hpp | 2 + - redfish-core/lib/metric_definition.hpp | 335 ++++++++++++++++++ + redfish-core/lib/metric_definition.hpp | 264 ++++++++++++++++++ + redfish-core/lib/sensors.hpp | 25 +- redfish-core/lib/telemetry_service.hpp | 2 + - 4 files changed, 342 insertions(+) + 6 files changed, 342 insertions(+), 12 deletions(-) + create mode 100644 redfish-core/include/utils/get_chassis_names.hpp create mode 100644 redfish-core/lib/metric_definition.hpp diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index 7a14969..d280a86 100644 +index 4418c3d..594520d 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp -@@ -26,6 +26,7 @@ +@@ -25,6 +25,7 @@ #include "../lib/managers.hpp" #include "../lib/memory.hpp" #include "../lib/message_registries.hpp" @@ -40,7 +41,7 @@ index 7a14969..d280a86 100644 #include "../lib/metric_report.hpp" #include "../lib/metric_report_definition.hpp" #include "../lib/network_protocol.hpp" -@@ -219,6 +220,8 @@ class RedfishService +@@ -215,6 +216,8 @@ class RedfishService nodes.emplace_back(std::make_unique<HypervisorResetActionInfo>(app)); nodes.emplace_back(std::make_unique<TelemetryService>(app)); @@ -49,31 +50,19 @@ index 7a14969..d280a86 100644 nodes.emplace_back( std::make_unique<MetricReportDefinitionCollection>(app)); nodes.emplace_back(std::make_unique<MetricReportDefinition>(app)); -diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp -index 5872350..1b4f75d 100644 ---- a/redfish-core/include/utils/telemetry_utils.hpp -+++ b/redfish-core/include/utils/telemetry_utils.hpp -@@ -10,6 +10,8 @@ namespace telemetry - - constexpr const char* service = "xyz.openbmc_project.Telemetry"; - constexpr const char* reportInterface = "xyz.openbmc_project.Telemetry.Report"; -+constexpr const char* metricDefinitionUri = -+ "/redfish/v1/TelemetryService/MetricDefinitions/"; - constexpr const char* metricReportDefinitionUri = - "/redfish/v1/TelemetryService/MetricReportDefinitions/"; - constexpr const char* metricReportUri = -diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp +diff --git a/redfish-core/include/utils/get_chassis_names.hpp b/redfish-core/include/utils/get_chassis_names.hpp new file mode 100644 -index 0000000..515fe86 +index 0000000..0276b6f --- /dev/null -+++ b/redfish-core/lib/metric_definition.hpp -@@ -0,0 +1,335 @@ ++++ b/redfish-core/include/utils/get_chassis_names.hpp +@@ -0,0 +1,58 @@ +#pragma once + -+#include "async_resp.hpp" -+#include "node.hpp" -+#include "sensors.hpp" -+#include "utils/telemetry_utils.hpp" ++#include <include/dbus_singleton.hpp> ++ ++#include <array> ++#include <string> ++#include <vector> + +namespace redfish +{ @@ -81,52 +70,6 @@ index 0000000..515fe86 +namespace utils +{ + -+class AsyncRespWithFinalizer -+{ -+ public: -+ AsyncRespWithFinalizer( -+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) : -+ asyncResp(asyncResp) -+ {} -+ -+ AsyncRespWithFinalizer(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, -+ std::function<void(crow::Response&)> finalizer) : -+ asyncResp(asyncResp), -+ finalizer(std::move(finalizer)) -+ {} -+ -+ AsyncRespWithFinalizer(const AsyncRespWithFinalizer&) = delete; -+ AsyncRespWithFinalizer(AsyncRespWithFinalizer&&) = delete; -+ -+ ~AsyncRespWithFinalizer() -+ { -+ if (finalizer) -+ { -+ try -+ { -+ finalizer(asyncResp->res); -+ } -+ catch (const std::exception& e) -+ { -+ BMCWEB_LOG_ERROR << "Executing finalizer failed: " << e.what(); -+ messages::internalError(asyncResp->res); -+ } -+ } -+ } -+ -+ void setFinalizer(std::function<void(crow::Response&)> newFinalizer) -+ { -+ finalizer = std::move(newFinalizer); -+ } -+ -+ private: -+ std::shared_ptr<bmcweb::AsyncResp> asyncResp; -+ std::function<void(crow::Response&)> finalizer; -+ -+ public: -+ crow::Response& res = asyncResp->res; -+}; -+ +template <typename F> +inline void getChassisNames(F&& cb) +{ @@ -170,6 +113,37 @@ index 0000000..515fe86 + +} // namespace utils + ++} // namespace redfish +diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp +index 5872350..1b4f75d 100644 +--- a/redfish-core/include/utils/telemetry_utils.hpp ++++ b/redfish-core/include/utils/telemetry_utils.hpp +@@ -10,6 +10,8 @@ namespace telemetry + + constexpr const char* service = "xyz.openbmc_project.Telemetry"; + constexpr const char* reportInterface = "xyz.openbmc_project.Telemetry.Report"; ++constexpr const char* metricDefinitionUri = ++ "/redfish/v1/TelemetryService/MetricDefinitions/"; + constexpr const char* metricReportDefinitionUri = + "/redfish/v1/TelemetryService/MetricReportDefinitions/"; + constexpr const char* metricReportUri = +diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp +new file mode 100644 +index 0000000..072fe20 +--- /dev/null ++++ b/redfish-core/lib/metric_definition.hpp +@@ -0,0 +1,264 @@ ++#pragma once ++ ++#include "async_resp.hpp" ++#include "node.hpp" ++#include "sensors.hpp" ++#include "utils/get_chassis_names.hpp" ++#include "utils/telemetry_utils.hpp" ++ ++namespace redfish ++{ ++ +namespace telemetry +{ + @@ -180,7 +154,8 @@ index 0000000..515fe86 + { + sdbusplus::message::object_path path(dbusSensor); + sdbusplus::message::object_path parentPath = path.parent_path(); -+ std::string type = parentPath.filename(); ++ const std::string type = parentPath.filename(); ++ + if (type.empty()) + { + BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = " @@ -191,18 +166,24 @@ index 0000000..515fe86 + nlohmann::json& members = res.jsonValue["Members"]; + + const std::string odataId = -+ telemetry::metricDefinitionUri + std::move(type); -+ -+ const auto it = -+ std::find_if(members.begin(), members.end(), -+ [&odataId](const nlohmann::json& item) { -+ auto kt = item.find("@odata.id"); -+ if (kt == item.end()) -+ { -+ return false; -+ } -+ return kt->get<std::string>() == odataId; -+ }); ++ std::string(telemetry::metricDefinitionUri) + ++ sensors::toReadingType(type); ++ ++ const auto it = std::find_if(members.begin(), members.end(), ++ [&odataId](const nlohmann::json& item) { ++ auto kt = item.find("@odata.id"); ++ if (kt == item.end()) ++ { ++ return false; ++ } ++ const std::string* value = ++ kt->get_ptr<const std::string*>(); ++ if (!value) ++ { ++ return false; ++ } ++ return *value == odataId; ++ }); + + if (it == members.end()) + { @@ -242,25 +223,8 @@ index 0000000..515fe86 + asyncResp->res.jsonValue["Members"] = nlohmann::json::array(); + asyncResp->res.jsonValue["Members@odata.count"] = 0; + -+ auto handleRetrieveUriToDbusMap = -+ [asyncResp]( -+ const boost::beast::http::status status, -+ const boost::container::flat_map<std::string, std::string>& -+ uriToDbus) { -+ if (status != boost::beast::http::status::ok) -+ { -+ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " -+ "sensors map with err " -+ << static_cast<unsigned>(status); -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ telemetry::addMembers(asyncResp->res, uriToDbus); -+ }; -+ + utils::getChassisNames( -+ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap), -+ asyncResp](boost::system::error_code ec, ++ [asyncResp](boost::system::error_code ec, + const std::vector<std::string>& chassisNames) { + if (ec) + { @@ -269,6 +233,22 @@ index 0000000..515fe86 + return; + } + ++ auto handleRetrieveUriToDbusMap = ++ [asyncResp](const boost::beast::http::status status, ++ const boost::container::flat_map< ++ std::string, std::string>& uriToDbus) { ++ if (status != boost::beast::http::status::ok) ++ { ++ BMCWEB_LOG_ERROR ++ << "Failed to retrieve URI to dbus " ++ "sensors map with err " ++ << static_cast<unsigned>(status); ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ telemetry::addMembers(asyncResp->res, uriToDbus); ++ }; ++ + for (const std::string& chassisName : chassisNames) + { + for (const auto& [sensorNode, _] : sensors::dbus::paths) @@ -286,8 +266,26 @@ index 0000000..515fe86 +namespace telemetry +{ + ++bool isSensorIdSupported(std::string_view readingType) ++{ ++ for (const std::pair<std::string_view, std::vector<const char*>>& ++ typeToPaths : sensors::dbus::paths) ++ { ++ for (const char* supportedPath : typeToPaths.second) ++ { ++ if (readingType == ++ sensors::toReadingType( ++ sdbusplus::message::object_path(supportedPath).filename())) ++ { ++ return true; ++ } ++ } ++ } ++ return false; ++} ++ +void addMetricProperty( -+ utils::AsyncRespWithFinalizer& asyncResp, const std::string& id, ++ bmcweb::AsyncResp& asyncResp, const std::string& readingType, + const boost::container::flat_map<std::string, std::string>& el) +{ + nlohmann::json& metricProperties = @@ -298,7 +296,7 @@ index 0000000..515fe86 + std::string sensorId; + if (dbus::utility::getNthStringFromPath(dbusSensor, 3, sensorId)) + { -+ if (sensorId == id) ++ if (sensors::toReadingType(sensorId) == readingType) + { + metricProperties.push_back(redfishSensor); + } @@ -329,80 +327,152 @@ index 0000000..515fe86 + const crow::Request&, + const std::vector<std::string>& params) override + { -+ auto telemetryAsyncResp = -+ std::make_shared<utils::AsyncRespWithFinalizer>(asyncResp); -+ + if (params.size() != 1) + { -+ messages::internalError(telemetryAsyncResp->res); ++ messages::internalError(asyncResp->res); + return; + } + -+ const std::string& id = params[0]; -+ telemetryAsyncResp->setFinalizer([id](crow::Response& res) { -+ if (res.jsonValue["MetricProperties"].empty()) -+ { -+ messages::resourceNotFound(res, "MetricDefinition", id); -+ } -+ }); ++ const std::string& readingType = params[0]; + -+ telemetryAsyncResp->res.jsonValue["MetricProperties"] = -+ nlohmann::json::array(); -+ telemetryAsyncResp->res.jsonValue["Id"] = id; -+ telemetryAsyncResp->res.jsonValue["Name"] = id; -+ telemetryAsyncResp->res.jsonValue["@odata.id"] = -+ telemetry::metricDefinitionUri + id; -+ telemetryAsyncResp->res.jsonValue["@odata.type"] = -+ "#MetricDefinition.v1_0_3.MetricDefinition"; -+ telemetryAsyncResp->res.jsonValue["MetricDataType"] = "Decimal"; -+ telemetryAsyncResp->res.jsonValue["MetricType"] = "Numeric"; -+ telemetryAsyncResp->res.jsonValue["IsLinear"] = true; -+ telemetryAsyncResp->res.jsonValue["Units"] = -+ sensors::toReadingUnits(id); -+ -+ auto handleRetrieveUriToDbusMap = -+ [telemetryAsyncResp, -+ id](const boost::beast::http::status status, -+ const boost::container::flat_map<std::string, std::string>& -+ uriToDbus) { -+ if (status != boost::beast::http::status::ok) -+ { -+ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " -+ "sensors map with err " -+ << static_cast<unsigned>(status); -+ messages::internalError(telemetryAsyncResp->res); -+ return; -+ } -+ telemetry::addMetricProperty(*telemetryAsyncResp, id, -+ uriToDbus); -+ }; ++ if (!telemetry::isSensorIdSupported(readingType)) ++ { ++ messages::resourceNotFound(asyncResp->res, "MetricDefinition", ++ readingType); ++ return; ++ } + -+ utils::getChassisNames( -+ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap), -+ telemetryAsyncResp, -+ id](boost::system::error_code ec, -+ const std::vector<std::string>& chassisNames) { -+ if (ec) -+ { -+ messages::internalError(telemetryAsyncResp->res); -+ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value(); -+ return; -+ } ++ asyncResp->res.jsonValue["MetricProperties"] = nlohmann::json::array(); ++ asyncResp->res.jsonValue["Id"] = readingType; ++ asyncResp->res.jsonValue["Name"] = readingType; ++ asyncResp->res.jsonValue["@odata.id"] = ++ telemetry::metricDefinitionUri + readingType; ++ asyncResp->res.jsonValue["@odata.type"] = ++ "#MetricDefinition.v1_0_3.MetricDefinition"; ++ asyncResp->res.jsonValue["MetricDataType"] = "Decimal"; ++ asyncResp->res.jsonValue["MetricType"] = "Numeric"; ++ asyncResp->res.jsonValue["IsLinear"] = true; ++ asyncResp->res.jsonValue["Implementation"] = "PhysicalSensor"; ++ asyncResp->res.jsonValue["Units"] = ++ sensors::toReadingUnits(readingType); ++ ++ utils::getChassisNames([asyncResp, ++ readingType](boost::system::error_code ec, ++ const std::vector<std::string>& ++ chassisNames) { ++ if (ec) ++ { ++ messages::internalError(asyncResp->res); ++ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value(); ++ return; ++ } + -+ for (const std::string& chassisName : chassisNames) -+ { -+ for (const auto& [sensorNode, dbusPaths] : -+ sensors::dbus::paths) ++ auto handleRetrieveUriToDbusMap = ++ [asyncResp, readingType]( ++ const boost::beast::http::status status, ++ const boost::container::flat_map<std::string, std::string>& ++ uriToDbus) { ++ if (status != boost::beast::http::status::ok) + { -+ retrieveUriToDbusMap(chassisName, sensorNode.data(), -+ handleRetrieveUriToDbusMap); ++ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " ++ "sensors map with err " ++ << static_cast<unsigned>(status); ++ messages::internalError(asyncResp->res); ++ return; + } ++ telemetry::addMetricProperty(*asyncResp, readingType, ++ uriToDbus); ++ }; ++ ++ for (const std::string& chassisName : chassisNames) ++ { ++ for (const auto& [sensorNode, dbusPaths] : sensors::dbus::paths) ++ { ++ retrieveUriToDbusMap(chassisName, sensorNode.data(), ++ handleRetrieveUriToDbusMap); + } -+ }); ++ } ++ }); + } +}; + +} // namespace redfish +diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp +index e7f4cde..b16b014 100644 +--- a/redfish-core/lib/sensors.hpp ++++ b/redfish-core/lib/sensors.hpp +@@ -111,46 +111,47 @@ inline const char* toReadingType(const std::string& sensorType) + return ""; + } + +-inline const char* toReadingUnits(const std::string& sensorType) ++inline const char* toReadingUnits(const std::string& readingType) + { +- if (sensorType == "voltage") ++ if (readingType == "Voltage") + { + return "V"; + } +- if (sensorType == "power") ++ if (readingType == "Power") + { + return "W"; + } +- if (sensorType == "current") ++ if (readingType == "Current") + { + return "A"; + } +- if (sensorType == "fan_tach") ++ if (readingType == "Rotational") + { + return "RPM"; + } +- if (sensorType == "temperature") ++ if (readingType == "Temperature") + { + return "Cel"; + } +- if (sensorType == "fan_pwm" || sensorType == "utilization") ++ if (readingType == "Percent") + { + return "%"; + } +- if (sensorType == "altitude") ++ if (readingType == "Altitude") + { + return "m"; + } +- if (sensorType == "airflow") ++ if (readingType == "AirFlow") + { + return "cft_i/min"; + } +- if (sensorType == "energy") ++ if (readingType == "EnergyJoules") + { + return "J"; + } + return ""; + } ++ + } // namespace sensors + + /** +@@ -953,11 +954,11 @@ inline void objectInterfacesToJson( + sensorJson["ReadingType"] = readingType; + } + +- const std::string& readingUnits = sensors::toReadingUnits(sensorType); ++ const std::string& readingUnits = sensors::toReadingUnits(readingType); + if (readingUnits.empty()) + { + BMCWEB_LOG_ERROR << "Redfish cannot map reading unit for " +- << sensorType; ++ << readingType; + } + else + { diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp index 9ec0737..de9c800 100644 --- a/redfish-core/lib/telemetry_service.hpp diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch index 4119045f1..9b77c29df 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch @@ -1,4 +1,4 @@ -From 0ed9ff4f37e7d3ea81073ad35acd530730104033 Mon Sep 17 00:00:00 2001 +From 206411b4c9b603e7b0edf63e03c0ef7bf10b09b2 Mon Sep 17 00:00:00 2001 From: "Wludzik, Jozef" <jozef.wludzik@intel.com> Date: Tue, 15 Dec 2020 12:30:31 +0100 Subject: [PATCH] Sync Telmetry service with EventService @@ -22,7 +22,7 @@ Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> 2 files changed, 69 insertions(+), 115 deletions(-) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index c3c110a..dc99cda 100644 +index a1761bb..0e2ebfd 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -14,6 +14,7 @@ @@ -33,7 +33,7 @@ index c3c110a..dc99cda 100644 #include "node.hpp" #include "registries.hpp" #include "registries/base_message_registry.hpp" -@@ -529,47 +530,32 @@ class Subscription +@@ -523,47 +524,32 @@ class Subscription } #endif @@ -92,7 +92,7 @@ index c3c110a..dc99cda 100644 this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); } -@@ -1421,75 +1407,6 @@ class EventServiceManager +@@ -1359,75 +1345,6 @@ class EventServiceManager } #endif @@ -168,7 +168,7 @@ index c3c110a..dc99cda 100644 void unregisterMetricReportSignal() { if (matchTelemetryMonitor) -@@ -1509,9 +1426,11 @@ class EventServiceManager +@@ -1447,9 +1364,11 @@ class EventServiceManager } BMCWEB_LOG_DEBUG << "Metrics report signal - Register"; @@ -183,7 +183,7 @@ index c3c110a..dc99cda 100644 matchTelemetryMonitor = std::make_shared<sdbusplus::bus::match::match>( *crow::connections::systemBus, matchStr, -@@ -1522,10 +1441,43 @@ class EventServiceManager +@@ -1460,10 +1379,43 @@ class EventServiceManager return; } @@ -291,5 +291,4 @@ index ad15a05..18a6dcc 100644 telemetry::service, reportPath, "org.freedesktop.DBus.Properties", "Get", -- -2.17.1 - +2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Revert-Remove-LogService-from-TelemetryService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Revert-Remove-LogService-from-TelemetryService.patch new file mode 100644 index 000000000..645351a51 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Revert-Remove-LogService-from-TelemetryService.patch @@ -0,0 +1,26 @@ +From dc7e43c70285596195efd9d328b303091794278c Mon Sep 17 00:00:00 2001 +From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> +Date: Mon, 31 May 2021 10:08:57 +0000 +Subject: [PATCH] Revert "Remove LogService from TelemetryService" + +This reverts commit 2b3da45876aac57a36d3093379a992d699e7e396. +--- + redfish-core/lib/telemetry_service.hpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp +index de9c800..f05bf6d 100644 +--- a/redfish-core/lib/telemetry_service.hpp ++++ b/redfish-core/lib/telemetry_service.hpp +@@ -38,6 +38,8 @@ class TelemetryService : public Node + "/redfish/v1/TelemetryService/MetricReportDefinitions"; + asyncResp->res.jsonValue["MetricReports"]["@odata.id"] = + "/redfish/v1/TelemetryService/MetricReports"; ++ asyncResp->res.jsonValue["LogService"]["@odata.id"] = ++ "/redfish/v1/Managers/bmc/LogServices/Journal"; + + crow::connections::systemBus->async_method_call( + [asyncResp]( +-- +2.25.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-event-service-fix-added-Context-field-to-response.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-event-service-fix-added-Context-field-to-response.patch new file mode 100644 index 000000000..ffab743f6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-event-service-fix-added-Context-field-to-response.patch @@ -0,0 +1,29 @@ +From 0ca8c383db8c9afbce63380955a20ada0acc20b7 Mon Sep 17 00:00:00 2001 +From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> +Date: Wed, 2 Jun 2021 12:44:43 +0000 +Subject: [PATCH] event service fix, added Context field to response + +Tested: + - Context field is present + - No regression detected + +Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> +--- + redfish-core/include/event_service_manager.hpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp +index 2b957ea..289886b 100644 +--- a/redfish-core/include/event_service_manager.hpp ++++ b/redfish-core/include/event_service_manager.hpp +@@ -556,6 +556,7 @@ class Subscription + << id; + return; + } ++ msg["Context"] = customText; + + this->sendEvent( + msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); +-- +2.25.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README index 20c93c08e..ea6ac73bd 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README @@ -3,8 +3,13 @@ Until change is integrated they will be manually merged here to enable feature i Current revisions: - Add support for MetricDefinition scheme - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/72 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/80 - Sync Telmetry service with EventService - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/30 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/31 +- LogService field, actual implementation will be upstreamed with triggers feature + file://telemetry/0003-Revert-Remove-LogService-from-TelemetryService.patch + +- Event service fix for Context field + file://telemetry/0004-event-service-fix-added-Context-field-to-response.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend index 7e9d42228..2a7221b7b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "2ebb9683287cf6b1a2f2cc3c077bd99aceefa8dd" +SRCREV = "eb75770c6c4369984cb150ded4f5ace410ed24a9" DEPENDS += "boost-url" RDEPENDS_${PN} += "phosphor-nslcd-authority-cert-config" @@ -22,6 +22,8 @@ SRC_URI += "file://0001-Firmware-update-configuration-changes.patch \ file://0015-Add-state-sensor-messages-to-the-registry.patch \ file://0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch \ file://0017-Add-msg-registry-for-subscription-related-actions.patch \ + file://0018-bmcweb-Add-BMC-Time-update-log-to-the-registry.patch \ + file://0019-Add-generic-message-PropertySizeExceeded.patch \ " # OOB Bios Config: @@ -50,11 +52,14 @@ SRC_URI += "file://eventservice/0001-EventService-Fix-retry-handling-for-http-cl file://eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch \ file://eventservice/0006-Add-EventService-SSE-filter-support.patch \ file://eventservice/0007-EventService-Log-events-for-subscription-actions.patch \ + file://eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch \ " # Temporary downstream mirror of upstream patches, see telemetry\README for details -SRC_URI += " file://telemetry/0003-Add-support-for-MetricDefinition-scheme.patch \ - file://telemetry/0004-Sync-Telmetry-service-with-EventService.patch \ +SRC_URI += " file://telemetry/0001-Add-support-for-MetricDefinition-scheme.patch \ + file://telemetry/0002-Sync-Telmetry-service-with-EventService.patch \ + file://telemetry/0003-Revert-Remove-LogService-from-TelemetryService.patch \ + file://telemetry/0004-event-service-fix-added-Context-field-to-response.patch \ " # Temporary fix: Move it to service file diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0002-Add-log-count-limitation-to-requestAdd.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0002-Add-log-count-limitation-to-requestAdd.patch new file mode 100644 index 000000000..f24d585a9 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb/0002-Add-log-count-limitation-to-requestAdd.patch @@ -0,0 +1,94 @@ +From 1b01638d44ebb5d6163899775dea2fcc7e0715d6 Mon Sep 17 00:00:00 2001 +From: Helen Huang <he.huang@intel.com> +Date: Mon, 31 May 2021 09:19:55 +0800 +Subject: [PATCH] Add log count limitation to requestAdd() + +To avoid log storm, add the log count limitation to +requestAdd(). + +Change-Id: I91894ff07fa252ed7746816535611a33b6f640ea +Signed-off-by: Helen Huang <he.huang@intel.com> +--- + ipmbbridged.cpp | 44 ++++++++++++++++++++++++++++++++++++++------ + ipmbbridged.hpp | 3 +++ + 2 files changed, 41 insertions(+), 6 deletions(-) + +diff --git a/ipmbbridged.cpp b/ipmbbridged.cpp +index 6d1be04..93f5b2f 100644 +--- a/ipmbbridged.cpp ++++ b/ipmbbridged.cpp +@@ -916,12 +916,44 @@ std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>> + + if (i2cRetryCnt == ipmbI2cNumberOfRetries) + { +- std::string msgToLog = +- "requestAdd: Sent to I2C failed after retries." +- " busId=" + +- std::to_string(ipmbBusId) + ", error=" + ec.message(); +- phosphor::logging::log<phosphor::logging::level::INFO>( +- msgToLog.c_str()); ++ if ((requestAddLogCount <= ipmbRequestAddLogLimit) || ++ (!(requestAddLogCount % ipmbRequestAddLogInterval)) || ++ (UINT_MAX == requestAddLogCount)) ++ { ++ std::string msgToLog; ++ if (requestAddLogCount == ipmbRequestAddLogLimit) ++ { ++ msgToLog = "requestAdd: There are " + ++ std::to_string(ipmbRequestAddLogLimit - 1) + ++ " similiar logs." ++ " To avoid log storm, not all the logs for the " ++ "issue will be shown: "; ++ } ++ if (!(requestAddLogCount % ipmbRequestAddLogInterval) && (requestAddLogCount != 0)) ++ { ++ msgToLog = "requestAdd: There are " + ++ std::to_string(requestAddLogCount) + ++ " similiar logs so far: "; ++ } ++ if (UINT_MAX == requestAddLogCount) ++ { ++ msgToLog = "requestAdd: There are " + ++ std::to_string(requestAddLogCount) + ++ " similiar logs," ++ " The log count will be rolled back to zero: "; ++ } ++ msgToLog += "requestAdd: Sent to I2C failed after retries." ++ " busId=" + ++ std::to_string(ipmbBusId) + ++ ", error=" + ec.message(); ++ phosphor::logging::log<phosphor::logging::level::INFO>( ++ msgToLog.c_str()); ++ } ++ requestAddLogCount++; ++ } ++ else ++ { ++ requestAddLogCount = 0; + } + + request->timer->expires_after( +diff --git a/ipmbbridged.hpp b/ipmbbridged.hpp +index c79ac63..eaba7ae 100644 +--- a/ipmbbridged.hpp ++++ b/ipmbbridged.hpp +@@ -50,6 +50,8 @@ constexpr int ipmbMaxOutstandingRequestsCount = 64; + constexpr int ipmbNumberOfTries = 6; + constexpr uint64_t ipmbRequestRetryTimeout = 250; // ms + ++constexpr int ipmbRequestAddLogLimit = 10; ++constexpr int ipmbRequestAddLogInterval = 100; + /** + * @brief Ipmb I2C communication + */ +@@ -313,6 +315,7 @@ class IpmbChannel + uint8_t ipmbBusId; + uint8_t channelIdx; + ++ unsigned int requestAddLogCount = 0; + std::shared_ptr<IpmbCommandFilter> commandFilter; + + // array storing outstanding requests +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend index 33392f3c1..a83e1f670 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-ipmb_%.bbappend @@ -2,10 +2,11 @@ SRC_URI = "git://github.com/openbmc/ipmbbridge.git" SRCREV = "8fe0abe6d9f69f735e93d7055687fce4b56e80bf" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += "file://0001-Add-dbus-method-SlotIpmbRequest.patch \ + file://0002-Add-log-count-limitation-to-requestAdd.patch \ file://ipmb-channels.json \ " do_install_append() { install -D ${WORKDIR}/ipmb-channels.json \ ${D}/usr/share/ipmbbridge -}
\ No newline at end of file +} diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-rakp12-Add-username-to-SessionInfo-interface.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-rakp12-Add-username-to-SessionInfo-interface.patch new file mode 100644 index 000000000..89a111d06 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-rakp12-Add-username-to-SessionInfo-interface.patch @@ -0,0 +1,49 @@ +From 20bf13de482b02a4a467f44070f7ff184c340dd2 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> +Date: Tue, 1 Jun 2021 12:22:19 +0000 +Subject: [PATCH] rakp12: Add username to SessionInfo interface + +Add username to SessionInfo interface to get username info on individual +IPMI session Id's on Redfish + +Tested: +1. Activate SOL session +Command: ipmitool -I lanplus -U root -P 0penBmc -H <BMC_IP> -C 17 + sol activate +Response: // Success +2. Verified on SessionInfo D-bus interface. +busctl introspect xyz.openbmc_project.Ipmi.Channel.eth0 + /xyz/openbmc_project/ipmi/session/eth0/<session_id> +NAME TYPE SIGNATURE RESULT/VALUE FLAGS +...... +xyz.openbmc_project.Ipmi.SessionInfo interface - - - +.ChannelNum property y 3 emits-change writable +.CurrentPrivilege property y 4 emits-change writable +.RemoteIPAddr property u 22253066 emits-change writable +.RemoteMACAddress property ay 0 emits-change writable +.RemotePort property q 41096 emits-change writable +.SessionHandle property y 129 emits-change writable +.State property y 2 emits-change writable +.UserID property y 1 emits-change writable +.Username property s "root" emits-change writable + +Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> +--- + command/rakp12.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/command/rakp12.cpp b/command/rakp12.cpp +index 099c5dc..98b6891 100644 +--- a/command/rakp12.cpp ++++ b/command/rakp12.cpp +@@ -227,6 +227,7 @@ std::vector<uint8_t> RAKP12(const std::vector<uint8_t>& inPayload, + } + session->channelNum(chNum); + session->userID(userId); ++ session->username(userName); + // minimum privilege of Channel / User / session::privilege::USER + // has to be used as session current privilege level + uint8_t minPriv = 0; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend index 56b581ce7..7a36ac50e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend @@ -3,7 +3,7 @@ inherit useradd # TODO: This should be removed, once up-stream bump up # issue is resolved SRC_URI += "git://github.com/openbmc/phosphor-net-ipmid" -SRCREV = "7b645018775b85a0c61148e592d951841809eef9" +SRCREV = "ecc8efad10bc2101a434a0c1fbd253eeaa1a3a99" USERADD_PACKAGES = "${PN}" # add a group called ipmi @@ -22,6 +22,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI += " file://10-nice-rules.conf \ file://0006-Modify-dbus-namespace-of-chassis-control-for-guid.patch \ file://0011-Remove-Get-SOL-Config-Command-from-Netipmid.patch \ + file://0012-rakp12-Add-username-to-SessionInfo-interface.patch \ " do_install_append() { diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb index 8a6911345..d5c1888b3 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-node-manager-proxy_git.bb @@ -3,7 +3,7 @@ DESCRIPTION = "The Node Manager Proxy provides a simple interface for communicat with Management Engine via IPMB" SRC_URI = "git://github.com/Intel-BMC/node-manager;protocol=ssh" -SRCREV = "1b243b3bfa5a3523a6ca9805626c8cf045146697" +SRCREV = "23590b428ea26e0ed4b8225015471b962e3b3704" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend index 48f72ab36..15673c0bf 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/peci/peci-pcie_%.bbappend @@ -1,3 +1,5 @@ SRC_URI = "git://github.com/openbmc/peci-pcie" -SRCREV = "d570dfd4f3a7c38b029f74a8194eeb3911b5f6a5" +SRCREV = "6f55203b70316baec228073abcd581b64985af93" + +EXTRA_OECMAKE += "-DWAIT_FOR_OS_STANDBY=1 -DUSE_RDENDPOINTCFG=1" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb index 6881a8065..8d965268f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp_intel" DESCRIPTION = "Implementation of MCTP(DMTF DSP0236)" SRC_URI = "git://github.com/Intel-BMC/libmctp.git;protocol=ssh" -SRCREV = "807b80296c9793900f46ba5675e5e739fc18dafd" +SRCREV = "ba0ec42a97e5e87c04b67473e32f14b7bdc7e930" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb index 67b7d2b42..cc611e3db 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libpldm_intel" DESCRIPTION = "Provides encode/decode APIs for PLDM specifications" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "0b73929a2116d9e1386e7e95190787bed7e715a8" +SRCREV = "7c8ae26530a7634ed75cf28f52fb97431bd046ce" S = "${WORKDIR}/git/libpldm_intel" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb index 7527e949d..78c5d7823 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" +SRCREV = "7c8ae26530a7634ed75cf28f52fb97431bd046ce" S = "${WORKDIR}/git/mctp_emulator" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb index f9c2adcb5..7a8bd2bc4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" +SRCREV = "7c8ae26530a7634ed75cf28f52fb97431bd046ce" S = "${WORKDIR}/git/mctp_wrapper" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb index 78244d0ba..4588c399b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${PN}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "e850d4ad2f72698e51f0a95bb949aa7a6055ccd6" +SRCREV = "7c8ae26530a7634ed75cf28f52fb97431bd046ce" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb index 055b9b7e4..aa9eb1fac 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=615045c30a05cde5c0e924854d43c327" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" +SRCREV = "7c8ae26530a7634ed75cf28f52fb97431bd046ce" S = "${WORKDIR}/git/mctpwplus" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb index 2f0e2c8e7..965ed2543 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI = "git://github.com/Intel-BMC/nvme-mi.git;protocol=ssh" -SRCREV = "f3ba26e5fd3542d3c30b1069c4c1439a637f42ba" +SRCREV = "a7b519e7e67b45aec7022c7fb608bcd9a4b9c91b" S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" @@ -14,4 +14,4 @@ inherit meson systemd SYSTEMD_SERVICE_${PN} += "xyz.openbmc_project.nvme-mi.service" DEPENDS = "boost sdbusplus systemd phosphor-logging mctpwplus googletest nlohmann-json" -EXTRA_OEMESON = "-Dyocto_dep='enabled' -Dtests='enabled'" +EXTRA_OEMESON = "-Dyocto_dep='enabled'" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb index 3d747004a..d2790db29 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI += "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "0b73929a2116d9e1386e7e95190787bed7e715a8" +SRCREV = "7c8ae26530a7634ed75cf28f52fb97431bd046ce" S = "${WORKDIR}/git/pldmd" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb index 1ad639ba1..b9bf23609 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" +SRCREV = "7c8ae26530a7634ed75cf28f52fb97431bd046ce" S = "${WORKDIR}/git/pmci_launcher" 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 c9175fd64..6815b5563 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,105 +1,109 @@ -From 17e3ed85f2ff919ff52b4a3fe7a1eb0026f28898 Mon Sep 17 00:00:00 2001 +From 235bb8a9b809c2449e3f5bf4e999db881012c144 Mon Sep 17 00:00:00 2001 From: Zhikui Ren <zhikui.ren@intel.com> -Date: Thu, 24 Sep 2020 14:27:32 -0700 -Subject: [PATCH] Fix missing threshold de-assert event when threshold changes. +Date: Tue, 22 Jun 2021 11:35:12 -0700 +Subject: [PATCH] Fix missing de-assert event when threshold changes +Issue: Sensor can be re-constructed when sensor configuration changes like a new threshold value. Threshold deassert can be missed if the new threshold value fixes the alarm because the default state for new threshold interface is de-asserted. -Send threshold de-assert message after interfaces are initialized to -ensure de-assert event is logged if there is an active assert -event. + +Resolution: +Add a member variable hadValidSensor that is initialized to false +for new sensor. When hadValidSensor is false, threshold property changed +message will be emitted even if threshold property did not change, +If the previous sensor instance had the threshold raised, +Phosphor-sel-logger would notice the change and log a de-assert event. +If the previous sensor instance did not have the threshold raised, +Phosphor-sel-logger would notice this is not a change and not create +new SEL log. +Set hadValidSensor to true when sensor value is updated with a value +that is not NaN. This is done after threshold property changed message +is emitted. Tested: -step1: -busctl set-property xyz.openbmc_project.ADCSensor /xyz/openbmc_project/sensors/voltage/P3VBAT xyz.openbmc_project.Sensor.Threshold.Warning WarningLow d 2.457 -ipmitool sel list -SEL has no entries -step2: -busctl set-property xyz.openbmc_project.ADCSensor /xyz/openbmc_project/sensors/voltage/P3VBAT xyz.openbmc_project.Sensor.Threshold.Warning WarningLow d 3.1 -ipmitool sel list - 1 | 09/24/20 | 21:30:15 UTC | Voltage #0x2d | Lower Non-critical going low | Asserted -step3: -busctl set-property xyz.openbmc_project.ADCSensor /xyz/openbmc_project/sensors/voltage/P3VBAT xyz.openbmc_project.Sensor.Threshold.Warning WarningLow d 2.457 -ipmitool sel list - 1 | 09/24/20 | 21:30:15 UTC | Voltage #0x2d | Lower Non-critical going low | Asserted - 2 | 09/24/20 | 21:30:33 UTC | Voltage #0x2d | Lower Non-critical going low | Deasserted +1. Change threshold value for a voltage sensor to force a SEL. + ipmitool raw 0x04 0x26 0x60 0x1b 0x95 0x6b 0x00 0x99 0xa6 0x00 + +2. Verify SEL logged threshold assert event as expected + ipmitool sel list + 1 | Pre-Init |0000007277| Voltage #0x60 | Upper Non-critical going high | Asserted + +3. Use ipmitool to change threshold value back to normal + ipmitool raw 0x04 0x26 0x60 0x1b 0x95 0x6b 0x00 0xa4 0xa6 0x00 + +4. Verify SEL logged threshold de-assert event as expected + ipmitool sel list + 1 | Pre-Init |0000007277| Voltage #0x60 | Upper Non-critical going high | Asserted + 2 | Pre-Init |0000007304| Voltage #0x60 | Upper Non-critical going high | Deasserted Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> -Change-Id: If28870ac1e0d09be4a631a3145408ec70390dfc5 --- - include/Thresholds.hpp | 5 ++++- - include/sensor.hpp | 13 +++++++++++++ - src/ADCSensor.cpp | 1 + - src/Thresholds.cpp | 15 +++++++++++++-- - 4 files changed, 31 insertions(+), 3 deletions(-) + include/Thresholds.hpp | 2 +- + include/sensor.hpp | 2 ++ + src/Thresholds.cpp | 17 ++++++++++++++--- + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/Thresholds.hpp b/include/Thresholds.hpp -index ca2b0a0..c1d0baf 100644 +index af63f72..fd507d0 100644 --- a/include/Thresholds.hpp +++ b/include/Thresholds.hpp -@@ -45,7 +45,10 @@ struct Threshold +@@ -44,7 +44,7 @@ struct Threshold void assertThresholds(Sensor* sensor, double assertValue, thresholds::Level level, thresholds::Direction direction, - bool assert); + bool assert, bool force = false); -+ -+void forceDeassertThresholds(Sensor* sensor, thresholds::Level level, -+ thresholds::Direction direction); struct TimerUsed { diff --git a/include/sensor.hpp b/include/sensor.hpp -index 0ef87d5..d50b2ff 100644 +index b98241b..6235674 100644 --- a/include/sensor.hpp +++ b/include/sensor.hpp -@@ -312,6 +312,19 @@ struct Sensor - operationalInterface->register_property("Functional", true); - operationalInterface->initialize(); +@@ -71,6 +71,7 @@ struct Sensor + std::shared_ptr<sdbusplus::asio::dbus_interface> operationalInterface; + double value = std::numeric_limits<double>::quiet_NaN(); + double rawValue = std::numeric_limits<double>::quiet_NaN(); ++ bool hadValidValue = false; + bool overriddenState = false; + bool internalSet = false; + double hysteresisTrigger; +@@ -432,6 +433,7 @@ struct Sensor + { + markFunctional(true); + markAvailable(true); ++ hadValidValue = true; } -+ -+ // Sensor can be reconstructed when sensor configuration changes -+ // like a new threshold value. Threshold deassert can be missed -+ // if the new threshold value fixes the alarm because -+ // default state for new threshold interface is de-asserted. -+ // Send threshold de-assert message during initialization to -+ // ensure de-assert events are logged if there is an active assert -+ // event. -+ for (auto& threshold : thresholds) -+ { -+ thresholds::forceDeassertThresholds(this, threshold.level, -+ threshold.direction); -+ } } - bool readingStateGood() -diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp -index fe600d7..632fc8c 100644 ---- a/src/ADCSensor.cpp -+++ b/src/ADCSensor.cpp -@@ -88,6 +88,7 @@ ADCSensor::~ADCSensor() - // close the input dev to cancel async operations - inputDev.close(); - waitTimer.cancel(); -+ - objServer.remove_interface(thresholdInterfaceWarning); - objServer.remove_interface(thresholdInterfaceCritical); - objServer.remove_interface(sensorInterface); diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp -index f4d4ed0..3c791c9 100644 +index bbe8e20..78ded55 100644 --- a/src/Thresholds.cpp +++ b/src/Thresholds.cpp -@@ -344,6 +344,7 @@ bool checkThresholds(Sensor* sensor) +@@ -418,10 +418,19 @@ bool checkThresholds(Sensor* sensor) { bool status = true; std::vector<ChangeParam> changes = checkThresholds(sensor, sensor->value); + ++ // Sensor can be reconstructed when sensor configuration changes ++ // like a new threshold value. Threshold deassert can be missed ++ // if the new threshold value fixes the alarm because ++ // default state for new threshold interface is de-asserted. ++ // force sending assert/de-assert message when a not NaN value is updated ++ // for the first time even when threshold property did not change. ++ bool forceAssert = !sensor->hadValidValue; for (const auto& change : changes) { assertThresholds(sensor, change.assertValue, change.threshold.level, -@@ -392,7 +393,7 @@ void checkThresholdsPowerDelay(Sensor* sensor, ThresholdTimer& thresholdTimer) +- change.threshold.direction, change.asserted); ++ change.threshold.direction, change.asserted, ++ forceAssert); + if (change.threshold.level == thresholds::Level::CRITICAL && + change.asserted) + { +@@ -473,7 +482,7 @@ void checkThresholdsPowerDelay(const std::weak_ptr<Sensor>& weakSensor, void assertThresholds(Sensor* sensor, double assertValue, thresholds::Level level, thresholds::Direction direction, @@ -108,7 +112,7 @@ index f4d4ed0..3c791c9 100644 { std::string property; std::shared_ptr<sdbusplus::asio::dbus_interface> interface; -@@ -432,7 +433,9 @@ void assertThresholds(Sensor* sensor, double assertValue, +@@ -513,7 +522,9 @@ void assertThresholds(Sensor* sensor, double assertValue, return; } @@ -119,21 +123,6 @@ index f4d4ed0..3c791c9 100644 { try { -@@ -452,6 +455,14 @@ void assertThresholds(Sensor* sensor, double assertValue, - } - } - -+// Explicitely de-assert a threshold with existing sensor value -+// Should only be called on sensor desctruction -+void forceDeassertThresholds(Sensor* sensor, thresholds::Level level, -+ thresholds::Direction direction) -+{ -+ assertThresholds(sensor, sensor->value, level, direction, false, true); -+} -+ - bool parseThresholdsFromAttr( - std::vector<thresholds::Threshold>& thresholdVector, - const std::string& inputPath, const double& scaleFactor, -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch index fb38b0348..0a6e73708 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch @@ -1,4 +1,4 @@ -From f516fc884fcbc03bf560b4ef975ad236232bd1e6 Mon Sep 17 00:00:00 2001 +From ba069b63307352ae0dc0a94a837306dc0bc51e94 Mon Sep 17 00:00:00 2001 From: Zhikui Ren <zhikui.ren@intel.com> Date: Tue, 11 May 2021 11:14:55 -0700 Subject: [PATCH] CPUSensor: create RequiredTempSensor if defined @@ -48,7 +48,7 @@ index 29b8209..5d09e4e 100644 static constexpr unsigned int sensorScaleFactor = 1000; static constexpr unsigned int sensorPollMs = 1000; diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp -index 7f9a2c5..7c29cf0 100644 +index c882698..277dd3f 100644 --- a/src/CPUSensor.cpp +++ b/src/CPUSensor.cpp @@ -99,6 +99,75 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, @@ -65,8 +65,8 @@ index 7f9a2c5..7c29cf0 100644 + std::vector<thresholds::Threshold>&& thresholdsIn, + const std::string& sensorConfiguration) : + Sensor(boost::replace_all_copy(sensorName, " ", "_"), -+ std::move(thresholdsIn), sensorConfiguration, objectType, 0, 0, conn, -+ PowerState::on), ++ std::move(thresholdsIn), sensorConfiguration, objectType, false, 0, ++ 0, conn, PowerState::on), + objServer(objectServer), inputDev(io), waitTimer(io), + privTcontrol(std::numeric_limits<double>::quiet_NaN()), dtsOffset(0), + show(true), pollTime(CPUSensor::sensorPollMs), minMaxReadCounter(0) @@ -128,10 +128,10 @@ index 7f9a2c5..7c29cf0 100644 { // close the input dev to cancel async operations diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp -index 92c1716..4c00551 100644 +index c565890..a28a5be 100644 --- a/src/CPUSensorMain.cpp +++ b/src/CPUSensorMain.cpp -@@ -332,10 +332,9 @@ bool createSensors(boost::asio::io_service& io, +@@ -333,10 +333,9 @@ bool createSensors(boost::asio::io_service& io, { if (debug) { @@ -144,7 +144,7 @@ index 92c1716..4c00551 100644 } // check hidden properties -@@ -636,9 +635,9 @@ void detectCpuAsync( +@@ -637,9 +636,9 @@ void detectCpuAsync( }); } @@ -156,7 +156,7 @@ index 92c1716..4c00551 100644 sdbusplus::asio::object_server& objectServer) { bool useCache = false; -@@ -700,6 +699,45 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, +@@ -701,6 +700,45 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, iface->register_property("Present", *present); iface->initialize(); inventoryIfaces[name] = std::move(iface); @@ -202,7 +202,7 @@ index 92c1716..4c00551 100644 } auto findBus = config.second.find("Bus"); -@@ -728,7 +766,6 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, +@@ -729,7 +767,6 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, std::cout << "name: " << name << "\n"; std::cout << "type: " << type << "\n"; } @@ -210,7 +210,7 @@ index 92c1716..4c00551 100644 cpuConfigs.emplace(bus, addr, name, State::OFF); } } -@@ -764,7 +801,8 @@ int main() +@@ -765,7 +802,8 @@ int main() return; // we're being canceled } @@ -220,7 +220,7 @@ index 92c1716..4c00551 100644 { detectCpuAsync(pingTimer, creationTimer, io, objectServer, systemBus, cpuConfigs, sensorConfigs); -@@ -792,7 +830,7 @@ int main() +@@ -793,7 +831,7 @@ int main() return; // we're being canceled } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch new file mode 100644 index 000000000..dbe851fde --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0007-Add-support-for-the-energy-hwmon-type.patch @@ -0,0 +1,267 @@ +From b839028a4dda6fcec027f3a26887e0de0e8172bb Mon Sep 17 00:00:00 2001 +From: Szymon Dompke <szymon.dompke@intel.com> +Date: Tue, 18 May 2021 05:22:33 +0200 +Subject: [PATCH] Add support for the energy hwmon type +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With this commit CPUSensors should be able detect hwmon files of type +‘energy’ described here: + + https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface + +These files hold a cumulative energy [micro Joule]. +Values read from these type of files will be exposed on dbus as a new +sensor. An example: + +└─/xyz + └─/xyz/openbmc_project + └─/xyz/openbmc_project/sensors + ├─/xyz/openbmc_project/sensors/energy + │ └─/xyz/openbmc_project/sensors/energy/Cumulative_Energy_CPU1 + +The energy counter will have different scale factor and different +default min/max values than other types of CPU sensors (power/temp). + +Tested: + Tested on physical machine where the `energy_input` files were present, + works as desired no regression detected. + +Authored-by: Zbigniew Kurzynski <zbigniew.kurzynski@intel.com> +Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> +--- + include/CPUSensor.hpp | 13 ++++++-- + src/CPUSensor.cpp | 69 +++++++++++++++---------------------------- + src/CPUSensorMain.cpp | 30 ++++++++++++++++--- + 3 files changed, 60 insertions(+), 52 deletions(-) + +diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp +index 5d09e4e..cb3742a 100644 +--- a/include/CPUSensor.hpp ++++ b/include/CPUSensor.hpp +@@ -16,6 +16,15 @@ + #include <variant> + #include <vector> + ++struct SensorProperties ++{ ++ std::string path; ++ std::string units; ++ double max; ++ double min; ++ unsigned int scaleFactor; ++}; ++ + class CPUSensor : public Sensor + { + public: +@@ -25,7 +34,7 @@ class CPUSensor : public Sensor + boost::asio::io_service& io, const std::string& sensorName, + std::vector<thresholds::Threshold>&& thresholds, + const std::string& configuration, int cpuId, bool show, +- double dtsOffset); ++ double dtsOffset, const SensorProperties& sensorProperties); + + // Create a CPUSensor without a path to sensor value + CPUSensor(const std::string& objectType, +@@ -36,7 +45,6 @@ class CPUSensor : public Sensor + const std::string& sensorConfiguration); + + ~CPUSensor() override; +- static constexpr unsigned int sensorScaleFactor = 1000; + static constexpr unsigned int sensorPollMs = 1000; + static constexpr size_t warnAfterErrorCount = 10; + static constexpr const char* labelTcontrol = "Tcontrol"; +@@ -54,6 +62,7 @@ class CPUSensor : public Sensor + size_t pollTime; + bool loggedInterfaceDown = false; + uint8_t minMaxReadCounter; ++ unsigned int scaleFactor; + void setupRead(void); + void handleResponse(const boost::system::error_code& err); + void checkThresholds(void) override; +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index 277dd3f..0621e04 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -39,59 +39,37 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, + boost::asio::io_service& io, const std::string& sensorName, + std::vector<thresholds::Threshold>&& thresholdsIn, + const std::string& sensorConfiguration, int cpuId, +- bool show, double dtsOffset) : ++ bool show, double dtsOffset, ++ const SensorProperties& sensorProperties) : + Sensor(boost::replace_all_copy(sensorName, " ", "_"), +- std::move(thresholdsIn), sensorConfiguration, objectType, false, 0, +- 0, conn, PowerState::on), ++ std::move(thresholdsIn), sensorConfiguration, objectType, false, ++ sensorProperties.max, sensorProperties.min, conn, PowerState::on), + objServer(objectServer), inputDev(io), waitTimer(io), path(path), + privTcontrol(std::numeric_limits<double>::quiet_NaN()), + dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs), +- minMaxReadCounter(0) ++ minMaxReadCounter(0), scaleFactor(sensorProperties.scaleFactor) + { + nameTcontrol = labelTcontrol; + nameTcontrol += " CPU" + std::to_string(cpuId); + if (show) + { +- if (auto fileParts = splitFileName(path)) ++ std::string interfacePath = sensorProperties.path + name; ++ sensorInterface = objectServer.add_interface( ++ interfacePath, "xyz.openbmc_project.Sensor.Value"); ++ if (thresholds::hasWarningInterface(thresholds)) + { +- auto& [type, nr, item] = *fileParts; +- std::string interfacePath; +- const char* units; +- if (type.compare("power") == 0) +- { +- interfacePath = "/xyz/openbmc_project/sensors/power/" + name; +- units = sensor_paths::unitWatts; +- minValue = 0; +- maxValue = 511; +- } +- else +- { +- interfacePath = +- "/xyz/openbmc_project/sensors/temperature/" + name; +- units = sensor_paths::unitDegreesC; +- minValue = -128; +- maxValue = 127; +- } +- +- sensorInterface = objectServer.add_interface( +- interfacePath, "xyz.openbmc_project.Sensor.Value"); +- if (thresholds::hasWarningInterface(thresholds)) +- { +- thresholdInterfaceWarning = objectServer.add_interface( +- interfacePath, +- "xyz.openbmc_project.Sensor.Threshold.Warning"); +- } +- if (thresholds::hasCriticalInterface(thresholds)) +- { +- thresholdInterfaceCritical = objectServer.add_interface( +- interfacePath, +- "xyz.openbmc_project.Sensor.Threshold.Critical"); +- } +- association = objectServer.add_interface(interfacePath, +- association::interface); +- +- setInitialProperties(conn, units); ++ thresholdInterfaceWarning = objectServer.add_interface( ++ interfacePath, "xyz.openbmc_project.Sensor.Threshold.Warning"); ++ } ++ if (thresholds::hasCriticalInterface(thresholds)) ++ { ++ thresholdInterfaceCritical = objectServer.add_interface( ++ interfacePath, "xyz.openbmc_project.Sensor.Threshold.Critical"); + } ++ association = ++ objectServer.add_interface(interfacePath, association::interface); ++ ++ setInitialProperties(conn, sensorProperties.units); + } + + // call setup always as not all sensors call setInitialProperties +@@ -248,7 +226,7 @@ void CPUSensor::updateMinMaxValues(void) + auto& [suffix, oldValue, dbusName, newValue] = vectorItem; + auto attrPath = boost::replace_all_copy(path, fileItem, suffix); + +- if(auto tmp = readFile(attrPath, CPUSensor::sensorScaleFactor)) ++ if (auto tmp = readFile(attrPath, scaleFactor)) + { + newValue.get() = *tmp; + } +@@ -302,7 +280,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + std::getline(responseStream, response); + rawValue = std::stod(response); + responseStream.clear(); +- double nvalue = rawValue / CPUSensor::sensorScaleFactor; ++ double nvalue = rawValue / scaleFactor; + + if (show) + { +@@ -328,8 +306,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + { + std::vector<thresholds::Threshold> newThresholds; + if (parseThresholdsFromAttr(newThresholds, path, +- CPUSensor::sensorScaleFactor, +- dtsOffset)) ++ scaleFactor, dtsOffset)) + { + if (!std::equal(thresholds.begin(), thresholds.end(), + newThresholds.begin(), +diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp +index a28a5be..baa2bb6 100644 +--- a/src/CPUSensorMain.cpp ++++ b/src/CPUSensorMain.cpp +@@ -94,6 +94,18 @@ static constexpr std::array<const char*, 1> sensorTypes = {"XeonCPU"}; + static constexpr std::array<const char*, 3> hiddenProps = { + CPUSensor::labelTcontrol, "Tthrottle", "Tjmax"}; + ++static const boost::container::flat_map<std::string, SensorProperties> ++ sensorPropertiesMap = { ++ {"power", ++ {"/xyz/openbmc_project/sensors/power/", sensor_paths::unitWatts, 511, ++ 0, 1000}}, ++ {"energy", ++ {"/xyz/openbmc_project/sensors/energy/", sensor_paths::unitJoules, ++ std::numeric_limits<uint32_t>::max() / 1000000, 0.0, 1000000}}, ++ {"temp", ++ {"/xyz/openbmc_project/sensors/temperature/", ++ sensor_paths::unitDegreesC, 127.0, -128.0, 1000}}}; ++ + void detectCpuAsync( + boost::asio::deadline_timer& pingTimer, + boost::asio::deadline_timer& creationTimer, boost::asio::io_service& io, +@@ -297,7 +309,8 @@ bool createSensors(boost::asio::io_service& io, + + auto directory = hwmonNamePath.parent_path(); + std::vector<fs::path> inputPaths; +- if (!findFiles(directory, R"((temp|power)\d+_(input|average|cap)$)", ++ if (!findFiles(directory, ++ R"((temp|power|energy)\d+_(input|average|cap)$)", + inputPaths, 0)) + { + std::cerr << "No temperature sensors in system\n"; +@@ -365,6 +378,16 @@ bool createSensors(boost::asio::io_service& io, + } + } + ++ const auto& it = sensorPropertiesMap.find(type); ++ if (it == sensorPropertiesMap.end()) ++ { ++ std::cerr ++ << "Failure getting sensor properties for sensor type: " ++ << type << "\n"; ++ continue; ++ } ++ const SensorProperties& prop = it->second; ++ + std::vector<thresholds::Threshold> sensorThresholds; + std::string labelHead = label.substr(0, label.find(' ')); + parseThresholdsFromConfig(*sensorData, sensorThresholds, +@@ -372,8 +395,7 @@ bool createSensors(boost::asio::io_service& io, + if (sensorThresholds.empty()) + { + if (!parseThresholdsFromAttr(sensorThresholds, inputPathStr, +- CPUSensor::sensorScaleFactor, +- dtsOffset)) ++ prop.scaleFactor, dtsOffset)) + { + std::cerr << "error populating thresholds for " + << sensorName << "\n"; +@@ -385,7 +407,7 @@ bool createSensors(boost::asio::io_service& io, + sensorPtr = std::make_unique<CPUSensor>( + inputPathStr, sensorType, objectServer, dbusConnection, io, + sensorName, std::move(sensorThresholds), *interfacePath, cpuId, +- show, dtsOffset); ++ show, dtsOffset, prop); + createdSensors.insert(sensorName); + if (debug) + { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0008-CPUSensor-additional-debug-message.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0008-CPUSensor-additional-debug-message.patch new file mode 100644 index 000000000..40c8d46bd --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0008-CPUSensor-additional-debug-message.patch @@ -0,0 +1,69 @@ +From c045d0ace218a8f0c9e9af0b04aed24ec733fc79 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren <zhikui.ren@intel.com> +Date: Tue, 22 Jun 2021 14:49:44 -0700 +Subject: [PATCH] CPUSensor: additional debug message + +Add debug message to capture more information on threshold changes. + +Example output - DTS threshold changes when Tcontrol was first read + Jan 01 00:06:06 intel-obmc cpusensor[461]: Core_16_CPU1: Tcontrol changed from nan to 92 + Jan 01 00:06:06 intel-obmc cpusensor[461]: Core_22_CPU1: Tcontrol changed from nan to 92 + Jan 01 00:06:06 intel-obmc cpusensor[461]: Core_24_CPU1: Tcontrol changed from nan to 92 + Jan 01 00:06:06 intel-obmc cpusensor[461]: DTS_CPU1: Tcontrol changed from nan to 92 + Jan 01 00:06:06 intel-obmc cpusensor[461]: Threshold: /sys/bus/peci/devices/peci-0/0-30/peci-cputemp.0/hwmon/hwmon12/temp2_max: 92 + Jan 01 00:06:06 intel-obmc cpusensor[461]: Threshold: /sys/bus/peci/devices/peci-0/0-30/peci-cputemp.0/hwmon/hwmon12/temp2_crit: 100 + Jan 01 00:06:06 intel-obmc cpusensor[461]: DTS_CPU1: new threshold value 92 + Jan 01 00:06:06 intel-obmc cpusensor[461]: DTS_CPU1: new threshold value 100 + +The above message will be logged when BMC reset or host resets. + +Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> +--- + src/CPUSensor.cpp | 5 +++++ + src/Thresholds.cpp | 7 ++----- + 2 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index 0621e04..65acdac 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -300,6 +300,7 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + : std::numeric_limits<double>::quiet_NaN(); + if (gTcontrol != privTcontrol) + { ++ std::cout << name << ": Tcontrol changed from " << privTcontrol << " to " << gTcontrol << "\n"; + privTcontrol = gTcontrol; + + if (!thresholds.empty()) +@@ -318,6 +319,10 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + thresholds::updateThresholds(this); + } + } ++ for (auto& threshold : thresholds) ++ { ++ std::cout << name << ": new threshold value " << threshold.value << "\n"; ++ } + } + else + { +diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp +index 78ded55..283dacf 100644 +--- a/src/Thresholds.cpp ++++ b/src/Thresholds.cpp +@@ -583,11 +583,8 @@ bool parseThresholdsFromAttr( + if (auto val = readFile(attrPath, scaleFactor)) + { + *val += offset; +- if (debug) +- { +- std::cout << "Threshold: " << attrPath << ": " << *val +- << "\n"; +- } ++ std::cout << "Threshold: " << attrPath << ": " << *val ++ << "\n"; + thresholdVector.emplace_back(level, direction, *val); + } + } +-- +2.17.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 361e425e5..95c9000c3 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}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" -SRCREV = "13b63f8f597d396db8b5bd182ac2e5814d599e2f" +SRCREV = "8685b17ab14a187eae08399153b9ec6bace2ab9b" #SRC_URI = "git://github.com/openbmc/dbus-sensors.git" SRC_URI += "\ @@ -12,6 +12,8 @@ SRC_URI += "\ file://0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch \ file://0005-Fix-PECI-ioctl-number.patch \ 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 \ " DEPENDS_append = " libgpiod libmctp" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb index 6acbfff37..275963595 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/settings/settings_git.bb @@ -1,7 +1,7 @@ SUMMARY = "Settings" SRC_URI = "git://github.com/Intel-BMC/settings.git;protocol=ssh" -SRCREV = "1bdbb05873b5790bd56b683ce8ddf1a02a6795e7" +SRCREV = "1a39605ff52db92048df733181eda8fcfe18ce2f" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb index adcdd0588..e566f3ea6 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/special-mode-manager.git;protocol=ssh" -SRCREV = "4f4f122790b999dc7db973a80727dbc1ca785e57" +SRCREV = "5f413eec673f3e6e5e754e2c55048abf0a146e5b" EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend index ebb498866..8732ccd40 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/state/phosphor-post-code-manager_git.bbappend @@ -1,2 +1,2 @@ #SRC_URI = "git://github.com/openbmc/phosphor-post-code-manager.git" -SRCREV = "0171dd6bce9004e187c957f160809b729322f37d" +SRCREV = "aed7b3de090005433b16ca986ed3df4dbc81446f" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend index 34a93fb6c..3183745ce 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/telemetry.git" -SRCREV = "32859b634e366a015331fb8ab62766340df9c7b8" +SRCREV = "4ab1d496d8a50d0466afb7f49668c40758bfe6a9" EXTRA_OEMESON += " -Dmax-reports=10" EXTRA_OEMESON += " -Dmax-reading-parameters=200" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0005-Added-suport-for-multiple-user-manager-services.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0005-Added-suport-for-multiple-user-manager-services.patch index dfd980a2b..a7f431049 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0005-Added-suport-for-multiple-user-manager-services.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager/0005-Added-suport-for-multiple-user-manager-services.patch @@ -1,13 +1,14 @@ -From 6fd1c797ec7440551052e8fc638d06313c9d6836 Mon Sep 17 00:00:00 2001 +From 75971b8faf7ef7af7285ba7d5207be71c66e5d11 Mon Sep 17 00:00:00 2001 From: Radivoje Jovanovic <radivoje.jovanovic@intel.com> Date: Mon, 2 Jul 2018 19:23:25 -0700 -Subject: [PATCH 1/2] Added suport for multiple user manager services +Subject: [PATCH] Added suport for multiple user manager services Support added for SSSD service implementation Signed-off-by: Alberto Salazar Perez <alberto.salazar.perez@intel.com> Signed-off-by: Radivoje Jovanovic <radivoje.jovanovic@intel.com> Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com> +Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com> --- Makefile.am | 5 +- mainapp.cpp | 90 +++++- @@ -20,7 +21,7 @@ Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.co create mode 100644 user_service.hpp diff --git a/Makefile.am b/Makefile.am -index 7c7271e..58916b0 100644 +index 1dbd594..fe47aaf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,11 +1,12 @@ @@ -151,7 +152,7 @@ index e08da61..f4b7f8c 100644 // Claim the bus now bus.request_name(USER_MANAGER_BUSNAME); diff --git a/user_mgr.cpp b/user_mgr.cpp -index c65a822..eed81aa 100644 +index 1b14e8e..f6f2fdb 100644 --- a/user_mgr.cpp +++ b/user_mgr.cpp @@ -18,43 +18,34 @@ @@ -285,7 +286,7 @@ index c65a822..eed81aa 100644 throwForInvalidPrivilege(priv); throwForInvalidGroups(groupNames); - // All user management lock has to be based on /etc/shadow -- phosphor::user::shadow::Lock lock(); +- // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; throwForUserExists(userName); throwForUserNameConstraints(userName, groupNames); throwForMaxGrpUserCount(groupNames); @@ -328,7 +329,7 @@ index c65a822..eed81aa 100644 void UserMgr::deleteUser(std::string userName) { - // All user management lock has to be based on /etc/shadow -- phosphor::user::shadow::Lock lock(); +- // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; throwForUserDoesNotExist(userName); - try - { @@ -352,7 +353,7 @@ index c65a822..eed81aa 100644 void UserMgr::renameUser(std::string userName, std::string newUserName) { - // All user management lock has to be based on /etc/shadow -- phosphor::user::shadow::Lock lock(); +- // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; throwForUserDoesNotExist(userName); throwForUserExists(newUserName); throwForUserNameConstraints(newUserName, @@ -380,7 +381,7 @@ index c65a822..eed81aa 100644 throwForInvalidPrivilege(priv); throwForInvalidGroups(groupNames); - // All user management lock has to be based on /etc/shadow -- phosphor::user::shadow::Lock lock(); +- // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; throwForUserDoesNotExist(userName); const std::vector<std::string>& oldGroupNames = usersList[userName].get()->userGroups(); @@ -421,7 +422,7 @@ index c65a822..eed81aa 100644 void UserMgr::userEnable(const std::string& userName, bool enabled) { - // All user management lock has to be based on /etc/shadow -- phosphor::user::shadow::Lock lock(); +- // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; throwForUserDoesNotExist(userName); - try - { @@ -443,7 +444,7 @@ index c65a822..eed81aa 100644 UserSSHLists UserMgr::getUserAndSshGrpList() { - // All user management lock has to be based on /etc/shadow -- phosphor::user::shadow::Lock lock(); +- // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; - - std::vector<std::string> userList; - std::vector<std::string> sshUsersList; @@ -500,7 +501,7 @@ index c65a822..eed81aa 100644 bool UserMgr::isUserEnabled(const std::string& userName) { - // All user management lock has to be based on /etc/shadow -- phosphor::user::shadow::Lock lock(); +- // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; - std::array<char, 4096> buffer{}; - struct spwd spwd; - struct spwd* resultPtr = nullptr; @@ -552,7 +553,7 @@ index c65a822..eed81aa 100644 @@ -1106,11 +866,9 @@ void UserMgr::initUserObjects(void) { // All user management lock has to be based on /etc/shadow - phosphor::user::shadow::Lock lock(); + // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; - std::vector<std::string> userNameList; - std::vector<std::string> sshGrpUsersList; UserSSHLists userSSHLists = getUserAndSshGrpList(); @@ -628,7 +629,7 @@ index f5aac22..5d5ca99 100644 "priv-user", "priv-noaccess"}; diff --git a/user_service.cpp b/user_service.cpp new file mode 100644 -index 0000000..ad4e510 +index 0000000..6e11755 --- /dev/null +++ b/user_service.cpp @@ -0,0 +1,789 @@ @@ -726,7 +727,7 @@ index 0000000..ad4e510 + phosphor::user::UserSSHLists getUserAndSshGrpList() const override + { + // All user management lock has to be based on /etc/shadow -+ phosphor::user::shadow::Lock lock(); ++ // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; + + std::vector<std::string> userList; + std::vector<std::string> sshUsersList; @@ -812,7 +813,7 @@ index 0000000..ad4e510 + const std::string& priv, const bool& enabled) const override + { + // All user management lock has to be based on /etc/shadow -+ phosphor::user::shadow::Lock lock(); ++ // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; + + std::string groups = getCSVFromVector(groupNames); + bool sshRequested = removeStringFromCSV(groups, phosphor::user::grpSsh); @@ -847,7 +848,7 @@ index 0000000..ad4e510 + const std::string& newUserName) const override + { + // All user management lock has to be based on /etc/shadow -+ phosphor::user::shadow::Lock lock(); ++ // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; + try + { + std::string newHomeDir = "/home/" + newUserName; @@ -867,7 +868,7 @@ index 0000000..ad4e510 + void deleteUser(const std::string& userName) const override + { + // All user management lock has to be based on /etc/shadow -+ phosphor::user::shadow::Lock lock(); ++ // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; + + try + { @@ -888,7 +889,7 @@ index 0000000..ad4e510 + const std::string& priv) const override + { + // All user management lock has to be based on /etc/shadow -+ phosphor::user::shadow::Lock lock(); ++ // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; + + std::string groups = getCSVFromVector(groupNames); + bool sshRequested = removeStringFromCSV(groups, phosphor::user::grpSsh); @@ -922,7 +923,7 @@ index 0000000..ad4e510 + const bool& enabled) const override + { + // All user management lock has to be based on /etc/shadow -+ phosphor::user::shadow::Lock lock(); ++ // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; + try + { + phosphor::user::executeCmd("/usr/sbin/usermod", userName.c_str(), @@ -939,7 +940,7 @@ index 0000000..ad4e510 + bool isUserEnabled(const std::string& userName) const override + { + // All user management lock has to be based on /etc/shadow -+ phosphor::user::shadow::Lock lock(); ++ // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; + std::array<char, 4096> buffer{}; + struct spwd spwd; + struct spwd* resultPtr = nullptr; diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend index 43fd25df4..c0d4215a0 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend @@ -1,7 +1,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI = "git://github.com/openbmc/phosphor-user-manager" -SRCREV = "e6500a493a156dd58a92b384c77aef2cbd3addac" +SRCREV = "607ed50ae1c4817969a117d951a3e90f686fbde0" EXTRA_OECONF += "${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], '', '--disable-root_user_mgmt', d)}" @@ -9,3 +9,8 @@ SRC_URI += " \ file://0005-Added-suport-for-multiple-user-manager-services.patch \ file://0006-Use-groupmems-instead-of-getgrnam_r-due-to-overlay.patch \ " + +FILES_${PN} += "/dbus-1/system.d/phosphor-nslcd-cert-config.conf" +FILES_${PN} += "/usr/share/phosphor-certificate-manager/nslcd" +FILES_${PN} += "\ + /lib/systemd/system/multi-user.target.wants/phosphor-certificate-manager@nslcd.service"
\ No newline at end of file diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend index 244af18dc..36b155fe9 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/phosphor-webui_%.bbappend @@ -1,4 +1,4 @@ SRC_URI = "git://github.com/Intel-BMC/phosphor-webui;protocol=ssh;branch=intel2" FILESEXTRAPATHS_prepend_intel := "${THISDIR}/${PN}:" -SRCREV = "40dd78bd5fe1dfcadd22bba9eee8e402b634b40d" +SRCREV = "2397c142c0d75c7705757a52848945b00928232d" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend index 618f4dddb..398dced5c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend @@ -1,6 +1,6 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/webui-vue.git" -SRCREV = "71114feb9a800d42f6eeddfa477077a8ab8e44f6" +SRCREV = "240c056c8989c5e3e0f0ff640f38f3e4cdbc6ac5" do_compile_prepend() { cp -vf ${S}/.env.intel ${S}/.env |