From 9cc183a531e1e309a99784f65b15c0fb1a18ddef Mon Sep 17 00:00:00 2001 From: P Dheeraj Srujan Kumar Date: Fri, 6 May 2022 06:11:20 +0530 Subject: Update to internal 1-0.91-67 Signed-off-by: P Dheeraj Srujan Kumar --- ...sabling-serial-console-if-FFUJ-is-enabled.patch | 57 ++- .../0006-Fix-PSU-fan-sensor-read-0.patch | 26 ++ .../recipes-kernel/linux/linux-aspeed_%.bbappend | 1 + .../ac-boot-check/ac-boot-check/ac-boot-check.sh | 8 + .../meta-common/recipes-core/expat/expat/run-ptest | 23 + .../meta-common/recipes-core/expat/expat_2.4.4.bb | 31 ++ .../glibc/glibc/0001-CVE-2022-23218.patch | 178 +++++++ .../glibc/glibc/0001-CVE-2022-23219.patch | 55 +++ .../glibc/glibc/0002-CVE-2022-23218.patch | 126 +++++ .../glibc/glibc/0002-CVE-2022-23219.patch | 89 ++++ .../recipes-core/glibc/glibc/CVE-2021-43396.patch | 184 ++++++++ .../recipes-core/glibc/glibc_%.bbappend | 5 + .../recipes-core/ipmi/intel-ipmi-oem_%.bbappend | 2 +- ...ut-to-systemd-networkd-wait-online.servic.patch | 26 ++ .../recipes-core/systemd/systemd_%.bbappend | 1 + ...ify-Redfish-MessageID-from-Panic-to-Resil.patch | 119 +++++ .../recipes-intel/intel-pfr/pfr-manager_%.bbappend | 4 + .../files/0001-Add-vector-size-check.patch | 49 ++ .../recipes-intel/psu-manager/psu-manager.bb | 2 + .../recipes-intel/smbios/smbios-mdrv2.bb | 2 +- ...ed-Improve-workaround-for-controller-hang.patch | 55 +++ .../recipes-kernel/linux/linux-aspeed_%.bbappend | 1 + ...ernet_interface-Defer-setting-NIC-enabled.patch | 60 +++ .../network/phosphor-network_%.bbappend | 1 + .../network/static-mac-addr/mac-check | 2 +- ...evice-Add-MUX-channel-name-to-FRU-objects.patch | 268 +++++++++++ .../configuration/entity-manager_%.bbappend | 3 +- ...rmwareResiliency-and-FirmwareUpdateStatus.patch | 138 ++++++ ...-Property-PhysicalContext-is-invalid-none.patch | 520 +++++++++++++++++++++ ...Severity-for-ServiceFailure-redfish-event.patch | 56 +++ .../bmcweb/0031-Change-PcieType-to-PCIeType.patch | 68 +++ ...-Define-Redfish-interface-Registries-Bios.patch | 11 +- ...fix-for-broken-feature-Pending-Attributes.patch | 43 +- .../0004-Add-Server-Sent-Events-support.patch | 38 +- .../0014-Fix-Event-Subscription-URI.patch | 37 ++ ...0004-Fixed-timestamp-in-telemetry-service.patch | 106 +++++ .../interfaces/bmcweb/telemetry/README | 5 +- ...-Return-404-for-POST-on-Proxy-InsertMedia.patch | 379 +++++++++++++++ .../recipes-phosphor/interfaces/bmcweb_%.bbappend | 8 + ...gmt-Fix-for-user-privilege-race-condition.patch | 152 ++++++ .../ipmi/phosphor-ipmi-host_%.bbappend | 1 + .../ipmi/phosphor-ipmi-net_%.bbappend | 10 +- .../meta-common/recipes-phosphor/pmci/mctpd.bb | 2 +- .../meta-common/recipes-phosphor/pmci/pldmd.bb | 2 +- ...Add-support-for-Get-PMBUS-Readings-method.patch | 457 ++++++++++++++++++ ...0011-Fix-for-cpusensor-going-into-D-state.patch | 224 +++++++++ .../0012-Serialize-cpusensor-polling.patch | 343 ++++++++++++++ .../0013-Add-dummy-cpu-sensor-flag.patch | 60 +++ ...temperatures-readings-as-errors-in-IpmbSe.patch | 49 ++ .../sensors/dbus-sensors_%.bbappend | 5 + ...suport-for-multiple-user-manager-services.patch | 58 ++- .../virtual-media/virtual-media.bb | 2 +- 52 files changed, 4070 insertions(+), 82 deletions(-) create mode 100644 meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0006-Fix-PSU-fan-sensor-read-0.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-core/expat/expat/run-ptest create mode 100644 meta-openbmc-mods/meta-common/recipes-core/expat/expat_2.4.4.bb create mode 100644 meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/CVE-2021-43396.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0003-Added-timeout-to-systemd-networkd-wait-online.servic.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager/0001-mainapp-Modify-Redfish-MessageID-from-Panic-to-Resil.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-intel/psu-manager/files/0001-Add-vector-size-check.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-peci-aspeed-Improve-workaround-for-controller-hang.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Revert-ethernet_interface-Defer-setting-NIC-enabled.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0001-fru-device-Add-MUX-channel-name-to-FRU-objects.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0028-Add-FirmwareResiliency-and-FirmwareUpdateStatus.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0029-Fix-Property-PhysicalContext-is-invalid-none.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0030-Change-Severity-for-ServiceFailure-redfish-event.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0031-Change-PcieType-to-PCIeType.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0014-Fix-Event-Subscription-URI.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Fixed-timestamp-in-telemetry-service.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Return-404-for-POST-on-Proxy-InsertMedia.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-user_mgmt-Fix-for-user-privilege-race-condition.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0010-Add-support-for-Get-PMBUS-Readings-method.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0011-Fix-for-cpusensor-going-into-D-state.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0012-Serialize-cpusensor-polling.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0013-Add-dummy-cpu-sensor-flag.patch create mode 100644 meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0014-Treat-zero-temperatures-readings-as-errors-in-IpmbSe.patch diff --git a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0038-Disabling-serial-console-if-FFUJ-is-enabled.patch b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0038-Disabling-serial-console-if-FFUJ-is-enabled.patch index 372d69e26..676107b54 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0038-Disabling-serial-console-if-FFUJ-is-enabled.patch +++ b/meta-openbmc-mods/meta-ast2600/recipes-bsp/u-boot/files/0038-Disabling-serial-console-if-FFUJ-is-enabled.patch @@ -1,4 +1,4 @@ -From a9f5d0357701c817106cd158d377ef645309ccc2 Mon Sep 17 00:00:00 2001 +From 622a7d9cae44056b7cc06f1c1997fc883cd8c954 Mon Sep 17 00:00:00 2001 From: gokulsanker Date: Wed, 8 Dec 2021 01:44:19 +0530 Subject: [PATCH] If FFUJ is enabled serial console must be disabled @@ -8,16 +8,56 @@ line interface. Serial console is disabled by creating an indefinite sleep if FFUJ is enabled, same functionality is used in whitely platforms +Since, boot failure check and FFUJ check were handled +by a single function, U-boot was disabling serial console which was the +expected behaviour of FFUJ mode. +That single fuction was splitted into two separate function for FFUJ +check and boot failure check. So in case of failed boot check, BMC +is going for #ast mode. + Tested: Serial console is disabled in FFUJ mode +After 3rd terminating command for watchdog,this is the output: +Board ID: 0x02 +Net: eth1: ftgmac@1e680000 +FFUJ: 0 +Intel failed boot check +ast# + Signed-off-by: gokulsanker +Signed-off-by: Anjaliintel-21 --- - common/autoboot.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) + board/aspeed/ast2600_intel/intel.c | 6 ++---- + common/autoboot.c | 16 ++++++++++++++-- + 2 files changed, 16 insertions(+), 6 deletions(-) +diff --git a/board/aspeed/ast2600_intel/intel.c b/board/aspeed/ast2600_intel/intel.c +index 37b798ea44..fc435935de 100644 +--- a/board/aspeed/ast2600_intel/intel.c ++++ b/board/aspeed/ast2600_intel/intel.c +@@ -57,7 +57,8 @@ int intel_failed_boot(void) + ret = led_get_by_label("id", &dev); + if (!ret) + led_set_state(dev, LEDST_ON); +- ++ printf("Intel failed boot check \n"); ++ + return 1; + } + +@@ -111,9 +112,6 @@ int gpio_abort(void) + { + int value; + +- if (intel_failed_boot()) +- return 1; +- + /* check ffuj to abort the autoboot */ + value = read_ffuj(); + printf("FFUJ: %d\n", value); diff --git a/common/autoboot.c b/common/autoboot.c -index 8a99780423..21e59feea7 100644 +index 8a99780423..b9b872f6f1 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -19,6 +19,7 @@ DECLARE_GLOBAL_DATA_PTR; @@ -28,13 +68,12 @@ index 8a99780423..21e59feea7 100644 #ifndef DEBUG_BOOTKEYS #define DEBUG_BOOTKEYS 0 #endif -@@ -271,9 +272,14 @@ static int abortboot(int bootdelay) +@@ -271,9 +272,20 @@ static int abortboot(int bootdelay) { int abort = 0; - abort = gpio_abort(); - if (abort) -- goto exit; + if (gpio_abort()) + { + printf("#### BMC is in disabled state(FFU Jumper is asserted), " @@ -42,6 +81,12 @@ index 8a99780423..21e59feea7 100644 + while (1) { + mdelay(WAIT_STATE_TIMEOUT); + } ++ } ++ ++ if (intel_failed_boot()) ++ { ++ abort=1; + goto exit; + } if (bootdelay >= 0) diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0006-Fix-PSU-fan-sensor-read-0.patch b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0006-Fix-PSU-fan-sensor-read-0.patch new file mode 100644 index 000000000..800b107d7 --- /dev/null +++ b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed/0006-Fix-PSU-fan-sensor-read-0.patch @@ -0,0 +1,26 @@ +From bf27d571ef4e46724a60e26ff52e0eae9709db75 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Tue, 11 Jan 2022 09:00:01 -0800 +Subject: [PATCH] Fix PSU fan sensor read 0 + +Signed-off-by: Zhikui Ren +--- + drivers/hwmon/pmbus/pmbus_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c +index a4bf6f0fe013..c45b283fffa7 100644 +--- a/drivers/hwmon/pmbus/pmbus_core.c ++++ b/drivers/hwmon/pmbus/pmbus_core.c +@@ -997,7 +997,7 @@ static ssize_t pmbus_set_sensor(struct device *dev, + if (ret < 0) + rv = ret; + else +- sensor->data = -ENODATA; ++ sensor->data = regval; + mutex_unlock(&data->update_lock); + return rv; + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend index 94d22381f..7ec69d252 100644 --- a/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-ast2600/recipes-kernel/linux/linux-aspeed_%.bbappend @@ -8,4 +8,5 @@ SRC_URI += " \ file://0003-serial-8250_aspeed-Make-port-type-fixed.patch \ file://0004-Add-a-workaround-to-cover-UART-interrupt-bug-in-AST2.patch \ file://0005-Add-sample-i3c-slave-driver.patch \ + file://0006-Fix-PSU-fan-sensor-read-0.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh b/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh index bf5377482..5a1fa3240 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh +++ b/meta-openbmc-mods/meta-common/recipes-core/ac-boot-check/ac-boot-check/ac-boot-check.sh @@ -21,6 +21,14 @@ done < /proc/cmdline busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/control/host0/ac_boot xyz.openbmc_project.Common.ACBoot ACBoot s "$ACBOOT" +if [ "$ACBOOT" == "True" ]; then + # On AC cycle, setting service's last event parameters of PFR reset to allow logging of every recovery event in redfish event log + busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/pfr/last_events xyz.openbmc_project.PFR.LastEvents lastMajorErr y 0 + busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/pfr/last_events xyz.openbmc_project.PFR.LastEvents lastMinorErr y 0 + busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/pfr/last_events xyz.openbmc_project.PFR.LastEvents lastPanicCount y 0 + busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/pfr/last_events xyz.openbmc_project.PFR.LastEvents lastRecoveryCount y 0 +fi + source /etc/os-release echo "VERSION INFO - BMC - ${VERSION_ID}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/expat/expat/run-ptest b/meta-openbmc-mods/meta-common/recipes-core/expat/expat/run-ptest new file mode 100644 index 000000000..2cd3637d8 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/expat/expat/run-ptest @@ -0,0 +1,23 @@ +#!/bin/bash + +output=${1:-"expat_tests.log"} # default log file + +# logging function +function testCheck() { + testExec="$1" + shift + echo && echo ${testExec} && ./${testExec} "$@" + error=$? + result=$([[ ${error} -eq 0 ]] && echo "PASS" || echo "FAIL") + echo "${result}: ${testExec}" && echo "============================" +} + +export output +export -f testCheck +TIME=$(which time) + +echo "runtests" +${TIME} -f 'Execution time: %e s' bash -c "./runtests -v" +echo "runtestspp" +${TIME} -f 'Execution time: %e s' bash -c "./runtestspp -v" +echo diff --git a/meta-openbmc-mods/meta-common/recipes-core/expat/expat_2.4.4.bb b/meta-openbmc-mods/meta-common/recipes-core/expat/expat_2.4.4.bb new file mode 100644 index 000000000..332dc0603 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/expat/expat_2.4.4.bb @@ -0,0 +1,31 @@ +SUMMARY = "A stream-oriented XML parser library" +DESCRIPTION = "Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags)" +HOMEPAGE = "http://expat.sourceforge.net/" +SECTION = "libs" +LICENSE = "MIT" + +LIC_FILES_CHKSUM = "file://COPYING;md5=9e2ce3b3c4c0f2670883a23bbd7c37a9" + +VERSION_TAG = "${@d.getVar('PV').replace('.', '_')}" + +SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TAG}/expat-${PV}.tar.bz2 \ + file://run-ptest \ + " + +UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/" + +SRC_URI[sha256sum] = "14c58c2a0b5b8b31836514dfab41bd191836db7aa7b84ae5c47bc0327a20d64a" + +EXTRA_OECMAKE:class-native += "-DEXPAT_BUILD_DOCS=OFF" + +RDEPENDS:${PN}-ptest += "bash" + +inherit cmake lib_package ptest + +do_install_ptest:class-target() { + install -m 755 ${B}/tests/* ${D}${PTEST_PATH} +} + +BBCLASSEXTEND += "native nativesdk" + +CVE_PRODUCT = "expat libexpat" diff --git a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch new file mode 100644 index 000000000..4eb1fb7fb --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0001-CVE-2022-23218.patch @@ -0,0 +1,178 @@ +From e368b12f6c16b6888dda99ba641e999b9c9643c8 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Mon, 17 Jan 2022 10:21:34 +0100 +Subject: [PATCH] socket: Add the __sockaddr_un_set function + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=e368b12f6c16b6888dda99ba641e999b9c9643c8] +CVE: CVE-2022-23219 + +Reviewed-by: Siddhesh Poyarekar +Signed-off-by: Pgowda +--- + include/sys/un.h | 12 +++++++ + socket/Makefile | 6 +++- + socket/sockaddr_un_set.c | 41 ++++++++++++++++++++++++ + socket/tst-sockaddr_un_set.c | 62 ++++++++++++++++++++++++++++++++++++ + 4 files changed, 120 insertions(+), 1 deletion(-) + create mode 100644 socket/sockaddr_un_set.c + create mode 100644 socket/tst-sockaddr_un_set.c + +diff --git a/include/sys/un.h b/include/sys/un.h +index bdbee99980..152afd9fc7 100644 +--- a/include/sys/un.h ++++ b/include/sys/un.h +@@ -1 +1,13 @@ + #include ++ ++#ifndef _ISOMAC ++ ++/* Set ADDR->sun_family to AF_UNIX and ADDR->sun_path to PATHNAME. ++ Return 0 on success or -1 on failure (due to overlong PATHNAME). ++ The caller should always use sizeof (struct sockaddr_un) as the ++ socket address length, disregaring the length of PATHNAME. ++ Only concrete (non-abstract) pathnames are supported. */ ++int __sockaddr_un_set (struct sockaddr_un *addr, const char *pathname) ++ attribute_hidden; ++ ++#endif /* _ISOMAC */ +diff --git a/socket/Makefile b/socket/Makefile +index 39333e10ca..156eec6c85 100644 +--- a/socket/Makefile ++++ b/socket/Makefile +@@ -29,13 +29,17 @@ headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \ + routines := accept bind connect getpeername getsockname getsockopt \ + listen recv recvfrom recvmsg send sendmsg sendto \ + setsockopt shutdown socket socketpair isfdtype opensock \ +- sockatmark accept4 recvmmsg sendmmsg ++ sockatmark accept4 recvmmsg sendmmsg sockaddr_un_set + + tests := \ + tst-accept4 \ + tst-sockopt \ + # tests + ++tests-internal := \ ++ tst-sockaddr_un_set \ ++ # tests-internal ++ + tests-time64 := \ + tst-sockopt-time64 \ + # tests +diff --git a/socket/sockaddr_un_set.c b/socket/sockaddr_un_set.c +new file mode 100644 +index 0000000000..0bd40dc34e +--- /dev/null ++++ b/socket/sockaddr_un_set.c +@@ -0,0 +1,41 @@ ++/* Set the sun_path member of struct sockaddr_un. ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++ ++int ++__sockaddr_un_set (struct sockaddr_un *addr, const char *pathname) ++{ ++ size_t name_length = strlen (pathname); ++ ++ /* The kernel supports names of exactly sizeof (addr->sun_path) ++ bytes, without a null terminator, but userspace does not; see the ++ SUN_LEN macro. */ ++ if (name_length >= sizeof (addr->sun_path)) ++ { ++ __set_errno (EINVAL); /* Error code used by the kernel. */ ++ return -1; ++ } ++ ++ addr->sun_family = AF_UNIX; ++ memcpy (addr->sun_path, pathname, name_length + 1); ++ return 0; ++} +diff --git a/socket/tst-sockaddr_un_set.c b/socket/tst-sockaddr_un_set.c +new file mode 100644 +index 0000000000..29c2a81afd +--- /dev/null ++++ b/socket/tst-sockaddr_un_set.c +@@ -0,0 +1,62 @@ ++/* Test the __sockaddr_un_set function. ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++/* Re-compile the function because the version in libc is not ++ exported. */ ++#include "sockaddr_un_set.c" ++ ++#include ++ ++static int ++do_test (void) ++{ ++ struct sockaddr_un sun; ++ ++ memset (&sun, 0xcc, sizeof (sun)); ++ __sockaddr_un_set (&sun, ""); ++ TEST_COMPARE (sun.sun_family, AF_UNIX); ++ TEST_COMPARE (__sockaddr_un_set (&sun, ""), 0); ++ ++ memset (&sun, 0xcc, sizeof (sun)); ++ TEST_COMPARE (__sockaddr_un_set (&sun, "/example"), 0); ++ TEST_COMPARE_STRING (sun.sun_path, "/example"); ++ ++ { ++ char pathname[108]; /* Length of sun_path (ABI constant). */ ++ memset (pathname, 'x', sizeof (pathname)); ++ pathname[sizeof (pathname) - 1] = '\0'; ++ memset (&sun, 0xcc, sizeof (sun)); ++ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), 0); ++ TEST_COMPARE (sun.sun_family, AF_UNIX); ++ TEST_COMPARE_STRING (sun.sun_path, pathname); ++ } ++ ++ { ++ char pathname[109]; ++ memset (pathname, 'x', sizeof (pathname)); ++ pathname[sizeof (pathname) - 1] = '\0'; ++ memset (&sun, 0xcc, sizeof (sun)); ++ errno = 0; ++ TEST_COMPARE (__sockaddr_un_set (&sun, pathname), -1); ++ TEST_COMPARE (errno, EINVAL); ++ } ++ ++ return 0; ++} ++ ++#include +-- +2.27.0 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch new file mode 100644 index 000000000..261c2909d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0001-CVE-2022-23219.patch @@ -0,0 +1,55 @@ +From 226b46770c82899b555986583294b049c6ec9b40 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Mon, 17 Jan 2022 10:21:34 +0100 +Subject: [PATCH] CVE-2022-23219: Buffer overflow in sunrpc clnt_create for + "unix" (bug 22542) + +Processing an overlong pathname in the sunrpc clnt_create function +results in a stack-based buffer overflow. + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=226b46770c82899b555986583294b049c6ec9b40] +CVE: CVE-2022-23219 + +Reviewed-by: Siddhesh Poyarekar +Signed-off-by: Pgowda +--- + NEWS | 4 +++- + sunrpc/clnt_gen.c | 10 +++++++--- + 2 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/NEWS b/NEWS +index ddd95a8329..38a9ddb2cf 100644 +--- a/NEWS ++++ b/NEWS +@@ -206,6 +206,10 @@ Security related changes: + CVE-2022-23218: Passing an overlong file name to the svcunix_create + legacy function could result in a stack-based buffer overflow. + ++ CVE-2022-23219: Passing an overlong file name to the clnt_create ++ legacy function could result in a stack-based buffer overflow when ++ using the "unix" protocol. Reported by Martin Sebor. ++ + The following bugs are resolved with this release: + + [4737] libc: fork is not async-signal-safe +diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c +index 13ced8994e..b44357cd88 100644 +--- a/sunrpc/clnt_gen.c ++++ b/sunrpc/clnt_gen.c +@@ -57,9 +57,13 @@ clnt_create (const char *hostname, u_lon + + if (strcmp (proto, "unix") == 0) + { +- memset ((char *)&sun, 0, sizeof (sun)); +- sun.sun_family = AF_UNIX; +- strcpy (sun.sun_path, hostname); ++ if (__sockaddr_un_set (&sun, hostname) < 0) ++ { ++ struct rpc_createerr *ce = &get_rpc_createerr (); ++ ce->cf_stat = RPC_SYSTEMERROR; ++ ce->cf_error.re_errno = errno; ++ return NULL; ++ } + sock = RPC_ANYSOCK; + client = clntunix_create (&sun, prog, vers, &sock, 0, 0); + if (client == NULL) diff --git a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch new file mode 100644 index 000000000..00fb3266c --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0002-CVE-2022-23218.patch @@ -0,0 +1,126 @@ +From f545ad4928fa1f27a3075265182b38a4f939a5f7 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Mon, 17 Jan 2022 10:21:34 +0100 +Subject: [PATCH] CVE-2022-23218: Buffer overflow in sunrpc svcunix_create (bug + 28768) + +The sunrpc function svcunix_create suffers from a stack-based buffer +overflow with overlong pathname arguments. + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=f545ad4928fa1f27a3075265182b38a4f939a5f7] +CVE: CVE-2022-23218 + +Reviewed-by: Siddhesh Poyarekar +Signed-off-by: Pgowda +--- + NEWS | 3 +++ + sunrpc/Makefile | 2 +- + sunrpc/svc_unix.c | 11 ++++------- + sunrpc/tst-bug28768.c | 42 ++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 50 insertions(+), 8 deletions(-) + create mode 100644 sunrpc/tst-bug28768.c + +diff --git a/NEWS b/NEWS +index 38a9ddb2cf..38802f0673 100644 +--- a/NEWS ++++ b/NEWS +@@ -203,6 +203,9 @@ Security related changes: + parameter number when processing the expansion resulting in a crash. + Reported by Philippe Antoine. + ++ CVE-2022-23218: Passing an overlong file name to the svcunix_create ++ legacy function could result in a stack-based buffer overflow. ++ + The following bugs are resolved with this release: + + [4737] libc: fork is not async-signal-safe +diff --git a/sunrpc/Makefile b/sunrpc/Makefile +index 183ef3dc55..a79a7195fc 100644 +--- a/sunrpc/Makefile ++++ b/sunrpc/Makefile +@@ -65,7 +65,7 @@ shared-only-routines = $(routines) + endif + + tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \ +- tst-udp-nonblocking ++ tst-udp-nonblocking tst-bug28768 + xtests := tst-getmyaddr + + ifeq ($(have-thread-library),yes) +diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c +index f2280b4c49..67177a2e78 100644 +--- a/sunrpc/svc_unix.c ++++ b/sunrpc/svc_unix.c +@@ -154,7 +154,10 @@ svcunix_create (int sock, u_int sendsize + SVCXPRT *xprt; + struct unix_rendezvous *r; + struct sockaddr_un addr; +- socklen_t len = sizeof (struct sockaddr_in); ++ socklen_t len = sizeof (addr); ++ ++ if (__sockaddr_un_set (&addr, path) < 0) ++ return NULL; + + if (sock == RPC_ANYSOCK) + { +@@ -165,12 +168,6 @@ svcunix_create (int sock, u_int sendsize + } + madesock = TRUE; + } +- memset (&addr, '\0', sizeof (addr)); +- addr.sun_family = AF_UNIX; +- len = strlen (path) + 1; +- memcpy (addr.sun_path, path, len); +- len += sizeof (addr.sun_family); +- + __bind (sock, (struct sockaddr *) &addr, len); + + if (__getsockname (sock, (struct sockaddr *) &addr, &len) != 0 +diff --git a/sunrpc/tst-bug28768.c b/sunrpc/tst-bug28768.c +new file mode 100644 +index 0000000000..35a4b7b0b3 +--- /dev/null ++++ b/sunrpc/tst-bug28768.c +@@ -0,0 +1,42 @@ ++/* Test to verify that long path is rejected by svcunix_create (bug 28768). ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++/* svcunix_create does not have a default version in linkobj/libc.so. */ ++compat_symbol_reference (libc, svcunix_create, svcunix_create, GLIBC_2_1); ++ ++static int ++do_test (void) ++{ ++ char pathname[109]; ++ memset (pathname, 'x', sizeof (pathname)); ++ pathname[sizeof (pathname) - 1] = '\0'; ++ ++ errno = 0; ++ TEST_VERIFY (svcunix_create (RPC_ANYSOCK, 4096, 4096, pathname) == NULL); ++ TEST_COMPARE (errno, EINVAL); ++ ++ return 0; ++} ++ ++#include diff --git a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch new file mode 100644 index 000000000..6779e9afd --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/0002-CVE-2022-23219.patch @@ -0,0 +1,89 @@ +From ef972a4c50014a16132b5c75571cfb6b30bef136 Mon Sep 17 00:00:00 2001 +From: Martin Sebor +Date: Mon, 17 Jan 2022 10:21:34 +0100 +Subject: [PATCH] sunrpc: Test case for clnt_create "unix" buffer overflow (bug + 22542) + +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=ef972a4c50014a16132b5c75571cfb6b30bef136] +CVE: CVE-2022-23219 + +Reviewed-by: Siddhesh Poyarekar +Signed-off-by: Pgowda +--- + sunrpc/Makefile | 5 ++++- + sunrpc/tst-bug22542.c | 44 +++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 48 insertions(+), 1 deletion(-) + create mode 100644 sunrpc/tst-bug22542.c + +diff --git a/sunrpc/Makefile b/sunrpc/Makefile +index 9a31fe48b9..183ef3dc55 100644 +--- a/sunrpc/Makefile ++++ b/sunrpc/Makefile +@@ -65,7 +65,7 @@ shared-only-routines = $(routines) + endif + + tests = tst-xdrmem tst-xdrmem2 test-rpcent tst-udp-error tst-udp-timeout \ +- tst-udp-nonblocking tst-bug28768 ++ tst-udp-nonblocking tst-bug22542 tst-bug28768 + xtests := tst-getmyaddr + + ifeq ($(have-thread-library),yes) +@@ -110,6 +110,8 @@ $(objpfx)tst-udp-nonblocking: $(common-o + $(objpfx)tst-udp-garbage: \ + $(common-objpfx)linkobj/libc.so $(shared-thread-library) + ++$(objpfx)tst-bug22542: $(common-objpfx)linkobj/libc.so ++ + else # !have-GLIBC_2.31 + + routines = $(routines-for-nss) +diff --git a/sunrpc/tst-bug22542.c b/sunrpc/tst-bug22542.c +new file mode 100644 +index 0000000000..d6cd79787b +--- /dev/null ++++ b/sunrpc/tst-bug22542.c +@@ -0,0 +1,44 @@ ++/* Test to verify that overlong hostname is rejected by clnt_create ++ and doesn't cause a buffer overflow (bug 22542). ++ ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static int ++do_test (void) ++{ ++ /* Create an arbitrary hostname that's longer than fits in sun_path. */ ++ char name [sizeof ((struct sockaddr_un*)0)->sun_path * 2]; ++ memset (name, 'x', sizeof name - 1); ++ name [sizeof name - 1] = '\0'; ++ ++ errno = 0; ++ CLIENT *clnt = clnt_create (name, 0, 0, "unix"); ++ ++ TEST_VERIFY (clnt == NULL); ++ TEST_COMPARE (errno, EINVAL); ++ return 0; ++} ++ ++#include diff --git a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/CVE-2021-43396.patch b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/CVE-2021-43396.patch new file mode 100644 index 000000000..ebea5efd3 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc/CVE-2021-43396.patch @@ -0,0 +1,184 @@ +From ff012870b2c02a62598c04daa1e54632e020fd7d Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Tue, 2 Nov 2021 13:21:42 +0500 +Subject: [PATCH] gconv: Do not emit spurious NUL character in ISO-2022-JP-3 + (bug 28524) + +Bugfix 27256 has introduced another issue: +In conversion from ISO-2022-JP-3 encoding, it is possible +to force iconv to emit extra NUL character on internal state reset. +To do this, it is sufficient to feed iconv with escape sequence +which switches active character set. +The simplified check 'data->__statep->__count != ASCII_set' +introduced by the aforementioned bugfix picks that case and +behaves as if '\0' character has been queued thus emitting it. + +To eliminate this issue, these steps are taken: +* Restore original condition +'(data->__statep->__count & ~7) != ASCII_set'. +It is necessary since bits 0-2 may contain +number of buffered input characters. +* Check that queued character is not NUL. +Similar step is taken for main conversion loop. + +Bundled test case follows following logic: +* Try to convert ISO-2022-JP-3 escape sequence +switching active character set +* Reset internal state by providing NULL as input buffer +* Ensure that nothing has been converted. + +Signed-off-by: Nikita Popov + +CVE: CVE-2021-43396 +Upstream-Status: Backport [ff012870b2c02a62598c04daa1e54632e020fd7d] +--- + iconvdata/Makefile | 5 +++- + iconvdata/bug-iconv15.c | 60 +++++++++++++++++++++++++++++++++++++++ + iconvdata/iso-2022-jp-3.c | 28 ++++++++++++------ + 3 files changed, 84 insertions(+), 9 deletions(-) + create mode 100644 iconvdata/bug-iconv15.c + +Index: git/iconvdata/Makefile +=================================================================== +--- git.orig/iconvdata/Makefile ++++ git/iconvdata/Makefile +@@ -1,4 +1,5 @@ + # Copyright (C) 1997-2021 Free Software Foundation, Inc. ++# Copyright (C) The GNU Toolchain Authors. + # This file is part of the GNU C Library. + + # The GNU C Library is free software; you can redistribute it and/or +@@ -74,7 +75,7 @@ ifeq (yes,$(build-shared)) + tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \ + tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \ + bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 \ +- bug-iconv13 bug-iconv14 ++ bug-iconv13 bug-iconv14 bug-iconv15 + ifeq ($(have-thread-library),yes) + tests += bug-iconv3 + endif +@@ -327,6 +328,8 @@ $(objpfx)bug-iconv12.out: $(addprefix $( + $(addprefix $(objpfx),$(modules.so)) + $(objpfx)bug-iconv14.out: $(addprefix $(objpfx), $(gconv-modules)) \ + $(addprefix $(objpfx),$(modules.so)) ++$(objpfx)bug-iconv15.out: $(addprefix $(objpfx), $(gconv-modules)) \ ++ $(addprefix $(objpfx),$(modules.so)) + + $(objpfx)iconv-test.out: run-iconv-test.sh \ + $(addprefix $(objpfx), $(gconv-modules)) \ +Index: git/iconvdata/bug-iconv15.c +=================================================================== +--- /dev/null ++++ git/iconvdata/bug-iconv15.c +@@ -0,0 +1,60 @@ ++/* Bug 28524: Conversion from ISO-2022-JP-3 with iconv ++ may emit spurious NUL character on state reset. ++ Copyright (C) The GNU Toolchain Authors. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++ ++static int ++do_test (void) ++{ ++ char in[] = "\x1b(I"; ++ char *inbuf = in; ++ size_t inleft = sizeof (in) - 1; ++ char out[1]; ++ char *outbuf = out; ++ size_t outleft = sizeof (out); ++ iconv_t cd; ++ ++ cd = iconv_open ("UTF8", "ISO-2022-JP-3"); ++ TEST_VERIFY_EXIT (cd != (iconv_t) -1); ++ ++ /* First call to iconv should alter internal state. ++ Now, JISX0201_Kana_set is selected and ++ state value != ASCII_set. */ ++ TEST_VERIFY (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) != (size_t) -1); ++ ++ /* No bytes should have been added to ++ the output buffer at this point. */ ++ TEST_VERIFY (outbuf == out); ++ TEST_VERIFY (outleft == sizeof (out)); ++ ++ /* Second call shall emit spurious NUL character in unpatched glibc. */ ++ TEST_VERIFY (iconv (cd, NULL, NULL, &outbuf, &outleft) != (size_t) -1); ++ ++ /* No characters are expected to be produced. */ ++ TEST_VERIFY (outbuf == out); ++ TEST_VERIFY (outleft == sizeof (out)); ++ ++ TEST_VERIFY_EXIT (iconv_close (cd) != -1); ++ ++ return 0; ++} ++ ++#include +Index: git/iconvdata/iso-2022-jp-3.c +=================================================================== +--- git.orig/iconvdata/iso-2022-jp-3.c ++++ git/iconvdata/iso-2022-jp-3.c +@@ -1,5 +1,6 @@ + /* Conversion module for ISO-2022-JP-3. + Copyright (C) 1998-2021 Free Software Foundation, Inc. ++ Copyright (C) The GNU Toolchain Authors. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998, + and Bruno Haible , 2002. +@@ -81,20 +82,31 @@ enum + the output state to the initial state. This has to be done during the + flushing. */ + #define EMIT_SHIFT_TO_INIT \ +- if (data->__statep->__count != ASCII_set) \ ++ if ((data->__statep->__count & ~7) != ASCII_set) \ + { \ + if (FROM_DIRECTION) \ + { \ +- if (__glibc_likely (outbuf + 4 <= outend)) \ ++ uint32_t ch = data->__statep->__count >> 6; \ ++ \ ++ if (__glibc_unlikely (ch != 0)) \ + { \ +- /* Write out the last character. */ \ +- *((uint32_t *) outbuf) = data->__statep->__count >> 6; \ +- outbuf += sizeof (uint32_t); \ +- data->__statep->__count = ASCII_set; \ ++ if (__glibc_likely (outbuf + 4 <= outend)) \ ++ { \ ++ /* Write out the last character. */ \ ++ put32u (outbuf, ch); \ ++ outbuf += 4; \ ++ data->__statep->__count &= 7; \ ++ data->__statep->__count |= ASCII_set; \ ++ } \ ++ else \ ++ /* We don't have enough room in the output buffer. */ \ ++ status = __GCONV_FULL_OUTPUT; \ + } \ + else \ +- /* We don't have enough room in the output buffer. */ \ +- status = __GCONV_FULL_OUTPUT; \ ++ { \ ++ data->__statep->__count &= 7; \ ++ data->__statep->__count |= ASCII_set; \ ++ } \ + } \ + else \ + { \ diff --git a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc_%.bbappend index 19e136238..be793e5e8 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/glibc/glibc_%.bbappend @@ -3,4 +3,9 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI += " \ file://0035-Fix-build-error.patch \ file://0036-sunrpc-use-snprintf-to-guard-against-buffer-overflow.patch \ + file://0001-CVE-2022-23218.patch \ + file://0002-CVE-2022-23218.patch \ + file://0001-CVE-2022-23219.patch \ + file://0002-CVE-2022-23219.patch \ + file://CVE-2021-43396.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend index a9e6c81ad..26bbc34ee 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/ipmi/intel-ipmi-oem_%.bbappend @@ -2,7 +2,7 @@ EXTRA_OECMAKE += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', '-DINTEL_PF EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" EXTRA_OECMAKE += "-DUSING_ENTITY_MANAGER_DECORATORS=OFF" SRC_URI = "git://github.com/openbmc/intel-ipmi-oem.git" -SRCREV = "d2d60ab5b325c4630c8e794e861b88cf3c9337bf" +SRCREV = "a165038f0472459ae2ec0ae50b7e0c09969882c7" FILESEXTRAPATHS:append := ":${THISDIR}/${PN}" diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0003-Added-timeout-to-systemd-networkd-wait-online.servic.patch b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0003-Added-timeout-to-systemd-networkd-wait-online.servic.patch new file mode 100644 index 000000000..5bdaa8e1d --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd/0003-Added-timeout-to-systemd-networkd-wait-online.servic.patch @@ -0,0 +1,26 @@ +From 3f651f6d9d9f6c07c852a94966d40f2390c528b0 Mon Sep 17 00:00:00 2001 +From: Gokul Sanker V G +Date: Wed, 26 Jan 2022 17:35:27 +0530 +Subject: [PATCH] Added timeout to systemd-networkd-wait-online.service + +Signed-off-by: Gokul Sanker V G +--- + units/systemd-networkd-wait-online.service.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/units/systemd-networkd-wait-online.service.in b/units/systemd-networkd-wait-online.service.in +index 10d8b08c8e..04abd55ef4 100644 +--- a/units/systemd-networkd-wait-online.service.in ++++ b/units/systemd-networkd-wait-online.service.in +@@ -18,7 +18,7 @@ Before=network-online.target shutdown.target + + [Service] + Type=oneshot +-ExecStart={{ROOTLIBEXECDIR}}/systemd-networkd-wait-online ++ExecStart={{ROOTLIBEXECDIR}}/systemd-networkd-wait-online --timeout=60 + RemainAfterExit=yes + + [Install] +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend index 2eb5330d8..6b7cc8a0d 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-core/systemd/systemd_%.bbappend @@ -3,6 +3,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI += "file://0002-Add-event-log-for-system-time-synchronization.patch \ + file://0003-Added-timeout-to-systemd-networkd-wait-online.servic.patch \ " # We don't support loadable modules in kernel config diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager/0001-mainapp-Modify-Redfish-MessageID-from-Panic-to-Resil.patch b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager/0001-mainapp-Modify-Redfish-MessageID-from-Panic-to-Resil.patch new file mode 100644 index 000000000..1296d38a7 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager/0001-mainapp-Modify-Redfish-MessageID-from-Panic-to-Resil.patch @@ -0,0 +1,119 @@ +From 5e41f37815549b0635941f7f0dbc2bb925f61cfd Mon Sep 17 00:00:00 2001 +From: Chalapathi Venkataramashetty +Date: Thu, 7 Oct 2021 16:07:47 +0000 +Subject: [PATCH] mainapp: Modify Redfish MessageID from 'Panic' to + 'Resiliency' + +Panic word not suitable for Platform firmware resiliency events. Hence +modify the Redfish MessageID to following MessageIDs. +1. FirmwareResiliency for warning severity events. +2. FirmwareUpdateStatus for firmware update notifications with +OK severity. + +The above Message registries are updated in below bmcweb review. +https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/48988 + +Tested: +Enable PFR provision. + +1. Update BMC firmware +POST: https:///redfish/v1/UpdateService/ + with binary file +After BMC reboots check for Event log in Redfish +Command: GET: https:///redfish/v1/Systems/system/LogServices/ + EventLog/Entries +Response: + { + "@odata.id": "/redfish/v1/Systems/system/LogServices/ + EventLog/Entries/1618207226", + "@odata.type": "#LogEntry.v1_8_0.LogEntry", + "Created": "2021-04-12T06:00:26+00:00", + "EntryType": "Event", + "Id": "1618207226", + "Message": "Firmware update occurred due to BMC update + intent.", + "MessageArgs": [ + "BMC update intent" + ], + "MessageId": "OpenBMC.0.2.FirmwareUpdateStatus", + "Name": "System Event Log Entry", + "Severity": "OK" + } +2. Reset BMC. +Command: ipmitool raw 6 2 +After BMC reboots check for Event log in Redfish +Command: GET: https:///redfish/v1/Systems/system/LogServices/ + EventLog/Entries +Response: + { + "@odata.id": "/redfish/v1/Systems/system/LogServices/ + EventLog/Entries/1618207249", + "@odata.type": "#LogEntry.v1_8_0.LogEntry", + "Created": "2021-04-12T06:02:49+00:00", + "EntryType": "Event", + "Id": "1618207249", + "Message": "Firmware resiliency event occurred due to BMC + reset detected.", + "MessageArgs": [ + "BMC reset detected" + ], + "MessageId": "OpenBMC.0.2.FirmwareResiliency", + "Name": "System Event Log Entry", + "Severity": "Warning" + } + +Signed-off-by: Chalapathi Venkataramashetty +Change-Id: I1a3a563fb345dce270e3678290dbc7ee7c134b9e +--- + service/src/mainapp.cpp | 28 +++++++++++++--------------- + 1 file changed, 13 insertions(+), 15 deletions(-) + +diff --git a/service/src/mainapp.cpp b/service/src/mainapp.cpp +index 8a91dab..60bf3ad 100644 +--- a/service/src/mainapp.cpp ++++ b/service/src/mainapp.cpp +@@ -83,16 +83,15 @@ static const boost::container::flat_map, {, }) + static const boost::container::flat_map> +- panicReasonMap = { +- {0x01, {"BIOSFirmwarePanicReason", "BIOS update intent"}}, +- {0x02, {"BMCFirmwarePanicReason", "BMC update intent"}}, +- {0x03, {"BMCFirmwarePanicReason", "BMC reset detected"}}, +- {0x04, {"BMCFirmwarePanicReason", "BMC watchdog expired"}}, +- {0x05, {"MEFirmwarePanicReason", "ME watchdog expired"}}, +- {0x06, {"BIOSFirmwarePanicReason", "ACM watchdog expired"}}, +- {0x09, +- {"BIOSFirmwarePanicReason", +- "ACM or IBB or OBB authentication failure"}}}; ++ panicReasonMap = {{0x01, {"FirmwareUpdateStatus", "BIOS update intent"}}, ++ {0x02, {"FirmwareUpdateStatus", "BMC update intent"}}, ++ {0x03, {"FirmwareResiliency", "BMC reset detected"}}, ++ {0x04, {"FirmwareResiliency", "BMC watchdog expired"}}, ++ {0x05, {"FirmwareResiliency", "ME watchdog expired"}}, ++ {0x06, {"FirmwareResiliency", "ACM watchdog expired"}}, ++ {0x09, ++ {"FirmwareResiliencyError", ++ "ACM or IBB or OBB authentication failure"}}}; + + // Firmware resiliency major map. + // {, {, }) +@@ -156,11 +155,10 @@ static void logLastPanicEvent() + return; + } + +- std::string msgId = "OpenBMC.0.1." + it->second.first; +- sd_journal_send("MESSAGE=%s", "Platform firmware panic occurred.", +- "PRIORITY=%i", LOG_WARNING, "REDFISH_MESSAGE_ID=%s", +- msgId.c_str(), "REDFISH_MESSAGE_ARGS=%s", +- it->second.second.c_str(), NULL); ++ std::string msgId = "OpenBMC.0.2." + it->second.first; ++ sd_journal_send("MESSAGE=Platform firmware resiliency event occurred.", ++ "REDFISH_MESSAGE_ID=%s", msgId.c_str(), ++ "REDFISH_MESSAGE_ARGS=%s", it->second.second.c_str(), NULL); + } + + static void logResiliencyErrorEvent(const uint8_t majorErrorCode, +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend index 1e6becb03..5f591a295 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-intel/intel-pfr/pfr-manager_%.bbappend @@ -3,3 +3,7 @@ SRC_URI = "git://github.com/openbmc/pfr-manager" SRCREV = "57f42c3d37d9546ede4f2c015bf9f392130c93b5" DEPENDS += " libgpiod \ " + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +SRC_URI += "file://0001-mainapp-Modify-Redfish-MessageID-from-Panic-to-Resil.patch \ + " diff --git a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/files/0001-Add-vector-size-check.patch b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/files/0001-Add-vector-size-check.patch new file mode 100644 index 000000000..0df27f048 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/files/0001-Add-vector-size-check.patch @@ -0,0 +1,49 @@ +From 556d1fe01fa1624b7ee967efbd2f55ed80375356 Mon Sep 17 00:00:00 2001 +From: "Arun P. Mohanan" +Date: Tue, 15 Feb 2022 16:56:37 +0530 +Subject: [PATCH] Add vector size check + +When PowerSupplyRedundancyEnabled is set to true and RotationRankOrder +is 0, xyz.openbmc_project.coldredundancy.service core-dump issue +is observed. + +Add a check to address above corner case and avoid core-dump. + +Tested: +Verified core-dump is not observed with above settings + +Feb 15 11:39:25 intel-obmc psuredundancy[18502]: RotationRankOrder less than number of PSUs + +Signed-off-by: Arun P. Mohanan +--- + src/cold_redundancy.cpp | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/src/cold_redundancy.cpp b/src/cold_redundancy.cpp +index 9cee6ec..9dc5907 100644 +--- a/src/cold_redundancy.cpp ++++ b/src/cold_redundancy.cpp +@@ -615,7 +615,19 @@ void ColdRedundancy::reRanking(void) + { + psu->order = 0; + } +- orders[psuNumber++] = psu->order; ++ if (psuNumber < orders.size()) ++ { ++ orders[psuNumber++] = psu->order; ++ } ++ else ++ { ++ static bool logOnlyOnce = false; ++ if (!logOnlyOnce) ++ { ++ std::cerr << "RotationRankOrder less than number of PSUs\n"; ++ logOnlyOnce = true; ++ } ++ } + } + rotationRankOrder(orders); + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb index 6ce844f60..4c1625695 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/psu-manager/psu-manager.bb @@ -4,6 +4,8 @@ DESCRIPTION = "Power supply manager which include PSU Cold Redundancy service" SRC_URI = "git://git@github.com/Intel-BMC/psu-manager.git;protocol=ssh" SRCREV = "30788892792c302b1317bac4e7f837ca1374d789" +SRC_URI += "file://0001-Add-vector-size-check.patch \ + " S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb index fefaddbce..1a7e3a26c 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2.bb @@ -2,7 +2,7 @@ SUMMARY = "SMBIOS MDR version 2 service for Intel based platform" DESCRIPTION = "SMBIOS MDR version 2 service for Intel based platfrom" SRC_URI = "git://github.com/openbmc/smbios-mdr.git" -SRCREV = "bc924d0f9f590d7d420b9f7bc98bdb9b8688618e" +SRCREV = "0435a483afb10a5eabe7ae93f07fbb2d2265e53f" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-peci-aspeed-Improve-workaround-for-controller-hang.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-peci-aspeed-Improve-workaround-for-controller-hang.patch new file mode 100644 index 000000000..6639862aa --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0001-peci-aspeed-Improve-workaround-for-controller-hang.patch @@ -0,0 +1,55 @@ +From c658e865b15daaaf0e873512f7e454305717ca41 Mon Sep 17 00:00:00 2001 +From: Iwona Winiarska +Date: Thu, 27 Jan 2022 21:09:52 +0100 +Subject: [PATCH] peci: aspeed: Improve workaround for controller hang + +When processing PECI transaction, observing any HW state different than +"idle" means that PECI controller won't be able to send PECI commands. +When that occurs, attempting to reinitialize the HW by writing registers +is not enough in some cases, and actual reset needs to be involved. + +Fixes: 20b020c06aa9 ("peci: aspeed: add a WA to cover timing negotiation issue") +Signed-off-by: Iwona Winiarska +--- + drivers/peci/busses/peci-aspeed.c | 23 +++++++++++++++++++++-- + 1 file changed, 21 insertions(+), 2 deletions(-) + +diff --git a/drivers/peci/busses/peci-aspeed.c b/drivers/peci/busses/peci-aspeed.c +index 9dd3686a4228..224a3ae8492c 100644 +--- a/drivers/peci/busses/peci-aspeed.c ++++ b/drivers/peci/busses/peci-aspeed.c +@@ -165,10 +165,29 @@ static void aspeed_peci_init_regs(struct aspeed_peci *priv) + static inline int aspeed_peci_check_idle(struct aspeed_peci *priv) + { + u32 cmd_sts = readl(priv->base + ASPEED_PECI_CMD); ++ int ret; ++ ++ /* ++ * Under normal circumstances, we expect to be idle here. ++ * In case there were any errors/timeouts that led to the situation ++ * where the hardware is not in idle state - we need to reset and ++ * reinitialize it to avoid potential controller hang. ++ */ ++ if (FIELD_GET(ASPEED_PECI_CMD_STS_MASK, cmd_sts)) { ++ ret = reset_control_assert(priv->rst); ++ if (ret) { ++ dev_err(priv->dev, "cannot assert reset control\n"); ++ return ret; ++ } ++ ++ ret = reset_control_deassert(priv->rst); ++ if (ret) { ++ dev_err(priv->dev, "cannot deassert reset control\n"); ++ return ret; ++ } + +- if (FIELD_GET(ASPEED_PECI_CMD_STS_MASK, +- cmd_sts) == ASPEED_PECI_CMD_STS_ADDR_T_NEGO) + aspeed_peci_init_regs(priv); ++ } + + return readl_poll_timeout(priv->base + ASPEED_PECI_CMD, + cmd_sts, +-- +2.34.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend index 2a9a03d1b..302338120 100644 --- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed_%.bbappend @@ -15,6 +15,7 @@ do_compile:prepend(){ SRC_URI += " \ file://intel.cfg \ + file://0001-peci-aspeed-Improve-workaround-for-controller-hang.patch \ " SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'file://1000-128MB-flashmap-for-PFR.patch', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Revert-ethernet_interface-Defer-setting-NIC-enabled.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Revert-ethernet_interface-Defer-setting-NIC-enabled.patch new file mode 100644 index 000000000..48ce9e508 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0004-Revert-ethernet_interface-Defer-setting-NIC-enabled.patch @@ -0,0 +1,60 @@ +From 6e2a7257749c2b27f20095514a96d0b85a4d1fcc Mon Sep 17 00:00:00 2001 +From: Johnathan Mantey +Date: Mon, 17 Jan 2022 11:18:21 -0800 +Subject: [PATCH] Revert "ethernet_interface: Defer setting NIC enabled" + +This reverts commit 329b5fba06acd63ce0fb9f43ea3f99b1542e862e. + +The changes made in this commit prevent enabling and disabling the +NIC. The "Unmanaged" entry in the systemd.network configuration file +is never created or removed. + +Tested: +Alternated the Redfish PATCH command between true and false. +PATCH :url/redfish/v1/Managers/bmc/EthernetInterfaces/eth1 +"InterfaceEnabled": + +Observed the contents of the systemd.network file and saw the +"Unmanaged" entry was never created or removed. + +Used "ip a" to review the active state of the NIC. The NIC was always +active despite sending a PATCH command to disable the NIC. + +When this commit is reverted the NIC enable/disable feature works as +expected. + +Change-Id: Ie4945baa5fff238effe9e2b7b156616cf7200597 +Signed-off-by: Johnathan Mantey +--- + src/ethernet_interface.cpp | 13 +++---------- + 1 file changed, 3 insertions(+), 10 deletions(-) + +diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp +index 3cca478..fb4bfd6 100644 +--- a/src/ethernet_interface.cpp ++++ b/src/ethernet_interface.cpp +@@ -785,18 +785,11 @@ bool EthernetInterface::nicEnabled(bool value) + return EthernetInterfaceIntf::nicEnabled(); + } + auto ifname = interfaceName(); ++ setNICAdminState(eifSocket.sock, ifname.c_str(), value); + +- writeConfigurationFile(); +- if (!value) +- { +- // We only need to bring down the interface, networkd will always bring +- // up managed interfaces +- manager.addReloadPreHook( +- [ifname = std::move(ifname), eifSocket = std::move(eifSocket)]() { +- setNICAdminState(eifSocket.sock, ifname.c_str(), false); +- }); +- } + EthernetInterfaceIntf::nicEnabled(value); ++ ++ writeConfigurationFile(); + manager.reloadConfigs(); + + return value; +-- +2.34.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend index a6cc6f510..8640f0af7 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network_%.bbappend @@ -6,6 +6,7 @@ SRC_URI = "git://github.com/openbmc/phosphor-networkd" SRCREV = "cc5a670f1650e76b66750365bd4beecf821969fa" SRC_URI += " file://0003-Adding-channel-specific-privilege-to-network.patch \ + file://0004-Revert-ethernet_interface-Defer-setting-NIC-enabled.patch \ " EXTRA_OECONF:append = " --enable-nic-ethtool=yes" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check index 429f9264b..e949a9117 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check +++ b/meta-openbmc-mods/meta-common/recipes-network/network/static-mac-addr/mac-check @@ -84,7 +84,7 @@ configure_netipmid_svc_eth1() { /bin/systemctl enable "phosphor-ipmi-net@eth1.socket" /bin/systemctl start "phosphor-ipmi-net@eth1.socket" fi - if [ $(systemctl is-enabled phosphor-ipmi-net@eth1.service) =="disabled" ]; + if [ $(systemctl is-enabled phosphor-ipmi-net@eth1.service) == "disabled" ]; then /bin/systemctl enable "phosphor-ipmi-net@eth1.service" /bin/systemctl start "phosphor-ipmi-net@eth1.service" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0001-fru-device-Add-MUX-channel-name-to-FRU-objects.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0001-fru-device-Add-MUX-channel-name-to-FRU-objects.patch new file mode 100644 index 000000000..5c301a7eb --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0001-fru-device-Add-MUX-channel-name-to-FRU-objects.patch @@ -0,0 +1,268 @@ +From 7a5638d451dd323b81bd946ea7d688304b7a5b29 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren +Date: Tue, 21 Sep 2021 14:48:09 -0700 +Subject: [PATCH] fru-device: Add MUX channel name to FRU objects + +If multiple FRUs of the same type are plugged into different channels +of a i2c mux, it may be desirable to be able to identify them +in a predictable way instead of with a dynamically assigned bus number. + +Entity manager supports channel name configuration for MUX device type. +Add a function to test if a FRU is behind a MUX and a channel name exists. +If the channel name is found, set MUX property to the channel name. + +In templateCharReplace function, trim the leading and trailing spaces +in the resulted string. Replace multiple spaces in middle of string +with one single space. Example: "$MUX PSU" is parsed to "PSU" and +"Pwm $MUX PSU" is parsed to "Pwm PSU" when $MUX is empty, +ie FRU is connected without a mux. + +Now $MUX can be added as a template in a FRU's configuration JSON file. +This gives identical inventory entities (FRUs) unique and meaningful +names. SOLUM_PSSF162202_PSU.json is modified to use this new feature. + +Tested: +1) Run on systems that have multiple PSUs connected to a I2C Mux. +$MUX in config file is replaced with channel name for the mux. +2) PSU connected without the mux, same objects are created as before. +busctl tree xyz.openbmc_project.PSUSensor +/xyz/openbmc_project/sensors + |-/xyz/openbmc_project/sensors/current + | |-/xyz/openbmc_project/sensors/current/PSU1_Input_Current + | `-/xyz/openbmc_project/sensors/current/PSU1_Output_Current +3) phosphor-pid-control service starts up successfully + +Signed-off-by: Zhikui Ren +Change-Id: Ide804dfd56c34c73e8dcffc0eab818609fe1a69c +--- + configurations/SOLUM_PSSF162202_PSU.json | 44 ++++++++++++++---------- + src/FruDevice.cpp | 28 ++++++++++++++- + src/Utils.cpp | 3 ++ + 3 files changed, 55 insertions(+), 20 deletions(-) + +diff --git a/configurations/SOLUM_PSSF162202_PSU.json b/configurations/SOLUM_PSSF162202_PSU.json +index 1451830..2a5ff90 100644 +--- a/configurations/SOLUM_PSSF162202_PSU.json ++++ b/configurations/SOLUM_PSSF162202_PSU.json +@@ -4,7 +4,7 @@ + { + "Address": "$address", + "Bus": "$bus", +- "Name": "SOLUM CO IS162F22 PSU FRU", ++ "Name": "$MUX SOLUM CO IS162F22 PSU FRU", + "Type": "EEPROM" + }, + { +@@ -15,14 +15,14 @@ + "ILimitMax": 0.0, + "ILimitMin": 0.0, + "Inputs": [ +- "PSU$ADDRESS % 4 + 1 Fan Speed 1" ++ "$MUX PSU$ADDRESS % 4 + 1 Fan Speed 1" + ], +- "Name": "PSU$ADDRESS % 4 + 1 Fan 1", ++ "Name": "$MUX PSU$ADDRESS % 4 + 1 Fan 1", + "NegativeHysteresis": 2.0, + "OutLimitMax": 100.0, + "OutLimitMin": 30.0, + "Outputs": [ +- "Pwm PSU$ADDRESS % 4 + 1 Fan 1" ++ "Pwm $MUX PSU$ADDRESS % 4 + 1 Fan 1" + ], + "PCoefficient": 0.0, + "PositiveHysteresis": 0.0, +@@ -30,7 +30,7 @@ + "SlewPos": 0.0, + "Type": "Pid", + "Zones": [ +- "PSU" ++ "$MUX PSU" + ] + }, + { +@@ -41,14 +41,14 @@ + "ILimitMax": 0.0, + "ILimitMin": 0.0, + "Inputs": [ +- "PSU$ADDRESS % 4 + 1 Fan Speed 2" ++ "$MUX PSU$ADDRESS % 4 + 1 Fan Speed 2" + ], +- "Name": "PSU$ADDRESS % 4 + 1 Fan 2", ++ "Name": "$MUX PSU$ADDRESS % 4 + 1 Fan 2", + "NegativeHysteresis": 2.0, + "OutLimitMax": 100.0, + "OutLimitMin": 30.0, + "Outputs": [ +- "Pwm PSU$ADDRESS % 4 + 1 Fan 2" ++ "Pwm $MUX PSU$ADDRESS % 4 + 1 Fan 2" + ], + "PCoefficient": 0.0, + "PositiveHysteresis": 0.0, +@@ -56,7 +56,7 @@ + "SlewPos": 0.0, + "Type": "Pid", + "Zones": [ +- "PSU" ++ "$MUX PSU" + ] + }, + { +@@ -67,9 +67,9 @@ + "ILimitMax": 100, + "ILimitMin": 30, + "Inputs": [ +- "PSU$ADDRESS % 4 + 1 Temperature" ++ "$MUX PSU$ADDRESS % 4 + 1 Temperature" + ], +- "Name": "PSU$ADDRESS % 4 + 1 Temperature", ++ "Name": "$MUX PSU$ADDRESS % 4 + 1 Temperature", + "NegativeHysteresis": 5.0, + "OutLimitMax": 100, + "OutLimitMin": 30, +@@ -81,15 +81,15 @@ + "SlewPos": 0.0, + "Type": "Pid", + "Zones": [ +- "PSU" ++ "$MUX PSU" + ] + }, + { + "Class": "Floor", + "Inputs": [ +- "PSU$ADDRESS % 4 + 1 Temperature" ++ "$MUX PSU$ADDRESS % 4 + 1 Temperature" + ], +- "Name": "PSU$ADDRESS % 4 + 1 LCC", ++ "Name": "$MUX PSU$ADDRESS % 4 + 1 LCC", + "NegativeHysteresis": 2, + "Output": [ + 40.0, +@@ -102,9 +102,15 @@ + ], + "Type": "Stepwise", + "Zones": [ +- "PSU" ++ "$MUX PSU" + ] + }, ++ { ++ "FailSafePercent": 100, ++ "MinThermalOutput": 30, ++ "Name": "$MUX PSU", ++ "Type": "Pid.Zone" ++ }, + { + "Address": "$ADDRESS % 4 + 88", + "Bus": "$bus", +@@ -118,8 +124,8 @@ + "fan1", + "fan2" + ], +- "Name": "PSU$ADDRESS % 4 + 1", +- "Name1": "PSU$ADDRESS % 4 + 1", ++ "Name": "$MUX PSU$ADDRESS % 4 + 1", ++ "Name1": "$MUX PSU$ADDRESS % 4 + 1", + "Thresholds": [ + { + "Direction": "greater than", +@@ -167,7 +173,7 @@ + "Type": "pmbus" + } + ], +- "Name": "SOLUM CO IS162F22 PSU$ADDRESS % 4 + 1", ++ "Name": "$MUX SOLUM CO IS162F22 $ADDRESS % 4 + 1", + "Probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'IS162F22*'})", + "Type": "PowerSupply", + "xyz.openbmc_project.Inventory.Decorator.Asset": { +@@ -177,4 +183,4 @@ + "SerialNumber": "$PRODUCT_SERIAL_NUMBER" + } + } +-] ++] +\ No newline at end of file +diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp +index 3774a2d..2200d35 100644 +--- a/src/FruDevice.cpp ++++ b/src/FruDevice.cpp +@@ -172,6 +172,31 @@ static bool isMuxBus(size_t bus) + "/sys/bus/i2c/devices/i2c-" + std::to_string(bus) + "/mux_device")); + } + ++static std::optional getMuxBusChannelName(size_t bus) ++{ ++ if (!fs::exists("/dev/i2c-mux")) ++ { ++ return std::nullopt; ++ } ++ ++ auto ec = std::error_code(); ++ auto devName = "i2c-" + std::to_string(bus); ++ for (auto& mux : fs::recursive_directory_iterator("/dev/i2c-mux")) ++ { ++ auto channel = std::filesystem::read_symlink(mux, ec); ++ if (ec) ++ { ++ continue; ++ } ++ ++ if (devName == channel.filename()) ++ { ++ return mux.path().filename(); ++ } ++ } ++ return std::nullopt; ++} ++ + static void makeProbeInterface(size_t bus, size_t address, + sdbusplus::asio::object_server& objServer) + { +@@ -744,7 +769,7 @@ void addFruObjectToDbus( + std::shared_ptr iface = + objServer.add_interface(productName, "xyz.openbmc_project.FruDevice"); + dbusInterfaceMap[std::pair(bus, address)] = iface; +- ++ auto muxChannel = getMuxBusChannelName(bus); + for (auto& property : formattedFRU) + { + +@@ -797,6 +822,7 @@ void addFruObjectToDbus( + // baseboard will be 0, 0 + iface->register_property("BUS", bus); + iface->register_property("ADDRESS", address); ++ iface->register_property("MUX", muxChannel.value_or("")); + + iface->initialize(); + } +diff --git a/src/Utils.cpp b/src/Utils.cpp +index 31a10bc..9ad9a56 100644 +--- a/src/Utils.cpp ++++ b/src/Utils.cpp +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -242,6 +243,7 @@ std::optional templateCharReplace( + boost::replace_all(*strPtr, *replaceStr, + std::to_string(foundDeviceIdx)); + } ++ boost::trim_all(*strPtr); + + for (auto& foundDevicePair : foundDevice) + { +@@ -270,6 +272,7 @@ std::optional templateCharReplace( + foundDevicePair.second); + boost::ireplace_all(*strPtr, + templateChar + foundDevicePair.first, val); ++ boost::trim_all(*strPtr); + continue; + } + +-- +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 32f0a7857..a8a9f17c5 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 @@ -4,7 +4,8 @@ SRCREV = "3b802f1c8c030965b76737966b9b022433e6ef5b" FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" -SRC_URI += " file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ +SRC_URI += " file://0001-fru-device-Add-MUX-channel-name-to-FRU-objects.patch \ + 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 \ file://0005-Allow-MUX-idle-state-to-be-configured-as-DISCONNECT.patch \ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0028-Add-FirmwareResiliency-and-FirmwareUpdateStatus.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0028-Add-FirmwareResiliency-and-FirmwareUpdateStatus.patch new file mode 100644 index 000000000..934573fd6 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0028-Add-FirmwareResiliency-and-FirmwareUpdateStatus.patch @@ -0,0 +1,138 @@ +From 377fce592890a6dcc8bd45b3ff25290c4edb8908 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala +Date: Fri, 21 Jan 2022 23:11:27 +0000 +Subject: [PATCH] Add FirmwareResiliency and FirmwareUpdateStatus + +Panic word not suitable for Platform firmware resiliency events. Hence +add the following message registry for PFR events. +1. FirmwareResiliency for warning severity events. +2. FirmwareUpdateStatus for firmware update notifications with +OK severity. + +These message registries are implemented in the following review. +https://gerrit.openbmc-project.xyz/c/openbmc/pfr-manager/+/47609 + +Tested: +Redfish Service Validator test passed for this change. + +1. Update BMC firmware +POST: https:///redfish/v1/UpdateService/ + with binary file +After BMC reboots check for Event log in Redfish +Command: GET: https:///redfish/v1/Systems/system/LogServices/ + EventLog/Entries +Response: +{ + "@odata.id": "/redfish/v1/Systems/system/LogServices/ + EventLog/Entries/1618207226", + "@odata.type": "#LogEntry.v1_8_0.LogEntry", + "Created": "2021-04-12T06:00:26+00:00", + "EntryType": "Event", + "Id": "1618207226", + "Message": "Firmware update occurred due to BMC update + intent.", + "MessageArgs": [ + "BMC update intent" + ], + "MessageId": "OpenBMC.0.2.FirmwareUpdateStatus", + "Name": "System Event Log Entry", + "Severity": "OK" +} +2. Reset BMC. +Command: ipmitool raw 6 2 +After BMC reboots check for Event log in Redfish +Command: GET: https:///redfish/v1/Systems/system/LogServices/ + EventLog/Entries +Response: +{ + "@odata.id": "/redfish/v1/Systems/system/LogServices/ + EventLog/Entries/1618207249", + "@odata.type": "#LogEntry.v1_8_0.LogEntry", + "Created": "2021-04-12T06:02:49+00:00", + "EntryType": "Event", + "Id": "1618207249", + "Message": "Firmware resiliency event occurred due to BMC + reset detected.", + "MessageArgs": [ + "BMC reset detected" + ], + "MessageId": "OpenBMC.0.2.FirmwareResiliency", + "Name": "System Event Log Entry", + "Severity": "Warning" +} + +Signed-off-by: Jayaprakash Mutyala +Signed-off-by: Chalapathi Venkataramashetty +--- + .../registries/openbmc_message_registry.hpp | 33 ++++++++++++++++--- + 1 file changed, 29 insertions(+), 4 deletions(-) + +diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp +index 967713f..3747aaf 100644 +--- a/redfish-core/include/registries/openbmc_message_registry.hpp ++++ b/redfish-core/include/registries/openbmc_message_registry.hpp +@@ -21,15 +21,15 @@ namespace redfish::message_registries::openbmc + const Header header = { + "Copyright 2018 OpenBMC. All rights reserved.", + "#MessageRegistry.v1_4_0.MessageRegistry", +- "OpenBMC.0.2.0", ++ "OpenBMC.0.3.0", + "OpenBMC Message Registry", + "en", + "This registry defines the base messages for OpenBMC.", + "OpenBMC", +- "0.2.0", ++ "0.3.0", + "OpenBMC", + }; +-constexpr std::array registry = { ++constexpr std::array registry = { + MessageEntry{ + "ADDDCCorrectable", + { +@@ -560,9 +560,21 @@ constexpr std::array registry = { + {"string"}, + "None.", + }}, ++ MessageEntry{"FirmwareResiliency", ++ { ++ "Indicates the reason for last firmware resiliency event.", ++ "Firmware resiliency event occurred due to %1.", ++ "Warning", ++ "Warning", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, + MessageEntry{"FirmwareResiliencyError", + { +- "Indicates firmware encountered resilience error.", ++ "Indicates firmware encountered resiliency error.", + "Firmware resiliency error. Error reason: %1.", + "Critical", + "Critical", +@@ -613,6 +625,19 @@ constexpr std::array registry = { + {"string", "string"}, + "None.", + }}, ++ MessageEntry{ ++ "FirmwareUpdateStatus", ++ { ++ "Indicates the reason for last firmware update on resiliency system.", ++ "Firmware update occurred due to %1.", ++ "OK", ++ "OK", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, + MessageEntry{ + "GeneralFirmwareSecurityViolation", + { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0029-Fix-Property-PhysicalContext-is-invalid-none.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0029-Fix-Property-PhysicalContext-is-invalid-none.patch new file mode 100644 index 000000000..cf8148ff5 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0029-Fix-Property-PhysicalContext-is-invalid-none.patch @@ -0,0 +1,520 @@ +From bf7ef9a5b2e3a6cac3f418d3c7753f29bea66913 Mon Sep 17 00:00:00 2001 +From: sunitakx +Date: Tue, 18 Jan 2022 11:05:05 +0000 +Subject: [PATCH] [Fix]: Property PhysicalContext is invalid "none" + +Issue: Redfish validator is throwing error "PhysicalContext: +This type is invalid none" for multiple temperature sensors + +Endpoint : /redfish/v1/Chassis//Thermal#/Temperatures/ + +Root Cause : PhysicalContext Schema was missing from redfish schema +metadata + +Tested: Redfish validator script passed. + +*** /redfish/v1/Chassis//Thermal#/Temperatures/0 + Type (#Thermal.v1_3_0.Temperature), GET SUCCESS (time: 0) + PASS + +Signed-off-by: sunitakx +Change-Id: Ifbfe7d96e99030c0c5ba67a1aba5080cd049e57b +--- + scripts/update_schemas.py | 1 + + static/redfish/v1/$metadata/index.xml | 3 + + .../PhysicalContext/PhysicalContext.json | 62 +++ + .../v1/JsonSchemas/PhysicalContext/index.json | 22 ++ + .../redfish/v1/schema/PhysicalContext_v1.xml | 357 ++++++++++++++++++ + 5 files changed, 445 insertions(+) + create mode 100644 static/redfish/v1/JsonSchemas/PhysicalContext/PhysicalContext.json + create mode 100644 static/redfish/v1/JsonSchemas/PhysicalContext/index.json + create mode 100644 static/redfish/v1/schema/PhysicalContext_v1.xml + +diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py +index eb6318f..3f0f57c 100755 +--- a/scripts/update_schemas.py ++++ b/scripts/update_schemas.py +@@ -65,6 +65,7 @@ include_list = [ + 'PCIeDeviceCollection', + 'PCIeFunction', + 'PCIeFunctionCollection', ++ 'PhysicalContext', + 'Power', + 'Privileges', # Used in Role + 'Processor', +diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml +index c925581..9b080f3 100644 +--- a/static/redfish/v1/$metadata/index.xml ++++ b/static/redfish/v1/$metadata/index.xml +@@ -1568,6 +1568,9 @@ + + + ++ ++ ++ + + + +diff --git a/static/redfish/v1/JsonSchemas/PhysicalContext/PhysicalContext.json b/static/redfish/v1/JsonSchemas/PhysicalContext/PhysicalContext.json +new file mode 100644 +index 0000000..c9ffeee +--- /dev/null ++++ b/static/redfish/v1/JsonSchemas/PhysicalContext/PhysicalContext.json +@@ -0,0 +1,62 @@ ++{ ++ "$schema": "http://redfish.dmtf.org/schemas/v1/redfish-schema.v1_3_0.json", ++ "copyright": "Copyright 2014-2017 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright", ++ "definitions": { ++ "PhysicalContext": { ++ "deprecated": "This definition has been moved to the unversioned namespace so that external references can pick up changes over time.", ++ "enum": [ ++ "Room", ++ "Intake", ++ "Exhaust", ++ "Front", ++ "Back", ++ "Upper", ++ "Lower", ++ "CPU", ++ "GPU", ++ "Backplane", ++ "SystemBoard", ++ "PowerSupply", ++ "VoltageRegulator", ++ "StorageDevice", ++ "NetworkingDevice", ++ "ComputeBay", ++ "StorageBay", ++ "NetworkBay", ++ "ExpansionBay", ++ "PowerSupplyBay", ++ "Memory", ++ "Chassis", ++ "Fan" ++ ], ++ "enumDescriptions": { ++ "Back": "The back of the chassis.", ++ "Backplane": "A backplane within the chassis.", ++ "CPU": "A Processor (CPU).", ++ "Chassis": "The entire chassis.", ++ "ComputeBay": "Within a compute bay.", ++ "Exhaust": "The exhaust point of the chassis.", ++ "ExpansionBay": "Within an expansion bay.", ++ "Fan": "A fan.", ++ "Front": "The front of the chassis.", ++ "GPU": "A Graphics Processor (GPU).", ++ "Intake": "The intake point of the chassis.", ++ "Lower": "The lower portion of the chassis.", ++ "Memory": "A memory device.", ++ "NetworkBay": "Within a networking bay.", ++ "NetworkingDevice": "A networking device.", ++ "PowerSupply": "A power supply.", ++ "PowerSupplyBay": "Within a power supply bay.", ++ "Room": "The room.", ++ "StorageBay": "Within a storage bay.", ++ "StorageDevice": "A storage device.", ++ "SystemBoard": "The system board (PCB).", ++ "Upper": "The upper portion of the chassis.", ++ "VoltageRegulator": "A voltage regulator device." ++ }, ++ "type": "string" ++ } ++ }, ++ "title": "#PhysicalContext.v1_3_0" ++} ++ +diff --git a/static/redfish/v1/JsonSchemas/PhysicalContext/index.json b/static/redfish/v1/JsonSchemas/PhysicalContext/index.json +new file mode 100644 +index 0000000..729c0ca +--- /dev/null ++++ b/static/redfish/v1/JsonSchemas/PhysicalContext/index.json +@@ -0,0 +1,22 @@ ++{ ++ "@odata.context": "/redfish/v1/$metadata#JsonSchemaFile.JsonSchemaFile", ++ "@odata.id": "/redfish/v1/JsonSchemas/PhysicalContext", ++ "@odata.type": "#JsonSchemaFile.v1_0_2.JsonSchemaFile", ++ "Name": "PhysicalContext Schema File", ++ "Schema": "#PhysicalContext.PhysicalContext", ++ "Description": "PhysicalContext Schema File Location", ++ "Id": "PhysicalContext", ++ "Languages": [ ++ "en" ++ ], ++ "Languages@odata.count": 1, ++ "Location": [ ++ { ++ "Language": "en", ++ "PublicationUri": "http://redfish.dmtf.org/schemas/v1/PhysicalContext.json", ++ "Uri": "/redfish/v1/JsonSchemas/PhysicalContext/PhysicalContext.json" ++ } ++ ], ++ "Location@odata.count": 1 ++} ++ +diff --git a/static/redfish/v1/schema/PhysicalContext_v1.xml b/static/redfish/v1/schema/PhysicalContext_v1.xml +new file mode 100644 +index 0000000..4c54e3e +--- /dev/null ++++ b/static/redfish/v1/schema/PhysicalContext_v1.xml +@@ -0,0 +1,357 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0030-Change-Severity-for-ServiceFailure-redfish-event.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0030-Change-Severity-for-ServiceFailure-redfish-event.patch new file mode 100644 index 000000000..b2ff26c33 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0030-Change-Severity-for-ServiceFailure-redfish-event.patch @@ -0,0 +1,56 @@ +From 12adbae465b3f6b3dc8aa2a444bc295e8261c382 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala +Date: Tue, 15 Feb 2022 10:14:57 +0000 +Subject: [PATCH] Change Severity for ServiceFailure redfish event + +During Ac cycle stress, at times some services may exit unsuccessfully. +This will not have any functionality impact. So updated Severity of +"ServiceFailure" redfish event to "Ok". + +Tested: +1. Redfish validator - passed for this with change +2. Killed couple of process and observed Redfish EventLog shows updated + Severity. +Redfish URI: +GET: https:///redfish/v1/Systems/system/LogServices/EventLog + /Entries +{ + "@odata.id": "/redfish/v1/Systems/system/LogServices/ + EventLog/Entries/1624604288", + "@odata.type": "#LogEntry.v1_4_0.LogEntry", + "Created": "2021-06-25T06:58:08+00:00", + "EntryType": "Event", + "Id": "1624604288", + "Message": "Service phosphor-ipmi-host.service has exited + unsuccessfully.", + "MessageArgs": [ + "phosphor-ipmi-host.service" + ], + "MessageId": "OpenBMC.0.1.ServiceFailure", + "Name": "System Event Log Entry", + "Severity": "OK" +} + +Signed-off-by: Jayaprakash Mutyala +--- + redfish-core/include/registries/openbmc_message_registry.hpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp +index 3747aaf..0b409cf 100644 +--- a/redfish-core/include/registries/openbmc_message_registry.hpp ++++ b/redfish-core/include/registries/openbmc_message_registry.hpp +@@ -2375,8 +2375,8 @@ constexpr std::array registry = { + { + "Indicates that a service has exited unsuccessfully.", + "Service %1 has exited unsuccessfully.", +- "Warning", +- "Warning", ++ "OK", ++ "OK", + 1, + {"string"}, + "None.", +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0031-Change-PcieType-to-PCIeType.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0031-Change-PcieType-to-PCIeType.patch new file mode 100644 index 000000000..71b364468 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0031-Change-PcieType-to-PCIeType.patch @@ -0,0 +1,68 @@ +From 5b69a40d50b7ca024dea83dbadcfdaa5e045918d Mon Sep 17 00:00:00 2001 +From: Anjaliintel-21 +Date: Tue, 15 Feb 2022 16:01:14 +0000 +Subject: [PATCH] Change PcieType to PCIeType + +In the patch:https://github.com/openbmc/bmcweb/commit/62cd45af311e7741064c114581ba34186d6e508c + +Mismatch of PCIeType from pcie.hpp to PCIeDevice_v1.xml.In function requestRoutesSystemPCIeDevice, +PCIeType mentioned for PCIeInterface details, was written as PcieType but in PCIeDevice_v1.xml, +property name is PCIeType which was giving error in the validator. + +Tested using RedfishServiceValidator: +*** /redfish/v1/Systems/system/PCIeDevices +Type (#PCIeDeviceCollection.PCIeDeviceCollection), GET SUCCESS (time: 1.35205) +PASS + +*** /redfish/v1/Systems/system/PCIeDevices/S0B1D0 +Type (#PCIeDevice.v1_4_0.PCIeDevice), GET SUCCESS (time: 1.290409) +PASS + +*** /redfish/v1/Systems/system/PCIeDevices/S0B1D0/PCIeFunctions +Type (#PCIeFunctionCollection.PCIeFunctionCollection), GET SUCCESS (time: 1.287055) +PASS + +*** /redfish/v1/Systems/system/PCIeDevices/S0B1D0/PCIeFunctions/0 +Type (#PCIeFunction.v1_2_0.PCIeFunction), GET SUCCESS (time: 1.336434) +PASS + +*** /redfish/v1/Systems/system/PCIeDevices/S0B2D0 +Type (#PCIeDevice.v1_4_0.PCIeDevice), GET SUCCESS (time: 1.282768) +PASS + +*** /redfish/v1/Systems/system/PCIeDevices/S0B2D0/PCIeFunctions +Type (#PCIeFunctionCollection.PCIeFunctionCollection), GET SUCCESS (time: 1.401044) +PASS + +*** /redfish/v1/Systems/system/PCIeDevices/S0B2D0/PCIeFunctions/0 +Type (#PCIeFunction.v1_2_0.PCIeFunction), GET SUCCESS (time: 1.286989) +PASS + +*** /redfish/v1/Systems/system/PCIeDevices/S0B3D0 +Type (#PCIeDevice.v1_4_0.PCIeDevice), GET SUCCESS (time: 1.331661) +PASS +Elapsed time: 0:01:17 +Counter({'metadataNamespaces': 2337, 'skipOptional': 67, 'pass': 51, 'passGet': 8, 'serviceNamespaces': 4}) +Validation has succeeded. + +Signed-off-by: Anjaliintel-21 +--- + redfish-core/lib/pcie.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp +index 1904c26..1b9e28e 100644 +--- a/redfish-core/lib/pcie.hpp ++++ b/redfish-core/lib/pcie.hpp +@@ -223,7 +223,7 @@ inline void requestRoutesSystemPCIeDevice(App& app) + return; + } + asyncResp->res +- .jsonValue["PCIeInterface"]["PcieType"] = ++ .jsonValue["PCIeInterface"]["PCIeType"] = + *generationInUse; + } + asyncResp->res.jsonValue["PCIeFunctions"] = { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch index 19a392873..57c183c76 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch @@ -1,4 +1,4 @@ -From bde7f728d5a87522674bcd5515baaa02bf7b9373 Mon Sep 17 00:00:00 2001 +From 7956c74860a39e75d80f0caadcfbd5570569717d Mon Sep 17 00:00:00 2001 From: Kuiying Wang Date: Fri, 4 Sep 2020 19:24:25 +0800 Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable @@ -226,6 +226,7 @@ Oem - Resource.Oem No Optional Change-Id: Iecc61018c350f0b8c89df59b2864b941508b1916 Signed-off-by: Kuiying Wang Signed-off-by: Snehalatha Venkatesh +Signed-off-by: Smriti Ayushi --- redfish-core/include/redfish.hpp | 3 + .../include/registries/bios_registry.hpp | 41 ++ @@ -235,7 +236,7 @@ Signed-off-by: Snehalatha Venkatesh create mode 100644 redfish-core/include/registries/bios_registry.hpp diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index 0a97150..07a9417 100644 +index 2479332..8bd4bf8 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp @@ -148,7 +148,10 @@ class RedfishService @@ -297,7 +298,7 @@ index 0000000..c80937a +}; +} // namespace redfish::message_registries::bios diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index c2fb284..87536d6 100644 +index c2fb284..9d7157c 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp @@ -3,8 +3,140 @@ @@ -451,7 +452,7 @@ index c2fb284..87536d6 100644 + {"SettingsObject", + {{"@odata.id", "/redfish/v1/Systems/system/Bios/Settings"}}}}; + asyncResp->res.jsonValue["AttributeRegistry"] = "BiosAttributeRegistry"; -+ asyncResp->res.jsonValue["Attributes"] = {}; ++ asyncResp->res.jsonValue["Attributes"] = nlohmann::json::object(); + + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec, @@ -835,7 +836,7 @@ index c2fb284..87536d6 100644 * BiosReset class supports handle POST method for Reset bios. * The class retrieves and sends data directly to D-Bus. diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp -index 43359e3..b2fb43c 100644 +index ae02189..510b19a 100644 --- a/redfish-core/lib/message_registries.hpp +++ b/redfish-core/lib/message_registries.hpp @@ -17,6 +17,7 @@ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch index 85b5b3494..e7036c28c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0006-Add-fix-for-broken-feature-Pending-Attributes.patch @@ -1,6 +1,6 @@ -From 8225b2dc07279c65cdfe2ddc13964d84fd2ed8bb Mon Sep 17 00:00:00 2001 +From 5ba2b29277e982fddaf8622af39902b6a046e259 Mon Sep 17 00:00:00 2001 From: Arun Lal K M -Date: Tue, 4 Jan 2022 01:56:57 +0000 +Date: Wed, 19 Jan 2022 14:44:07 +0000 Subject: [PATCH] Add fix for broken feature 'Pending Attributes'. Fix is added for the following: @@ -11,6 +11,7 @@ Fix is added for the following: 5) POST to '/redfish/v1/Systems/system/Bios/Actions /Bios.ChangePassword/'. 6) Add support for Enumeration. +7) Support DMTF standard of displaying "Value" in BIOS attribute registries. Tested: By giving PATCH to 'redfish/v1/Systems/system/Bios/Settings' @@ -134,11 +135,11 @@ Validation has succeeded. Signed-off-by: Arun Lal K M Signed-off-by: Snehalatha Venkatesh --- - redfish-core/lib/bios.hpp | 592 ++++++++++++++++++++++++-------------- - 1 file changed, 383 insertions(+), 209 deletions(-) + redfish-core/lib/bios.hpp | 602 +++++++++++++++++++++++++------------- + 1 file changed, 391 insertions(+), 211 deletions(-) diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 0bb0b9e..69340eb 100644 +index f6d6eff..c327053 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp @@ -12,13 +12,15 @@ map{attributeName,struct{attributeType,readonlyStatus,displayname, @@ -637,9 +638,9 @@ index 0bb0b9e..69340eb 100644 BMCWEB_LOG_ERROR - << "doPatch resp_handler got error " << ec; + << "getBiosAttributes DBUS error: " << ec; - messages::internalError(asyncResp->res); - return; - } ++ messages::internalError(asyncResp->res); ++ return; ++ } + + const BiosBaseTableType* baseBiosTable = + std::get_if(&retBiosTable); @@ -647,9 +648,9 @@ index 0bb0b9e..69340eb 100644 + if (baseBiosTable == nullptr) + { + BMCWEB_LOG_ERROR << "baseBiosTable is empty."; -+ messages::internalError(asyncResp->res); -+ return; -+ } + messages::internalError(asyncResp->res); + return; + } + + PendingAttributesType pendingAttributes{}; + @@ -895,10 +896,11 @@ index 0bb0b9e..69340eb 100644 } if (optItemTypeRedfish == "OneOf") { -@@ -671,6 +817,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) +@@ -671,7 +817,21 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if( &std::get( optItem)); +- optItemJson[optItemTypeRedfish] = + + if (!currValue) + { @@ -910,13 +912,18 @@ index 0bb0b9e..69340eb 100644 + continue; + } + - optItemJson[optItemTypeRedfish] = ++ optItemJson["ValueDisplayName"] = ++ currValue != nullptr ? *currValue ++ : ""; ++ optItemJson["ValueName"] = currValue != nullptr ? *currValue : ""; -@@ -681,6 +838,17 @@ inline void requestRoutesBiosAttributeRegistry(App& app) + } +@@ -681,7 +841,21 @@ inline void requestRoutesBiosAttributeRegistry(App& app) std::get_if( &std::get( optItem)); +- optItemJson[optItemTypeRedfish] = + + if (!currValue) + { @@ -928,10 +935,14 @@ index 0bb0b9e..69340eb 100644 + continue; + } + - optItemJson[optItemTypeRedfish] = ++ optItemJson["ValueDisplayName"] = ++ currValue != nullptr ? *currValue ++ : 0; ++ optItemJson["ValueName"] = currValue != nullptr ? *currValue : 0; -@@ -689,6 +857,12 @@ inline void requestRoutesBiosAttributeRegistry(App& app) + } +@@ -689,6 +863,12 @@ inline void requestRoutesBiosAttributeRegistry(App& app) optionsArray.push_back(optItemJson); } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch index dfa67935c..760462154 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch @@ -1,4 +1,4 @@ -From ea7d0091545450721d8b9b901e2593401b50d24c Mon Sep 17 00:00:00 2001 +From 1b9e0f434a4c667f6edbaadb257f7a9709953429 Mon Sep 17 00:00:00 2001 From: AppaRao Puli Date: Fri, 12 Mar 2021 18:53:25 +0000 Subject: [PATCH] Add Server-Sent-Events support @@ -22,12 +22,15 @@ Tested: Change-Id: I36956565cbba30c2007852c9471f477f6d1736e9 Signed-off-by: AppaRao Puli Signed-off-by: P Dheeraj Srujan Kumar +Signed-off-by: Ankita Vilas Gawade + +%% original patch: 0004-Add-Server-Sent-Events-support.patch --- http/http_connection.hpp | 10 +- http/http_response.hpp | 7 +- - http/routing.hpp | 71 ++++++++++ - http/server_sent_event.hpp | 279 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 362 insertions(+), 5 deletions(-) + http/routing.hpp | 71 +++++++++ + http/server_sent_event.hpp | 298 +++++++++++++++++++++++++++++++++++++ + 4 files changed, 381 insertions(+), 5 deletions(-) create mode 100644 http/server_sent_event.hpp diff --git a/http/http_connection.hpp b/http/http_connection.hpp @@ -180,10 +183,10 @@ index fe9c7e9..c748580 100644 self_t* self = static_cast(this); diff --git a/http/server_sent_event.hpp b/http/server_sent_event.hpp new file mode 100644 -index 0000000..41d18ed +index 0000000..c23a4ee --- /dev/null +++ b/http/server_sent_event.hpp -@@ -0,0 +1,279 @@ +@@ -0,0 +1,298 @@ +#pragma once +#include "http_request.hpp" + @@ -201,6 +204,8 @@ index 0000000..41d18ed + +namespace crow +{ ++constexpr auto inputBufferSize = 1024U * 64U; ++constexpr uint8_t maxFailCount = 5; + +struct SseConnection : std::enable_shared_from_this +{ @@ -443,6 +448,22 @@ index 0000000..41d18ed + } + rawData += "\n\n"; + ++ if (rawData.size() > inputBufferSize) ++ { ++ BMCWEB_LOG_DEBUG ++ << "Skipping Send Event/Report to SSE Subscription as Buffer Size Exceeded. Size: " ++ << rawData.size(); ++ failCount++; ++ if (failCount > maxFailCount) ++ { ++ BMCWEB_LOG_ERROR ++ << "Fail Count Threshold reached. Closing SSE Connection"; ++ close("max buffer size not suported"); ++ } ++ return; ++ } ++ failCount = 0; ++ + boost::asio::buffer_copy(inputBuffer.prepare(rawData.size()), + boost::asio::buffer(rawData)); + inputBuffer.commit(rawData.size()); @@ -454,8 +475,9 @@ index 0000000..41d18ed + Adaptor adaptor; + + boost::beast::flat_static_buffer<1024U * 8U> outputBuffer; -+ boost::beast::flat_static_buffer<1024U * 64U> inputBuffer; ++ boost::beast::flat_static_buffer inputBuffer; + bool doingWrite = false; ++ uint8_t failCount = 0; + + std::function&, const crow::Request&, + crow::Response&)> @@ -464,5 +486,5 @@ index 0000000..41d18ed +}; +} // namespace crow -- -2.17.1 +2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0014-Fix-Event-Subscription-URI.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0014-Fix-Event-Subscription-URI.patch new file mode 100644 index 000000000..a06389c46 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0014-Fix-Event-Subscription-URI.patch @@ -0,0 +1,37 @@ +From 93daba6ca2de8a82492ea88a7da75a7d337123e1 Mon Sep 17 00:00:00 2001 +From: Gayathri Leburu +Date: Wed, 9 Feb 2022 10:45:19 +0000 +Subject: [PATCH] Fix Event Subscription URI + +While performing GET on /redfish/v1/EventService/Subscriptions/ results +in error 405 - Method not allowed. + +This commit fixes the subscription URI while registering the ROUTE i.e., +during BMCWEB_ROUTE. + +TESTED : + - GET on /redfish/v1/EventService/Subscriptions/ successfully returned + all the list of subscribed events. + +Signed-off-by: Gayathri Leburu +Change-Id: I0edcfd8403e0178fe84d6b8328dabad71c4d5c98 +--- + redfish-core/lib/event_service.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp +index 9b4f6bd..7359a82 100644 +--- a/redfish-core/lib/event_service.hpp ++++ b/redfish-core/lib/event_service.hpp +@@ -173,7 +173,7 @@ inline void requestRoutesSubmitTestEvent(App& app) + + inline void requestRoutesEventDestinationCollection(App& app) + { +- BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions") ++ BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/") + .privileges(redfish::privileges::getEventDestinationCollection) + .methods(boost::beast::http::verb::get)( + [](const crow::Request&, +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Fixed-timestamp-in-telemetry-service.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Fixed-timestamp-in-telemetry-service.patch new file mode 100644 index 000000000..0db2d00ae --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Fixed-timestamp-in-telemetry-service.patch @@ -0,0 +1,106 @@ +From 45c367e066d36ed0f7a38a12c80c1a40930efdfb Mon Sep 17 00:00:00 2001 +From: Krzysztof Grobelny +Date: Wed, 29 Dec 2021 10:28:53 +0100 +Subject: [PATCH] Fixed timestamp in telemetry service + +Telemetry service is using timestamp with milliseconds accuracy. Bmcweb +code assumed that timestamp is in seconds which produced a bad result. +This patchset updates the APIs, and adds a getDateTimeUintMs method, +which can be used to convert a millisecond timestamp into a string. In +the future, this can be used to get more precision out of the API. + +Reference: '9.4.3. Date-Time values' +https://www.dmtf.org/sites/default/files/standards/documents/DSP0266_1.8.0.pdf + +Tested: +- Telemetry service timestamp show correct timestamp with milliseconds + precission. Example: 2022-01-11T13:06:58.648000+00:00 +- Other timestamps in bmcweb did not change +- All unit tests are passing + +Reference: Properties.Readings +https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Telemetry/Report.interface.yaml + +Signed-off-by: Krzysztof Grobelny +Signed-off-by: Ed Tanous +Change-Id: I5b40ef6889b5af8c045ec0d35a758967e53dbed2 +--- + http/utility.hpp | 28 +++++++++++++++++----------- + redfish-core/lib/metric_report.hpp | 4 ++-- + 2 files changed, 19 insertions(+), 13 deletions(-) + +diff --git a/http/utility.hpp b/http/utility.hpp +index 033755e..374caea 100644 +--- a/http/utility.hpp ++++ b/http/utility.hpp +@@ -572,29 +572,35 @@ inline bool base64Decode(const std::string_view input, std::string& output) + return true; + } + +-/** +- * Method returns Date Time information in the ISO extended format +- * +- * @param[in] timestamp in second since the Epoch; it can be negative +- * +- * @return Date Time in the ISO extended format +- */ +-inline std::string getDateTime(boost::posix_time::seconds secondsSinceEpoch) ++namespace details ++{ ++inline std::string getDateTime(boost::posix_time::milliseconds timeSinceEpoch) + { + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); +- boost::posix_time::ptime time = epoch + secondsSinceEpoch; ++ boost::posix_time::ptime time = epoch + timeSinceEpoch; + // append zero offset to the end according to the Redfish spec for Date-Time + return boost::posix_time::to_iso_extended_string(time) + "+00:00"; + } ++} // namespace details + + inline std::string getDateTimeUint(uint64_t secondsSinceEpoch) + { +- return getDateTime(boost::posix_time::seconds(secondsSinceEpoch)); ++ boost::posix_time::seconds boostSeconds(secondsSinceEpoch); ++ return details::getDateTime( ++ boost::posix_time::milliseconds(boostSeconds.total_milliseconds())); ++} ++ ++inline std::string getDateTimeUintMs(uint64_t millisSecondsSinceEpoch) ++{ ++ return details::getDateTime( ++ boost::posix_time::milliseconds(millisSecondsSinceEpoch)); + } + + inline std::string getDateTimeStdtime(std::time_t secondsSinceEpoch) + { +- return getDateTime(boost::posix_time::seconds(secondsSinceEpoch)); ++ boost::posix_time::ptime time = ++ boost::posix_time::from_time_t(secondsSinceEpoch); ++ return boost::posix_time::to_iso_extended_string(time) + "+00:00"; + } + + /** +diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp +index b7ebb99..f933cd4 100644 +--- a/redfish-core/lib/metric_report.hpp ++++ b/redfish-core/lib/metric_report.hpp +@@ -28,7 +28,7 @@ inline nlohmann::json toMetricValues(const Readings& readings) + {"MetricId", id}, + {"MetricProperty", metadata}, + {"MetricValue", std::to_string(sensorValue)}, +- {"Timestamp", crow::utility::getDateTimeUint(timestamp)}, ++ {"Timestamp", crow::utility::getDateTimeUintMs(timestamp)}, + }); + } + +@@ -46,7 +46,7 @@ inline bool fillReport(nlohmann::json& json, const std::string& id, + telemetry::metricReportDefinitionUri + std::string("/") + id; + + const auto& [timestamp, readings] = timestampReadings; +- json["Timestamp"] = crow::utility::getDateTimeUint(timestamp); ++ json["Timestamp"] = crow::utility::getDateTimeUintMs(timestamp); + json["MetricValues"] = toMetricValues(readings); + return true; + } +-- +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 541fa6aba..9bb1e5eb9 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 @@ -9,4 +9,7 @@ Current revisions: file://telemetry/0002-Revert-Remove-LogService-from-TelemetryService.patch - Switched bmcweb to use new telemetry service API - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44270/28 + file://telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch + +- Fixed timestamp in telemetry service + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/50027/3 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Return-404-for-POST-on-Proxy-InsertMedia.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Return-404-for-POST-on-Proxy-InsertMedia.patch new file mode 100644 index 000000000..2d9ab1dae --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Return-404-for-POST-on-Proxy-InsertMedia.patch @@ -0,0 +1,379 @@ +From 793e4d6952b2a121da55d866eb510b26e179750c Mon Sep 17 00:00:00 2001 +From: Przemyslaw Czarnowski +Date: Fri, 4 Feb 2022 15:41:54 +0100 +Subject: [PATCH] Return 404 for POST on Proxy InsertMedia + +.../Actions/VirtualMedia.InsertMedia does not exist for proxy mode. But +it does for legacy, so handler needs to return 404 for proxy and run +mounting in legacy. Similar action has to be done for get, delete and +patch. + +As the check shares the same codebase besides the action itself, this +patch creates generic function for parsing GetManagedObjects, finding +valid VirtualMedia endpoint and invoking specific action handler. + +Tested: +Manually, with the following set of commands: +POST /Proxy /InsertAction : returned 404 +POST /Legacy/InsertAction : returned 200 (mounted) +GET /Proxy /InsertAction : returned 404 +GET /Legacy/InsertAction : returned 405 +PATCH /Proxy /InsertAction : returned 404 +PATCH /Legacy/InsertAction : returned 405 +DELETE/Proxy /InsertAction : returned 404 +DELETE/Legacy/InsertAction : returned 405 + +Signed-off-by: Przemyslaw Czarnowski +--- + redfish-core/lib/virtual_media.hpp | 265 ++++++++++++----------------- + 1 file changed, 108 insertions(+), 157 deletions(-) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index da66b4b..6dfc726 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + // for GetObjectType and ManagedObjectType + +@@ -32,13 +33,14 @@ namespace redfish + { + + /** +- * @brief Function checks if insert media request is Legacy or Proxy type +- * and sets suitable response code for unsupported REST method. ++ * @brief Function parses getManagedObject response, finds item, makes generic ++ * validation and invokes callback handler on this item. + * + */ +-void checkProxyMode(const std::shared_ptr& aResp, +- const crow::Request& req, const std::string& name, +- const std::string& resName) ++template ++void findItemAndRunHandler(const std::shared_ptr& aResp, ++ const crow::Request& req, const std::string& name, ++ const std::string& resName, T&& handler) + { + if (name != "bmc") + { +@@ -48,8 +50,8 @@ void checkProxyMode(const std::shared_ptr& aResp, + } + + crow::connections::systemBus->async_method_call( +- [aResp, req, resName](const boost::system::error_code ec, +- const GetObjectType& getObjectType) { ++ [aResp, req, resName, handler](const boost::system::error_code ec, ++ const GetObjectType& getObjectType) { + if (ec) + { + BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " +@@ -70,9 +72,9 @@ void checkProxyMode(const std::shared_ptr& aResp, + BMCWEB_LOG_DEBUG << "GetObjectType: " << service; + + crow::connections::systemBus->async_method_call( +- [service, resName, req, +- aResp](const boost::system::error_code ec, +- ManagedObjectType& subtree) { ++ [service, resName, req, aResp, ++ handler](const boost::system::error_code ec, ++ ManagedObjectType& subtree) { + if (ec) + { + BMCWEB_LOG_DEBUG << "DBUS response error"; +@@ -105,26 +107,8 @@ void checkProxyMode(const std::shared_ptr& aResp, + continue; + } + +- // Check if dbus path is Legacy type +- if (mode.filename() == "Legacy") +- { +- BMCWEB_LOG_DEBUG << "InsertMedia only allowed " +- "with POST method " +- "in legacy mode"; +- aResp->res.result( +- boost::beast::http::status::method_not_allowed); +- +- return; +- } +- // Check if dbus path is Proxy type +- if (mode.filename() == "Proxy") ++ if (handler(service, aResp, item) == true) + { +- // Not possible in proxy mode +- BMCWEB_LOG_DEBUG << "InsertMedia not " +- "allowed in proxy mode"; +- aResp->res.result( +- boost::beast::http::status::not_found); +- + return; + } + } +@@ -289,10 +273,7 @@ static std::optional + std::chrono::seconds(*timeoutValue + timeoutMarginSeconds)) + .count(); + } +- else +- { +- return std::nullopt; +- } ++ return std::nullopt; + } + + /** +@@ -972,14 +953,43 @@ struct InsertMediaActionParams + + inline void requestNBDVirtualMediaRoutes(App& app) + { ++ auto handler = []([[maybe_unused]] const std::string& service, ++ const std::shared_ptr& aResp, ++ std::pair& item) { ++ auto mode = item.first.parent_path(); ++ auto type = mode.parent_path(); ++ // Check if dbus path is Legacy type ++ if (mode.filename() == "Legacy") ++ { ++ BMCWEB_LOG_DEBUG << "InsertMedia only allowed " ++ "with POST method " ++ "in legacy mode"; ++ aResp->res.result(boost::beast::http::status::method_not_allowed); ++ ++ return true; ++ } ++ // Check if dbus path is Proxy type ++ if (mode.filename() == "Proxy") ++ { ++ // Not possible in proxy mode ++ BMCWEB_LOG_DEBUG << "InsertMedia not " ++ "allowed in proxy mode"; ++ aResp->res.result(boost::beast::http::status::not_found); ++ ++ return true; ++ } ++ return false; ++ }; + BMCWEB_ROUTE(app, "/redfish/v1/Managers//VirtualMedia//Actions/" + "VirtualMedia.InsertMedia") + .privileges({{"Login"}}) + .methods(boost::beast::http::verb::get)( +- [](const crow::Request& req, +- const std::shared_ptr& asyncResp, +- const std::string& name, const std::string& resName) { +- checkProxyMode(asyncResp, req, name, resName); ++ [handler](const crow::Request& req, ++ const std::shared_ptr& asyncResp, ++ const std::string& name, const std::string& resName) { ++ findItemAndRunHandler(asyncResp, req, name, resName, ++ std::move(handler)); + }); + + for (auto method : +@@ -991,10 +1001,12 @@ inline void requestNBDVirtualMediaRoutes(App& app) + "VirtualMedia.InsertMedia") + .privileges({{"ConfigureManager"}}) + .methods(method)( +- [](const crow::Request& req, +- const std::shared_ptr& asyncResp, +- const std::string& name, const std::string& resName) { +- checkProxyMode(asyncResp, req, name, resName); ++ [handler = std::move(handler)]( ++ const crow::Request& req, ++ const std::shared_ptr& asyncResp, ++ const std::string& name, const std::string& resName) { ++ findItemAndRunHandler(asyncResp, req, name, resName, ++ std::move(handler)); + }); + } + +@@ -1006,129 +1018,68 @@ inline void requestNBDVirtualMediaRoutes(App& app) + [](const crow::Request& req, + const std::shared_ptr& asyncResp, + const std::string& name, const std::string& resName) { +- if (name != "bmc") +- { +- messages::resourceNotFound(asyncResp->res, +- "VirtualMedia.Insert", resName); +- +- return; +- } +- InsertMediaActionParams actionParams; +- +- // Read obligatory parameters (url of +- // image) +- if (!json_util::readJson( +- req, asyncResp->res, "Image", actionParams.imageUrl, +- "WriteProtected", actionParams.writeProtected, +- "UserName", actionParams.userName, "Password", +- actionParams.password, "Inserted", +- actionParams.inserted, "TransferMethod", +- actionParams.transferMethod, "TransferProtocolType", +- actionParams.transferProtocolType)) +- { +- BMCWEB_LOG_DEBUG << "Image is not provided"; +- return; +- } +- +- bool paramsValid = validateParams( +- asyncResp->res, actionParams.imageUrl, +- actionParams.inserted, actionParams.transferMethod, +- actionParams.transferProtocolType); +- +- if (paramsValid == false) +- { +- return; +- } +- +- crow::connections::systemBus->async_method_call( +- [asyncResp, actionParams, +- resName](const boost::system::error_code ec, +- const GetObjectType& getObjectType) mutable { +- if (ec) ++ // handle legacy mode (parse parameters and start action ++ // for proxy mode return 404. ++ auto handler = ++ [req, resName]( ++ const std::string& service, ++ const std::shared_ptr& asyncResp, ++ std::pair& item) { ++ auto mode = item.first.parent_path(); ++ auto type = mode.parent_path(); ++ if (mode.filename() == "Proxy") + { +- BMCWEB_LOG_ERROR +- << "ObjectMapper::GetObject call failed: " +- << ec; +- messages::internalError(asyncResp->res); ++ // Not possible in proxy mode ++ BMCWEB_LOG_DEBUG << "InsertMedia not " ++ "allowed in proxy mode"; ++ messages::resourceNotFound( ++ asyncResp->res, "VirtualMedia.InsertMedia", ++ resName); + +- return; ++ return true; + } +- std::string service = getObjectType.begin()->first; +- BMCWEB_LOG_DEBUG << "GetObjectType: " << service; +- +- crow::connections::systemBus->async_method_call( +- [service, resName, actionParams, +- asyncResp](const boost::system::error_code ec, +- ManagedObjectType& subtree) mutable { +- if (ec) +- { +- BMCWEB_LOG_DEBUG << "DBUS response error"; + +- return; +- } +- +- for (const auto& object : subtree) +- { +- const std::string& path = +- static_cast( +- object.first); +- +- std::size_t lastIndex = path.rfind('/'); +- if (lastIndex == std::string::npos) +- { +- continue; +- } +- +- lastIndex += 1; +- +- if (path.substr(lastIndex) == resName) +- { +- lastIndex = path.rfind("Proxy"); +- if (lastIndex != std::string::npos) +- { +- // Not possible in proxy mode +- BMCWEB_LOG_DEBUG +- << "InsertMedia not " +- "allowed in proxy mode"; +- messages::resourceNotFound( +- asyncResp->res, +- "VirtualMedia.InsertMedia", +- resName); +- +- return; +- } ++ InsertMediaActionParams actionParams; ++ ++ // Read obligatory parameters (url of ++ // image) ++ if (!json_util::readJson( ++ req, asyncResp->res, "Image", ++ actionParams.imageUrl, "WriteProtected", ++ actionParams.writeProtected, "UserName", ++ actionParams.userName, "Password", ++ actionParams.password, "Inserted", ++ actionParams.inserted, "TransferMethod", ++ actionParams.transferMethod, ++ "TransferProtocolType", ++ actionParams.transferProtocolType)) ++ { ++ BMCWEB_LOG_DEBUG << "Image is not provided"; ++ return true; ++ } + +- lastIndex = path.rfind("Legacy"); +- if (lastIndex == std::string::npos) +- { +- continue; +- } ++ bool paramsValid = validateParams( ++ asyncResp->res, actionParams.imageUrl, ++ actionParams.inserted, actionParams.transferMethod, ++ actionParams.transferProtocolType); + +- // manager is irrelevant for +- // VirtualMedia dbus calls +- doMountVmLegacy( +- asyncResp, service, resName, +- actionParams.imageUrl, +- !(*actionParams.writeProtected), +- std::move(*actionParams.userName), +- std::move(*actionParams.password)); ++ if (paramsValid == false) ++ { ++ return true; ++ } + +- return; +- } +- } +- BMCWEB_LOG_DEBUG << "Parent item not found"; +- messages::resourceNotFound( +- asyncResp->res, "VirtualMedia", resName); +- }, +- service, "/xyz/openbmc_project/VirtualMedia", +- "org.freedesktop.DBus.ObjectManager", +- "GetManagedObjects"); +- }, +- "xyz.openbmc_project.ObjectMapper", +- "/xyz/openbmc_project/object_mapper", +- "xyz.openbmc_project.ObjectMapper", "GetObject", +- "/xyz/openbmc_project/VirtualMedia", +- std::array()); ++ // manager is irrelevant for ++ // VirtualMedia dbus calls ++ doMountVmLegacy(asyncResp, service, resName, ++ actionParams.imageUrl, ++ !(*actionParams.writeProtected), ++ std::move(*actionParams.userName), ++ std::move(*actionParams.password)); ++ ++ return true; ++ }; ++ findItemAndRunHandler(asyncResp, req, name, resName, handler); + }); + + BMCWEB_ROUTE( +-- +2.31.1 + 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 7183dfffa..f7154bda1 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -23,6 +23,10 @@ SRC_URI += "file://0001-Firmware-update-configuration-changes.patch \ file://0025-Add-Model-to-ProcessorSummary.patch \ file://0026-Revert-Delete-the-copy-constructor-on-the-Request.patch \ file://0027-Convert-VariantType-to-DbusVariantType.patch \ + file://0028-Add-FirmwareResiliency-and-FirmwareUpdateStatus.patch \ + file://0029-Fix-Property-PhysicalContext-is-invalid-none.patch \ + file://0030-Change-Severity-for-ServiceFailure-redfish-event.patch \ + file://0031-Change-PcieType-to-PCIeType.patch \ " # OOB Bios Config: @@ -44,6 +48,7 @@ SRC_URI += " \ file://vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch \ file://vm/0006-Bmcweb-handle-permission-denied-exception.patch \ file://vm/0007-Fix-unmounting-image-in-proxy-mode.patch \ + file://vm/0008-Return-404-for-POST-on-Proxy-InsertMedia.patch \ " # EventService: Temporary pulled to downstream. See eventservice\README for details @@ -58,6 +63,7 @@ SRC_URI += "file://eventservice/0001-Add-unmerged-changes-for-http-retry-support file://eventservice/0011-Fix-bmcweb-crash-while-deleting-terminated-subscriptions.patch \ file://eventservice/0012-Add-support-for-deleting-terminated-subscriptions.patch \ file://eventservice/0013-event-service-fix-added-Context-field-to-response.patch \ + file://eventservice/0014-Fix-Event-Subscription-URI.patch \ " @@ -65,6 +71,7 @@ SRC_URI += "file://eventservice/0001-Add-unmerged-changes-for-http-retry-support SRC_URI += " file://telemetry/0001-Add-support-for-POST-on-TriggersCollection.patch \ file://telemetry/0002-Revert-Remove-LogService-from-TelemetryService.patch \ file://telemetry/0003-Switched-bmcweb-to-use-new-telemetry-service-API.patch \ + file://telemetry/0004-Fixed-timestamp-in-telemetry-service.patch \ " # Temporary downstream patch for routing and privilege changes @@ -83,6 +90,7 @@ EXTRA_OEMESON += " -Dvm-nbdproxy=enabled" # Disable dependency on external nbd-proxy application EXTRA_OEMESON += " -Dvm-websocket=disabled" +EXTRA_OEMESON += " -Dredfish-host-logger=disabled" RDEPENDS:${PN}:remove += "jsnbd" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-user_mgmt-Fix-for-user-privilege-race-condition.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-user_mgmt-Fix-for-user-privilege-race-condition.patch new file mode 100644 index 000000000..7f0a63b77 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0064-user_mgmt-Fix-for-user-privilege-race-condition.patch @@ -0,0 +1,152 @@ +From 2c40b63025d39382db78dc4ec62e6fb55c7c66a7 Mon Sep 17 00:00:00 2001 +From: Jayaprakash Mutyala +Date: Fri, 1 Oct 2021 16:01:57 +0000 +Subject: [PATCH] user_mgmt: Fix for user privilege race condition + +This is porting of main line upstream review change #47382. + +The ipmid and netipmid processes cache IPMI user data in a shared file. +The current implementation has coherency and consistency problems: + +Coherence: If a user account is created and immediately enabled with +IPMI commands, the updated data may not be propagated to netipmid. This +condition can last indefinitely, so the cache is not coherent. The +problem is caused by a lock that doesn't work and allows both processes +to register signal handlers that write to the file. + +Consistency: This cache scheme does not have a strict (or linearizable) +consistency model. The ipmid and netipmid processes have an inconsistent +view of the user database until changes propagate to netipmid. Cache +file reads are controlled by mtime comparisons with a one-second +granularity. + +So mitigated the second problem by using the full 10ms resolution of +mtime. Now a new user is ready to use much faster than a client can +submit two commands. + +Mitigating the second (consistency) problem does not fix the first +problem. It might hide it, but the result will still depend on +non-deterministic timing of DBus signals and mtime granularity. + +To fix the coherency problem, changed sigHndlrLock to use a different +file that isn't closed after each operation. Closing a POSIX file lock +releases the lock. + +Tested: +1. Verified using IPMI commands by creating multiple users continuously. +Successfully created all users and able to perform RMCPP with that user. + +Command: ipmitool user set name +Response: //User created successfully +Command: ipmitool user set password +Response: Set User Password command successful +Command: ipmitool channel setaccess link=on ipmi=on + callin=on privilege=4 +Response: Set User Access (channel id ) successful. +Command: ipmitool raw 0x6 0x43 0x9 0x4 0x0 + // Set User Access Command +Response: //Success +Command: ipmitool user enable +Response: //Success +Command: ipmitool -H -U -P -C 17 -I + lanplus raw 0x06 0x01 +Response: //Success + +Signed-off-by: Luke Phillips +Signed-off-by: Jayaprakash Mutyala +Change-Id: If5ede3b0f97a2ba2b33cf358a9aaaf93d765d359 +--- + user_channel/user_mgmt.cpp | 27 +++++++++++++++++++++------ + user_channel/user_mgmt.hpp | 4 ++-- + 2 files changed, 23 insertions(+), 8 deletions(-) + +diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp +index 2459de7..1644154 100644 +--- a/user_channel/user_mgmt.cpp ++++ b/user_channel/user_mgmt.cpp +@@ -70,6 +70,8 @@ static constexpr const char* getObjectMethod = "GetObject"; + static constexpr const char* ipmiUserMutex = "ipmi_usr_mutex"; + static constexpr const char* ipmiMutexCleanupLockFile = + "/var/lib/ipmi/ipmi_usr_mutex_cleanup"; ++static constexpr const char* ipmiUserSignalLockFile = ++ "/var/lib/ipmi/ipmi_usr_signal_mutex"; + static constexpr const char* ipmiUserDataFile = "/var/lib/ipmi/ipmi_user.json"; + static constexpr const char* ipmiGrpName = "ipmi"; + static constexpr size_t privNoAccess = 0xF; +@@ -1504,8 +1506,10 @@ void UserAccess::deleteUserIndex(const size_t& usrIdx) + + void UserAccess::checkAndReloadUserData() + { +- std::time_t updateTime = getUpdatedFileTime(); +- if (updateTime != fileLastUpdatedTime || updateTime == -EIO) ++ std::timespec updateTime = getUpdatedFileTime(); ++ if ((updateTime.tv_sec != fileLastUpdatedTime.tv_sec || ++ updateTime.tv_nsec != fileLastUpdatedTime.tv_nsec) || ++ (updateTime.tv_sec == 0 && updateTime.tv_nsec == 0)) + { + std::fill(reinterpret_cast(&usersTbl), + reinterpret_cast(&usersTbl) + sizeof(usersTbl), 0); +@@ -1557,15 +1561,15 @@ void UserAccess::getSystemPrivAndGroups() + return; + } + +-std::time_t UserAccess::getUpdatedFileTime() ++std::timespec UserAccess::getUpdatedFileTime() + { + struct stat fileStat; + if (stat(ipmiUserDataFile, &fileStat) != 0) + { + log("Error in getting last updated time stamp"); +- return -EIO; ++ return std::timespec{0, 0}; + } +- return fileStat.st_mtime; ++ return fileStat.st_mtim; + } + + void UserAccess::getUserProperties(const DbusUserObjProperties& properties, +@@ -1631,7 +1635,18 @@ void UserAccess::cacheUserDataFile() + } + writeUserData(); + } +- sigHndlrLock = boost::interprocess::file_lock(ipmiUserDataFile); ++ // Create lock file if it does not exist ++ int fd = open(ipmiUserSignalLockFile, O_CREAT | O_TRUNC | O_SYNC, ++ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); ++ if (fd < 0) ++ { ++ log("Error in creating IPMI user signal lock file"); ++ throw std::ios_base::failure( ++ "Error in creating temporary IPMI user signal lock file"); ++ } ++ close(fd); ++ ++ sigHndlrLock = boost::interprocess::file_lock(ipmiUserSignalLockFile); + // Register it for single object and single process either netipimd / + // host-ipmid + if (userUpdatedSignal == nullptr && sigHndlrLock.try_lock()) +diff --git a/user_channel/user_mgmt.hpp b/user_channel/user_mgmt.hpp +index 833f6a1..602d549 100644 +--- a/user_channel/user_mgmt.hpp ++++ b/user_channel/user_mgmt.hpp +@@ -379,7 +379,7 @@ class UserAccess + std::vector availablePrivileges; + std::vector availableGroups; + sdbusplus::bus::bus bus; +- std::time_t fileLastUpdatedTime; ++ std::timespec fileLastUpdatedTime; + bool signalHndlrObject = false; + boost::interprocess::file_lock sigHndlrLock; + boost::interprocess::file_lock mutexCleanupLock; +@@ -388,7 +388,7 @@ class UserAccess + * + * @return time stamp or -EIO for failure + */ +- std::time_t getUpdatedFileTime(); ++ std::timespec getUpdatedFileTime(); + + /** @brief function to available system privileges and groups + * +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend index 5c0908515..9225fb36d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host_%.bbappend @@ -10,6 +10,7 @@ SRC_URI += "file://phosphor-ipmi-host.service \ file://0059-Move-Set-SOL-config-parameter-to-host-ipmid.patch \ file://0060-Move-Get-SOL-config-parameter-to-host-ipmid.patch \ file://0063-Save-the-pre-timeout-interrupt-in-dbus-property.patch \ + file://0064-user_mgmt-Fix-for-user-privilege-race-condition.patch \ " EXTRA_OECONF:append = " --disable-i2c-whitelist-check" 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 853d68d87..d7204990d 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,20 +3,12 @@ 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 = "af23add2a2cf73226cdc72af4793fde6357e8932" +SRCREV = "2528dfbdfdac5e0167d6529a25ee12b556577e1a" USERADD_PACKAGES = "${PN}" # add a group called ipmi GROUPADD_PARAM:${PN} = "ipmi " -# Default rmcpp iface is eth0; channel 1 -# Add channel 2 instance (eth1) -RMCPP_EXTRA = "eth1" -SYSTEMD_SERVICE:${PN} += " \ - ${PN}@${RMCPP_EXTRA}.service \ - ${PN}@${RMCPP_EXTRA}.socket \ - " - FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI += " file://10-nice-rules.conf \ 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 1710c1acd..687a71caf 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://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://git@github.com/Intel-BMC/mctpd.git;protocol=ssh;branch=main" -SRCREV = "60c0862eb286b2de8cee93a2f6736a3d317d9739" +SRCREV = "1d8974fda04b2888032b99fdcc8022353cab52f3" S = "${WORKDIR}/git" 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 661db1ea0..c641132be 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb @@ -4,7 +4,7 @@ DESCRIPTION = "Implementation of PLDM specifications" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" -SRC_URI += "git://git@github.com/Intel-BMC/pldmd.git;protocol=ssh;branch=main;branch=main" +SRC_URI += "git://git@github.com/Intel-BMC/pldmd.git;protocol=ssh;branch=main" SRCREV = "5a698ca08b8159d935f8ccbc09a84960cf201896" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0010-Add-support-for-Get-PMBUS-Readings-method.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0010-Add-support-for-Get-PMBUS-Readings-method.patch new file mode 100644 index 000000000..d305ef008 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0010-Add-support-for-Get-PMBUS-Readings-method.patch @@ -0,0 +1,457 @@ +From 5c2fbc31b076a32d0291e74046a576de852ac90c Mon Sep 17 00:00:00 2001 +From: Arun Lal K M +Date: Thu, 6 Jan 2022 20:30:09 +0000 +Subject: [PATCH] Add support for 'Get PMBUS Readings' method. + +VR sensor is currently read in the following way: +BMC gives read command, and ME proxy forward it to VR sensor. + +In 'Get PMBUS Readings' method BMC reads the data from ME. +This is used in platforms where ME cannot proxy forward PMBUS command. + +Command: +0x2E 0xF5 0x57 0x01 0x00 0x 0x0F 0x00 + +0x2E is net function +0xF5 is corresponding to 'Get PMBUS Readings' +0x57 0x01 0x00 is Intel manufacturers ID +ID is the ID of senssor in ME (not actual sensor address) +0x0F is PMBUS-enabled Device Index +0x00 is reserved byte + +New configuration parameters in Baseboard.json: +1) DeviceIndex: ID of the sensor in ME. +2) ReadMethod: use "ReadME" for 'Get PMBUS Readings'. +3) Register: Register to read in the response byte array. + For example, + Registers 1 = Temperature + Registers 2 = Voltage + Registers 3 = Current + +Note: +This is not a complete replacement for the old method, we are adding +one more way to read these sensors. The old implementation is still +present, as in, new code with old configuration file +(xx_Baseboard.json) will work (using the old method of reading the +sensor). + +References: +1) Intelligent Power Node Manager External Interface Specification + Using IPMI. +2) PMBus-Specification. + +Tested: +Case 1: Using proxy (Backward compatibility testing) +Sample configuration in Baseboard.json: +{ + "Address": "0xXX", + "Class": "MpsBridgeTemp", + "Name": "XX VR Temp", + "Thresholds": [...], + "Type": "IpmbSensor" +} + +Give command 'ipmitool sdr elist' +Response: +CPU1 PVCCD VR Te | 31h | ok | 0.1 | 37 degrees C +CPU2 PVCCD VR Te | 36h | ok | 0.1 | 37 degrees C +CPU1 PVCCFA EHV | 32h | ok | 0.1 | 34 degrees C +CPU2 PVCCFA EHV | 37h | ok | 0.1 | 33 degrees C +CPU1 VCCIN VR Te | 34h | ok | 0.1 | 48 degrees C +CPU2 VCCIN VR Te | 39h | ok | 0.1 | 58 degrees C + +Case 2: Using 'Get PMBUS Readings' method +Sample configuration in Baseboard.json: +{ + "Address": "0xXX", + "DeviceIndex": "0xXX", + "Class": "MpsBridgeTemp", + "Register": 1, + "ReadMethod": "ReadME", + "Name": "XX VR Temp", + "Thresholds": [...], + "Type": "IpmbSensor" +} + +Give command 'ipmitool sdr elist' +Response: +CPU1 PVCCD VR Te | 31h | ok | 0.1 | 41 degrees C +CPU2 PVCCD VR Te | 36h | ok | 0.1 | 43 degrees C +CPU1 PVCCFA EHV | 32h | ok | 0.1 | 37 degrees C +CPU2 PVCCFA EHV | 37h | ok | 0.1 | 37 degrees C +CPU1 VCCIN VR Te | 34h | ok | 0.1 | 60 degrees C +CPU2 VCCIN VR Te | 39h | ok | 0.1 | 56 degrees C + +Signed-off-by: Arun Lal K M +--- + include/IpmbSensor.hpp | 51 ++++++++++ + src/IpmbSensor.cpp | 217 ++++++++++++++++++++++++++++++++++------- + 2 files changed, 233 insertions(+), 35 deletions(-) + +diff --git a/include/IpmbSensor.hpp b/include/IpmbSensor.hpp +index 18d10c1..2a89251 100644 +--- a/include/IpmbSensor.hpp ++++ b/include/IpmbSensor.hpp +@@ -43,6 +43,51 @@ namespace sensor + { + constexpr uint8_t netFn = 0x04; + constexpr uint8_t getSensorReading = 0x2d; ++constexpr uint8_t manufacturerId[3] = {0x57, 0x01, 0x00}; ++ ++namespace read_me ++{ ++/** ++ * Refernce: ++ * Intelligent Power Node Manager External Interface Specification ++ * getPmbusReadings = Get PMBUS Readings (F5h) ++ * ++ * bytesForTimestamp and bytesForManufacturerId are decoded from ++ * response bytes for Get PMBUS Readings. ++ */ ++constexpr uint8_t getPmbusReadings = 0xF5; ++constexpr uint8_t bytesForTimestamp = 4; ++constexpr uint8_t bytesForManufacturerId = 3; ++ ++constexpr size_t fixedOffset = bytesForTimestamp + bytesForManufacturerId; ++ ++void getRawData(uint8_t registerToRead, const std::vector& input, ++ std::vector& result) ++{ ++ if (input.size() < 3) ++ { ++ return; ++ } ++ ++ /* Every register is two bytes*/ ++ size_t offset = fixedOffset + (registerToRead * 2); ++ if (input.size() <= (offset + 1)) ++ { ++ return; ++ } ++ ++ result.reserve(5); ++ ++ // ID ++ result.emplace_back(input[0]); ++ result.emplace_back(input[1]); ++ result.emplace_back(input[2]); ++ ++ // Value in registerToRead ++ result.emplace_back(input[offset]); ++ result.emplace_back(input[offset + 1]); ++} ++} // namespace read_me + + static bool isValid(const std::vector& data) + { +@@ -91,6 +136,7 @@ struct IpmbSensor : public Sensor + void loadDefaults(void); + void runInitCmd(void); + bool processReading(const std::vector& data, double& resp); ++ void setReadMethod(const SensorBaseConfigMap& sensorBaseConfig); + + IpmbType type; + IpmbSubType subType; +@@ -102,6 +148,9 @@ struct IpmbSensor : public Sensor + uint8_t deviceAddress; + uint8_t errorCount; + uint8_t hostSMbusIndex; ++ uint8_t registerToRead = 0; ++ bool isReadMe = false; ++ uint8_t deviceIndex = 0; + std::vector commandData; + std::optional initCommand; + std::vector initData; +@@ -112,4 +161,6 @@ struct IpmbSensor : public Sensor + private: + sdbusplus::asio::object_server& objectServer; + boost::asio::deadline_timer waitTimer; ++ ++ void getMeCommand(); + }; +diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp +index eedf21e..75f74b5 100644 +--- a/src/IpmbSensor.cpp ++++ b/src/IpmbSensor.cpp +@@ -150,6 +150,39 @@ void IpmbSensor::runInitCmd() + } + } + ++/** ++ * Refernce: ++ * Intelligent Power Node Manager External Interface Specification ++ */ ++void IpmbSensor::getMeCommand() ++{ ++ /* ++ * Byte 1, 2, 3 = Manufacturer ID. ++ */ ++ commandData.emplace_back(ipmi::sensor::manufacturerId[0]); ++ commandData.emplace_back(ipmi::sensor::manufacturerId[1]); ++ commandData.emplace_back(ipmi::sensor::manufacturerId[2]); ++ ++ /* ++ * Byte 4 = Device Index. ++ */ ++ commandData.emplace_back(deviceIndex); ++ ++ /* ++ * Byte 5 = History index. ++ * bit 0 to 3 = History index. Supported value: 0Fh to retrieve ++ * current samples. ++ * bit 4 to 7 = Page number – used only for devices which support ++ * pages. ++ */ ++ commandData.emplace_back(0x0F); ++ ++ /* ++ * Byte 6 = First Register Offset. ++ */ ++ commandData.emplace_back(0x00); ++} ++ + void IpmbSensor::loadDefaults() + { + if (type == IpmbType::meSensor) +@@ -164,28 +197,44 @@ void IpmbSensor::loadDefaults() + { + commandAddress = meAddress; + netfn = ipmi::me_bridge::netFn; +- command = ipmi::me_bridge::sendRawPmbus; +- initCommand = ipmi::me_bridge::sendRawPmbus; +- // pmbus read temp +- commandData = {0x57, 0x01, 0x00, 0x16, hostSMbusIndex, +- deviceAddress, 0x00, 0x00, 0x00, 0x00, +- 0x01, 0x02, 0x8d}; +- // goto page 0 +- initData = {0x57, 0x01, 0x00, 0x14, hostSMbusIndex, +- deviceAddress, 0x00, 0x00, 0x00, 0x00, +- 0x02, 0x00, 0x00, 0x00}; + readingFormat = ReadingFormat::linearElevenBit; ++ if (isReadMe) ++ { ++ command = ipmi::sensor::read_me::getPmbusReadings; ++ getMeCommand(); ++ } ++ else ++ { ++ command = ipmi::me_bridge::sendRawPmbus; ++ initCommand = ipmi::me_bridge::sendRawPmbus; ++ // pmbus read temp ++ commandData = {0x57, 0x01, 0x00, 0x16, hostSMbusIndex, ++ deviceAddress, 0x00, 0x00, 0x00, 0x00, ++ 0x01, 0x02, 0x8d}; ++ // goto page 0 ++ initData = {0x57, 0x01, 0x00, 0x14, hostSMbusIndex, ++ deviceAddress, 0x00, 0x00, 0x00, 0x00, ++ 0x02, 0x00, 0x00, 0x00}; ++ } + } + else if (type == IpmbType::IR38363VR) + { + commandAddress = meAddress; + netfn = ipmi::me_bridge::netFn; +- command = ipmi::me_bridge::sendRawPmbus; +- // pmbus read temp +- commandData = {0x57, 0x01, 0x00, 0x16, hostSMbusIndex, +- deviceAddress, 00, 0x00, 0x00, 0x00, +- 0x01, 0x02, 0x8D}; + readingFormat = ReadingFormat::elevenBitShift; ++ if (isReadMe) ++ { ++ command = ipmi::sensor::read_me::getPmbusReadings; ++ getMeCommand(); ++ } ++ else ++ { ++ command = ipmi::me_bridge::sendRawPmbus; ++ // pmbus read temp ++ commandData = {0x57, 0x01, 0x00, 0x16, hostSMbusIndex, ++ deviceAddress, 00, 0x00, 0x00, 0x00, ++ 0x01, 0x02, 0x8D}; ++ } + } + else if (type == IpmbType::ADM1278HSC) + { +@@ -194,20 +243,28 @@ void IpmbSensor::loadDefaults() + { + case IpmbSubType::temp: + case IpmbSubType::curr: +- uint8_t snsNum; +- if (subType == IpmbSubType::temp) ++ netfn = ipmi::me_bridge::netFn; ++ readingFormat = ReadingFormat::elevenBit; ++ if (isReadMe) + { +- snsNum = 0x8d; ++ command = ipmi::sensor::read_me::getPmbusReadings; ++ getMeCommand(); + } + else + { +- snsNum = 0x8c; ++ uint8_t snsNum; ++ if (subType == IpmbSubType::temp) ++ { ++ snsNum = 0x8d; ++ } ++ else ++ { ++ snsNum = 0x8c; ++ } ++ command = ipmi::me_bridge::sendRawPmbus; ++ commandData = {0x57, 0x01, 0x00, 0x86, deviceAddress, ++ 0x00, 0x00, 0x01, 0x02, snsNum}; + } +- netfn = ipmi::me_bridge::netFn; +- command = ipmi::me_bridge::sendRawPmbus; +- commandData = {0x57, 0x01, 0x00, 0x86, deviceAddress, +- 0x00, 0x00, 0x01, 0x02, snsNum}; +- readingFormat = ReadingFormat::elevenBit; + break; + case IpmbSubType::power: + case IpmbSubType::volt: +@@ -224,17 +281,25 @@ void IpmbSensor::loadDefaults() + { + commandAddress = meAddress; + netfn = ipmi::me_bridge::netFn; +- command = ipmi::me_bridge::sendRawPmbus; +- initCommand = ipmi::me_bridge::sendRawPmbus; +- // pmbus read temp +- commandData = {0x57, 0x01, 0x00, 0x16, hostSMbusIndex, +- deviceAddress, 0x00, 0x00, 0x00, 0x00, +- 0x01, 0x02, 0x8d}; +- // goto page 0 +- initData = {0x57, 0x01, 0x00, 0x14, hostSMbusIndex, +- deviceAddress, 0x00, 0x00, 0x00, 0x00, +- 0x02, 0x00, 0x00, 0x00}; + readingFormat = ReadingFormat::byte3; ++ if (isReadMe) ++ { ++ command = ipmi::sensor::read_me::getPmbusReadings; ++ getMeCommand(); ++ } ++ else ++ { ++ command = ipmi::me_bridge::sendRawPmbus; ++ initCommand = ipmi::me_bridge::sendRawPmbus; ++ // pmbus read temp ++ commandData = {0x57, 0x01, 0x00, 0x16, hostSMbusIndex, ++ deviceAddress, 0x00, 0x00, 0x00, 0x00, ++ 0x01, 0x02, 0x8d}; ++ // goto page 0 ++ initData = {0x57, 0x01, 0x00, 0x14, hostSMbusIndex, ++ deviceAddress, 0x00, 0x00, 0x00, 0x00, ++ 0x02, 0x00, 0x00, 0x00}; ++ } + } + else + { +@@ -362,7 +427,19 @@ void IpmbSensor::read(void) + read(); + return; + } +- const std::vector& data = std::get<5>(response); ++ ++ std::vector data; ++ ++ if (isReadMe) ++ { ++ ipmi::sensor::read_me::getRawData( ++ registerToRead, std::get<5>(response), data); ++ } ++ else ++ { ++ data = std::get<5>(response); ++ } ++ + if constexpr (debug) + { + std::cout << name << ": "; +@@ -408,6 +485,74 @@ void IpmbSensor::read(void) + "sendRequest", commandAddress, netfn, lun, command, commandData); + }); + } ++ ++void IpmbSensor::setReadMethod(const SensorBaseConfigMap& sensorBaseConfig) ++{ ++ /* ++ * Some sensor can be read in two ways ++ * 1) Using proxy: BMC read command is proxy forward by ME ++ * to sensor. 2) Using 'Get PMBUS Readings': ME responds to ++ * BMC with sensor data. ++ * ++ * By default we assume the method is 1. And if ReadMethod ++ * == "ReadME" we switch to method 2. ++ */ ++ auto readMethod = sensorBaseConfig.find("ReadMethod"); ++ if (readMethod == sensorBaseConfig.end()) ++ { ++ std::cerr << "'ReadMethod' not found, defaulting to " ++ "proxy method of reading sensor\n"; ++ return; ++ } ++ ++ if (std::visit(VariantToStringVisitor(), readMethod->second) != "ReadME") ++ { ++ std::cerr << "'ReadMethod' != 'ReadME', defaulting to " ++ "proxy method of reading sensor\n"; ++ return; ++ } ++ ++ /* ++ * In 'Get PMBUS Readings' the response containt a ++ * set of registers from the sensor. And different ++ * values such as temperature power voltage will be ++ * mapped to different registers. ++ */ ++ auto registerToReadConfig = sensorBaseConfig.find("Register"); ++ if (registerToReadConfig == sensorBaseConfig.end()) ++ { ++ std::cerr << "'Register' not found, defaulting to " ++ "proxy method of reading sensor\n"; ++ return; ++ } ++ ++ registerToRead = ++ std::visit(VariantToUnsignedIntVisitor(), registerToReadConfig->second); ++ ++ /* ++ * In 'Get PMBUS Readings' since ME is ++ * responding with the sensor data we need ++ * to use the address for sensor in ME, this ++ * is different from the actual sensor ++ * address. ++ */ ++ auto deviceIndexConfig = sensorBaseConfig.find("SensorMeAddress"); ++ if (deviceIndexConfig == sensorBaseConfig.end()) ++ { ++ std::cerr << "'SensorMeAddress' not found, defaulting to " ++ "proxy method of reading sensor\n"; ++ return; ++ } ++ ++ deviceIndex = ++ std::visit(VariantToUnsignedIntVisitor(), deviceIndexConfig->second); ++ ++ /* ++ * We found all parameters to use 'Get PMBUS Readings' ++ * method. ++ */ ++ isReadMe = true; ++} + void createSensors( + boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer, + boost::container::flat_map>& +@@ -485,6 +630,8 @@ void createSensors( + std::move(sensorThresholds), deviceAddress, + hostSMbusIndex, pollRate, sensorTypeName); + ++ sensor->setReadMethod(entry.second); ++ + /* Initialize scale and offset value */ + sensor->scaleVal = 1; + sensor->offsetVal = 0; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0011-Fix-for-cpusensor-going-into-D-state.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0011-Fix-for-cpusensor-going-into-D-state.patch new file mode 100644 index 000000000..cc9587bf7 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0011-Fix-for-cpusensor-going-into-D-state.patch @@ -0,0 +1,224 @@ +From dd880b25d01c0c7e25d65930ba0d38ddd1a6ec76 Mon Sep 17 00:00:00 2001 +From: Arun Lal K M +Date: Fri, 31 Dec 2021 13:29:56 +0000 +Subject: [PATCH] Fix for cpusensor going into D state. + +When PECI driver returns the error code EAGAIN, async_read_until will +go into a keep trying again loop. As async_read_until does not handle +EAGAIN reliably. + +Same issue was identified and fix for PSUSensor: +https://github.com/openbmc/dbus-sensors/commit/bcf76717697238e380be785bd28150963ecf0e9e + +Fix for this is to use async_wait instead of async_read_until. + +Tested: +In Intel system verified cpusensor daemon is not getting into D state +when there is a peci error EAGAIN. +Verified sensors are getting populated as expected when there is no PECI +error. + +Signed-off-by: Arun Lal K M +Signed-off-by: Arun P. Mohanan +Change-Id: I52e35075e522d0ae0d99e1c893db76156e299871 +--- + include/CPUSensor.hpp | 3 ++ + src/CPUSensor.cpp | 119 ++++++++++++++++++++++++++---------------- + 2 files changed, 77 insertions(+), 45 deletions(-) + +diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp +index a6fbdad..12d8788 100644 +--- a/include/CPUSensor.hpp ++++ b/include/CPUSensor.hpp +@@ -64,9 +64,12 @@ class CPUSensor : public Sensor, public std::enable_shared_from_this + bool loggedInterfaceDown = false; + uint8_t minMaxReadCounter; + unsigned int scaleFactor; ++ int fd; + void handleResponse(const boost::system::error_code& err); + void checkThresholds(void) override; + void updateMinMaxValues(void); ++ bool initInputDev(); ++ void restartRead(void); + }; + + extern boost::container::flat_map> +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index de33f9b..4ced5e2 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -75,6 +75,7 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, + + // call setup always as not all sensors call setInitialProperties + setupPowerMatch(conn); ++ initInputDev(); + } + + // Create a dummy "not available" CPUSensor +@@ -161,56 +162,60 @@ CPUSensor::~CPUSensor() + } + } + +-void CPUSensor::setupRead(void) ++bool CPUSensor::initInputDev() + { +- std::weak_ptr weakRef = weak_from_this(); +- +- if (readingStateGood()) +- { +- inputDev.close(); +- int fd = open(path.c_str(), O_RDONLY); +- if (fd >= 0) +- { +- inputDev.assign(fd); +- +- boost::asio::async_read_until( +- inputDev, readBuf, '\n', +- [weakRef](const boost::system::error_code& ec, +- std::size_t /*bytes_transfered*/) { +- std::shared_ptr self = weakRef.lock(); +- if (!self) +- { +- return; +- } +- self->handleResponse(ec); +- }); +- } +- else +- { +- std::cerr << name << " unable to open fd!\n"; +- pollTime = sensorFailedPollTimeMs; +- } +- } +- else ++ fd = open(path.c_str(), O_RDONLY | O_NONBLOCK); ++ if (fd < 0) + { +- pollTime = sensorFailedPollTimeMs; +- markAvailable(false); ++ std::cerr << "CPU sensor failed to open file\n"; ++ return false; + } ++ ++ inputDev.assign(fd); ++ return true; ++} ++ ++void CPUSensor::restartRead(void) ++{ ++ std::weak_ptr weakRef = weak_from_this(); + waitTimer.expires_from_now(boost::posix_time::milliseconds(pollTime)); + waitTimer.async_wait([weakRef](const boost::system::error_code& ec) { + if (ec == boost::asio::error::operation_aborted) + { +- return; // we're being canceled ++ std::cerr << "Failed to reschedule\n"; ++ return; + } + std::shared_ptr self = weakRef.lock(); +- if (!self) ++ ++ if (self) + { +- return; ++ self->setupRead(); + } +- self->setupRead(); + }); + } + ++void CPUSensor::setupRead(void) ++{ ++ if (!readingStateGood()) ++ { ++ markAvailable(false); ++ updateValue(std::numeric_limits::quiet_NaN()); ++ restartRead(); ++ return; ++ } ++ ++ std::weak_ptr weakRef = weak_from_this(); ++ inputDev.async_wait(boost::asio::posix::descriptor_base::wait_read, ++ [weakRef](const boost::system::error_code& ec) { ++ std::shared_ptr self = weakRef.lock(); ++ ++ if (self) ++ { ++ self->handleResponse(ec); ++ } ++ }); ++} ++ + void CPUSensor::updateMinMaxValues(void) + { + double newMin = std::numeric_limits::quiet_NaN(); +@@ -265,8 +270,8 @@ void CPUSensor::updateMinMaxValues(void) + + void CPUSensor::handleResponse(const boost::system::error_code& err) + { +- +- if (err == boost::system::errc::bad_file_descriptor) ++ if ((err == boost::system::errc::bad_file_descriptor) || ++ (err == boost::asio::error::misc_errors::not_found)) + { + return; // we're being destroyed + } +@@ -285,16 +290,35 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + return; + } + loggedInterfaceDown = false; +- pollTime = CPUSensor::sensorPollMs; +- std::istream responseStream(&readBuf); +- if (!err) ++ ++ if (err) + { +- std::string response; ++ pollTime = sensorFailedPollTimeMs; ++ incrementError(); ++ if (fd >= 0) ++ { ++ lseek(fd, 0, SEEK_SET); ++ } ++ return; ++ } ++ ++ static constexpr uint32_t bufLen = 128; ++ std::string response; ++ response.resize(bufLen); ++ int rdLen = 0; ++ ++ if (fd >= 0) ++ { ++ lseek(fd, 0, SEEK_SET); ++ rdLen = read(fd, response.data(), bufLen); ++ } ++ ++ if (rdLen > 0) ++ { ++ + try + { +- std::getline(responseStream, response); + rawValue = std::stod(response); +- responseStream.clear(); + double nvalue = rawValue / scaleFactor; + + if (show) +@@ -358,7 +382,12 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + incrementError(); + } + +- responseStream.clear(); ++ if (fd >= 0) ++ { ++ lseek(fd, 0, SEEK_SET); ++ } ++ ++ restartRead(); + } + + void CPUSensor::checkThresholds(void) +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0012-Serialize-cpusensor-polling.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0012-Serialize-cpusensor-polling.patch new file mode 100644 index 000000000..4617235f1 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0012-Serialize-cpusensor-polling.patch @@ -0,0 +1,343 @@ +From dbcdef1ba1ee2445d2a571d1fd47be256833f94b Mon Sep 17 00:00:00 2001 +From: Arun Lal K M +Date: Fri, 31 Dec 2021 13:29:56 +0000 +Subject: [PATCH] Serialize cpusensor polling + +Say we have 100 cpusensor objects, there will be 100 reads made +to peci driver. And in peci driver, if a read fails, it will keep +trying again till timeout. Timeout is 0.7 sec. + +Which means, under peci error state, cpusensor daemon will +make 100 calls to peci driver. And each of that call will take 0.7 sec. + +This ultimately result in io having a queue of 100 request at the same +time. And since we only has one thread for io (and peci can only do one read +at a time) these calls will make io nonresponsive. + +As io is busy: +1) busctl tree or introspect to xyz.openbmc_project.CPUSensor will fail. +2) phosphor-pid-control will try to get data from cpusensor, +and after trying for 5 times, phosphor-pid-control will gracefully exit. + +Fix for this is to serialize the requests made to peci from cpusensor daemon. +This is done via single poll loop for all cpu sensors using coroutine. +This basically avoid overloading the io with flooding of requests. + +Also, the polling frequency of individual sensors are modified to small +delay between 2 sensor reads. + +Tested: +Negative test case: In Intel system which has peci error. +By giving busctl tree or introspect to xyz.openbmc_project.CPUSensor +And making sure tree is populated. + +Positive test case: In Intel system which does not have peci error. +By giving command ipmitool sensor list and making sure CPU sensors +in are showing values as expected. + +Signed-off-by: Arun Lal K M +Signed-off-by: Arun P. Mohanan +Change-Id: Id435d198d6427e3141517ea517a8fa6f946c5dd5 +--- + .clang-tidy | 1 + + include/CPUSensor.hpp | 7 ++---- + meson.build | 6 +++++ + src/CPUSensor.cpp | 53 ++++++++++------------------------------ + src/CPUSensorMain.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++- + 5 files changed, 78 insertions(+), 46 deletions(-) + +diff --git a/.clang-tidy b/.clang-tidy +index 13f6a4b..9d58421 100644 +--- a/.clang-tidy ++++ b/.clang-tidy +@@ -258,4 +258,5 @@ CheckOptions: + - { key: readability-identifier-naming.ParameterCase, value: camelBack } + - { key: readability-identifier-naming.NamespaceCase, value: lower_case } + - { key: readability-identifier-naming.StructCase, value: CamelCase } ++ - { key: performance-unnecessary-value-param.AllowedTypes, value: 'boost::asio::yield_context' } + +diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp +index 12d8788..0ba4090 100644 +--- a/include/CPUSensor.hpp ++++ b/include/CPUSensor.hpp +@@ -45,22 +45,20 @@ class CPUSensor : public Sensor, public std::enable_shared_from_this + const std::string& sensorConfiguration); + + ~CPUSensor() override; +- static constexpr unsigned int sensorPollMs = 1000; ++ static constexpr unsigned int sensorScaleFactor = 1000; + static constexpr size_t warnAfterErrorCount = 10; + static constexpr const char* labelTcontrol = "Tcontrol"; +- void setupRead(void); ++ void setupRead(boost::asio::yield_context yield); + + private: + sdbusplus::asio::object_server& objServer; + boost::asio::streambuf readBuf; + boost::asio::posix::stream_descriptor inputDev; +- boost::asio::deadline_timer waitTimer; + std::string nameTcontrol; + std::string path; + double privTcontrol; + double dtsOffset; + bool show; +- size_t pollTime; + bool loggedInterfaceDown = false; + uint8_t minMaxReadCounter; + unsigned int scaleFactor; +@@ -69,7 +67,6 @@ class CPUSensor : public Sensor, public std::enable_shared_from_this + void checkThresholds(void) override; + void updateMinMaxValues(void); + bool initInputDev(); +- void restartRead(void); + }; + + extern boost::container::flat_map> +diff --git a/meson.build b/meson.build +index 7e8a3e6..b9dd039 100644 +--- a/meson.build ++++ b/meson.build +@@ -43,6 +43,11 @@ sdbusplus = dependency( + ], + ) + ++boost = dependency( ++ 'boost', ++ modules: ['coroutine'], ++) ++ + phosphor_logging_dep = dependency( + 'phosphor-logging', + fallback: ['phosphor-logging', 'phosphor_logging_dep'], +@@ -70,6 +75,7 @@ default_deps = [ + nlohmann_json, + phosphor_logging_dep, + sdbusplus, ++ boost, + ] + + thresholds_a = static_library( +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index 4ced5e2..8c49bc5 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -45,10 +45,10 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, + objectType, false, false, sensorProperties.max, sensorProperties.min, + conn, PowerState::on), + std::enable_shared_from_this(), objServer(objectServer), +- inputDev(io), waitTimer(io), path(path), ++ inputDev(io), path(path), + privTcontrol(std::numeric_limits::quiet_NaN()), +- dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs), +- minMaxReadCounter(0), scaleFactor(sensorProperties.scaleFactor) ++ dtsOffset(dtsOffset), show(show), minMaxReadCounter(0), ++ scaleFactor(sensorProperties.scaleFactor) + { + nameTcontrol = labelTcontrol; + nameTcontrol += " CPU" + std::to_string(cpuId); +@@ -89,9 +89,9 @@ CPUSensor::CPUSensor(const std::string& objectType, + const std::string& sensorConfiguration) : + Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration, + objectType, false, false, 0, 0, conn, PowerState::on), +- objServer(objectServer), inputDev(io), waitTimer(io), ++ objServer(objectServer), inputDev(io), + privTcontrol(std::numeric_limits::quiet_NaN()), dtsOffset(0), +- show(true), pollTime(CPUSensor::sensorPollMs), minMaxReadCounter(0) ++ show(true), minMaxReadCounter(0) + { + // assume it is a temperature sensor for now + // support for other type can be added later +@@ -150,7 +150,6 @@ CPUSensor::~CPUSensor() + { + // close the input dev to cancel async operations + inputDev.close(); +- waitTimer.cancel(); + if (show) + { + objServer.remove_interface(thresholdInterfaceWarning); +@@ -175,45 +174,24 @@ bool CPUSensor::initInputDev() + return true; + } + +-void CPUSensor::restartRead(void) +-{ +- std::weak_ptr weakRef = weak_from_this(); +- waitTimer.expires_from_now(boost::posix_time::milliseconds(pollTime)); +- waitTimer.async_wait([weakRef](const boost::system::error_code& ec) { +- if (ec == boost::asio::error::operation_aborted) +- { +- std::cerr << "Failed to reschedule\n"; +- return; +- } +- std::shared_ptr self = weakRef.lock(); +- +- if (self) +- { +- self->setupRead(); +- } +- }); +-} +- +-void CPUSensor::setupRead(void) ++void CPUSensor::setupRead(boost::asio::yield_context yield) + { + if (!readingStateGood()) + { + markAvailable(false); + updateValue(std::numeric_limits::quiet_NaN()); +- restartRead(); + return; + } + + std::weak_ptr weakRef = weak_from_this(); ++ boost::system::error_code ec; + inputDev.async_wait(boost::asio::posix::descriptor_base::wait_read, +- [weakRef](const boost::system::error_code& ec) { +- std::shared_ptr self = weakRef.lock(); +- +- if (self) +- { +- self->handleResponse(ec); +- } +- }); ++ yield[ec]); ++ std::shared_ptr self = weakRef.lock(); ++ if (self) ++ { ++ self->handleResponse(ec); ++ } + } + + void CPUSensor::updateMinMaxValues(void) +@@ -284,7 +262,6 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + std::cerr << name << " interface down!\n"; + loggedInterfaceDown = true; + } +- pollTime = CPUSensor::sensorPollMs * 10u; + markFunctional(false); + } + return; +@@ -293,7 +270,6 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + + if (err) + { +- pollTime = sensorFailedPollTimeMs; + incrementError(); + if (fd >= 0) + { +@@ -378,7 +354,6 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + } + else + { +- pollTime = sensorFailedPollTimeMs; + incrementError(); + } + +@@ -386,8 +361,6 @@ void CPUSensor::handleResponse(const boost::system::error_code& err) + { + lseek(fd, 0, SEEK_SET); + } +- +- restartRead(); + } + + void CPUSensor::checkThresholds(void) +diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp +index 32cb6b3..0de6673 100644 +--- a/src/CPUSensorMain.cpp ++++ b/src/CPUSensorMain.cpp +@@ -51,6 +51,10 @@ + // clang-format on + + static constexpr bool debug = false; ++static std::unique_ptr waitTimer = nullptr; ++static bool sensorMapUpdated = false; ++static constexpr unsigned int sensorPollWaitMs = 20; ++static constexpr unsigned int sensorEmptyWaitMs = 500; + + boost::container::flat_map> gCpuSensors; + boost::container::flat_mapsetupRead(); ++ sensorMapUpdated = true; + createdSensors.insert(sensorName); + if (debug) + { +@@ -427,6 +431,52 @@ bool createSensors(boost::asio::io_service& io, + return true; + } + ++bool doWait(boost::asio::yield_context yield, int delay) ++{ ++ boost::system::error_code ec; ++ waitTimer->expires_from_now(boost::posix_time::milliseconds(delay)); ++ waitTimer->async_wait(yield[ec]); ++ if (ec == boost::asio::error::operation_aborted) ++ { ++ std::cerr << "Timer aborted\n"; ++ return false; ++ } ++ if (ec) ++ { ++ std::cerr << "Timer failed\n"; ++ return false; ++ } ++ return true; ++} ++ ++void pollCPUSensors(boost::asio::yield_context yield) ++{ ++ while (true) ++ { ++ sensorMapUpdated = false; ++ for (auto& [name, sensor] : gCpuSensors) ++ { ++ sensor->setupRead(yield); ++ if (!doWait(yield, sensorPollWaitMs)) ++ { ++ throw std::runtime_error("Wait timer failed"); ++ } ++ if (sensorMapUpdated) ++ { ++ break; ++ } ++ } ++ ++ if (gCpuSensors.size() == 0) ++ { ++ if (!doWait(yield, sensorEmptyWaitMs)) ++ { ++ throw std::runtime_error("Wait timer failed"); ++ } ++ } ++ } ++} ++ + int exportDevice(const CPUConfig& config) + { + std::ostringstream hex; +@@ -905,6 +955,7 @@ int main() + boost::asio::deadline_timer pingTimer(io); + boost::asio::deadline_timer creationTimer(io); + boost::asio::deadline_timer filterTimer(io); ++ waitTimer = std::make_unique(io); + ManagedObjectType sensorConfigs; + + filterTimer.expires_from_now(boost::posix_time::seconds(1)); +@@ -966,6 +1017,10 @@ int main() + systemBus->request_name("xyz.openbmc_project.CPUSensor"); + + setupManufacturingModeMatch(*systemBus); ++ ++ boost::asio::spawn( ++ io, [](boost::asio::yield_context yield) { pollCPUSensors(yield); }); ++ + io.run(); + return 0; + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0013-Add-dummy-cpu-sensor-flag.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0013-Add-dummy-cpu-sensor-flag.patch new file mode 100644 index 000000000..01f3fda09 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0013-Add-dummy-cpu-sensor-flag.patch @@ -0,0 +1,60 @@ +From 1429b5e9d7a1aa2b0ac9b997b56f53728f8de712 Mon Sep 17 00:00:00 2001 +From: "Arun P. Mohanan" +Date: Thu, 3 Feb 2022 23:56:33 +0530 +Subject: [PATCH] Add dummy cpu sensor flag + +With updated cpu sensor logic, the setupRead() will get called for +dummy sensors as well. This will cause cpu sensor to exit unsuccessfully. + +Add a flag to skip dummy sensors from polling. + +Tested: +CPU sensor polling worked as expected. +Unsuccessfull service exit issue is not observed. + +Signed-off-by: Arun P. Mohanan +--- + include/CPUSensor.hpp | 1 + + src/CPUSensor.cpp | 7 ++++++- + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp +index 0ba4090..b5921b9 100644 +--- a/include/CPUSensor.hpp ++++ b/include/CPUSensor.hpp +@@ -63,6 +63,7 @@ class CPUSensor : public Sensor, public std::enable_shared_from_this + uint8_t minMaxReadCounter; + unsigned int scaleFactor; + int fd; ++ bool dummySensor = false; + void handleResponse(const boost::system::error_code& err); + void checkThresholds(void) override; + void updateMinMaxValues(void); +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index 8c49bc5..7990e99 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -91,7 +91,7 @@ CPUSensor::CPUSensor(const std::string& objectType, + objectType, false, false, 0, 0, conn, PowerState::on), + objServer(objectServer), inputDev(io), + privTcontrol(std::numeric_limits::quiet_NaN()), dtsOffset(0), +- show(true), minMaxReadCounter(0) ++ show(true), minMaxReadCounter(0), dummySensor(true) + { + // assume it is a temperature sensor for now + // support for other type can be added later +@@ -176,6 +176,11 @@ bool CPUSensor::initInputDev() + + void CPUSensor::setupRead(boost::asio::yield_context yield) + { ++ if (dummySensor) ++ { ++ return; ++ } ++ + if (!readingStateGood()) + { + markAvailable(false); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0014-Treat-zero-temperatures-readings-as-errors-in-IpmbSe.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0014-Treat-zero-temperatures-readings-as-errors-in-IpmbSe.patch new file mode 100644 index 000000000..25b6d5cab --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0014-Treat-zero-temperatures-readings-as-errors-in-IpmbSe.patch @@ -0,0 +1,49 @@ +From 3659064b5ef97e78f054823657670d226bb0420e Mon Sep 17 00:00:00 2001 +From: Arun Lal K M +Date: Thu, 10 Feb 2022 17:21:30 +0000 +Subject: [PATCH] Treat zero temperatures readings as errors in IpmbSensors + +During normal operations, IpmbSensors temperature sensors are not +expected to read zero value. There might be some other root cause +need to be identified and addressed. Treat zeros readings as errors +in temperatures as a workaround. + +Tested: +Valid temperature reading is being reported in IpmbSensors. +By giving ipmitool sensors list command. + +CPU1 North VR Te | 36.000 +CPU1 PVCCD VR Te | 39.000 +CPU1 PVCCFA EHV | 37.000 +CPU1 South VR Te | 37.000 +CPU1 VCCIN VR Te | 51.000 +CPU2 North VR Te | 40.000 +CPU2 PVCCD VR Te | 43.000 +CPU2 PVCCFA EHV | 38.000 +CPU2 South VR Te | 36.000 +CPU2 VCCIN VR Te | 50.000 + +Signed-off-by: Arun Lal K M +--- + src/IpmbSensor.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp +index 75f74b5..e7d1ded 100644 +--- a/src/IpmbSensor.cpp ++++ b/src/IpmbSensor.cpp +@@ -458,7 +458,10 @@ void IpmbSensor::read(void) + + double value = 0; + +- if (!processReading(data, value)) ++ // Temperature sensors are not expected to read 0 ++ // treat them as errors ++ if (!processReading(data, value) || ++ (subType == IpmbSubType::temp && value == 0.0)) + { + incrementError(); + read(); +-- +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 23a44d69a..09a2a50ed 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 @@ -15,6 +15,11 @@ SRC_URI += "\ file://0007-Add-support-for-the-energy-hwmon-type.patch \ file://0008-CPUSensor-additional-debug-message.patch \ file://0009-CPUSensor-Create-CPUConfig-for-each-PECI-adapter.patch \ + file://0010-Add-support-for-Get-PMBUS-Readings-method.patch \ + file://0011-Fix-for-cpusensor-going-into-D-state.patch \ + file://0012-Serialize-cpusensor-polling.patch \ + file://0013-Add-dummy-cpu-sensor-flag.patch \ + file://0014-Treat-zero-temperatures-readings-as-errors-in-IpmbSe.patch \ " DEPENDS:append = " libgpiod libmctp" 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 0a8962698..0eff20be1 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,4 +1,4 @@ -From d03ec9b688a5d93f8f44e775eb74358d30d9d314 Mon Sep 17 00:00:00 2001 +From 604b4c8b3f028497cbed815b27cf7f60dfb8ceab Mon Sep 17 00:00:00 2001 From: Radivoje Jovanovic Date: Mon, 2 Jul 2018 19:23:25 -0700 Subject: [PATCH] Added suport for multiple user manager services @@ -9,14 +9,15 @@ Signed-off-by: Alberto Salazar Perez Signed-off-by: Radivoje Jovanovic Signed-off-by: Richard Marian Thomaiyar Signed-off-by: Arun P. Mohanan +Signed-off-by: Jiaqing Zhao --- Makefile.am | 5 +- mainapp.cpp | 90 +++++- - user_mgr.cpp | 305 ++---------------- + user_mgr.cpp | 299 ++---------------- user_mgr.hpp | 9 +- - user_service.cpp | 789 +++++++++++++++++++++++++++++++++++++++++++++++ + user_service.cpp | 793 +++++++++++++++++++++++++++++++++++++++++++++++ user_service.hpp | 233 ++++++++++++++ - 6 files changed, 1150 insertions(+), 281 deletions(-) + 6 files changed, 1152 insertions(+), 277 deletions(-) create mode 100644 user_service.cpp create mode 100644 user_service.hpp @@ -152,7 +153,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 8fc899f..acc16b0 100644 +index 8fc899f..c49fbef 100644 --- a/user_mgr.cpp +++ b/user_mgr.cpp @@ -18,43 +18,34 @@ @@ -281,7 +282,7 @@ index 8fc899f..acc16b0 100644 bool UserMgr::isUserExist(const std::string& userName) { if (userName.empty()) -@@ -299,44 +217,15 @@ void UserMgr::createUser(std::string userName, +@@ -299,39 +217,12 @@ void UserMgr::createUser(std::string userName, { throwForInvalidPrivilege(priv); throwForInvalidGroups(groupNames); @@ -321,16 +322,9 @@ index 8fc899f..acc16b0 100644 + // Tell the User Service to create a new user with the info provided. + userSrvc->createUser(userName, groupNames, priv, enabled); -- // Add the users object before sending out the signal -- sdbusplus::message::object_path tempObjPath(usersObjPath); -- tempObjPath /= userName; -- std::string userObj(tempObjPath); -+ // Add the users to the local list before sending out the signal -+ std::string userObj = std::string(usersObjPath) + "/" + userName; - std::sort(groupNames.begin(), groupNames.end()); - usersList.emplace( - userName, std::move(std::make_unique( -@@ -349,19 +238,11 @@ void UserMgr::createUser(std::string userName, + // Add the users object before sending out the signal + sdbusplus::message::object_path tempObjPath(usersObjPath); +@@ -349,19 +240,11 @@ void UserMgr::createUser(std::string userName, void UserMgr::deleteUser(std::string userName) { @@ -354,7 +348,7 @@ index 8fc899f..acc16b0 100644 usersList.erase(userName); -@@ -372,24 +253,13 @@ void UserMgr::deleteUser(std::string userName) +@@ -372,24 +255,13 @@ void UserMgr::deleteUser(std::string userName) void UserMgr::renameUser(std::string userName, std::string newUserName) { @@ -382,7 +376,7 @@ index 8fc899f..acc16b0 100644 const auto& user = usersList[userName]; std::string priv = user.get()->userPrivilege(); std::vector groupNames = user.get()->userGroups(); -@@ -415,8 +285,6 @@ void UserMgr::updateGroupsAndPriv(const std::string& userName, +@@ -415,8 +287,6 @@ void UserMgr::updateGroupsAndPriv(const std::string& userName, { throwForInvalidPrivilege(priv); throwForInvalidGroups(groupNames); @@ -391,7 +385,7 @@ index 8fc899f..acc16b0 100644 throwForUserDoesNotExist(userName); const std::vector& oldGroupNames = usersList[userName].get()->userGroups(); -@@ -432,29 +300,8 @@ void UserMgr::updateGroupsAndPriv(const std::string& userName, +@@ -432,29 +302,8 @@ void UserMgr::updateGroupsAndPriv(const std::string& userName, throwForMaxGrpUserCount(groupNames); } @@ -423,7 +417,7 @@ index 8fc899f..acc16b0 100644 log("User groups / privilege updated successfully", entry("USER_NAME=%s", userName.c_str())); -@@ -650,21 +497,9 @@ int UserMgr::setPamModuleArgValue(const std::string& moduleName, +@@ -650,21 +499,9 @@ int UserMgr::setPamModuleArgValue(const std::string& moduleName, void UserMgr::userEnable(const std::string& userName, bool enabled) { @@ -447,7 +441,7 @@ index 8fc899f..acc16b0 100644 log("User enabled/disabled state updated successfully", entry("USER_NAME=%s", userName.c_str()), -@@ -787,54 +622,8 @@ bool UserMgr::userPasswordExpired(const std::string& userName) +@@ -787,54 +624,8 @@ bool UserMgr::userPasswordExpired(const std::string& userName) UserSSHLists UserMgr::getUserAndSshGrpList() { @@ -504,7 +498,7 @@ index 8fc899f..acc16b0 100644 } size_t UserMgr::getIpmiUsersCount() -@@ -845,49 +634,14 @@ size_t UserMgr::getIpmiUsersCount() +@@ -845,49 +636,14 @@ size_t UserMgr::getIpmiUsersCount() bool UserMgr::isUserEnabled(const std::string& userName) { @@ -558,7 +552,7 @@ index 8fc899f..acc16b0 100644 } DbusUserObj UserMgr::getPrivilegeMapperObject(void) -@@ -1114,11 +868,9 @@ void UserMgr::initUserObjects(void) +@@ -1114,11 +870,9 @@ void UserMgr::initUserObjects(void) { // All user management lock has to be based on /etc/shadow // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; @@ -572,7 +566,7 @@ index 8fc899f..acc16b0 100644 if (!userNameList.empty()) { -@@ -1175,8 +927,10 @@ void UserMgr::initUserObjects(void) +@@ -1175,8 +929,10 @@ void UserMgr::initUserObjects(void) } } @@ -585,7 +579,7 @@ index 8fc899f..acc16b0 100644 { UserMgrIface::allPrivileges(privMgr); std::sort(groupsMgr.begin(), groupsMgr.end()); -@@ -1284,6 +1038,7 @@ UserMgr::UserMgr(sdbusplus::bus::bus& bus, const char* path) : +@@ -1284,6 +1040,7 @@ UserMgr::UserMgr(sdbusplus::bus::bus& bus, const char* path) : } AccountPolicyIface::accountUnlockTimeout(value32); } @@ -637,10 +631,10 @@ index f5aac22..5d5ca99 100644 "priv-user", "priv-noaccess"}; diff --git a/user_service.cpp b/user_service.cpp new file mode 100644 -index 0000000..6e11755 +index 0000000..457f488 --- /dev/null +++ b/user_service.cpp -@@ -0,0 +1,789 @@ +@@ -0,0 +1,793 @@ +/* +// Copyright (c) 2018 Intel Corporation +// @@ -839,10 +833,12 @@ index 0000000..6e11755 + + try + { ++ // set EXPIRE_DATE to 0 to disable user, PAM takes 0 as expire on ++ // 1970-01-01, that's an implementation-defined behavior + phosphor::user::executeCmd( + "/usr/sbin/useradd", userName.c_str(), "-G", groups.c_str(), + "-m", "-N", "-s", (sshRequested ? "/bin/sh" : "/bin/nologin"), -+ "-e", (enabled ? "" : "1970-01-02")); ++ "-e", (enabled ? "" : "1970-01-01")); + } + catch (const phosphor::user::InternalFailure& e) + { @@ -934,8 +930,10 @@ index 0000000..6e11755 + // TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{}; + try + { ++ // set EXPIRE_DATE to 0 to disable user, PAM takes 0 as expire on ++ // 1970-01-01, that's an implementation-defined behavior + phosphor::user::executeCmd("/usr/sbin/usermod", userName.c_str(), -+ "-e", (enabled ? "" : "1970-01-02")); ++ "-e", (enabled ? "" : "1970-01-01")); + } + catch (const phosphor::user::InternalFailure& e) + { @@ -1670,5 +1668,5 @@ index 0000000..50ee4db +} // namespace user +} // namespace phosphor -- -2.17.1 +2.25.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb index f41ae7e3a..a74260f68 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/virtual-media/virtual-media.bb @@ -2,7 +2,7 @@ SUMMARY = "Virtual Media Service" DESCRIPTION = "Virtual Media Service" SRC_URI = "git://git@github.com/Intel-BMC/virtual-media.git;protocol=ssh;branch=main" -SRCREV = "6165e07cd0ef6da314ed1ef4f58fe47b7d8112db" +SRCREV = "6df74a76eeacc5240d36fa7e62717cd1cdd238a7" S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" -- cgit v1.2.3