diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-06-24 02:18:49 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-06-24 03:07:59 +0300 |
commit | defdca82c107f46e980c84bffb1b2c1263522fa0 (patch) | |
tree | c31fba338a65c86741b16e061d66e0e060e3b768 /meta-openbmc-mods/meta-common | |
parent | 5565c9abcc817b88098b849b2de5c017a8fb559f (diff) | |
download | openbmc-defdca82c107f46e980c84bffb1b2c1263522fa0.tar.xz |
Update to internal 0.57
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common')
85 files changed, 1446 insertions, 2509 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch b/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch deleted file mode 100644 index 6bb6d9c82..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch +++ /dev/null @@ -1,104 +0,0 @@ -From b8f84bd39485d3977625c9a8b8e8cff5d23be56f Mon Sep 17 00:00:00 2001 -From: Roy Li <rongqing.li@windriver.com> -Date: Thu, 27 Feb 2014 09:05:02 +0800 -Subject: [PATCH] dbus: clear guid_from_server if send_negotiate_unix_fd - failed - -Upstream-Status: Submitted - -bus-test dispatch test failed with below information: - ./bus/bus-test: Running message dispatch test - Activating service name='org.freedesktop.DBus.TestSuiteEchoService' - Successfully activated service 'org.freedesktop.DBus.TestSuiteEchoService' - 6363: assertion failed "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0" file "dbus-auth.c" line 1545 function process_ok - ./bus/bus-test(_dbus_print_backtrace+0x29) [0x80cb969] - ./bus/bus-test(_dbus_abort+0x14) [0x80cfb44] - ./bus/bus-test(_dbus_real_assert+0x53) [0x80b52c3] - ./bus/bus-test() [0x80e24da] - ./bus/bus-test(_dbus_auth_do_work+0x388) [0x80e3848] - ./bus/bus-test() [0x80aea49] - ./bus/bus-test() [0x80affde] - ./bus/bus-test(_dbus_transport_handle_watch+0xb1) [0x80ad841] - ./bus/bus-test(_dbus_connection_handle_watch+0x104) [0x8089174] - ./bus/bus-test(dbus_watch_handle+0xd8) [0x80b15e8] - ./bus/bus-test(_dbus_loop_iterate+0x4a9) [0x80d1509] - ./bus/bus-test(bus_test_run_clients_loop+0x5d) [0x808129d] - ./bus/bus-test() [0x806cab0] - ./bus/bus-test() [0x806e0ca] - ./bus/bus-test() [0x806da6f] - ./bus/bus-test(_dbus_test_oom_handling+0x18c) [0x80b5c8c] - ./bus/bus-test() [0x806f723] - ./bus/bus-test(bus_dispatch_test+0x3c) [0x8071aac] - ./bus/bus-test(main+0x1b7) [0x805acc7] - /lib/libc.so.6(__libc_start_main+0xf3) [0x45f919b3] - ./bus/bus-test() [0x805ae39] - -The stack is below: - #0 0xffffe425 in __kernel_vsyscall () - #1 0x45fa62d6 in raise () from /lib/libc.so.6 - #2 0x45fa9653 in abort () from /lib/libc.so.6 - #3 0x080cfb65 in _dbus_abort () at dbus-sysdeps.c:94 - #4 0x080b52c3 in _dbus_real_assert (condition=0, - condition_text=condition_text@entry=0x8117a38 "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0", - file=file@entry=0x8117273 "dbus-auth.c", line=line@entry=1545, - func=func@entry=0x8117f8e <__FUNCTION__.3492> "process_ok") - data=0x8157290) at dbus-connection.c:1515 - #0 0x00000033fee353e9 in raise () from /lib64/libc.so.6 - #1 0x00000033fee38508 in abort () from /lib64/libc.so.6 - #2 0x000000000047d585 in _dbus_abort () at dbus-sysdeps.c:94 - #3 0x0000000000466486 in _dbus_real_assert (condition=<optimized out>, - condition_text=condition_text@entry=0x4c2988 "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0", - file=file@entry=0x4c21a5 "dbus-auth.c", line=line@entry=1546, - func=func@entry=0x4c2fce <__FUNCTION__.3845> "process_ok") - at dbus-internals.c:931 - #4 0x000000000048d424 in process_ok (args_from_ok=0x7fffffffe480, - auth=0x6ff340) at dbus-auth.c:1546 - #5 handle_client_state_waiting_for_data (auth=0x6ff340, - command=<optimized out>, args=0x7fffffffe480) at dbus-auth.c:1996 - #6 0x000000000048e789 in process_command (auth=0x6ff340) at dbus-auth.c:2208 - #7 _dbus_auth_do_work (auth=0x6ff340) at dbus-auth.c:2458 - #8 0x000000000046091d in do_authentication ( - transport=transport@entry=0x6ffaa0, do_reading=do_reading@entry=1, - do_writing=do_writing@entry=0, - auth_completed=auth_completed@entry=0x7fffffffe55c) - at dbus-transport-socket.c:442 - #9 0x0000000000461d08 in socket_handle_watch (transport=0x6ffaa0, - watch=0x6f4190, flags=1) at dbus-transport-socket.c:921 - #10 0x000000000045fa3a in _dbus_transport_handle_watch (transport=0x6ffaa0, - -Once send_negotiate_unix_fd failed, this failure will happen, since -auth->guid_from_server has been set to some value before -send_negotiate_unix_fd. send_negotiate_unix_fd failure will lead to -this auth be handled by process_ok again, but this auth->guid_from_server -is not zero. - -So we should clear auth->guid_from_server if send_negotiate_unix_fd failed - -Signed-off-by: Roy Li <rongqing.li@windriver.com> ---- - dbus/dbus-auth.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c -index d2c37a7..37b45c6 100644 ---- a/dbus/dbus-auth.c -+++ b/dbus/dbus-auth.c -@@ -1571,8 +1571,13 @@ process_ok(DBusAuth *auth, - _dbus_verbose ("Got GUID '%s' from the server\n", - _dbus_string_get_const_data (& DBUS_AUTH_CLIENT (auth)->guid_from_server)); - -- if (auth->unix_fd_possible) -- return send_negotiate_unix_fd(auth); -+ if (auth->unix_fd_possible) { -+ if (!send_negotiate_unix_fd(auth)) { -+ _dbus_string_set_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server, 0); -+ return FALSE; -+ } -+ return TRUE; -+ } - - _dbus_verbose("Not negotiating unix fd passing, since not possible\n"); - return send_begin (auth); --- -1.7.10.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/dbus-1.init b/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/dbus-1.init deleted file mode 100644 index 90e167e57..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/dbus-1.init +++ /dev/null @@ -1,123 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: dbus -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 1 -# Short-Description: D-Bus systemwide message bus -# Description: D-Bus is a simple interprocess messaging system, used -# for sending messages between applications. -### END INIT INFO -# -# -*- coding: utf-8 -*- -# Debian init.d script for D-BUS -# Copyright © 2003 Colin Walters <walters@debian.org> - -# set -e - -# Source function library. -. /etc/init.d/functions - -DAEMON=@bindir@/dbus-daemon -NAME=dbus -DAEMONUSER=messagebus # must match /usr/share/dbus-1/system.conf -PIDFILE=/var/run/dbus/pid # must match /usr/share/dbus-1/system.conf -UUIDDIR=/var/lib/dbus -DESC="system message bus" -EVENTDIR=/etc/dbus-1/event.d - -test -x $DAEMON || exit 0 - -# Source defaults file; edit that file to configure this script. -ENABLED=1 -PARAMS="" -if [ -e /etc/default/dbus ]; then - . /etc/default/dbus -fi - -test "$ENABLED" != "0" || exit 0 - -start_it_up() -{ - mkdir -p "`dirname $PIDFILE`" - if [ -e $PIDFILE ]; then - PIDDIR=/proc/$(cat $PIDFILE) - if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then - echo "$DESC already started; not starting." - else - echo "Removing stale PID file $PIDFILE." - rm -f $PIDFILE - fi - fi - - if [ ! -d $UUIDDIR ]; then - mkdir -p $UUIDDIR - chown $DAEMONUSER $UUIDDIR - chgrp $DAEMONUSER $UUIDDIR - fi - - dbus-uuidgen --ensure - - echo -n "Starting $DESC: " - start-stop-daemon -o --start --quiet --pidfile $PIDFILE \ - --user $DAEMONUSER --exec $DAEMON -- --system $PARAMS - echo "$NAME." - if [ -d $EVENTDIR ]; then - run-parts --arg=start $EVENTDIR - fi -} - -shut_it_down() -{ - if [ -d $EVENTDIR ]; then - # TODO: --reverse when busybox supports it - run-parts --arg=stop $EVENTDIR - fi - echo -n "Stopping $DESC: " - start-stop-daemon -o --stop --quiet --pidfile $PIDFILE \ - --user $DAEMONUSER - # We no longer include these arguments so that start-stop-daemon - # can do its job even given that we may have been upgraded. - # We rely on the pidfile being sanely managed - # --exec $DAEMON -- --system $PARAMS - echo "$NAME." - rm -f $PIDFILE -} - -reload_it() -{ - echo -n "Reloading $DESC config: " - dbus-send --print-reply --system --type=method_call \ - --dest=org.freedesktop.DBus \ - / org.freedesktop.DBus.ReloadConfig > /dev/null - # hopefully this is enough time for dbus to reload it's config file. - echo "done." -} - -case "$1" in - start) - start_it_up - ;; - stop) - shut_it_down - ;; - status) - status $DAEMON - exit $? - ;; - reload|force-reload) - reload_it - ;; - restart) - shut_it_down - sleep 1 - start_it_up - ;; - *) - echo "Usage: /etc/init.d/$NAME {start|stop|status|restart|reload|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/tmpdir.patch b/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/tmpdir.patch deleted file mode 100644 index bf086e178..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus/tmpdir.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 5105fedd7fa13dadd2d0d864fb77873b83b79a4b Mon Sep 17 00:00:00 2001 -From: Koen Kooi <koen@dominion.thruhere.net> -Date: Thu, 23 Jun 2011 13:52:09 +0200 -Subject: [PATCH] buildsys: hardcode socketdir to /tmp - -the TMPDIR env var isn't always pointing to the right target path - -Upstream-Status: Inappropriate [embedded] - -Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> - -Original comment: - - avoid to check tmp dir at build time. instead uses hard coded /tmp here - comment added by Kevin Tian <kevin.tian@intel.com> ---- - configure.ac | 11 +---------- - 1 files changed, 1 insertions(+), 10 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 408054b..6d26180 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1483,16 +1483,7 @@ AC_SUBST(TEST_LAUNCH_HELPER_BINARY) - AC_DEFINE_UNQUOTED(DBUS_TEST_LAUNCH_HELPER_BINARY, "$TEST_LAUNCH_HELPER_BINARY", - [Full path to the launch helper test program in the builddir]) - --#### Find socket directories --if ! test -z "$TMPDIR" ; then -- DEFAULT_SOCKET_DIR=$TMPDIR --elif ! test -z "$TEMP" ; then -- DEFAULT_SOCKET_DIR=$TEMP --elif ! test -z "$TMP" ; then -- DEFAULT_SOCKET_DIR=$TMP --else -- DEFAULT_SOCKET_DIR=/tmp --fi -+DEFAULT_SOCKET_DIR=/tmp - - DEFAULT_SOCKET_DIR=`echo $DEFAULT_SOCKET_DIR | sed 's/+/%2B/g'` - --- -1.6.6.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus_%.bbappend deleted file mode 100644 index 288c80f06..000000000 --- a/meta-openbmc-mods/meta-common/recipes-core/dbus/dbus_%.bbappend +++ /dev/null @@ -1,11 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -PV = "1.12.18" - -SRC_URI = "https://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \ - file://tmpdir.patch \ - file://dbus-1.init \ - file://clear-guid_from_server-if-send_negotiate_unix_f.patch \ - " -SRC_URI[md5sum] = "4ca570c281be35d0b30ab83436712242" -SRC_URI[sha256sum] = "64cf4d70840230e5e9bc784d153880775ab3db19d656ead8a0cb9c0ab5a95306" diff --git a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb index ead001a7c..38426e81d 100644 --- a/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-core/interfaces/libmctp_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp" DESCRIPTION = "Implementation of MCTP (DTMF DSP0236)" SRC_URI = "git://github.com/openbmc/libmctp.git" -SRCREV = "eba19a3b122a39ef2b5dbda49b418a202f78a48d" +SRCREV = "9f5b47a5844023719b84855cb6c554271c95ee4a" PV = "0.1+git${SRCPV}" 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 d1aa797a1..628352f2c 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,4 +2,4 @@ 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 = "01fbd0176c403feb29bf2a9ddd17469d0a27c3ef" +SRCREV = "fb9f1aa1ea3c944fbba17b51ab26264af1c67a25" diff --git a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend index 5e3751ded..6d16fe190 100644 --- a/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-extended/sdbusplus/sdbusplus_%.bbappend @@ -1,8 +1,5 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRC_URI = "git://github.com/openbmc/sdbusplus.git;nobranch=1" -SRCREV = "95874d930f0bcc8390cd47ab3bb1e5e46db45278" SRC_URI += " \ file://0001-Revert-server-Check-return-code-for-sd_bus_add_objec.patch \ " - diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend index f42119baa..7172e7a00 100644 --- a/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-graphics/libvncserver/libvncserver_%.bbappend @@ -2,4 +2,4 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" # Use the latest to support obmc-ikvm properly SRC_URI = "git://github.com/LibVNC/libvncserver" -SRCREV = "2b6d595e3ea89597b3bebbf545eb7d3c0a1224a8" +SRCREV = "d0bc9c46e217fd923ccad4719d8701b25e3c0523" diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch deleted file mode 100644 index 43600ac8a..000000000 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 0c0b7b5da551c99161bda98820a529ba29cbaac1 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> -Date: Wed, 21 Aug 2019 16:52:30 -0700 -Subject: [PATCH] Fix keyboard and mouse input events dropping issue - -Restarting of HID input devices causes input events dropping issue -which is critical for BMC KVM uses. For an example, user can't enter -to BIOS by doing keep pressing 'F2' or 'Del' key because of this issue. - -To fix the issue, this commit removes the input device restarting -logic and refines error log journaling logic using errno checking. - -Tested: - 1. Open BMCweb -> Server control -> KVM. - 2. Make a host reset and keep pressing 'F2' key. - 3. Was able to enter to BIOS using the key press. - -Change-Id: Iec1bfad1d9e5825858844cab658bbfa3e6bc24f6 -Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> ---- - ikvm_input.cpp | 58 +++++++--------------------------------------------------- - ikvm_input.hpp | 4 ---- - ikvm_video.cpp | 3 +-- - 3 files changed, 8 insertions(+), 57 deletions(-) - -diff --git a/ikvm_input.cpp b/ikvm_input.cpp -index d95e6313f62c..df12f2715585 100644 ---- a/ikvm_input.cpp -+++ b/ikvm_input.cpp -@@ -23,9 +23,9 @@ using namespace phosphor::logging; - using namespace sdbusplus::xyz::openbmc_project::Common::File::Error; - - Input::Input(const std::string& kbdPath, const std::string& ptrPath) : -- pointerError(false), sendKeyboard(false), sendPointer(false), -- keyboardFd(-1), pointerFd(-1), keyboardReport{0}, pointerReport{0}, -- keyboardPath(kbdPath), pointerPath(ptrPath) -+ sendKeyboard(false), sendPointer(false), keyboardFd(-1), pointerFd(-1), -+ keyboardReport{0}, pointerReport{0}, keyboardPath(kbdPath), -+ pointerPath(ptrPath) - { - if (!keyboardPath.empty()) - { -@@ -156,36 +156,6 @@ void Input::pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl) - rfbDefaultPtrAddEvent(buttonMask, x, y, cl); - } - --void Input::restart() --{ -- if (!keyboardPath.empty() && keyboardFd < 0) -- { -- keyboardFd = open(keyboardPath.c_str(), O_RDWR | O_CLOEXEC); -- if (keyboardFd < 0) -- { -- log<level::ERR>("Failed to open input device", -- entry("PATH=%s", keyboardPath.c_str()), -- entry("ERROR=%s", strerror(errno))); -- } -- -- sendKeyboard = false; -- } -- -- if (!pointerPath.empty() && pointerFd < 0) -- { -- pointerFd = open(pointerPath.c_str(), O_RDWR | O_CLOEXEC | O_NONBLOCK); -- if (pointerFd < 0) -- { -- log<level::ERR>("Failed to open input device", -- entry("PATH=%s", pointerPath.c_str()), -- entry("ERROR=%s", strerror(errno))); -- } -- -- pointerError = false; -- sendPointer = false; -- } --} -- - void Input::sendWakeupPacket() - { - uint8_t wakeupReport[KEY_REPORT_LENGTH] = {0}; -@@ -459,13 +429,10 @@ bool Input::writeKeyboard(const uint8_t *report) - { - if (write(keyboardFd, report, KEY_REPORT_LENGTH) != KEY_REPORT_LENGTH) - { -- log<level::ERR>("Failed to write keyboard report", -- entry("ERROR=%s", strerror(errno))); -- -- if (errno == ESHUTDOWN) -+ if (errno != ESHUTDOWN && errno != EAGAIN) - { -- close(keyboardFd); -- keyboardFd = -1; -+ log<level::ERR>("Failed to write keyboard report", -+ entry("ERROR=%s", strerror(errno))); - } - - return false; -@@ -478,23 +445,12 @@ void Input::writePointer(const uint8_t *report) - { - if (write(pointerFd, report, PTR_REPORT_LENGTH) != PTR_REPORT_LENGTH) - { -- if (!pointerError) -+ if (errno != ESHUTDOWN && errno != EAGAIN) - { - log<level::ERR>("Failed to write pointer report", - entry("ERROR=%s", strerror(errno))); -- pointerError = true; -- } -- -- if (errno == ESHUTDOWN) -- { -- close(pointerFd); -- pointerFd = -1; - } - } -- else -- { -- pointerError = false; -- } - } - - } // namespace ikvm -diff --git a/ikvm_input.hpp b/ikvm_input.hpp -index 953333263e2d..2adc7c106755 100644 ---- a/ikvm_input.hpp -+++ b/ikvm_input.hpp -@@ -48,8 +48,6 @@ class Input - */ - static void pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl); - -- /* @brief Re-opens USB device in case the endpoint shutdown */ -- void restart(); - /* @brief Sends a wakeup data packet to the USB input device */ - void sendWakeupPacket(); - /* @brief Sends an HID report to the USB input device */ -@@ -90,8 +88,6 @@ class Input - bool writeKeyboard(const uint8_t *report); - void writePointer(const uint8_t *report); - -- /* @brief Indicates whether or not a pointer report error has occurred */ -- bool pointerError; - /* @brief Indicates whether or not to send a keyboard report */ - bool sendKeyboard; - /* @brief Indicates whether or not to send a pointer report */ -diff --git a/ikvm_video.cpp b/ikvm_video.cpp -index 6a5aa6c10927..7bd4b4eb6c98 100644 ---- a/ikvm_video.cpp -+++ b/ikvm_video.cpp -@@ -163,10 +163,9 @@ bool Video::needsResize() - restart(); - return false; - } -- else if (timingsError) -+ else - { - timingsError = false; -- input.restart(); - } - - if (timings.bt.width != width || timings.bt.height != height) --- -2.7.4 - diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0004-Connect-HID-gadget-device-dynamically.patch b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0004-Connect-HID-gadget-device-dynamically.patch deleted file mode 100644 index 0fe93c604..000000000 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0004-Connect-HID-gadget-device-dynamically.patch +++ /dev/null @@ -1,494 +0,0 @@ -From 9a0f78ab773b33fd0445b23358097ddcd175a58f Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> -Date: Wed, 22 Jul 2020 23:39:18 -0700 -Subject: [PATCH] Connect HID gadget device dynamically - -Connecting HID gadget device statically from the beginning of this -service causes an issue on WHLK test. To prevent the issue, this -commit changes the HID gadget device handling as dynamic so that -the HID gadget device can be connected when this service has at -least one KVM client. - -Tested: /dev/hidg0 and /dev/hidg1 created only when at least one -KVM client is connected. - -Change-Id: I5f6596b9e4e297fb6b507000499fc041460659f7 -Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> ---- - create_usbhid.sh | 278 ++++++++++++++++++++++++-------------------- - ikvm_input.cpp | 64 +++++++++- - ikvm_input.hpp | 14 +++ - ikvm_server.cpp | 2 + - start-ipkvm.service | 2 +- - 5 files changed, 230 insertions(+), 130 deletions(-) - -diff --git a/create_usbhid.sh b/create_usbhid.sh -index 656299102d7f..d1fa4e036bbe 100644 ---- a/create_usbhid.sh -+++ b/create_usbhid.sh -@@ -1,135 +1,157 @@ - #!/bin/sh - --new_directory="/sys/kernel/config/usb_gadget/obmc_hid" -+hid_conf_directory="/sys/kernel/config/usb_gadget/obmc_hid" -+dev_name="1e6a0000.usb-vhub" - --if [ -e "${new_directory}" ]; then -- exit 0 --fi -+create_hid() { -+ # create gadget -+ mkdir "${hid_conf_directory}" -+ cd "${hid_conf_directory}" -+ -+ # add basic information -+ echo 0x0100 > bcdDevice -+ echo 0x0200 > bcdUSB -+ echo 0x0104 > idProduct # Multifunction Composite Gadget -+ echo 0x1d6b > idVendor # Linux Foundation -+ -+ # create English locale -+ mkdir strings/0x409 -+ -+ echo "OpenBMC" > strings/0x409/manufacturer -+ echo "virtual_input" > strings/0x409/product -+ echo "OBMC0001" > strings/0x409/serialnumber -+ -+ # Create HID keyboard function -+ mkdir functions/hid.0 -+ -+ echo 1 > functions/hid.0/protocol # 1: keyboard -+ echo 8 > functions/hid.0/report_length -+ echo 1 > functions/hid.0/subclass -+ -+ # Binary HID keyboard descriptor -+ # 0x05, 0x01, // USAGE_PAGE (Generic Desktop) -+ # 0x09, 0x06, // USAGE (Keyboard) -+ # 0xa1, 0x01, // COLLECTION (Application) -+ # 0x05, 0x07, // USAGE_PAGE (Keyboard) -+ # 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) -+ # 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) -+ # 0x15, 0x00, // LOGICAL_MINIMUM (0) -+ # 0x25, 0x01, // LOGICAL_MAXIMUM (1) -+ # 0x75, 0x01, // REPORT_SIZE (1) -+ # 0x95, 0x08, // REPORT_COUNT (8) -+ # 0x81, 0x02, // INPUT (Data,Var,Abs) -+ # 0x95, 0x01, // REPORT_COUNT (1) -+ # 0x75, 0x08, // REPORT_SIZE (8) -+ # 0x81, 0x03, // INPUT (Data,Var,Abs) -+ # 0x95, 0x05, // REPORT_COUNT (5) -+ # 0x75, 0x01, // REPORT_SIZE (1) -+ # 0x05, 0x08, // USAGE_PAGE (LEDs) -+ # 0x19, 0x01, // USAGE_MINIMUM (Num Lock) -+ # 0x29, 0x05, // USAGE_MAXIMUM (Kana) -+ # 0x91, 0x02, // OUTPUT (Data,Var,Abs) -+ # 0x95, 0x01, // REPORT_COUNT (1) -+ # 0x75, 0x03, // REPORT_SIZE (3) -+ # 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) -+ # 0x95, 0x06, // REPORT_COUNT (6) -+ # 0x75, 0x08, // REPORT_SIZE (8) -+ # 0x15, 0x00, // LOGICAL_MINIMUM (0) -+ # 0x25, 0x65, // LOGICAL_MAXIMUM (101) -+ # 0x05, 0x07, // USAGE_PAGE (Keyboard) -+ # 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) -+ # 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) -+ # 0x81, 0x00, // INPUT (Data,Ary,Abs) -+ # 0xc0 // END_COLLECTION -+ echo -ne '\x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x03\x95\x05\x75\x01\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x03\x95\x06\x75\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xc0' > functions/hid.0/report_desc -+ -+ # Create HID mouse function -+ mkdir functions/hid.1 -+ -+ echo 2 > functions/hid.1/protocol # 2: mouse -+ echo 5 > functions/hid.1/report_length -+ echo 1 > functions/hid.1/subclass -+ -+ # Binary HID mouse descriptor (absolute coordinate) -+ # 0x05, 0x01, // USAGE_PAGE (Generic Desktop) -+ # 0x09, 0x02, // USAGE (Mouse) -+ # 0xa1, 0x01, // COLLECTION (Application) -+ # 0x09, 0x01, // USAGE (Pointer) -+ # 0xa1, 0x00, // COLLECTION (Physical) -+ # 0x05, 0x09, // USAGE_PAGE (Button) -+ # 0x19, 0x01, // USAGE_MINIMUM (Button 1) -+ # 0x29, 0x03, // USAGE_MAXIMUM (Button 3) -+ # 0x15, 0x00, // LOGICAL_MINIMUM (0) -+ # 0x25, 0x01, // LOGICAL_MAXIMUM (1) -+ # 0x95, 0x03, // REPORT_COUNT (3) -+ # 0x75, 0x01, // REPORT_SIZE (1) -+ # 0x81, 0x02, // INPUT (Data,Var,Abs) -+ # 0x95, 0x01, // REPORT_COUNT (1) -+ # 0x75, 0x05, // REPORT_SIZE (5) -+ # 0x81, 0x03, // INPUT (Cnst,Var,Abs) -+ # 0x05, 0x01, // USAGE_PAGE (Generic Desktop) -+ # 0x09, 0x30, // USAGE (X) -+ # 0x09, 0x31, // USAGE (Y) -+ # 0x35, 0x00, // PHYSICAL_MINIMUM (0) -+ # 0x46, 0xff, 0x7f, // PHYSICAL_MAXIMUM (32767) -+ # 0x15, 0x00, // LOGICAL_MINIMUM (0) -+ # 0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767) -+ # 0x65, 0x11, // UNIT (SI Lin:Distance) -+ # 0x55, 0x00, // UNIT_EXPONENT (0) -+ # 0x75, 0x10, // REPORT_SIZE (16) -+ # 0x95, 0x02, // REPORT_COUNT (2) -+ # 0x81, 0x02, // INPUT (Data,Var,Abs) -+ # 0xc0, // END_COLLECTION -+ # 0xc0 // END_COLLECTION -+ echo -ne '\x05\x01\x09\x02\xa1\x01\x09\x01\xa1\x00\x05\x09\x19\x01\x29\x03\x15\x00\x25\x01\x95\x03\x75\x01\x81\x02\x95\x01\x75\x05\x81\x03\x05\x01\x09\x30\x09\x31\x35\x00\x46\xff\x7f\x15\x00\x26\xff\x7f\x65\x11\x55\x00\x75\x10\x95\x02\x81\x02\xc0\xc0' > functions/hid.1/report_desc -+ -+ # Create configuration -+ mkdir configs/c.1 -+ mkdir configs/c.1/strings/0x409 -+ -+ echo 0x80 > configs/c.1/bmAttributes -+ echo 200 > configs/c.1/MaxPower -+ echo "" > configs/c.1/strings/0x409/configuration -+ -+ # Link HID functions to configuration -+ ln -s functions/hid.0 configs/c.1 -+ ln -s functions/hid.1 configs/c.1 -+} -+ -+connect_hid() { -+ if ! [[ `cat UDC` =~ "${dev_name}:p" ]]; then -+ i=0 -+ num_ports=5 -+ base_usb_dir="/sys/bus/platform/devices/${dev_name}/${dev_name}:p" -+ while [ $i -lt $num_ports ]; do -+ port=$(($i + 1)) -+ i=$port -+ if [ ! -e "${base_usb_dir}${port}/gadget/suspended" ]; then -+ break -+ fi -+ done -+ echo "${dev_name}:p${port}" > UDC -+ fi -+} -+ -+disconnect_hid() { -+ if [[ `cat UDC` =~ "${dev_name}:p" ]]; then -+ echo "" > UDC -+ fi -+} - --# create gadget - original_directory="$(pwd)" --mkdir "${new_directory}" --cd "${new_directory}" -- --# add basic information --echo 0x0100 > bcdDevice --echo 0x0200 > bcdUSB --echo 0x0104 > idProduct # Multifunction Composite Gadget --echo 0x1d6b > idVendor # Linux Foundation -- --# create English locale --mkdir strings/0x409 -- --echo "OpenBMC" > strings/0x409/manufacturer --echo "virtual_input" > strings/0x409/product --echo "OBMC0001" > strings/0x409/serialnumber -- --# Create HID keyboard function --mkdir functions/hid.0 -- --echo 1 > functions/hid.0/protocol # 1: keyboard --echo 8 > functions/hid.0/report_length --echo 1 > functions/hid.0/subclass -- --# Binary HID keyboard descriptor --# 0x05, 0x01, // USAGE_PAGE (Generic Desktop) --# 0x09, 0x06, // USAGE (Keyboard) --# 0xa1, 0x01, // COLLECTION (Application) --# 0x05, 0x07, // USAGE_PAGE (Keyboard) --# 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) --# 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) --# 0x15, 0x00, // LOGICAL_MINIMUM (0) --# 0x25, 0x01, // LOGICAL_MAXIMUM (1) --# 0x75, 0x01, // REPORT_SIZE (1) --# 0x95, 0x08, // REPORT_COUNT (8) --# 0x81, 0x02, // INPUT (Data,Var,Abs) --# 0x95, 0x01, // REPORT_COUNT (1) --# 0x75, 0x08, // REPORT_SIZE (8) --# 0x81, 0x03, // INPUT (Data,Var,Abs) --# 0x95, 0x05, // REPORT_COUNT (5) --# 0x75, 0x01, // REPORT_SIZE (1) --# 0x05, 0x08, // USAGE_PAGE (LEDs) --# 0x19, 0x01, // USAGE_MINIMUM (Num Lock) --# 0x29, 0x05, // USAGE_MAXIMUM (Kana) --# 0x91, 0x02, // OUTPUT (Data,Var,Abs) --# 0x95, 0x01, // REPORT_COUNT (1) --# 0x75, 0x03, // REPORT_SIZE (3) --# 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) --# 0x95, 0x06, // REPORT_COUNT (6) --# 0x75, 0x08, // REPORT_SIZE (8) --# 0x15, 0x00, // LOGICAL_MINIMUM (0) --# 0x25, 0x65, // LOGICAL_MAXIMUM (101) --# 0x05, 0x07, // USAGE_PAGE (Keyboard) --# 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) --# 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) --# 0x81, 0x00, // INPUT (Data,Ary,Abs) --# 0xc0 // END_COLLECTION --echo -ne '\x05\x01\x09\x06\xa1\x01\x05\x07\x19\xe0\x29\xe7\x15\x00\x25\x01\x75\x01\x95\x08\x81\x02\x95\x01\x75\x08\x81\x03\x95\x05\x75\x01\x05\x08\x19\x01\x29\x05\x91\x02\x95\x01\x75\x03\x91\x03\x95\x06\x75\x08\x15\x00\x25\x65\x05\x07\x19\x00\x29\x65\x81\x00\xc0' > functions/hid.0/report_desc -- --# Create HID mouse function --mkdir functions/hid.1 -- --echo 2 > functions/hid.1/protocol # 2: mouse --echo 5 > functions/hid.1/report_length --echo 1 > functions/hid.1/subclass -- --# Binary HID mouse descriptor (absolute coordinate) --# 0x05, 0x01, // USAGE_PAGE (Generic Desktop) --# 0x09, 0x02, // USAGE (Mouse) --# 0xa1, 0x01, // COLLECTION (Application) --# 0x09, 0x01, // USAGE (Pointer) --# 0xa1, 0x00, // COLLECTION (Physical) --# 0x05, 0x09, // USAGE_PAGE (Button) --# 0x19, 0x01, // USAGE_MINIMUM (Button 1) --# 0x29, 0x03, // USAGE_MAXIMUM (Button 3) --# 0x15, 0x00, // LOGICAL_MINIMUM (0) --# 0x25, 0x01, // LOGICAL_MAXIMUM (1) --# 0x95, 0x03, // REPORT_COUNT (3) --# 0x75, 0x01, // REPORT_SIZE (1) --# 0x81, 0x02, // INPUT (Data,Var,Abs) --# 0x95, 0x01, // REPORT_COUNT (1) --# 0x75, 0x05, // REPORT_SIZE (5) --# 0x81, 0x03, // INPUT (Cnst,Var,Abs) --# 0x05, 0x01, // USAGE_PAGE (Generic Desktop) --# 0x09, 0x30, // USAGE (X) --# 0x09, 0x31, // USAGE (Y) --# 0x35, 0x00, // PHYSICAL_MINIMUM (0) --# 0x46, 0xff, 0x7f, // PHYSICAL_MAXIMUM (32767) --# 0x15, 0x00, // LOGICAL_MINIMUM (0) --# 0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767) --# 0x65, 0x11, // UNIT (SI Lin:Distance) --# 0x55, 0x00, // UNIT_EXPONENT (0) --# 0x75, 0x10, // REPORT_SIZE (16) --# 0x95, 0x02, // REPORT_COUNT (2) --# 0x81, 0x02, // INPUT (Data,Var,Abs) --# 0xc0, // END_COLLECTION --# 0xc0 // END_COLLECTION --echo -ne '\x05\x01\x09\x02\xa1\x01\x09\x01\xa1\x00\x05\x09\x19\x01\x29\x03\x15\x00\x25\x01\x95\x03\x75\x01\x81\x02\x95\x01\x75\x05\x81\x03\x05\x01\x09\x30\x09\x31\x35\x00\x46\xff\x7f\x15\x00\x26\xff\x7f\x65\x11\x55\x00\x75\x10\x95\x02\x81\x02\xc0\xc0' > functions/hid.1/report_desc -- --# Create configuration --mkdir configs/c.1 --mkdir configs/c.1/strings/0x409 -- --echo 0x80 > configs/c.1/bmAttributes --echo 200 > configs/c.1/MaxPower --echo "" > configs/c.1/strings/0x409/configuration -- --# Link HID functions to configuration --ln -s functions/hid.0 configs/c.1 --ln -s functions/hid.1 configs/c.1 -- --# Enable gadget --dev_name="1e6a0000.usb-vhub" --i=0 --num_ports=5 --base_usb_dir="/sys/bus/platform/devices/${dev_name}/${dev_name}:p" --while [ $i -lt $num_ports ]; do -- port=$(($i + 1)) -- i=$port -- if [ ! -e "${base_usb_dir}${port}/gadget/suspended" ]; then -- break -- fi --done --echo "${dev_name}:p${port}" > UDC -+ -+if [ ! -e "${hid_conf_directory}" ]; then -+ create_hid -+else -+ cd "${hid_conf_directory}" -+fi -+ -+if [ "$1" = "connect" ]; then -+ connect_hid -+elif [ "$1" = "disconnect" ]; then -+ disconnect_hid -+else -+ echo "Invalid option: $1. Use 'connect' or 'disconnect'." -+fi - - cd "${original_directory}" -diff --git a/ikvm_input.cpp b/ikvm_input.cpp -index df12f2715585..c4cce5088461 100644 ---- a/ikvm_input.cpp -+++ b/ikvm_input.cpp -@@ -16,6 +16,8 @@ - - #include "scancodes.hpp" - -+namespace fs = std::filesystem; -+ - namespace ikvm - { - -@@ -27,6 +29,54 @@ Input::Input(const std::string& kbdPath, const std::string& ptrPath) : - keyboardReport{0}, pointerReport{0}, keyboardPath(kbdPath), - pointerPath(ptrPath) - { -+ hidUdcStream.exceptions(std::ofstream::failbit | std::ofstream::badbit); -+ hidUdcStream.open(hidUdcPath, std::ios::out | std::ios::app); -+} -+ -+Input::~Input() -+{ -+ if (keyboardFd >= 0) -+ { -+ close(keyboardFd); -+ } -+ -+ if (pointerFd >= 0) -+ { -+ close(pointerFd); -+ } -+ -+ disconnect(); -+ hidUdcStream.close(); -+} -+ -+void Input::connect() -+{ -+ try -+ { -+ for (const auto& port : fs::directory_iterator(usbVirtualHubPath)) -+ { -+ if (fs::is_directory(port) && !fs::is_symlink(port) && -+ !fs::exists(port.path() / "gadget/suspended")) -+ { -+ const std::string portId = port.path().filename(); -+ hidUdcStream << portId << std::endl; -+ break; -+ } -+ } -+ } -+ catch (fs::filesystem_error& e) -+ { -+ log<level::ERR>("Failed to search USB virtual hub port", -+ entry("ERROR=%s", e.what())); -+ return; -+ } -+ catch (std::ofstream::failure& e) -+ { -+ log<level::ERR>("Failed to connect HID gadget", -+ entry("ERROR=%s", e.what())); -+ return; -+ } -+ - if (!keyboardPath.empty()) - { - keyboardFd = open(keyboardPath.c_str(), O_RDWR | O_CLOEXEC); -@@ -56,16 +106,28 @@ Input::Input(const std::string& kbdPath, const std::string& ptrPath) : - } - } - --Input::~Input() -+void Input::disconnect() - { - if (keyboardFd >= 0) - { - close(keyboardFd); -+ keyboardFd = -1; - } - - if (pointerFd >= 0) - { - close(pointerFd); -+ pointerFd = -1; -+ } -+ -+ try -+ { -+ hidUdcStream << "" << std::endl; -+ } -+ catch (std::ofstream::failure& e) -+ { -+ log<level::ERR>("Failed to disconnect HID gadget", -+ entry("ERROR=%s", e.what())); - } - } - -diff --git a/ikvm_input.hpp b/ikvm_input.hpp -index 2adc7c106755..aae7cefbef6e 100644 ---- a/ikvm_input.hpp -+++ b/ikvm_input.hpp -@@ -2,6 +2,8 @@ - - #include <rfb/rfb.h> - -+#include <filesystem> -+#include <fstream> - #include <map> - #include <string> - -@@ -29,6 +31,10 @@ class Input - Input(Input&&) = default; - Input& operator=(Input&&) = default; - -+ /* @brief Connects HID gadget to host */ -+ void connect(); -+ /* @brief Disconnects HID gadget from host */ -+ void disconnect(); - /* - * @brief RFB client key event handler - * -@@ -72,6 +78,12 @@ class Input - 0x04, // left alt - 0x40 // right alt - }; -+ /* @brief Path to the HID gadget UDC */ -+ static constexpr const char* hidUdcPath = -+ "/sys/kernel/config/usb_gadget/obmc_hid/UDC"; -+ /* @brief Path to the USB virtual hub */ -+ static constexpr const char* usbVirtualHubPath = -+ "/sys/bus/platform/devices/1e6a0000.usb-vhub"; - /* - * @brief Translates a RFB-specific key code to HID modifier bit - * -@@ -109,6 +121,8 @@ class Input - * of which keys are down - */ - std::map<int, int> keysDown; -+ /* @brief Handle of the HID gadget UDC */ -+ std::ofstream hidUdcStream; - }; - - } // namespace ikvm -diff --git a/ikvm_server.cpp b/ikvm_server.cpp -index ebeaef049d04..1c2e981b7a72 100644 ---- a/ikvm_server.cpp -+++ b/ikvm_server.cpp -@@ -178,6 +178,7 @@ void Server::clientGone(rfbClientPtr cl) - - if (server->numClients-- == 1) - { -+ server->input.disconnect(); - rfbMarkRectAsModified(server->server, 0, 0, server->video.getWidth(), - server->video.getHeight()); - } -@@ -193,6 +194,7 @@ enum rfbNewClientAction Server::newClient(rfbClientPtr cl) - cl->clientFramebufferUpdateRequestHook = clientFramebufferUpdateRequest; - if (!server->numClients++) - { -+ server->input.connect(); - server->pendingResize = false; - server->frameCounter = 0; - } -diff --git a/start-ipkvm.service b/start-ipkvm.service -index 5f945b329a26..60234b231da3 100644 ---- a/start-ipkvm.service -+++ b/start-ipkvm.service -@@ -4,7 +4,7 @@ ConditionPathIsMountPoint=/sys/kernel/config - - [Service] - Restart=always --ExecStartPre=/usr/bin/create_usbhid.sh -+ExecStartPre=/usr/bin/create_usbhid.sh disconnect - ExecStart=/usr/bin/obmc-ikvm -v /dev/video0 -k /dev/hidg0 -p /dev/hidg1 - - [Install] --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0005-Refine-HID-report-writing-logic.patch b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0005-Refine-HID-report-writing-logic.patch deleted file mode 100644 index 5293f3f27..000000000 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm/0005-Refine-HID-report-writing-logic.patch +++ /dev/null @@ -1,295 +0,0 @@ -From 68885eb4d056b8343c567c48ece7e875feb28fc0 Mon Sep 17 00:00:00 2001 -From: Jae Hyun Yoo <jae.hyun.yoo@intel.com> -Date: Thu, 30 Jul 2020 00:29:19 -0700 -Subject: [PATCH] Refine HID report writing logic - -Blocking write on the keyboard HID device causes screen freezing -during turning off the host power. To fix this issue, this commit -refines the logic using non-blocking write. As a side effect, -non-blocking write introduces event dropping when kernel HID driver -returns -EAGAIN when the driver is in busy state so this commit also -adds retry logic to cover the case. - -Tested: Didn't see the screen freezing issue. - -Change-Id: Ibd95f567c49f448cd053948c14c006de17c52420 -Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com> ---- - ikvm_input.cpp | 106 ++++++++++++++++++++++++++++++++---------------- - ikvm_input.hpp | 13 +++--- - ikvm_server.cpp | 2 - - 3 files changed, 79 insertions(+), 42 deletions(-) - -diff --git a/ikvm_input.cpp b/ikvm_input.cpp -index c4cce5088461..480db3c094bc 100644 ---- a/ikvm_input.cpp -+++ b/ikvm_input.cpp -@@ -25,9 +25,8 @@ using namespace phosphor::logging; - using namespace sdbusplus::xyz::openbmc_project::Common::File::Error; - - Input::Input(const std::string& kbdPath, const std::string& ptrPath) : -- sendKeyboard(false), sendPointer(false), keyboardFd(-1), pointerFd(-1), -- keyboardReport{0}, pointerReport{0}, keyboardPath(kbdPath), -- pointerPath(ptrPath) -+ keyboardFd(-1), pointerFd(-1), keyboardReport{0}, pointerReport{0}, -+ keyboardPath(kbdPath), pointerPath(ptrPath) - { - hidUdcStream.exceptions(std::ofstream::failbit | std::ofstream::badbit); - hidUdcStream.open(hidUdcPath, std::ios::out | std::ios::app); -@@ -79,7 +78,8 @@ void Input::connect() - - if (!keyboardPath.empty()) - { -- keyboardFd = open(keyboardPath.c_str(), O_RDWR | O_CLOEXEC); -+ keyboardFd = open(keyboardPath.c_str(), -+ O_RDWR | O_CLOEXEC | O_NONBLOCK); - if (keyboardFd < 0) - { - log<level::ERR>("Failed to open input device", -@@ -135,6 +135,12 @@ void Input::keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl) - { - Server::ClientData* cd = (Server::ClientData*)cl->clientData; - Input* input = cd->input; -+ bool sendKeyboard = false; -+ -+ if (input->keyboardFd < 0) -+ { -+ return; -+ } - - if (down) - { -@@ -150,7 +156,7 @@ void Input::keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl) - { - input->keyboardReport[i] = sc; - input->keysDown.insert(std::make_pair(key, i)); -- input->sendKeyboard = true; -+ sendKeyboard = true; - break; - } - } -@@ -163,7 +169,7 @@ void Input::keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl) - if (mod) - { - input->keyboardReport[0] |= mod; -- input->sendKeyboard = true; -+ sendKeyboard = true; - } - } - } -@@ -175,7 +181,7 @@ void Input::keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl) - { - input->keyboardReport[it->second] = 0; - input->keysDown.erase(it); -- input->sendKeyboard = true; -+ sendKeyboard = true; - } - else - { -@@ -184,10 +190,15 @@ void Input::keyEvent(rfbBool down, rfbKeySym key, rfbClientPtr cl) - if (mod) - { - input->keyboardReport[0] &= ~mod; -- input->sendKeyboard = true; -+ sendKeyboard = true; - } - } - } -+ -+ if (sendKeyboard) -+ { -+ input->writeKeyboard(input->keyboardReport); -+ } - } - - void Input::pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl) -@@ -197,6 +208,11 @@ void Input::pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl) - Server* server = (Server*)cl->screen->screenData; - const Video& video = server->getVideo(); - -+ if (input->pointerFd < 0) -+ { -+ return; -+ } -+ - input->pointerReport[0] = ((buttonMask & 0x4) >> 1) | - ((buttonMask & 0x2) << 1) | (buttonMask & 0x1); - -@@ -214,8 +230,8 @@ void Input::pointerEvent(int buttonMask, int x, int y, rfbClientPtr cl) - memcpy(&input->pointerReport[3], &yy, 2); - } - -- input->sendPointer = true; - rfbDefaultPtrAddEvent(buttonMask, x, y, cl); -+ input->writePointer(input->pointerReport); - } - - void Input::sendWakeupPacket() -@@ -249,23 +265,6 @@ void Input::sendWakeupPacket() - } - } - --void Input::sendReport() --{ -- if (sendKeyboard && keyboardFd >= 0) -- { -- writeKeyboard(keyboardReport); -- -- sendKeyboard = false; -- } -- -- if (sendPointer && pointerFd >= 0) -- { -- writePointer(pointerReport); -- -- sendPointer = false; -- } --} -- - uint8_t Input::keyToMod(rfbKeySym key) - { - uint8_t mod = 0; -@@ -489,14 +488,35 @@ uint8_t Input::keyToScancode(rfbKeySym key) - - bool Input::writeKeyboard(const uint8_t *report) - { -- if (write(keyboardFd, report, KEY_REPORT_LENGTH) != KEY_REPORT_LENGTH) -+ std::unique_lock<std::mutex> lk(keyMutex); -+ uint retryCount = HID_REPORT_RETRY_MAX; -+ -+ while (retryCount > 0) - { -- if (errno != ESHUTDOWN && errno != EAGAIN) -+ if (write(keyboardFd, report, KEY_REPORT_LENGTH) == KEY_REPORT_LENGTH) - { -- log<level::ERR>("Failed to write keyboard report", -- entry("ERROR=%s", strerror(errno))); -+ break; -+ } -+ -+ if (errno != EAGAIN) -+ { -+ if (errno != ESHUTDOWN) -+ { -+ log<level::ERR>("Failed to write keyboard report", -+ entry("ERROR=%s", strerror(errno))); -+ } -+ -+ break; - } - -+ lk.unlock(); -+ std::this_thread::sleep_for(std::chrono::milliseconds(10)); -+ lk.lock(); -+ retryCount--; -+ } -+ -+ if (!retryCount || errno) -+ { - return false; - } - -@@ -505,13 +525,31 @@ bool Input::writeKeyboard(const uint8_t *report) - - void Input::writePointer(const uint8_t *report) - { -- if (write(pointerFd, report, PTR_REPORT_LENGTH) != PTR_REPORT_LENGTH) -+ std::unique_lock<std::mutex> lk(ptrMutex); -+ uint retryCount = HID_REPORT_RETRY_MAX; -+ -+ while (retryCount > 0) - { -- if (errno != ESHUTDOWN && errno != EAGAIN) -+ if (write(pointerFd, report, PTR_REPORT_LENGTH) == PTR_REPORT_LENGTH) - { -- log<level::ERR>("Failed to write pointer report", -- entry("ERROR=%s", strerror(errno))); -+ break; -+ } -+ -+ if (errno != EAGAIN) -+ { -+ if (errno != ESHUTDOWN) -+ { -+ log<level::ERR>("Failed to write pointer report", -+ entry("ERROR=%s", strerror(errno))); -+ } -+ -+ break; - } -+ -+ lk.unlock(); -+ std::this_thread::sleep_for(std::chrono::milliseconds(10)); -+ lk.lock(); -+ retryCount--; - } - } - -diff --git a/ikvm_input.hpp b/ikvm_input.hpp -index aae7cefbef6e..558251d673cc 100644 ---- a/ikvm_input.hpp -+++ b/ikvm_input.hpp -@@ -5,6 +5,7 @@ - #include <filesystem> - #include <fstream> - #include <map> -+#include <mutex> - #include <string> - - namespace ikvm -@@ -56,8 +57,6 @@ class Input - - /* @brief Sends a wakeup data packet to the USB input device */ - void sendWakeupPacket(); -- /* @brief Sends an HID report to the USB input device */ -- void sendReport(); - - private: - static constexpr int NUM_MODIFIER_BITS = 4; -@@ -84,6 +83,8 @@ class Input - /* @brief Path to the USB virtual hub */ - static constexpr const char* usbVirtualHubPath = - "/sys/bus/platform/devices/1e6a0000.usb-vhub"; -+ /* @brief Retry limit for writing an HID report */ -+ static constexpr int HID_REPORT_RETRY_MAX = 5; - /* - * @brief Translates a RFB-specific key code to HID modifier bit - * -@@ -100,10 +101,6 @@ class Input - bool writeKeyboard(const uint8_t *report); - void writePointer(const uint8_t *report); - -- /* @brief Indicates whether or not to send a keyboard report */ -- bool sendKeyboard; -- /* @brief Indicates whether or not to send a pointer report */ -- bool sendPointer; - /* @brief File descriptor for the USB keyboard device */ - int keyboardFd; - /* @brief File descriptor for the USB mouse device */ -@@ -123,6 +120,10 @@ class Input - std::map<int, int> keysDown; - /* @brief Handle of the HID gadget UDC */ - std::ofstream hidUdcStream; -+ /* @brief Mutex for sending keyboard reports */ -+ std::mutex keyMutex; -+ /* @brief Mutex for sending pointer reports */ -+ std::mutex ptrMutex; - }; - - } // namespace ikvm -diff --git a/ikvm_server.cpp b/ikvm_server.cpp -index 0736d1f55f73..7be99e4379d1 100644 ---- a/ikvm_server.cpp -+++ b/ikvm_server.cpp -@@ -79,8 +79,6 @@ void Server::run() - - if (server->clientHead) - { -- input.sendReport(); -- - frameCounter++; - if (pendingResize && frameCounter > video.getFrameRate()) - { --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend index 9ea9e1a4e..0d2c589ae 100644 --- a/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-graphics/obmc-ikvm/obmc-ikvm_%.bbappend @@ -1,10 +1,4 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" #SRC_URI = "git://github.com/openbmc/obmc-ikvm" -SRCREV = "861337e8ec92767c4c88237ec5db494a2a67fa8d" - -SRC_URI += " \ - file://0003-Fix-keyboard-and-mouse-input-events-dropping-issue.patch \ - file://0004-Connect-HID-gadget-device-dynamically.patch \ - file://0005-Refine-HID-report-writing-logic.patch \ - " +SRCREV = "673ac2eb1117a7d692460f808f1d947495d033db" diff --git a/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb b/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb index ed4ab4930..d8436709b 100644 --- a/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-intel/hsbp/hsbp-manager_git.bb @@ -2,7 +2,7 @@ SUMMARY = "HSBP Manager" DESCRIPTION = "HSBP Manager monitors HSBPs through SMBUS" SRC_URI = "git://github.com/openbmc/s2600wf-misc.git" -SRCREV = "291d6388e0b770e89091935bc4edc7f371874666" +SRCREV = "52639bebada24990c3514786d65598dc5557477a" PV = "0.1+git${SRCPV}" LICENSE = "Apache-2.0" @@ -12,7 +12,8 @@ SYSTEMD_SERVICE_${PN} = "hsbp-manager.service" DEPENDS = "boost \ i2c-tools \ - sdbusplus" + sdbusplus \ + libgpiod" S = "${WORKDIR}/git/hsbp-manager" inherit cmake systemd 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 482738d25..ab41db601 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 @@ -2,7 +2,7 @@ SUMMARY = "Power supply manager for Intel based platform" DESCRIPTION = "Power supply manager which include PSU Cold Redundancy service" SRC_URI = "git://github.com/Intel-BMC/psu-manager.git;protocol=ssh" -SRCREV = "d14c350c2dfcf9da3e6088ef29a8c5be4e40079b" +SRCREV = "139981b813f2d480ca55f60e6b129d55d6adcbc3" S = "${WORKDIR}/git" 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 fa591872a..44cee7361 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 = "2285be4fd22709c1dcfba10c2c604528353b428a" +SRCREV = "d23b84a7eb2be944b12e6539cf627f595b299fda" S = "${WORKDIR}/git" @@ -28,7 +28,7 @@ DEPENDS += " \ i2c-tools \ " -EXTRA_OECMAKE="-DYOCTO=1" +EXTRA_OECMAKE="-DYOCTO=1 -DIPMI_BLOB=0" PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'smbios-no-dimm', d)}" PACKAGECONFIG[smbios-no-dimm] = "-DDIMM_DBUS=OFF, -DDIMM_DBUS=ON" diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1003-Die_CPU-filter-first-zero-from-GetTemp.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1003-Die_CPU-filter-first-zero-from-GetTemp.patch new file mode 100644 index 000000000..b7823ce14 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1003-Die_CPU-filter-first-zero-from-GetTemp.patch @@ -0,0 +1,60 @@ +From 0d202fb06b873c5e258658462ac4fc01a673fd83 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren <zhikui.ren@intel.com> +Date: Mon, 11 Jan 2021 16:31:36 -0800 +Subject: [PATCH] Die_CPU: filter first zero from GetTemp + +Peci command GetTemp can return 0 during CPU reset. +It does not have a have completion code either. +Discard the first zero reading and return -ENODATA. +Consecutive zeros will be returned so that real hot +condition will still be detected and logged but possibly delayed +by the sensor polling period, which is normally 500ms-1s. + +Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> +--- + drivers/hwmon/peci-cputemp.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/drivers/hwmon/peci-cputemp.c b/drivers/hwmon/peci-cputemp.c +index b633ea545644..19002f02bd91 100644 +--- a/drivers/hwmon/peci-cputemp.c ++++ b/drivers/hwmon/peci-cputemp.c +@@ -15,6 +15,7 @@ + + struct temp_group { + struct peci_sensor_data die; ++ u32 die_raw_prev; + struct peci_sensor_data dts; + struct peci_sensor_data tcontrol; + struct peci_sensor_data tthrottle; +@@ -129,6 +130,7 @@ static int get_die_temp(struct peci_cputemp *priv) + { + struct peci_get_temp_msg msg; + int ret; ++ bool discard = false; + + if (!peci_sensor_need_update(&priv->temp.die)) + return 0; +@@ -139,6 +141,19 @@ static int get_die_temp(struct peci_cputemp *priv) + if (ret) + return ret; + ++ /* GET_TEMP command does not have cc and can return zero during ++ * cpu reset. Treat the first zero reading as data not available. ++ * Consecutive zeros will be returned so true hot condition ++ * is not be missed. ++ */ ++ if (msg.temp_raw == 0 && priv->temp.die_raw_prev != 0) { ++ pr_err("peci-cputemp_die: discard first 0 reading from GetTemp\n"); ++ discard = true; ++ } ++ priv->temp.die_raw_prev = msg.temp_raw; ++ if (discard) ++ return -ENODATA; ++ + /* Note that the tjmax should be available before calling it */ + priv->temp.die.value = priv->temp.tjmax.value + + (msg.temp_raw * 1000 / 64); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1004-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1004-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch new file mode 100644 index 000000000..aab6c3cea --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/1004-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch @@ -0,0 +1,64 @@ +From 68db4c74c43d4042b0b32bcd133121ab39b9b310 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren <zhikui.ren@intel.com> +Date: Tue, 2 Feb 2021 14:49:28 -0800 +Subject: [PATCH] DTS_CPU: filter first zero from RdPkgConfig 10 + +Peci command GetPkgConfig 10 can return 0 (hot) with cc 0x40 +after cpu reset. Once pcode run time image is loaded +and it returns 0x8000 as DTS margin data not ready +Discard the first zero reading and return -ENODATA. +Consecutive zeros will be returned so that real hot +condition will still be detected and logged but possibly delayed +by the sensor polling period, which is normally one second. + +Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> +--- + drivers/hwmon/peci-cputemp.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/drivers/hwmon/peci-cputemp.c b/drivers/hwmon/peci-cputemp.c +index 19002f02bd91..e1860779aa66 100644 +--- a/drivers/hwmon/peci-cputemp.c ++++ b/drivers/hwmon/peci-cputemp.c +@@ -17,6 +17,7 @@ struct temp_group { + struct peci_sensor_data die; + u32 die_raw_prev; + struct peci_sensor_data dts; ++ u32 dts_raw_prev; + struct peci_sensor_data tcontrol; + struct peci_sensor_data tthrottle; + struct peci_sensor_data tjmax; +@@ -168,6 +169,7 @@ static int get_dts(struct peci_cputemp *priv) + s32 dts_margin; + u8 pkg_cfg[4]; + int ret; ++ bool discard = false; + + if (!peci_sensor_need_update(&priv->temp.dts)) + return 0; +@@ -181,6 +183,22 @@ static int get_dts(struct peci_cputemp *priv) + + dts_margin = le16_to_cpup((__le16 *)pkg_cfg); + ++ /* There is a small window (500us) for read dts_margin (RdPkgConfig 10) ++ * to return cc 0x40, and dts_margin of 0 after cpu reset, before runtime ++ * image is loaded to set it to 0x8000 (dts reading not ready). ++ * DTS sensor is polled by user application at a slower rate than this window. ++ * Treat the first zero reading as data not available. ++ * Consecutive zeros will be returned so true hot condition ++ * is not be missed. ++ */ ++ if (dts_margin == 0 && priv->temp.dts_raw_prev != 0) { ++ pr_err("peci-cputemp_dts: discard first 0 reading from RdPkgConfig 10\n"); ++ discard = true; ++ } ++ priv->temp.dts_raw_prev = dts_margin; ++ if (discard) ++ return -ENODATA; ++ + /** + * Processors return a value of DTS reading in 10.6 format + * (10 bits signed decimal, 6 bits fractional). +-- +2.17.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 591e86160..54e182386 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 @@ -1,10 +1,12 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +LINUX_VERSION = "5.10.30" + KBRANCH = "dev-5.10-intel" KSRC = "git://github.com/Intel-BMC/linux;protocol=ssh;branch=${KBRANCH}" # Include this as a comment only for downstream auto-bump # SRC_URI = "git://github.com/Intel-BMC/linux;protocol=ssh;branch=dev-5.10-intel" -SRCREV="faadf371d041eb0d2c8b1d4cc729f19cf53e6a92" +SRCREV="0785121bf4894ebecd9a6efc82331894fefd6c82" do_compile_prepend(){ # device tree compiler flags @@ -17,6 +19,8 @@ SRC_URI += " \ file://0002-soc-aspeed-add-AST2600-A0-specific-fix-into-mbox-dri.patch \ file://0003-Fix-libmctp-build-error.patch \ file://0004-Add-a-quick-fix-to-resolve-USB-gadget-DMA-issue.patch \ + file://1003-Die_CPU-filter-first-zero-from-GetTemp.patch \ + file://1004-DTS_CPU-filter-first-zero-from-RdPkgConfig-10.patch \ " SRC_URI += "${@bb.utils.contains('IMAGE_FSTYPES', 'intel-pfr', 'file://0005-128MB-flashmap-for-PFR.patch', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch index 6bfe783af..428d4a67e 100644 --- a/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch +++ b/meta-openbmc-mods/meta-common/recipes-network/network/phosphor-network/0003-Adding-channel-specific-privilege-to-network.patch @@ -1,4 +1,4 @@ -From 07bba51a168b769563a649f1c0f3a9126f480e57 Mon Sep 17 00:00:00 2001 +From 24bac5f6660ec5e5ea15c0f062dc4a08fbc0e876 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Thu, 2 Apr 2020 17:06:07 +0530 Subject: [PATCH] Adding channel specific privilege to network @@ -26,7 +26,7 @@ Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com> 4 files changed, 271 insertions(+), 1 deletion(-) diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp -index c47a759..d7a4168 100644 +index 607e658..e2b2da9 100644 --- a/ethernet_interface.cpp +++ b/ethernet_interface.cpp @@ -45,6 +45,10 @@ constexpr auto PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"; @@ -48,7 +48,7 @@ index c47a759..d7a4168 100644 // Emit deferred signal. if (emitSignal) -@@ -1148,5 +1153,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) +@@ -1175,5 +1180,124 @@ std::string EthernetInterface::defaultGateway6(std::string gateway) manager.writeToConfigurationFile(); return gw; } @@ -174,7 +174,7 @@ index c47a759..d7a4168 100644 } // namespace network } // namespace phosphor diff --git a/ethernet_interface.hpp b/ethernet_interface.hpp -index e2418a2..60fd272 100644 +index 8e28b51..ebba151 100644 --- a/ethernet_interface.hpp +++ b/ethernet_interface.hpp @@ -2,11 +2,14 @@ @@ -192,7 +192,7 @@ index e2418a2..60fd272 100644 #include <sdbusplus/server/object.hpp> #include <string> #include <xyz/openbmc_project/Collection/DeleteAll/server.hpp> -@@ -23,7 +26,8 @@ using Ifaces = sdbusplus::server::object::object< +@@ -33,7 +36,8 @@ using Ifaces = sdbusplus::server::object::object< sdbusplus::xyz::openbmc_project::Network::server::MACAddress, sdbusplus::xyz::openbmc_project::Network::IP::server::Create, sdbusplus::xyz::openbmc_project::Network::Neighbor::server::CreateStatic, @@ -202,7 +202,7 @@ index e2418a2..60fd272 100644 using IP = sdbusplus::xyz::openbmc_project::Network::server::IP; -@@ -31,11 +35,14 @@ using EthernetInterfaceIntf = +@@ -41,11 +45,14 @@ using EthernetInterfaceIntf = sdbusplus::xyz::openbmc_project::Network::server::EthernetInterface; using MacAddressIntf = sdbusplus::xyz::openbmc_project::Network::server::MACAddress; @@ -217,10 +217,10 @@ index e2418a2..60fd272 100644 class Manager; // forward declaration of network manager. -@@ -233,6 +240,14 @@ class EthernetInterface : public Ifaces - */ +@@ -244,6 +251,14 @@ class EthernetInterface : public Ifaces std::string defaultGateway6(std::string gateway) override; + using EthernetInterfaceIntf::dhcpEnabled; + /** @brief sets the channel maxium privilege. + * @param[in] value - Channel privilege which needs to be set on the + * system. @@ -229,10 +229,10 @@ index e2418a2..60fd272 100644 + std::string maxPrivilege(std::string value) override; + + using ChannelAccessIntf::maxPrivilege; - using EthernetInterfaceIntf::dHCPEnabled; using EthernetInterfaceIntf::interfaceName; using EthernetInterfaceIntf::linkUp; -@@ -356,6 +371,26 @@ class EthernetInterface : public Ifaces + using EthernetInterfaceIntf::nicEnabled; +@@ -366,6 +381,26 @@ class EthernetInterface : public Ifaces * @returns true/false value if the address is static */ bool originIsManuallyAssigned(IP::AddressOrigin origin); @@ -260,7 +260,7 @@ index e2418a2..60fd272 100644 } // namespace network diff --git a/network_manager.cpp b/network_manager.cpp -index c55c9bb..50ff908 100644 +index 881b767..847852f 100644 --- a/network_manager.cpp +++ b/network_manager.cpp @@ -36,6 +36,13 @@ extern std::unique_ptr<Timer> restartTimer; @@ -380,10 +380,10 @@ index c55c9bb..50ff908 100644 bool Manager::createDefaultNetworkFiles(bool force) diff --git a/network_manager.hpp b/network_manager.hpp -index 6815d3f..96e20a6 100644 +index 227955c..9f5b7a9 100644 --- a/network_manager.hpp +++ b/network_manager.hpp -@@ -151,6 +151,12 @@ class Manager : public details::VLANCreateIface +@@ -155,6 +155,12 @@ class Manager : public details::VLANCreateIface return (interfaces.find(intf) != interfaces.end()); } @@ -396,7 +396,7 @@ index 6815d3f..96e20a6 100644 protected: /** @brief Persistent sdbusplus DBus bus connection. */ sdbusplus::bus::bus& bus; -@@ -173,6 +179,9 @@ class Manager : public details::VLANCreateIface +@@ -177,6 +183,9 @@ class Manager : public details::VLANCreateIface /** @brief Network Configuration directory. */ fs::path confDir; 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 3540e93b4..3877adabd 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 @@ -3,9 +3,10 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" DEPENDS += "nlohmann-json boost" SRC_URI = "git://github.com/openbmc/phosphor-networkd" -SRCREV = "ee5b2c9469a56205567a8b1b120ecf34fc9f5ef4" +SRCREV = "de433b74ec5bce22043ea44c55e83d9be3dc5372" -SRC_URI += "file://0003-Adding-channel-specific-privilege-to-network.patch \ +SRC_URI += " file://0003-Adding-channel-specific-privilege-to-network.patch \ " EXTRA_OECONF_append = " --enable-nic-ethtool=yes" +EXTRA_OECONF_append = " --enable-ipv6-accept-ra=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 2578785b4..68678e420 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 @@ -107,6 +107,10 @@ while read IFACE UBDEV; do if [ $error -ne 0 ] && [ $first_error_seen -eq 0 ]; then first_error_seen=$error fi + else + # Disable netipmid if present because eth(x) is not present + /bin/systemctl disable "phosphor-ipmi-net@$IFACE.socket" + /bin/systemctl disable "phosphor-ipmi-net@$IFACE.service" fi done <<-END_CONF eth0 eth1addr diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch index 8682e2cad..b44220e4b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager/0002-Entity-manager-Add-support-to-update-assetTag.patch @@ -1,4 +1,4 @@ -From ff5dbca96d12b1c2aaaec0bb891125990af3f218 Mon Sep 17 00:00:00 2001 +From 7ae5ebc43755631c1756bbc1e89b41f2a1da138c Mon Sep 17 00:00:00 2001 From: mansijos <mansi.joshi@intel.com> Date: Tue, 6 Apr 2021 02:12:56 +0530 Subject: [PATCH] Entity-manager: Add support to update assetTag @@ -15,14 +15,14 @@ The new value is preserved after BMC resets. Change-Id: If7fbfd8325488280f500ab0e2c8b38475813cc3f Signed-off-by: mansijos <mansi.joshi@intel.com> --- - src/EntityManager.cpp | 92 +++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 88 insertions(+), 4 deletions(-) + src/EntityManager.cpp | 93 +++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 89 insertions(+), 4 deletions(-) diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp -index 932b6f9..67b8f95 100644 +index 7cfcc6e..bf5e175 100644 --- a/src/EntityManager.cpp +++ b/src/EntityManager.cpp -@@ -47,9 +47,17 @@ constexpr const char* lastConfiguration = "/tmp/configuration/last.json"; +@@ -48,9 +48,17 @@ constexpr const char* lastConfiguration = "/tmp/configuration/last.json"; constexpr const char* currentConfiguration = "/var/configuration/system.json"; constexpr const char* globalSchema = "global.json"; constexpr const int32_t MAX_MAPPER_DEPTH = 0; @@ -40,7 +40,7 @@ index 932b6f9..67b8f95 100644 struct cmp_str { bool operator()(const char* a, const char* b) const -@@ -575,6 +583,43 @@ void addArrayToDbus(const std::string& name, const nlohmann::json& array, +@@ -576,6 +584,43 @@ void addArrayToDbus(const std::string& name, const nlohmann::json& array, } } @@ -84,7 +84,7 @@ index 932b6f9..67b8f95 100644 template <typename PropertyType> void addProperty(const std::string& propertyName, const PropertyType& value, sdbusplus::asio::dbus_interface* iface, -@@ -589,9 +634,18 @@ void addProperty(const std::string& propertyName, const PropertyType& value, +@@ -590,9 +635,18 @@ void addProperty(const std::string& propertyName, const PropertyType& value, } iface->register_property( propertyName, value, @@ -104,7 +104,7 @@ index 932b6f9..67b8f95 100644 val = newVal; if (!setJsonFromPointer(jsonPointerString, val, systemConfiguration)) -@@ -989,6 +1043,9 @@ void postToDbus(const nlohmann::json& newConfiguration, +@@ -990,6 +1044,9 @@ void postToDbus(const nlohmann::json& newConfiguration, populateInterfaceFromJson(systemConfiguration, jsonPointerPath, boardIface, boardValues, objServer); jsonPointerPath += "/"; @@ -114,7 +114,7 @@ index 932b6f9..67b8f95 100644 // iterate through board properties for (auto& boardField : boardValues.items()) { -@@ -998,9 +1055,28 @@ void postToDbus(const nlohmann::json& newConfiguration, +@@ -999,9 +1056,28 @@ void postToDbus(const nlohmann::json& newConfiguration, createInterface(objServer, boardName, boardField.key(), boardKeyOrig); @@ -146,18 +146,19 @@ index 932b6f9..67b8f95 100644 } } -@@ -1349,6 +1425,10 @@ void PerformScan::run() - continue; +@@ -1357,6 +1433,11 @@ void PerformScan::run() + { + continue; // non-numeric replacement } - ++ + nlohmann::json recordVal = *recordPtr; + // Save the dbus path info of the device + recordVal[foundObject]["Path"] = std::get<1>(*itr); + - int index = std::stoi( - nameIt->get<std::string>().substr(indexIdx), - nullptr, 0); -@@ -1421,6 +1501,10 @@ void PerformScan::run() + usedNames.insert(nameIt.value()); + auto usedIt = std::find(indexes.begin(), + indexes.end(), index); +@@ -1434,6 +1515,10 @@ void PerformScan::run() } } @@ -169,5 +170,5 @@ index 932b6f9..67b8f95 100644 { std::cerr << "Duplicates found, replacing " -- -2.17.1 +2.30.2 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 9d891c620..a7448a84b 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/configuration/entity-manager_%.bbappend @@ -1,11 +1,10 @@ # this is here just to bump faster than upstream # SRC_URI = "git://github.com/openbmc/entity-manager.git" -SRCREV = "1694ef625a1075599e40faa695a40d61ccd91095" +SRCREV = "cda147301b0fa7eac99eee3a7565604dbd6f74dd" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" -SRC_URI += " file://0001-Improve-initialization-of-I2C-sensors.patch \ - file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ +SRC_URI += " file://0002-Entity-manager-Add-support-to-update-assetTag.patch \ file://0003-Add-logs-to-fwVersionIsSame.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch new file mode 100644 index 000000000..6af0a5702 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control/0001-allow-dbus-sensors-without-thresholds.patch @@ -0,0 +1,39 @@ +From 6b4071c12bdcc3bd20e72a7bd2eed19ff14b97af Mon Sep 17 00:00:00 2001 +From: Zhikui Ren <zhikui.ren@intel.com> +Date: Wed, 12 May 2021 19:11:08 -0700 +Subject: [PATCH] allow dbus sensors without thresholds + +catch dbus exceptions when query for thresholds interfaces. +log messages and continue. + +Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> +--- + dbus/dbusconfiguration.cpp | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp +index 55151d3..fd7a138 100644 +--- a/dbus/dbusconfiguration.cpp ++++ b/dbus/dbusconfiguration.cpp +@@ -286,13 +286,15 @@ void populatePidInfo( + { + interface = thresholds::criticalInterface; + } +- const std::string& path = sensorConfig.at(info.inputs.front()).readPath; + +- DbusHelper helper(sdbusplus::bus::new_system()); +- std::string service = helper.getService(interface, path); + double reading = 0; + try + { ++ const std::string& path = sensorConfig.at(info.inputs.front()).readPath; ++ ++ DbusHelper helper(sdbusplus::bus::new_system()); ++ std::string service = helper.getService(interface, path); ++ + helper.getProperty(service, path, interface, *thresholdProperty, + reading); + } +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend index ab1cd3742..cdefe246f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fans/phosphor-pid-control_%.bbappend @@ -5,6 +5,10 @@ SYSTEMD_SERVICE_${PN} = "phosphor-pid-control.service" EXTRA_OECONF = "--enable-configure-dbus=yes" SRC_URI = "git://github.com/openbmc/phosphor-pid-control.git" -SRCREV = "cb4c1a27574a7fe121a851ae7ba67aec254a1129" +SRCREV = "18d5bb18dcb4ebf7340b0b7a0b39daa887d530ce" + +SRC_URI += "\ + file://0001-allow-dbus-sensors-without-thresholds.patch \ + " FILES_${PN} = "${bindir}/swampd ${bindir}/setsensor" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch index cfaa077eb..0a47e3278 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0005-Modified-firmware-activation-to-launch-fwupd.sh-thro.patch @@ -1,4 +1,4 @@ -From df1281792f6886b41c99919e8197c2c2d369d0ca Mon Sep 17 00:00:00 2001 +From 6ce336adafd723319befc4ce918ba67a0ad3492c Mon Sep 17 00:00:00 2001 From: Jennifer Lee <jennifer1.lee@intel.com> Date: Mon, 10 Dec 2018 10:36:44 -0800 Subject: [PATCH] Modified firmware activation to launch fwupd.sh through @@ -12,19 +12,19 @@ Signed-off-by: Jennifer Lee <jennifer1.lee@intel.com> Signed-off-by: James Feist <james.feist@linux.intel.com> --- activation.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- - meson.build | 1 + + meson.build | 2 ++ meson_options.txt | 3 +++ static/flash.cpp | 42 ++++++++++++++++++++++++++++++++++++++++-- ubi/flash.cpp | 9 +++------ - 5 files changed, 91 insertions(+), 9 deletions(-) + 5 files changed, 92 insertions(+), 9 deletions(-) diff --git a/activation.cpp b/activation.cpp -index eb57587..901caf3 100644 +index c82e297..d690a39 100644 --- a/activation.cpp +++ b/activation.cpp -@@ -92,7 +92,50 @@ auto Activation::activation(Activations value) -> Activations - value == - softwareServer::Activation::Activations::ActivatingAsStandbySpare) +@@ -88,7 +88,50 @@ auto Activation::activation(Activations value) -> Activations + + if (value == softwareServer::Activation::Activations::Activating) { +#ifdef FWUPD_SCRIPT + if (!activationProgress) @@ -53,7 +53,7 @@ index eb57587..901caf3 100644 + } + else if (activationProgress->progress() == 100) + { -+ log<level::ERR>("[Jennifer] progress == 100..."); ++ log<level::ERR>("progress == 100..."); + if (!redundancyPriority) + { + redundancyPriority = @@ -73,7 +73,7 @@ index eb57587..901caf3 100644 #ifdef HOST_BIOS_UPGRADE auto purpose = parent.versions.find(versionId)->second->purpose(); if (purpose == VersionPurpose::Host) -@@ -115,7 +158,6 @@ auto Activation::activation(Activations value) -> Activations +@@ -111,7 +154,6 @@ auto Activation::activation(Activations value) -> Activations return softwareServer::Activation::activation(value); } #endif @@ -81,7 +81,7 @@ index eb57587..901caf3 100644 auto versionStr = parent.versions.find(versionId)->second->version(); if (!minimum_ship_level::verify(versionStr)) -@@ -179,6 +221,7 @@ auto Activation::activation(Activations value) -> Activations +@@ -175,6 +217,7 @@ auto Activation::activation(Activations value) -> Activations return softwareServer::Activation::activation( softwareServer::Activation::Activations::Active); #endif @@ -90,19 +90,20 @@ index eb57587..901caf3 100644 else { diff --git a/meson.build b/meson.build -index 0a7a6a6..5990168 100644 +index a6ebcc4..5c79009 100644 --- a/meson.build +++ b/meson.build -@@ -57,6 +57,7 @@ conf.set('WANT_SIGNATURE_VERIFY', \ - get_option('verify-signature').enabled() or \ +@@ -59,6 +59,8 @@ conf.set('WANT_SIGNATURE_VERIFY', \ get_option('verify-full-signature').enabled()) conf.set('WANT_SIGNATURE_FULL_VERIFY', get_option('verify-full-signature').enabled()) -+conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) ++conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) ++ # Configurable variables conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) + conf.set_quoted('HASH_FILE_NAME', get_option('hash-file-name')) diff --git a/meson_options.txt b/meson_options.txt -index 355773c..f0c8730 100644 +index 0877798..da257b7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -25,6 +25,9 @@ option('verify-signature', type: 'feature', diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch index 49bdc138f..e1a7f1746 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0007-PFR-images-support.patch @@ -1,4 +1,4 @@ -From 030f918b90ea45104bccf68082c2d634c6694238 Mon Sep 17 00:00:00 2001 +From 51fd06346ff492d5d4862886cb34e024d05edb45 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy <vikram.bodireddy@intel.com> Date: Tue, 13 Aug 2019 22:43:12 +0530 Subject: [PATCH] PFR images support in phosphor-software-manager @@ -12,34 +12,20 @@ tested PFR image uploads and updates Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> --- - activation.cpp | 2 +- item_updater.cpp | 7 +- - meson.build | 7 +- + meson.build | 8 +- meson_options.txt | 3 + - pfr_image_manager.cpp | 217 ++++++++++++++++++++++++++++++++++++++++++ - pfr_image_manager.hpp | 75 +++++++++++++++ - 6 files changed, 306 insertions(+), 5 deletions(-) + pfr_image_manager.cpp | 218 ++++++++++++++++++++++++++++++++++++++++++ + pfr_image_manager.hpp | 76 +++++++++++++++ + 5 files changed, 308 insertions(+), 4 deletions(-) create mode 100644 pfr_image_manager.cpp create mode 100644 pfr_image_manager.hpp -diff --git a/activation.cpp b/activation.cpp -index bad17b8..3363230 100644 ---- a/activation.cpp -+++ b/activation.cpp -@@ -119,7 +119,7 @@ auto Activation::activation(Activations value) -> Activations - } - else if (activationProgress->progress() == 100) - { -- log<level::ERR>("[Jennifer] progress == 100..."); -+ log<level::INFO>("progress == 100..."); - if (!redundancyPriority) - { - redundancyPriority = diff --git a/item_updater.cpp b/item_updater.cpp -index df8595c..694975f 100644 +index 81fc01f..60e7d23 100644 --- a/item_updater.cpp +++ b/item_updater.cpp -@@ -64,10 +64,10 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) +@@ -65,10 +65,10 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg) auto value = SVersion::convertVersionPurposeFromString( std::get<std::string>(property.second)); if (value == VersionPurpose::BMC || @@ -52,7 +38,7 @@ index df8595c..694975f 100644 { purpose = value; } -@@ -399,6 +399,7 @@ void ItemUpdater::deleteAll() +@@ -414,6 +414,7 @@ void ItemUpdater::deleteAll() ItemUpdater::ActivationStatus ItemUpdater::validateSquashFSImage(const std::string& filePath) { @@ -60,7 +46,7 @@ index df8595c..694975f 100644 bool valid = true; // Record the images which are being updated -@@ -416,7 +417,7 @@ ItemUpdater::ActivationStatus +@@ -431,7 +432,7 @@ ItemUpdater::ActivationStatus return ItemUpdater::ActivationStatus::invalid; } } @@ -69,37 +55,27 @@ index df8595c..694975f 100644 return ItemUpdater::ActivationStatus::ready; } -@@ -690,8 +691,8 @@ void ItemUpdater::freeSpace(Activation& caller) - // Failed activations don't have priority, assign them a large value - // for sorting purposes. - auto priority = 999; -- if ((iter.second.get()->activation() == -- server::Activation::Activations::Active)&& -+ if ((iter.second.get()->activation() == -+ server::Activation::Activations::Active) && - iter.second->redundancyPriority.get()) - { - priority = iter.second->redundancyPriority.get()->priority(); diff --git a/meson.build b/meson.build -index 08d6f71..c61d59f 100644 +index 5c79009..e33998d 100644 --- a/meson.build +++ b/meson.build -@@ -55,6 +55,7 @@ conf.set('MMC_LAYOUT', get_option('bmc-layout').contains('mmc')) - conf.set('HOST_BIOS_UPGRADE', get_option('host-bios-upgrade').enabled()) - conf.set('WANT_SIGNATURE_VERIFY', get_option('verify-signature').enabled()) +@@ -60,6 +60,7 @@ conf.set('WANT_SIGNATURE_VERIFY', \ + conf.set('WANT_SIGNATURE_FULL_VERIFY', get_option('verify-full-signature').enabled()) + conf.set('FWUPD_SCRIPT', get_option('fwupd-script').enabled()) +conf.set('PFR_UPDATE', get_option('pfr-update').enabled()) - + # Configurable variables conf.set('ACTIVE_BMC_MAX_ALLOWED', get_option('active-bmc-max-allowed')) -@@ -195,12 +196,16 @@ executable( +@@ -205,12 +206,17 @@ executable( install: true ) - + +image_manager_source = files('image_manager.cpp') +if get_option('pfr-update').enabled() + image_manager_source = files('pfr_image_manager.cpp') +endif ++ executable( 'phosphor-version-software-manager', image_error_cpp, @@ -111,22 +87,22 @@ index 08d6f71..c61d59f 100644 'watch.cpp', dependencies: [deps, ssl], diff --git a/meson_options.txt b/meson_options.txt -index 4f7e62a..1593502 100644 +index da257b7..2204e04 100644 --- a/meson_options.txt +++ b/meson_options.txt -@@ -25,6 +25,9 @@ option('verify-signature', type: 'feature', +@@ -28,6 +28,9 @@ option('verify-full-signature', type: 'feature', option('fwupd-script', type: 'feature', description: 'Enable fwupd script support.') - + +option('pfr-update', type: 'feature', -+ description: 'Enable fwupd script support.') ++ description: 'Enable PFR image support.') + # Variables option( 'active-bmc-max-allowed', type: 'integer', diff --git a/pfr_image_manager.cpp b/pfr_image_manager.cpp new file mode 100644 -index 0000000..242a6ca +index 0000000..fec1e94 --- /dev/null +++ b/pfr_image_manager.cpp @@ -0,0 +1,218 @@ @@ -350,7 +326,7 @@ index 0000000..242a6ca +} // namespace phosphor diff --git a/pfr_image_manager.hpp b/pfr_image_manager.hpp new file mode 100644 -index 0000000..c6ee6a4 +index 0000000..b9a5822 --- /dev/null +++ b/pfr_image_manager.hpp @@ -0,0 +1,76 @@ diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch deleted file mode 100644 index 156e6fe7c..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager/0011-Fix-for-RedudancyPriority-in-item_updater.patch +++ /dev/null @@ -1,36 +0,0 @@ -From f6022e25d0b47af502522913773e589fcdd1568e Mon Sep 17 00:00:00 2001 -From: Vikram Bodireddy <vikram.bodireddy@intel.com> -Date: Sun, 5 Jul 2020 00:54:57 +0530 -Subject: [PATCH] Fix for RedudancyPriority in item_updater - -This fixes accessing RedudancyPriority property for the -activated image in item_updater. The downloaded image object -is not actually associated with RedudancyPriority before and -after activation. There exists no RedundancyPriority property -for downloaded image, accessing it causing a crash in -item_updater. - -Tested: Tested for coredumps during Seamless firmware update. - -Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> - ---- - item_updater.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/item_updater.cpp b/item_updater.cpp -index c3a846d..b299b4d 100644 ---- a/item_updater.cpp -+++ b/item_updater.cpp -@@ -690,8 +690,9 @@ void ItemUpdater::freeSpace(Activation& caller) - // Failed activations don't have priority, assign them a large value - // for sorting purposes. - auto priority = 999; -- if (iter.second.get()->activation() == -- server::Activation::Activations::Active) -+ if ((iter.second.get()->activation() == -+ server::Activation::Activations::Active)&& -+ iter.second->redundancyPriority.get()) - { - priority = iter.second->redundancyPriority.get()->priority(); - } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend index 63e0aff25..decea878f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/flash/phosphor-software-manager_%.bbappend @@ -13,7 +13,6 @@ SRC_URI += " \ file://0007-Adding-StandBySpare-for-firmware-activation.patch \ file://0008-item_updater-update-the-bmc_active-objectPath.patch \ file://0009-Add-ApplyOptions-D-bus-property-under-Software.patch \ - file://0011-Fix-for-RedudancyPriority-in-item_updater.patch \ file://0013-remove-image-file-on-pre-script-failures.patch \ " diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch index 193461baf..a76990262 100755 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch @@ -1,4 +1,4 @@ -From 10cb7cb14974725a29b3ead4c543ca5e58234c07 Mon Sep 17 00:00:00 2001 +From d5f2e8b00bc5f8a727a1ef678941c4993c3ea7a6 Mon Sep 17 00:00:00 2001 From: Vikram Bodireddy <vikram.bodireddy@intel.com> Date: Wed, 18 Nov 2020 17:14:41 +0530 Subject: [PATCH] Firmware update configuration changes @@ -39,23 +39,21 @@ Tested: - Successfully ran redfish validater with no new errors. -Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> - -%% original patch: 0001-Firmware-update-configuration-changes.patch - Change-Id: I44e1743fd76aa37c7b8affa49a3e05f808187037 +Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com> Signed-off-by: Helen Huang <he.huang@intel.com> +Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> --- - redfish-core/lib/update_service.hpp | 339 ++++++++++++++++-- + redfish-core/lib/update_service.hpp | 338 ++++++++++++++++-- static/redfish/v1/$metadata/index.xml | 3 + .../JsonSchemas/OemUpdateService/index.json | 69 ++++ .../redfish/v1/schema/OemUpdateService_v1.xml | 40 +++ - 4 files changed, 421 insertions(+), 30 deletions(-) + 4 files changed, 421 insertions(+), 29 deletions(-) create mode 100644 static/redfish/v1/JsonSchemas/OemUpdateService/index.json create mode 100644 static/redfish/v1/schema/OemUpdateService_v1.xml diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp -index 6d44171..8eda265 100644 +index ca1234f..0a9f81a 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -32,6 +32,17 @@ static std::unique_ptr<sdbusplus::bus::match::match> fwUpdateErrorMatcher; @@ -76,7 +74,7 @@ index 6d44171..8eda265 100644 static void cleanUp() { -@@ -40,27 +51,119 @@ static void cleanUp() +@@ -40,28 +51,120 @@ static void cleanUp() fwUpdateErrorMatcher = nullptr; } static void activateImage(const std::string& objPath, @@ -201,12 +199,13 @@ index 6d44171..8eda265 100644 // Note that asyncResp can be either a valid pointer or nullptr. If nullptr // then no asyncResp updates will occur - static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp, -+ const std::vector<std::string> imgUriTargets, - sdbusplus::message::message& m, - const crow::Request& req) + static void + softwareInterfaceAdded(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const std::vector<std::string> imgUriTargets, + sdbusplus::message::message& m, + const crow::Request& req) { -@@ -73,22 +176,24 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp, +@@ -74,22 +177,24 @@ static void m.read(objPath, interfacesProperties); @@ -235,7 +234,7 @@ index 6d44171..8eda265 100644 BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); if (asyncResp) -@@ -115,7 +220,7 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp, +@@ -116,7 +221,7 @@ static void // is added fwAvailableTimer = nullptr; @@ -244,7 +243,7 @@ index 6d44171..8eda265 100644 if (asyncResp) { std::shared_ptr<task::TaskData> task = -@@ -247,8 +352,7 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp, +@@ -248,8 +353,7 @@ static void "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str, @@ -254,17 +253,16 @@ index 6d44171..8eda265 100644 } } } -@@ -257,7 +361,8 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp, - // then no asyncResp updates will occur +@@ -259,7 +363,7 @@ static void static void monitorForSoftwareAvailable( - const std::shared_ptr<AsyncResp>& asyncResp, const crow::Request& req, -- const std::string& url, int timeoutTimeSeconds = 10) -+ const std::string& url, const std::vector<std::string>& imgUriTargets, -+ int timeoutTimeSeconds = 10) + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const crow::Request& req, const std::string& url, +- int timeoutTimeSeconds = 10) ++ const std::vector<std::string>& imgUriTargets, int timeoutTimeSeconds = 10) { // Only allow one FW update at a time if (fwUpdateInProgress != false) -@@ -297,9 +402,10 @@ static void monitorForSoftwareAvailable( +@@ -299,9 +403,10 @@ static void monitorForSoftwareAvailable( } }); @@ -277,7 +275,7 @@ index 6d44171..8eda265 100644 }; fwUpdateInProgress = true; -@@ -475,12 +581,15 @@ class UpdateServiceActionsSimpleUpdate : public Node +@@ -477,12 +582,15 @@ class UpdateServiceActionsSimpleUpdate : public Node std::string fwFile = imageURI.substr(separator + 1); BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile; @@ -294,7 +292,7 @@ index 6d44171..8eda265 100644 // TFTP can take up to 10 minutes depending on image size and // connection speed. Return to caller as soon as the TFTP operation -@@ -514,7 +623,8 @@ class UpdateServiceActionsSimpleUpdate : public Node +@@ -516,7 +624,8 @@ class UpdateServiceActionsSimpleUpdate : public Node class UpdateService : public Node { public: @@ -304,37 +302,38 @@ index 6d44171..8eda265 100644 { entityPrivileges = { {boost::beast::http::verb::get, {{"Login"}}}, -@@ -526,6 +636,8 @@ class UpdateService : public Node +@@ -528,6 +637,8 @@ class UpdateService : public Node } private: + std::vector<std::string> httpPushUriTargets; + bool httpPushUriTargetBusy; - void doGet(crow::Response& res, const crow::Request&, - const std::vector<std::string>&) override + void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const crow::Request&, const std::vector<std::string>&) override { -@@ -536,6 +648,8 @@ class UpdateService : public Node - res.jsonValue["Description"] = "Service for Software Update"; - res.jsonValue["Name"] = "Update Service"; - res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService"; -+ res.jsonValue["HttpPushUriTargets"] = httpPushUriTargets; -+ res.jsonValue["HttpPushUriTargetsBusy"] = httpPushUriTargetBusy; +@@ -538,6 +649,9 @@ class UpdateService : public Node + asyncResp->res.jsonValue["Description"] = "Service for Software Update"; + asyncResp->res.jsonValue["Name"] = "Update Service"; + asyncResp->res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService"; ++ asyncResp->res.jsonValue["HttpPushUriTargets"] = httpPushUriTargets; ++ asyncResp->res.jsonValue["HttpPushUriTargetsBusy"] = ++ httpPushUriTargetBusy; // UpdateService cannot be disabled - res.jsonValue["ServiceEnabled"] = true; - res.jsonValue["FirmwareInventory"] = { -@@ -585,6 +699,31 @@ class UpdateService : public Node + asyncResp->res.jsonValue["ServiceEnabled"] = true; + asyncResp->res.jsonValue["FirmwareInventory"] = { +@@ -587,6 +701,32 @@ class UpdateService : public Node "/xyz/openbmc_project/software/apply_time", "org.freedesktop.DBus.Properties", "Get", "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime"); + + // Get the ApplyOptions value + crow::connections::systemBus->async_method_call( -+ [aResp](const boost::system::error_code ec, -+ const std::variant<bool> applyOption) { ++ [asyncResp](const boost::system::error_code ec, ++ const std::variant<bool> applyOption) { + if (ec) + { + BMCWEB_LOG_DEBUG << "DBUS response error " << ec; -+ messages::internalError(aResp->res); ++ messages::internalError(asyncResp->res); + return; + } + @@ -342,10 +341,11 @@ index 6d44171..8eda265 100644 + + if (b) + { -+ aResp->res.jsonValue["Oem"]["ApplyOptions"]["@odata.type"] = ++ asyncResp->res ++ .jsonValue["Oem"]["ApplyOptions"]["@odata.type"] = + "#OemUpdateService.ApplyOptions"; -+ aResp->res.jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] = -+ *b; ++ asyncResp->res ++ .jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] = *b; + } + }, + "xyz.openbmc_project.Software.BMC.Updater", @@ -353,21 +353,20 @@ index 6d44171..8eda265 100644 + "Get", "xyz.openbmc_project.Software.ApplyOptions", "ClearConfig"); } - void doPatch(crow::Response& res, const crow::Request& req, -@@ -595,12 +734,61 @@ class UpdateService : public Node - std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); + void doPatch(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, +@@ -596,12 +736,61 @@ class UpdateService : public Node + BMCWEB_LOG_DEBUG << "doPatch..."; std::optional<nlohmann::json> pushUriOptions; -- if (!json_util::readJson(req, res, "HttpPushUriOptions", -- pushUriOptions)) + std::optional<std::vector<std::string>> imgTargets; + std::optional<bool> imgTargetBusy; + std::optional<nlohmann::json> oemProps; + -+ if (!json_util::readJson(req, res, "HttpPushUriOptions", pushUriOptions, -+ "HttpPushUriTargets", imgTargets, -+ "HttpPushUriTargetsBusy", imgTargetBusy, "Oem", -+ oemProps)) + if (!json_util::readJson(req, asyncResp->res, "HttpPushUriOptions", +- pushUriOptions)) ++ pushUriOptions, "HttpPushUriTargets", ++ imgTargets, "HttpPushUriTargetsBusy", ++ imgTargetBusy, "Oem", oemProps)) { + BMCWEB_LOG_DEBUG << "UpdateService doPatch: Invalid request body"; return; @@ -377,7 +376,7 @@ index 6d44171..8eda265 100644 + { + std::optional<nlohmann::json> applyOptions; + -+ if (!json_util::readJson(*oemProps, res, "ApplyOptions", ++ if (!json_util::readJson(*oemProps, asyncResp->res, "ApplyOptions", + applyOptions)) + { + return; @@ -386,8 +385,8 @@ index 6d44171..8eda265 100644 + if (applyOptions) + { + std::optional<bool> clearConfig; -+ if (!json_util::readJson(*applyOptions, res, "ClearConfig", -+ clearConfig)) ++ if (!json_util::readJson(*applyOptions, asyncResp->res, ++ "ClearConfig", clearConfig)) + { + return; + } @@ -418,7 +417,7 @@ index 6d44171..8eda265 100644 if (pushUriOptions) { std::optional<nlohmann::json> pushUriApplyTime; -@@ -665,6 +853,98 @@ class UpdateService : public Node +@@ -666,6 +855,98 @@ class UpdateService : public Node } } } @@ -516,9 +515,9 @@ index 6d44171..8eda265 100644 + } } - void doPost(crow::Response& res, const crow::Request& req, -@@ -675,8 +955,8 @@ class UpdateService : public Node - std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res); + void doPost(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, +@@ -675,8 +956,8 @@ class UpdateService : public Node + BMCWEB_LOG_DEBUG << "doPost..."; // Setup callback for when new software detected - monitorForSoftwareAvailable(asyncResp, req, @@ -528,7 +527,7 @@ index 6d44171..8eda265 100644 std::string filepath( "/tmp/images/" + -@@ -761,7 +1041,7 @@ class SoftwareInventoryCollection : public Node +@@ -759,7 +1040,7 @@ class SoftwareInventoryCollection : public Node "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/xyz/openbmc_project/software", static_cast<int32_t>(0), @@ -537,7 +536,7 @@ index 6d44171..8eda265 100644 } }; -@@ -943,7 +1223,7 @@ class SoftwareInventory : public Node +@@ -940,7 +1221,7 @@ class SoftwareInventory : public Node }, obj.second[0].first, obj.first, "org.freedesktop.DBus.Properties", "GetAll", @@ -546,7 +545,7 @@ index 6d44171..8eda265 100644 } if (!found) { -@@ -964,8 +1244,7 @@ class SoftwareInventory : public Node +@@ -961,8 +1242,7 @@ class SoftwareInventory : public Node "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", @@ -557,19 +556,19 @@ index 6d44171..8eda265 100644 }; diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml -index 514f3dd..c068d4f 100644 +index 9d9fd1f..6cbc0d1 100644 --- a/static/redfish/v1/$metadata/index.xml +++ b/static/redfish/v1/$metadata/index.xml -@@ -2142,6 +2142,9 @@ - <edmx:Reference Uri="/redfish/v1/schema/OemManager_v1.xml"> - <edmx:Include Namespace="OemManager"/> +@@ -2145,6 +2145,9 @@ + <edmx:Reference Uri="/redfish/v1/schema/OemComputerSystem_v1.xml"> + <edmx:Include Namespace="OemComputerSystem"/> </edmx:Reference> + <edmx:Reference Uri="/redfish/v1/schema/OemUpdateService_v1.xml"> + <edmx:Include Namespace="OemUpdateService"/> + </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/OemCrashdump_v1.xml"> - <edmx:Include Namespace="OemCrashdump.v1_0_0"/> - </edmx:Reference> + <edmx:Reference Uri="/redfish/v1/schema/OemVirtualMedia_v1.xml"> + <edmx:Include Namespace="OemVirtualMedia"/> + <edmx:Include Namespace="OemVirtualMedia.v1_0_0"/> diff --git a/static/redfish/v1/JsonSchemas/OemUpdateService/index.json b/static/redfish/v1/JsonSchemas/OemUpdateService/index.json new file mode 100644 index 0000000..74e39cd diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch deleted file mode 100644 index 54f00aa39..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch +++ /dev/null @@ -1,547 +0,0 @@ -From d340953bc925ff8535c5a8fac54db24b243ba8ad Mon Sep 17 00:00:00 2001 -From: AppaRao Puli <apparao.puli@linux.intel.com> -Date: Mon, 19 Oct 2020 13:21:42 +0530 -Subject: [PATCH] EventService: https client support - -Add https client support for push style -eventing. Using this BMC can push the event -logs/telemetry data to event listener over -secure http channel. - -Tested: - - Created subscription with https destination - url. Using SubmitTestEvent action set the - event and can see event on event listener. - - Validator passed. - -Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a -Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> -Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> ---- - http/http_client.hpp | 370 +++++++++++++----- - .../include/event_service_manager.hpp | 2 +- - 2 files changed, 267 insertions(+), 105 deletions(-) - -diff --git a/http/http_client.hpp b/http/http_client.hpp -index 5c7b13f..d782dee 100644 ---- a/http/http_client.hpp -+++ b/http/http_client.hpp -@@ -31,12 +31,17 @@ namespace crow - { - - static constexpr uint8_t maxRequestQueueSize = 50; -+static constexpr unsigned int httpReadBodyLimit = 1024; - - enum class ConnState - { - initialized, -+ resolveInProgress, -+ resolveFailed, -+ resolved, - connectInProgress, - connectFailed, -+ sslHandshakeInProgress, - connected, - sendInProgress, - sendFailed, -@@ -50,53 +55,124 @@ enum class ConnState - class HttpClient : public std::enable_shared_from_this<HttpClient> - { - private: -+ boost::asio::ip::tcp::resolver resolver; -+ boost::asio::ssl::context ctx{boost::asio::ssl::context::tlsv12_client}; - boost::beast::tcp_stream conn; -+ std::optional<boost::beast::ssl_stream<boost::beast::tcp_stream&>> sslConn; - boost::asio::steady_timer timer; -- boost::beast::flat_buffer buffer; -+ boost::beast::flat_static_buffer<httpReadBodyLimit> buffer; -+ std::optional< -+ boost::beast::http::response_parser<boost::beast::http::string_body>> -+ parser; - boost::beast::http::request<boost::beast::http::string_body> req; -- boost::beast::http::response<boost::beast::http::string_body> res; - boost::asio::ip::tcp::resolver::results_type endpoint; -- std::vector<std::pair<std::string, std::string>> headers; -+ boost::beast::http::fields fields; - std::queue<std::string> requestDataQueue; -- ConnState state; - std::string subId; - std::string host; - std::string port; - std::string uri; -+ bool useSsl; - uint32_t retryCount; - uint32_t maxRetryAttempts; - uint32_t retryIntervalSecs; - std::string retryPolicyAction; - bool runningTimer; -+ ConnState state; -+ -+ void doResolve() -+ { -+ BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port; -+ if (state == ConnState::resolveInProgress) -+ { -+ return; -+ } -+ state = ConnState::resolveInProgress; -+ // TODO: Use async_resolver. boost asio example -+ // code as is crashing with async_resolve(). -+ try -+ { -+ endpoint = resolver.resolve(host, port); -+ } -+ catch (const std::exception& e) -+ { -+ BMCWEB_LOG_ERROR << "Failed to resolve hostname: " << host << " - " -+ << e.what(); -+ state = ConnState::resolveFailed; -+ checkQueue(); -+ return; -+ } -+ state = ConnState::resolved; -+ checkQueue(); -+ } - - void doConnect() - { -- if (state == ConnState::connectInProgress) -+ if (useSsl) -+ { -+ sslConn.emplace(conn, ctx); -+ } -+ -+ if ((state == ConnState::connectInProgress) || -+ (state == ConnState::sslHandshakeInProgress)) - { - return; - } - state = ConnState::connectInProgress; - - BMCWEB_LOG_DEBUG << "Trying to connect to: " << host << ":" << port; -- // Set a timeout on the operation -+ -+ auto respHandler = -+ [self(shared_from_this())](const boost::beast::error_code ec, -+ const boost::asio::ip::tcp::resolver:: -+ results_type::endpoint_type& ep) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "Connect " << ep -+ << " failed: " << ec.message(); -+ self->state = ConnState::connectFailed; -+ self->checkQueue(); -+ return; -+ } -+ BMCWEB_LOG_DEBUG << "Connected to: " << ep; -+ if (self->sslConn) -+ { -+ self->performHandshake(); -+ } -+ else -+ { -+ self->state = ConnState::connected; -+ self->checkQueue(); -+ } -+ }; -+ - conn.expires_after(std::chrono::seconds(30)); -- conn.async_connect(endpoint, [self(shared_from_this())]( -- const boost::beast::error_code& ec, -- const boost::asio::ip::tcp::resolver:: -- results_type::endpoint_type& ep) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "Connect " << ep -- << " failed: " << ec.message(); -- self->state = ConnState::connectFailed; -- self->checkQueue(); -- return; -- } -- self->state = ConnState::connected; -- BMCWEB_LOG_DEBUG << "Connected to: " << ep; -+ conn.async_connect(endpoint, std::move(respHandler)); -+ } -+ -+ void performHandshake() -+ { -+ if (state == ConnState::sslHandshakeInProgress) -+ { -+ return; -+ } -+ state = ConnState::sslHandshakeInProgress; -+ -+ sslConn->async_handshake( -+ boost::asio::ssl::stream_base::client, -+ [self(shared_from_this())](const boost::beast::error_code ec) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "SSL handshake failed: " -+ << ec.message(); -+ self->doCloseAndCheckQueue(ConnState::connectFailed); -+ return; -+ } -+ self->state = ConnState::connected; -+ BMCWEB_LOG_DEBUG << "SSL Handshake successfull"; - -- self->checkQueue(); -- }); -+ self->checkQueue(); -+ }); - } - - void sendMessage(const std::string& data) -@@ -107,100 +183,170 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - } - state = ConnState::sendInProgress; - -- BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port; -+ BMCWEB_LOG_DEBUG << host << ":" << port; - -- req.version(static_cast<int>(11)); // HTTP 1.1 -- req.target(uri); -- req.method(boost::beast::http::verb::post); -- -- // Set headers -- for (const auto& [key, value] : headers) -+ req = {}; -+ for (const auto& field : fields) - { -- req.set(key, value); -+ req.set(field.name_string(), field.value()); - } - req.set(boost::beast::http::field::host, host); -+ req.set(boost::beast::http::field::content_type, "text/plain"); -+ -+ req.version(static_cast<int>(11)); // HTTP 1.1 -+ req.target(uri); -+ req.method(boost::beast::http::verb::post); - req.keep_alive(true); - - req.body() = data; - req.prepare_payload(); - -- // Set a timeout on the operation -- conn.expires_after(std::chrono::seconds(30)); -+ auto respHandler = [self(shared_from_this())]( -+ const boost::beast::error_code ec, -+ const std::size_t& bytesTransferred) { -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message(); -+ self->doCloseAndCheckQueue(ConnState::sendFailed); -+ return; -+ } -+ BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -+ << bytesTransferred; -+ boost::ignore_unused(bytesTransferred); - -- // Send the HTTP request to the remote host -- boost::beast::http::async_write( -- conn, req, -- [self(shared_from_this())](const boost::beast::error_code& ec, -- const std::size_t& bytesTransferred) { -- if (ec) -- { -- BMCWEB_LOG_ERROR << "sendMessage() failed: " -- << ec.message(); -- self->state = ConnState::sendFailed; -- self->checkQueue(); -- return; -- } -- BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -- << bytesTransferred; -- boost::ignore_unused(bytesTransferred); -+ self->recvMessage(); -+ }; - -- self->recvMessage(); -- }); -+ conn.expires_after(std::chrono::seconds(30)); -+ if (sslConn) -+ { -+ boost::beast::http::async_write(*sslConn, req, -+ std::move(respHandler)); -+ } -+ else -+ { -+ boost::beast::http::async_write(conn, req, std::move(respHandler)); -+ } - } - - void recvMessage() - { -- // Receive the HTTP response -- boost::beast::http::async_read( -- conn, buffer, res, -- [self(shared_from_this())](const boost::beast::error_code& ec, -- const std::size_t& bytesTransferred) { -+ auto respHandler = [self(shared_from_this())]( -+ const boost::beast::error_code ec, -+ const std::size_t& bytesTransferred) { -+ if (ec && ec != boost::beast::http::error::partial_message) -+ { -+ BMCWEB_LOG_ERROR << "recvMessage() failed: " << ec.message(); -+ self->doCloseAndCheckQueue(ConnState::recvFailed); -+ return; -+ } -+ BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " -+ << bytesTransferred; -+ boost::ignore_unused(bytesTransferred); -+ -+ // TODO: check for return status code and perform -+ // retry if fails(Ex: 40x). Take action depending on -+ // retry policy. -+ BMCWEB_LOG_DEBUG << "recvMessage() data: " -+ << self->parser->get().body(); -+ -+ // Send is successful, Lets remove data from queue -+ // check for next request data in queue. -+ self->requestDataQueue.pop(); -+ -+ // Transfer ownership of the response -+ self->parser->release(); -+ -+ // TODO: Implement the keep-alive connections. -+ // Most of the web servers close connection abruptly -+ // and might be reason due to which its observed that -+ // stream_truncated(Next read) or partial_message -+ // errors. So for now, closing connection and re-open -+ // for all cases. -+ self->doCloseAndCheckQueue(ConnState::closed); -+ }; -+ -+ parser.emplace(std::piecewise_construct, std::make_tuple()); -+ parser->body_limit(httpReadBodyLimit); -+ // Since these are all push style eventing, we are not -+ // bothered about response parsing. -+ parser->skip(true); -+ buffer.consume(buffer.size()); -+ -+ conn.expires_after(std::chrono::seconds(30)); -+ if (sslConn) -+ { -+ boost::beast::http::async_read(*sslConn, buffer, *parser, -+ std::move(respHandler)); -+ } -+ else -+ { -+ boost::beast::http::async_read(conn, buffer, *parser, -+ std::move(respHandler)); -+ } -+ } -+ -+ void doCloseAndCheckQueue(const ConnState setState = ConnState::closed) -+ { -+ if (sslConn) -+ { -+ conn.expires_after(std::chrono::seconds(30)); -+ sslConn->async_shutdown([self = shared_from_this(), -+ setState{std::move(setState)}]( -+ const boost::system::error_code ec) { - if (ec) - { -- BMCWEB_LOG_ERROR << "recvMessage() failed: " -- << ec.message(); -- self->state = ConnState::recvFailed; -- self->checkQueue(); -- return; -+ // Many https server closes connection abruptly -+ // i.e witnout close_notify. More details are at -+ // https://github.com/boostorg/beast/issues/824 -+ if (ec == boost::asio::ssl::error::stream_truncated) -+ { -+ BMCWEB_LOG_ERROR -+ << "doCloseAndCheckQueue(): Connection " -+ "closed by server. "; -+ } -+ else -+ { -+ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: " -+ << ec.message(); -+ } - } -- BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: " -- << bytesTransferred; -- boost::ignore_unused(bytesTransferred); -- -- // Discard received data. We are not interested. -- BMCWEB_LOG_DEBUG << "recvMessage() data: " << self->res; -- -- // Send is successful, Lets remove data from queue -- // check for next request data in queue. -- self->requestDataQueue.pop(); -- self->state = ConnState::idle; -+ else -+ { -+ BMCWEB_LOG_DEBUG << "Connection closed gracefully..."; -+ } -+ self->conn.cancel(); -+ self->state = setState; - self->checkQueue(); - }); -- } -- -- void doClose() -- { -- boost::beast::error_code ec; -- conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); -- -- state = ConnState::closed; -- // not_connected happens sometimes so don't bother reporting it. -- if (ec && ec != boost::beast::errc::not_connected) -+ } -+ else - { -- BMCWEB_LOG_ERROR << "shutdown failed: " << ec.message(); -- return; -+ boost::beast::error_code ec; -+ conn.expires_after(std::chrono::seconds(30)); -+ conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, -+ ec); -+ if (ec) -+ { -+ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: " -+ << ec.message(); -+ } -+ else -+ { -+ BMCWEB_LOG_DEBUG << "Connection closed gracefully..."; -+ } -+ -+ conn.close(); -+ state = setState; -+ checkQueue(); - } -- BMCWEB_LOG_DEBUG << "Connection closed gracefully"; -+ return; - } - - void checkQueue(const bool newRecord = false) - { - if (requestDataQueue.empty()) - { -- // TODO: Having issue in keeping connection alive. So lets close if -- // nothing to be transferred. -- doClose(); -- - BMCWEB_LOG_DEBUG << "requestDataQueue is empty\n"; - return; - } -@@ -232,6 +378,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - } - - if ((state == ConnState::connectFailed) || -+ (state == ConnState::resolveFailed) || - (state == ConnState::sendFailed) || - (state == ConnState::recvFailed)) - { -@@ -256,14 +403,18 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - << " seconds. RetryCount = " << retryCount; - timer.expires_after(std::chrono::seconds(retryIntervalSecs)); - timer.async_wait( -- [self = shared_from_this()](const boost::system::error_code&) { -+ [self = shared_from_this()](boost::system::error_code) { - self->runningTimer = false; - self->connStateCheck(); - }); - return; - } -- // reset retry count. -- retryCount = 0; -+ -+ if (state == ConnState::idle) -+ { -+ // State idle means, previous attempt is successful. -+ retryCount = 0; -+ } - connStateCheck(); - - return; -@@ -273,15 +424,21 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - { - switch (state) - { -+ case ConnState::initialized: -+ case ConnState::resolveFailed: -+ case ConnState::connectFailed: -+ doResolve(); -+ break; - case ConnState::connectInProgress: -+ case ConnState::resolveInProgress: -+ case ConnState::sslHandshakeInProgress: - case ConnState::sendInProgress: - case ConnState::suspended: - case ConnState::terminated: - // do nothing - break; -- case ConnState::initialized: - case ConnState::closed: -- case ConnState::connectFailed: -+ case ConnState::resolved: - case ConnState::sendFailed: - case ConnState::recvFailed: - { -@@ -297,22 +454,22 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - sendMessage(data); - break; - } -+ default: -+ break; - } - } - - public: - explicit HttpClient(boost::asio::io_context& ioc, const std::string& id, - const std::string& destIP, const std::string& destPort, -- const std::string& destUri) : -- conn(ioc), -- timer(ioc), subId(id), host(destIP), port(destPort), uri(destUri), -- retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0), -- retryPolicyAction("TerminateAfterRetries"), runningTimer(false) -- { -- boost::asio::ip::tcp::resolver resolver(ioc); -- endpoint = resolver.resolve(host, port); -- state = ConnState::initialized; -- } -+ const std::string& destUri, -+ const bool inUseSsl = true) : -+ resolver(ioc), -+ conn(ioc), timer(ioc), subId(id), host(destIP), port(destPort), -+ uri(destUri), useSsl(inUseSsl), retryCount(0), maxRetryAttempts(5), -+ retryPolicyAction("TerminateAfterRetries"), runningTimer(false), -+ state(ConnState::initialized) -+ {} - - void sendData(const std::string& data) - { -@@ -337,7 +494,12 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> - void setHeaders( - const std::vector<std::pair<std::string, std::string>>& httpHeaders) - { -- headers = httpHeaders; -+ // Set headers -+ for (const auto& [key, value] : httpHeaders) -+ { -+ // TODO: Validate the header fileds before assign. -+ fields.set(key, value); -+ } - } - - void setRetryConfig(const uint32_t retryAttempts, -diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 54dafb4..f68ae1d 100644 ---- a/redfish-core/include/event_service_manager.hpp -+++ b/redfish-core/include/event_service_manager.hpp -@@ -387,7 +387,7 @@ class Subscription - { - conn = std::make_shared<crow::HttpClient>( - crow::connections::systemBus->get_io_context(), id, host, port, -- path); -+ path, (uriProto == "https" ? true : false)); - } - - Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) : --- -2.17.1 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch index a9c46f487..d962d3872 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch @@ -1,4 +1,4 @@ -From a76314cd29f5cbcf19142b7120c5bf83358910fd Mon Sep 17 00:00:00 2001 +From b5e4edfc26eec245427d3435de9acaa9363ae836 Mon Sep 17 00:00:00 2001 From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Date: Mon, 28 Dec 2020 18:55:57 +0000 Subject: [PATCH] managers: add attributes for Manager.CommandShell @@ -32,26 +32,36 @@ Response: Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> --- - redfish-core/lib/managers.hpp | 6 ++++++ - 1 file changed, 6 insertions(+) + redfish-core/lib/managers.hpp | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp -index 6347caf..c401ca9 100644 +index 67f8d99..dcbc347 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp -@@ -1767,6 +1767,12 @@ class Manager : public Node - res.jsonValue["SerialConsole"]["MaxConcurrentSessions"] = 15; - res.jsonValue["SerialConsole"]["ConnectTypesSupported"] = {"IPMI", - "SSH"}; +@@ -1830,6 +1830,13 @@ class Manager : public Node + asyncResp->res.jsonValue["SerialConsole"]["MaxConcurrentSessions"] = 15; + asyncResp->res.jsonValue["SerialConsole"]["ConnectTypesSupported"] = { + "IPMI", "SSH"}; ++ + // Fill in CommandShell info -+ res.jsonValue["CommandShell"]["ServiceEnabled"] = true; -+ res.jsonValue["CommandShell"]["MaxConcurrentSessions"] = 4; -+ res.jsonValue["CommandShell"]["ConnectTypesSupported"] = {"SSH", -+ "IPMI"}; ++ asyncResp->res.jsonValue["CommandShell"]["ServiceEnabled"] = true; ++ asyncResp->res.jsonValue["CommandShell"]["MaxConcurrentSessions"] = 4; ++ asyncResp->res.jsonValue["CommandShell"]["ConnectTypesSupported"] = { ++ "SSH", "IPMI"}; + #ifdef BMCWEB_ENABLE_KVM // Fill in GraphicalConsole info - res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true; + asyncResp->res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true; +@@ -2272,7 +2279,7 @@ class Manager : public Node + } + + std::string uuid; +-}; ++}; // namespace redfish + + class ManagerCollection : public Node + { -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch index 5ffc259c0..5ffc259c0 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch index b171a8b2c..b171a8b2c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch index bc023839f..bc023839f 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch new file mode 100644 index 000000000..d0cfd1c44 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch @@ -0,0 +1,81 @@ +From 7282ab7756cdb8c844bef9affd8a8e894828678c Mon Sep 17 00:00:00 2001 +From: Ayushi Smriti <smriti.ayushi@intel.com> +Date: Mon, 10 May 2021 12:32:30 +0530 +Subject: [PATCH] Add msg registry for subscription related actions + +For subscription event message log purpose, added message registry +entry for event service subscription related actions- add, update +and delete. + +Tested: + - Message registry entry appears in the log for the corresponding + subscription action. + +Signed-off-by: AppaRao Puli <apparao.puli@intel.com> +Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com> +--- + .../registries/openbmc_message_registry.hpp | 41 ++++++++++++++++++- + 1 file changed, 40 insertions(+), 1 deletion(-) + +diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp +index e12a138..2f981db 100644 +--- a/redfish-core/include/registries/openbmc_message_registry.hpp ++++ b/redfish-core/include/registries/openbmc_message_registry.hpp +@@ -29,7 +29,7 @@ const Header header = { + "0.2.0", + "OpenBMC", + }; +-constexpr std::array<MessageEntry, 190> registry = { ++constexpr std::array<MessageEntry, 193> registry = { + MessageEntry{ + "ADDDCCorrectable", + { +@@ -417,6 +417,45 @@ constexpr std::array<MessageEntry, 190> registry = { + {}, + "None.", + }}, ++ MessageEntry{"EventSubscriptionAdded", ++ { ++ "Indicates that an Event subscription with specific " ++ "id was added.", ++ "Event subscription with id %1 was added.", ++ "OK", ++ "OK", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, ++ MessageEntry{"EventSubscriptionRemoved", ++ { ++ "Indicates that an Event subscription with specific " ++ "id was removed.", ++ "Event subscription with id %1 was removed.", ++ "OK", ++ "OK", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, ++ MessageEntry{"EventSubscriptionUpdated", ++ { ++ "Indicates that an Event subscription with specific " ++ " id was updated.", ++ "Event subscription with id %1 was updated.", ++ "OK", ++ "OK", ++ 1, ++ { ++ "string", ++ }, ++ "None.", ++ }}, + MessageEntry{"FanInserted", + { + "Indicates that a system fan has been inserted.", +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch deleted file mode 100644 index f02e5e1a4..000000000 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 7cde56820505a4f750cc67caa0dc9300688f3fd9 Mon Sep 17 00:00:00 2001 -From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> -Date: Tue, 13 Apr 2021 15:16:43 +0200 -Subject: [PATCH] Fix comparison for proxy/legacy mode - -After sdbusplus made available string path wrapper VM code has been -updated to use it. This makes legacy mode unusable as appropriate -change introduced a problem with comparison of DBus object path, which -is now fixed. - -Tested: -After applying this fix, legacy mode has InsertMedia action enabled -again. - -Change-Id: I062994f23b77cb7ab9c4421f296a65a80b9ce896 -Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> ---- - redfish-core/lib/virtual_media.hpp | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 365290b..dda73d8 100644 ---- a/redfish-core/lib/virtual_media.hpp -+++ b/redfish-core/lib/virtual_media.hpp -@@ -274,10 +274,22 @@ static void getVmData(const std::shared_ptr<AsyncResp>& aResp, - continue; - } - -+ auto mode = item.first.parent_path(); -+ auto type = mode.parent_path(); -+ if (mode.filename().empty() || type.filename().empty()) -+ { -+ continue; -+ } -+ -+ if (type.filename() != "VirtualMedia") -+ { -+ continue; -+ } -+ - aResp->res.jsonValue = vmItemTemplate(name, resName); - - // Check if dbus path is Legacy type -- if (thispath.find("VirtualMedia/Legacy") != std::string::npos) -+ if (mode.filename() == "Legacy") - { - aResp->res.jsonValue["Actions"]["#VirtualMedia.InsertMedia"] - ["target"] = --- -2.26.2 - diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-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 b2627644b..9cf4653d6 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-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 c645c011bb3ea2a2aaf52560cb9fcc461d048cae Mon Sep 17 00:00:00 2001 +From 72c273ae74bb6add062b89f59ebeee4d4eb7e523 Mon Sep 17 00:00:00 2001 From: Kuiying Wang <kuiying.wang@intel.com> Date: Fri, 4 Sep 2020 19:24:25 +0800 Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable @@ -228,16 +228,16 @@ Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> --- redfish-core/include/redfish.hpp | 2 + .../include/registries/bios_registry.hpp | 31 ++ - redfish-core/lib/bios.hpp | 503 ++++++++++++++++++ + redfish-core/lib/bios.hpp | 501 ++++++++++++++++++ redfish-core/lib/message_registries.hpp | 9 +- - 4 files changed, 544 insertions(+), 1 deletion(-) + 4 files changed, 542 insertions(+), 1 deletion(-) 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 5d5eb7b..a8e5cf2 100644 +index db58d60..298ebb8 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp -@@ -157,6 +157,8 @@ class RedfishService +@@ -156,6 +156,8 @@ class RedfishService nodes.emplace_back(std::make_unique<SystemActionsReset>(app)); nodes.emplace_back(std::make_unique<SystemResetActionInfo>(app)); nodes.emplace_back(std::make_unique<BiosService>(app)); @@ -285,7 +285,7 @@ index 0000000..88ef782 +} // namespace redfish::message_registries::bios \ No newline at end of file diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 2c31077..5f8c91b 100644 +index 0917cc7..cb2b74d 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp @@ -3,8 +3,140 @@ @@ -429,7 +429,7 @@ index 2c31077..5f8c91b 100644 /** * BiosService class supports handle get method for bios. */ -@@ -35,6 +167,377 @@ class BiosService : public Node +@@ -33,6 +165,375 @@ class BiosService : public Node // Get the ActiveSoftwareImage and SoftwareImages fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, "", true); @@ -532,10 +532,9 @@ index 2c31077..5f8c91b 100644 + } + + private: -+ void doGet(crow::Response& res, const crow::Request&, -+ const std::vector<std::string>&) override ++ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const crow::Request&, const std::vector<std::string>&) override + { -+ auto asyncResp = std::make_shared<AsyncResp>(res); + asyncResp->res.jsonValue["@odata.id"] = + "/redfish/v1/Systems/system/Bios/Settings"; + asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios"; @@ -641,10 +640,9 @@ index 2c31077..5f8c91b 100644 + } + + private: -+ void doGet(crow::Response& res, const crow::Request&, -+ const std::vector<std::string>&) override ++ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const crow::Request&, const std::vector<std::string>&) override + { -+ auto asyncResp = std::make_shared<AsyncResp>(res); + asyncResp->res.jsonValue["@odata.id"] = + "/redfish/v1/Registries/BiosAttributeRegistry/" + "BiosAttributeRegistry"; @@ -808,7 +806,7 @@ index 2c31077..5f8c91b 100644 }; /** diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp -index 77fc10e..0caf01c 100644 +index 455bf70..7afbfc2 100644 --- a/redfish-core/lib/message_registries.hpp +++ b/redfish-core/lib/message_registries.hpp @@ -18,6 +18,7 @@ @@ -831,9 +829,9 @@ index 77fc10e..0caf01c 100644 {{"@odata.id", "/redfish/v1/Registries/ResourceEvent"}}, + {{"@odata.id", "/redfish/v1/Registries/BiosAttributeRegistry"}}, {{"@odata.id", "/redfish/v1/Registries/OpenBMC"}}}}}; - - res.end(); -@@ -118,6 +120,11 @@ class MessageRegistryFile : public Node + } + }; +@@ -116,6 +118,11 @@ class MessageRegistryFile : public Node header = &message_registries::resource_event::header; url = message_registries::resource_event::url; } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch index 6f3794478..21a21e8db 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch @@ -1,4 +1,4 @@ -From ad2b1c83bd9cb1bb6eb86bebd1867b0172e5a7a8 Mon Sep 17 00:00:00 2001 +From 9c498d683be59ce25dd0124ba7ec5e026c59bbbf Mon Sep 17 00:00:00 2001 From: Kuiying Wang <kuiying.wang@intel.com> Date: Wed, 23 Dec 2020 16:50:45 +0800 Subject: [PATCH] BaseBiosTable: Add support for PATCH operation @@ -26,11 +26,11 @@ backend and that updates the BaseBiosTable. Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> --- - redfish-core/lib/bios.hpp | 94 ++++++++++++++++++++++++++++++++++++++- - 1 file changed, 93 insertions(+), 1 deletion(-) + redfish-core/lib/bios.hpp | 93 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 92 insertions(+), 1 deletion(-) diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 5f8c91b..cf76fe0 100644 +index cb2b74d..860a643 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp @@ -96,6 +96,29 @@ static std::string mapAttrTypeToRedfish(const std::string_view typeDbus) @@ -63,7 +63,7 @@ index 5f8c91b..cf76fe0 100644 static std::string mapBoundTypeToRedfish(const std::string_view typeDbus) { std::string ret; -@@ -262,7 +285,9 @@ class BiosSettings : public Node +@@ -260,7 +283,9 @@ class BiosSettings : public Node BiosSettings(App& app) : Node(app, "/redfish/v1/Systems/system/Bios/Settings") { @@ -74,16 +74,15 @@ index 5f8c91b..cf76fe0 100644 } private: -@@ -359,6 +384,73 @@ class BiosSettings : public Node +@@ -356,6 +381,72 @@ class BiosSettings : public Node "/xyz/openbmc_project/bios_config/manager", std::array<const char*, 0>()); } + -+ void doPatch(crow::Response& res, const crow::Request& req, ++ void doPatch(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const crow::Request& req, + const std::vector<std::string>&) override + { -+ auto asyncResp = std::make_shared<AsyncResp>(res); -+ + nlohmann::json inpJson; + + if (!redfish::json_util::readJson(req, asyncResp->res, "data", inpJson)) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch index 7e4e2e8d8..5a24996a0 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch @@ -1,4 +1,4 @@ -From a78eecb032eefeb84da3ec042700a40f55ae8f10 Mon Sep 17 00:00:00 2001 +From 4e85ce8a5f34038c289504855d21ebfa3d6b94f0 Mon Sep 17 00:00:00 2001 From: Kuiying Wang <kuiying.wang@intel.com> Date: Wed, 23 Dec 2020 22:47:56 +0800 Subject: [PATCH] Add support to ResetBios action @@ -10,16 +10,15 @@ POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios Change-Id: I5e5fbdd70d4a3ce3b976cc2eb0a7d9a2a3adb124 Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> - --- - redfish-core/lib/bios.hpp | 16 ++++++++++------ - 1 file changed, 10 insertions(+), 6 deletions(-) + redfish-core/lib/bios.hpp | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index cf76fe0..7b6fc3d 100644 +index 860a643..1eb7bef 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp -@@ -643,7 +643,7 @@ class BiosReset : public Node +@@ -638,7 +638,7 @@ class BiosReset : public Node Node(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/") { entityPrivileges = { @@ -28,13 +27,13 @@ index cf76fe0..7b6fc3d 100644 } private: -@@ -655,19 +655,23 @@ class BiosReset : public Node - const std::vector<std::string>&) override +@@ -649,19 +649,24 @@ class BiosReset : public Node + void doPost(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const crow::Request&, const std::vector<std::string>&) override { - auto asyncResp = std::make_shared<AsyncResp>(res); -- + std::string resetFlag = + "xyz.openbmc_project.BIOSConfig.Manager.ResetFlag.FactoryDefaults"; + crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code ec) { if (ec) diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch index 976292197..e87995aca 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch @@ -1,4 +1,4 @@ -From ede8454491b554c2494a61f42993fa2e39b4d865 Mon Sep 17 00:00:00 2001 +From 0ce94f6caf5d76d7f1abc71f6f8f7dc320517984 Mon Sep 17 00:00:00 2001 From: Kuiying Wang <kuiying.wang@intel.com> Date: Wed, 23 Dec 2020 14:41:23 +0800 Subject: [PATCH] Add support to ChangePassword action @@ -37,10 +37,10 @@ Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> 2 files changed, 71 insertions(+) diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index a8e5cf2..dabf78e 100644 +index 298ebb8..4418c3d 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp -@@ -160,6 +160,7 @@ class RedfishService +@@ -159,6 +159,7 @@ class RedfishService nodes.emplace_back(std::make_unique<BiosSettings>(app)); nodes.emplace_back(std::make_unique<BiosAttributeRegistry>(app)); nodes.emplace_back(std::make_unique<BiosReset>(app)); @@ -49,10 +49,10 @@ index a8e5cf2..dabf78e 100644 nodes.emplace_back(std::make_unique<VirtualMedia>(app)); nodes.emplace_back(std::make_unique<VirtualMediaCollection>(app)); diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp -index 7b6fc3d..61b396b 100644 +index 1eb7bef..12ec472 100644 --- a/redfish-core/lib/bios.hpp +++ b/redfish-core/lib/bios.hpp -@@ -186,6 +186,9 @@ class BiosService : public Node +@@ -184,6 +184,9 @@ class BiosService : public Node asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = { {"target", "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}}; @@ -62,7 +62,7 @@ index 7b6fc3d..61b396b 100644 // Get the ActiveSoftwareImage and SoftwareImages fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose, -@@ -674,4 +677,71 @@ class BiosReset : public Node +@@ -669,4 +672,71 @@ class BiosReset : public Node std::variant<std::string>(resetFlag)); } }; @@ -87,14 +87,14 @@ index 7b6fc3d..61b396b 100644 + * Function handles POST method request. + * Analyzes POST body message before sends Reset request data to D-Bus. + */ -+ void doPost(crow::Response& res, const crow::Request& req, ++ void doPost(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const crow::Request& req, + const std::vector<std::string>&) override + { -+ auto asyncResp = std::make_shared<AsyncResp>(res); + std::string currentPassword, newPassword, userName; -+ if (!json_util::readJson(req, res, "NewPassword", newPassword, -+ "OldPassword", currentPassword, "PasswordName", -+ userName)) ++ if (!json_util::readJson(req, asyncResp->res, "NewPassword", ++ newPassword, "OldPassword", currentPassword, ++ "PasswordName", userName)) + { + return; + } @@ -120,8 +120,8 @@ index 7b6fc3d..61b396b 100644 + [asyncResp](const boost::system::error_code ec) { + if (ec) + { -+ BMCWEB_LOG_CRITICAL << "Failed in doPost(BiosChangePassword) " -+ << ec; ++ BMCWEB_LOG_CRITICAL ++ << "Failed in doPost(BiosChangePassword) " << ec; + messages::internalError(asyncResp->res); + return; + } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch new file mode 100644 index 000000000..75a78abb4 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch @@ -0,0 +1,44 @@ +From fedcdb7887b4d934ee763d75f7988825300c5cef Mon Sep 17 00:00:00 2001 +From: Ayushi Smriti <smriti.ayushi@intel.com> +Date: Thu, 6 May 2021 11:56:38 +0530 +Subject: [PATCH] Fix:remove bios user pwd change option via Redfish + +BMC should not provide user bios setup password change option via +Redfish as per bios security requirements. Only Admin BIOS setup +password is supported. + +Added check for the password name action parameter and +do not allow if it has User Password value from redfish side. + +Tested: sent POST query in redfish on URI: +https://<ip>/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword +error occurs for UserPassword parameter and allows for AdminPassword. + +Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com> +--- + redfish-core/lib/bios.hpp | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp +index 12ec472..0416934 100644 +--- a/redfish-core/lib/bios.hpp ++++ b/redfish-core/lib/bios.hpp +@@ -722,6 +722,15 @@ class BiosChangePassword : public Node + "PasswordName"); + return; + } ++ ++ // In Intel BIOS, we are not supporting user password in BIOS setup ++ if (userName == "UserPassword") ++ { ++ messages::actionParameterUnknown(asyncResp->res, "ChangePassword", ++ "PasswordName"); ++ return; ++ } ++ + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec) { + if (ec) +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch index b46d30149..bda893a81 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch @@ -1,7 +1,7 @@ -From ae55e89c14ea5abef0895409c956f5f4c38f330f Mon Sep 17 00:00:00 2001 +From 3d6c3b3e91c04ff8f10bff49bcf2a7d7206c53df Mon Sep 17 00:00:00 2001 From: Sunitha Harish <sunithaharish04@gmail.com> Date: Fri, 19 Feb 2021 13:38:31 +0530 -Subject: [PATCH 1/2] EventService : Fix retry handling for http-client +Subject: [PATCH] EventService : Fix retry handling for http-client When the event send/receive is failed, the bmcweb does not handle the failure to tear-down the complete connection and start a fresh @@ -23,17 +23,22 @@ Tested by: - Generate an event and see the same is received at the listener's console - Update the listner to change the keep-alive to true/false and observe the http-client connection states at bmcweb + - Changed listener client to return non success HTTP status code + and observed retry logic gets trigrred in http-client. + - Gave wrong fqdn and observed async resolve failure and retry logc. + - Stopped listener after connect and verified timeouts on http-client + side. Change-Id: Ibb45691f139916ba2954da37beda9d4f91c7cef3 Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com> Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> --- - http/http_client.hpp | 289 ++++++++++-------- + http/http_client.hpp | 288 ++++++++++-------- .../include/event_service_manager.hpp | 2 +- - 2 files changed, 163 insertions(+), 128 deletions(-) + 2 files changed, 162 insertions(+), 128 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index 992ac2b..d116f6d 100644 +index 992ac2b..feabbba 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -34,22 +34,28 @@ namespace crow @@ -67,7 +72,7 @@ index 992ac2b..d116f6d 100644 }; class HttpClient : public std::enable_shared_from_this<HttpClient> -@@ -58,11 +64,14 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -58,11 +64,13 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> crow::async_resolve::Resolver resolver; boost::beast::tcp_stream conn; boost::asio::steady_timer timer; @@ -80,13 +85,12 @@ index 992ac2b..d116f6d 100644 + std::optional< + boost::beast::http::response_parser<boost::beast::http::string_body>> + parser; -+ boost::asio::ip::tcp::endpoint endpoint; + boost::circular_buffer_space_optimized<std::string> requestDataQueue{}; + std::vector<boost::asio::ip::tcp::endpoint> endPoints; ConnState state; std::string subId; std::string host; -@@ -76,12 +85,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -76,12 +84,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> void doResolve() { @@ -99,7 +103,7 @@ index 992ac2b..d116f6d 100644 BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port; auto respHandler = -@@ -89,78 +93,56 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -89,78 +92,56 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> const boost::beast::error_code ec, const std::vector<boost::asio::ip::tcp::endpoint>& endpointList) { @@ -191,7 +195,7 @@ index 992ac2b..d116f6d 100644 // Send the HTTP request to the remote host boost::beast::http::async_write( conn, req, -@@ -171,7 +153,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -171,7 +152,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message(); self->state = ConnState::sendFailed; @@ -200,7 +204,7 @@ index 992ac2b..d116f6d 100644 return; } BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: " -@@ -184,9 +166,18 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -184,9 +165,17 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> void recvMessage() { @@ -208,8 +212,7 @@ index 992ac2b..d116f6d 100644 + + parser.emplace(std::piecewise_construct, std::make_tuple()); + parser->body_limit(httpReadBodyLimit); -+ // Since these are all push style eventing, we are not -+ // bothered about response body parsing. ++ + // Check only for the response header + parser->skip(true); + @@ -220,7 +223,7 @@ index 992ac2b..d116f6d 100644 [self(shared_from_this())](const boost::beast::error_code& ec, const std::size_t& bytesTransferred) { if (ec) -@@ -194,30 +185,46 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -194,30 +183,47 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> BMCWEB_LOG_ERROR << "recvMessage() failed: " << ec.message(); self->state = ConnState::recvFailed; @@ -257,7 +260,8 @@ index 992ac2b..d116f6d 100644 + // enabled + self->state = ConnState::abortConnection; + } -+ // Transfer ownership of the response ++ ++ // Returns ownership of the parsed message + self->parser->release(); + + self->handleConnState(); @@ -275,7 +279,7 @@ index 992ac2b..d116f6d 100644 // not_connected happens sometimes so don't bother reporting it. if (ec && ec != boost::beast::errc::not_connected) { -@@ -225,112 +232,139 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -225,112 +231,139 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> return; } BMCWEB_LOG_DEBUG << "Connection closed gracefully"; @@ -369,7 +373,7 @@ index 992ac2b..d116f6d 100644 - retryCount = 0; - connStateCheck(); + runningTimer = true; - ++ + retryCount++; + + BMCWEB_LOG_DEBUG << "Attempt retry after " << retryIntervalSecs @@ -384,7 +388,7 @@ index 992ac2b..d116f6d 100644 + // sending the event as per the retry policy + } + self->runningTimer = false; -+ + + // Lets close connection and start from resolve. + self->doClose(); + }); @@ -469,7 +473,7 @@ index 992ac2b..d116f6d 100644 } } -@@ -339,37 +373,38 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -339,37 +372,38 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> const std::string& destIP, const std::string& destPort, const std::string& destUri) : conn(ioc), @@ -526,10 +530,10 @@ index 992ac2b..d116f6d 100644 void setRetryConfig(const uint32_t retryAttempts, diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 148c703..bffa68f 100644 +index fa4e41a..c999121 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -412,7 +412,7 @@ class Subscription +@@ -423,7 +423,7 @@ class Subscription reqHeaders.emplace_back(std::pair(key, val)); } } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch index b1f61c6fd..7cbb406a5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch @@ -1,7 +1,7 @@ -From 579fda953ec991b4e7f9d7194b08f6aa103fa0ec Mon Sep 17 00:00:00 2001 +From 5f19e5c8ebc5cb0ce331e4ef841526995b6bdb2e Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Mon, 22 Feb 2021 17:07:47 +0000 -Subject: [PATCH 2/2] EventService: https client support +Subject: [PATCH] EventService: https client support Add https client support for push style eventing. Using this BMC can push the event @@ -17,12 +17,12 @@ Tested: Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> --- - http/http_client.hpp | 255 ++++++++++++------ + http/http_client.hpp | 257 ++++++++++++------ .../include/event_service_manager.hpp | 2 +- - 2 files changed, 175 insertions(+), 82 deletions(-) + 2 files changed, 176 insertions(+), 83 deletions(-) diff --git a/http/http_client.hpp b/http/http_client.hpp -index d116f6d..cebc857 100644 +index feabbba..aaf1b2d 100644 --- a/http/http_client.hpp +++ b/http/http_client.hpp @@ -20,6 +20,7 @@ @@ -52,7 +52,7 @@ index d116f6d..cebc857 100644 boost::asio::steady_timer timer; boost::beast::flat_static_buffer<httpReadBodyLimit> buffer; boost::beast::http::request<boost::beast::http::string_body> req; -@@ -112,23 +117,52 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -111,23 +116,52 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> void doConnect() { state = ConnState::connectInProgress; @@ -113,7 +113,7 @@ index d116f6d..cebc857 100644 self->state = ConnState::connected; self->handleConnState(); }); -@@ -136,106 +170,159 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -135,106 +169,159 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> void sendMessage(const std::string& data) { @@ -207,15 +207,15 @@ index d116f6d..cebc857 100644 + // Abort the connection since server is not keep-alive enabled + self->state = ConnState::abortConnection; + } -+ // Transfer ownership of the response ++ ++ // Returns ownership of the parsed message + self->parser->release(); + + self->handleConnState(); + }; parser.emplace(std::piecewise_construct, std::make_tuple()); parser->body_limit(httpReadBodyLimit); - // Since these are all push style eventing, we are not - // bothered about response body parsing. + // Check only for the response header parser->skip(true); + conn.expires_after(std::chrono::seconds(30)); @@ -296,7 +296,8 @@ index d116f6d..cebc857 100644 + self->state = ConnState::closed; + self->handleConnState(); } -- // Transfer ownership of the response +- +- // Returns ownership of the parsed message - self->parser->release(); - - self->handleConnState(); @@ -344,7 +345,7 @@ index d116f6d..cebc857 100644 } } -@@ -302,6 +389,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -301,6 +388,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> { case ConnState::resolveInProgress: case ConnState::connectInProgress: @@ -352,7 +353,7 @@ index d116f6d..cebc857 100644 case ConnState::sendInProgress: case ConnState::recvInProgress: case ConnState::closeInProgress: -@@ -333,6 +421,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -332,6 +420,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> } case ConnState::resolveFailed: case ConnState::connectFailed: @@ -360,7 +361,7 @@ index d116f6d..cebc857 100644 case ConnState::sendFailed: case ConnState::recvFailed: case ConnState::retry: -@@ -371,7 +460,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -370,7 +459,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> public: explicit HttpClient(boost::asio::io_context& ioc, const std::string& id, const std::string& destIP, const std::string& destPort, @@ -370,7 +371,7 @@ index d116f6d..cebc857 100644 conn(ioc), timer(ioc), req(boost::beast::http::verb::post, destUri, 11), state(ConnState::initialized), subId(id), host(destIP), port(destPort), -@@ -384,8 +474,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> +@@ -383,8 +473,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient> req.keep_alive(true); requestDataQueue.set_capacity(maxRequestQueueSize); @@ -384,10 +385,10 @@ index d116f6d..cebc857 100644 { if ((state == ConnState::suspended) || (state == ConnState::terminated)) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index bffa68f..1e6f496 100644 +index c999121..267c857 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp -@@ -387,7 +387,7 @@ class Subscription +@@ -398,7 +398,7 @@ class Subscription { conn = std::make_shared<crow::HttpClient>( crow::connections::systemBus->get_io_context(), id, host, port, 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 0d31fbc72..cd59ed94d 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,7 +1,7 @@ -From e93a6a02b0fba3371144d474422fadacc3f25fde Mon Sep 17 00:00:00 2001 +From 0c531d959364192697290c1489d5f7b1bdd7a665 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Fri, 12 Mar 2021 18:53:25 +0000 -Subject: [PATCH 4/6] Add Server-Sent-Events support +Subject: [PATCH] Add Server-Sent-Events support Server-Sent Events is a standard describing how servers can initiate data transmission towards clients once an initial @@ -24,13 +24,13 @@ Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> --- http/http_connection.hpp | 14 +- http/http_response.hpp | 7 +- - http/routing.hpp | 70 ++++++++++ + http/routing.hpp | 71 ++++++++++ http/server_sent_event.hpp | 279 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 364 insertions(+), 6 deletions(-) + 4 files changed, 365 insertions(+), 6 deletions(-) create mode 100644 http/server_sent_event.hpp diff --git a/http/http_connection.hpp b/http/http_connection.hpp -index 4482f8d..2c8bf40 100644 +index 6172b3a..fc9fc60 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -326,7 +326,7 @@ class Connection : @@ -63,7 +63,7 @@ index 4482f8d..2c8bf40 100644 // delete lambda with self shared_ptr // to enable connection destruction diff --git a/http/http_response.hpp b/http/http_response.hpp -index cd00ec8..ffd6dda 100644 +index 7965704..29c56e1 100644 --- a/http/http_response.hpp +++ b/http/http_response.hpp @@ -13,10 +13,15 @@ namespace crow @@ -93,7 +93,7 @@ index cd00ec8..ffd6dda 100644 // In case of a JSON object, set the Content-Type header void jsonMode() diff --git a/http/routing.hpp b/http/routing.hpp -index 65c7b70..0824939 100644 +index dd07523..7ddc6b0 100644 --- a/http/routing.hpp +++ b/http/routing.hpp @@ -6,6 +6,7 @@ @@ -104,7 +104,7 @@ index 65c7b70..0824939 100644 #include "sessions.hpp" #include "utility.hpp" #include "websocket.hpp" -@@ -390,6 +391,67 @@ class WebSocketRule : public BaseRule +@@ -398,6 +399,68 @@ class WebSocketRule : public BaseRule std::function<void(crow::websocket::Connection&)> errorHandler; }; @@ -119,10 +119,11 @@ index 65c7b70..0824939 100644 + void validate() override + {} + -+ void handle(const Request&, Response& res, const RoutingParams&) override ++ void handle(const Request&, ++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const RoutingParams&) override + { -+ res.result(boost::beast::http::status::not_found); -+ res.end(); ++ asyncResp->res.result(boost::beast::http::status::not_found); + } + + void handleUpgrade(const Request& req, Response&, @@ -172,7 +173,7 @@ index 65c7b70..0824939 100644 template <typename T> struct RuleParameterTraits { -@@ -402,6 +464,14 @@ struct RuleParameterTraits +@@ -410,6 +473,14 @@ struct RuleParameterTraits return *p; } diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch index 02d28833f..37609c154 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch @@ -1,7 +1,7 @@ -From 698d2615c5bc30ab7f89f11ed5659df8bf248ea0 Mon Sep 17 00:00:00 2001 +From bcb80fc9a86555c74b56b5b37615601d3fbfae31 Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Tue, 16 Mar 2021 15:37:24 +0000 -Subject: [PATCH 5/6] Add SSE style subscription support to eventservice +Subject: [PATCH] Add SSE style subscription support to eventservice This commit adds the SSE style eventservice subscription style event. Using this, end user can subscribe for @@ -23,16 +23,16 @@ Change-Id: I7f4b7a34974080739c4ba968ed570489af0474de --- http/http_connection.hpp | 2 +- include/eventservice_sse.hpp | 75 +++++ - .../include/event_service_manager.hpp | 77 ++++- + .../include/event_service_manager.hpp | 109 +++++-- redfish-core/include/server_sent_events.hpp | 291 ------------------ redfish-core/lib/event_service.hpp | 4 +- src/webserver_main.cpp | 2 + - 6 files changed, 149 insertions(+), 302 deletions(-) + 6 files changed, 163 insertions(+), 320 deletions(-) create mode 100644 include/eventservice_sse.hpp delete mode 100644 redfish-core/include/server_sent_events.hpp diff --git a/http/http_connection.hpp b/http/http_connection.hpp -index 2c8bf40..1ab776c 100644 +index fc9fc60..3afb4da 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -350,7 +350,7 @@ class Connection : @@ -126,7 +126,7 @@ index 0000000..6c98e6e +} // namespace eventservice_sse +} // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 5821e2e..f4d57c2 100644 +index fa4e41a..ac644c1 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -23,13 +23,15 @@ @@ -146,7 +146,7 @@ index 5821e2e..f4d57c2 100644 #include <cstdlib> #include <ctime> #include <fstream> -@@ -46,9 +48,13 @@ using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>; +@@ -46,9 +48,27 @@ using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>; static constexpr const char* eventFormatType = "Event"; static constexpr const char* metricReportFormatType = "MetricReport"; @@ -157,11 +157,50 @@ index 5821e2e..f4d57c2 100644 +static constexpr const uint8_t maxNoOfSubscriptions = 20; +static constexpr const uint8_t maxNoOfSSESubscriptions = 10; + - #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES - static std::optional<boost::asio::posix::stream_descriptor> inotifyConn; - static constexpr const char* redfishEventLogDir = "/var/log"; -@@ -391,11 +397,9 @@ class Subscription - path, uriProto); ++#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES ++static std::optional<boost::asio::posix::stream_descriptor> inotifyConn; ++static constexpr const char* redfishEventLogDir = "/var/log"; ++static constexpr const char* redfishEventLogFile = "/var/log/redfish"; ++static constexpr const size_t iEventSize = sizeof(inotify_event); ++static int inotifyFd = -1; ++static int dirWatchDesc = -1; ++static int fileWatchDesc = -1; ++ ++// <ID, timestamp, RedfishLogId, registryPrefix, MessageId, MessageArgs> ++using EventLogObjectsType = ++ std::tuple<std::string, std::string, std::string, std::string, std::string, ++ std::vector<std::string>>; ++ + namespace message_registries + { + inline boost::beast::span<const MessageEntry> +@@ -68,24 +88,6 @@ inline boost::beast::span<const MessageEntry> + } + return boost::beast::span<const MessageEntry>(openbmc::registry); + } +-} // namespace message_registries +- +-#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES +-static std::optional<boost::asio::posix::stream_descriptor> inotifyConn; +-static constexpr const char* redfishEventLogDir = "/var/log"; +-static constexpr const char* redfishEventLogFile = "/var/log/redfish"; +-static constexpr const size_t iEventSize = sizeof(inotify_event); +-static int inotifyFd = -1; +-static int dirWatchDesc = -1; +-static int fileWatchDesc = -1; +- +-// <ID, timestamp, RedfishLogId, registryPrefix, MessageId, MessageArgs> +-using EventLogObjectsType = +- std::tuple<std::string, std::string, std::string, std::string, std::string, +- std::vector<std::string>>; +- +-namespace message_registries +-{ + static const Message* + getMsgFromRegistry(const std::string& messageKey, + const boost::beast::span<const MessageEntry>& registry) +@@ -401,11 +403,9 @@ class Subscription + path); } - Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) : @@ -175,7 +214,7 @@ index 5821e2e..f4d57c2 100644 ~Subscription() = default; -@@ -420,7 +424,7 @@ class Subscription +@@ -430,7 +430,7 @@ class Subscription if (sseConn != nullptr) { @@ -184,7 +223,7 @@ index 5821e2e..f4d57c2 100644 } } -@@ -510,6 +514,7 @@ class Subscription +@@ -520,6 +520,7 @@ class Subscription this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); @@ -192,7 +231,7 @@ index 5821e2e..f4d57c2 100644 } #endif -@@ -565,14 +570,39 @@ class Subscription +@@ -590,14 +591,39 @@ class Subscription return eventSeqNum; } @@ -233,7 +272,7 @@ index 5821e2e..f4d57c2 100644 }; static constexpr const bool defaultEnabledState = true; -@@ -963,6 +993,8 @@ class EventServiceManager +@@ -988,6 +1014,8 @@ class EventServiceManager subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval); subValue->updateRetryPolicy(); @@ -242,7 +281,7 @@ index 5821e2e..f4d57c2 100644 return id; } -@@ -987,11 +1019,40 @@ class EventServiceManager +@@ -1012,11 +1040,40 @@ class EventServiceManager } } @@ -581,7 +620,7 @@ index 578fa19..0000000 - -} // namespace crow diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index be6f04d..1875ec9 100644 +index 64a2009..7c9bb7a 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp @@ -34,8 +34,6 @@ static constexpr const std::array<const char*, 1> supportedResourceTypes = { @@ -603,7 +642,7 @@ index be6f04d..1875ec9 100644 {{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}}, {"Actions", diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp -index 902c32b..c871faa 100644 +index 902c32b..d4bd48c 100644 --- a/src/webserver_main.cpp +++ b/src/webserver_main.cpp @@ -5,6 +5,7 @@ @@ -614,14 +653,14 @@ index 902c32b..c871faa 100644 #include <hostname_monitor.hpp> #include <ibm/management_console_rest.hpp> #include <image_upload.hpp> -@@ -83,6 +84,7 @@ int main(int /*argc*/, char** /*argv*/) +@@ -81,6 +82,7 @@ int main(int /*argc*/, char** /*argv*/) + #endif + #ifdef BMCWEB_ENABLE_REDFISH ++ redfish::eventservice_sse::requestRoutes(app); redfish::requestRoutes(app); redfish::RedfishService redfish(app); -+ redfish::eventservice_sse::requestRoutes(app); - // Create EventServiceManager instance and initialize Config - redfish::EventServiceManager::getInstance(); -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch index 4d99b2754..16e8affa5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch @@ -1,7 +1,7 @@ -From 82185c52ae6e27cc1e086654a3b7d10e63ecc783 Mon Sep 17 00:00:00 2001 +From dda3c7a46391ef88e7c6a6f61fba7fe9133336bf Mon Sep 17 00:00:00 2001 From: AppaRao Puli <apparao.puli@linux.intel.com> Date: Wed, 17 Mar 2021 01:16:50 +0000 -Subject: [PATCH 6/6] Add EventService SSE filter support +Subject: [PATCH] Add EventService SSE filter support This commit implements the Event Service SSE stream filters support. As per redfish specification: @@ -35,9 +35,9 @@ Change-Id: I55c6f53bb5e57aa1f2d1601f1a16525a33b13bd2 include/eventservice_sse.hpp | 94 ++++++++++++++++++- redfish-core/include/error_messages.hpp | 9 ++ .../include/event_service_manager.hpp | 5 + - redfish-core/lib/event_service.hpp | 4 - + redfish-core/lib/event_service.hpp | 5 - redfish-core/src/error_messages.cpp | 26 +++++ - 5 files changed, 130 insertions(+), 8 deletions(-) + 5 files changed, 130 insertions(+), 9 deletions(-) diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp index 6c98e6e..ff72c4d 100644 @@ -171,7 +171,7 @@ index 7dfdc80..922dae9 100644 } // namespace redfish diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index f4d57c2..567fb9c 100644 +index ac644c1..3661fed 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -55,6 +55,11 @@ static constexpr const char* eventServiceFile = @@ -180,24 +180,25 @@ index f4d57c2..567fb9c 100644 +static constexpr const std::array<const char*, 2> supportedEvtFormatTypes = { + eventFormatType, metricReportFormatType}; -+static constexpr const std::array<const char*, 3> supportedRegPrefixes = { -+ "Base", "OpenBMC", "Task"}; ++static constexpr const std::array<const char*, 2> supportedRegPrefixes = { ++ "OpenBMC", "TaskEvent"}; + #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES static std::optional<boost::asio::posix::stream_descriptor> inotifyConn; static constexpr const char* redfishEventLogDir = "/var/log"; diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index 1875ec9..4d1ac9f 100644 +index 7c9bb7a..297a4ea 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp -@@ -19,10 +19,6 @@ +@@ -18,11 +18,6 @@ + namespace redfish { - +- -static constexpr const std::array<const char*, 2> supportedEvtFormatTypes = { - eventFormatType, metricReportFormatType}; -static constexpr const std::array<const char*, 3> supportedRegPrefixes = { -- "Base", "OpenBMC", "Task"}; +- "Base", "OpenBMC", "TaskEvent"}; static constexpr const std::array<const char*, 3> supportedRetryPolicies = { "TerminateAfterRetries", "SuspendRetries", "RetryForever"}; diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch new file mode 100644 index 000000000..0b12671e5 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch @@ -0,0 +1,132 @@ +From 0a1390428fd6f5651669f4306f6105d33a24453c Mon Sep 17 00:00:00 2001 +From: Ayushi Smriti <smriti.ayushi@intel.com> +Date: Mon, 10 May 2021 13:03:37 +0530 +Subject: [PATCH] EventService: Log events for subscription actions + +Log redfish event for below 3 actions + - Add new subscription + - Update existing subscription properties + - Delete existing subscription +in order to notify the subscribed clients on the subscription related +information. + +Modified method name accordingly to indicate the clear purpose and +added updateSubscription method with subscription id param +to log event for subscription update. + +Tested: + - Performed all the above actions and verified the redfish event + messages are logged. + +Change-Id: I528293e55b1f3401bc2bb09c11c63ae985fbfedb +Signed-off-by: AppaRao Puli <apparao.puli@intel.com> +Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com> +--- + .../include/event_service_manager.hpp | 35 ++++++++++++++++--- + redfish-core/lib/event_service.hpp | 2 +- + 2 files changed, 32 insertions(+), 5 deletions(-) + +diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp +index 9952ef1..2b957ea 100644 +--- a/redfish-core/include/event_service_manager.hpp ++++ b/redfish-core/include/event_service_manager.hpp +@@ -22,6 +22,7 @@ + #include "registries/task_event_message_registry.hpp" + + #include <sys/inotify.h> ++#include <systemd/sd-journal.h> + + #include <boost/asio/io_context.hpp> + #include <boost/beast/core/span.hpp> +@@ -800,7 +801,7 @@ class EventServiceManager + return; + } + +- void updateSubscriptionData() ++ void persistSubscriptionData() + { + // Persist the config and subscription data. + nlohmann::json jsonData; +@@ -897,7 +898,7 @@ class EventServiceManager + + if (updateConfig) + { +- updateSubscriptionData(); ++ persistSubscriptionData(); + } + + if (updateRetryCfg) +@@ -992,7 +993,7 @@ class EventServiceManager + + if (updateFile) + { +- updateSubscriptionData(); ++ persistSubscriptionData(); + } + + #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES +@@ -1007,6 +1008,13 @@ class EventServiceManager + + // Set Subscription ID for back trace + subValue->setSubscriptionId(id); ++ ++ /* Log event for subscription addition */ ++ sd_journal_send("MESSAGE=Event subscription added(Id: %s)", id.c_str(), ++ "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.EventSubscriptionAdded", ++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL); ++ + return id; + } + +@@ -1027,7 +1035,14 @@ class EventServiceManager + { + subscriptionsMap.erase(obj); + updateNoOfSubscribersCount(); +- updateSubscriptionData(); ++ ++ persistSubscriptionData(); ++ /* Log event for subscription delete. */ ++ sd_journal_send("MESSAGE=Event subscription removed.(Id = %s)", ++ id.c_str(), "PRIORITY=%i", LOG_INFO, ++ "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.EventSubscriptionRemoved", ++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL); + } + } + +@@ -1049,6 +1064,18 @@ class EventServiceManager + } + } + ++ void updateSubscription(const std::string& id) ++ { ++ persistSubscriptionData(); ++ ++ /* Log event for subscription update. */ ++ sd_journal_send("MESSAGE=Event subscription updated.(Id = %s)", ++ id.c_str(), "PRIORITY=%i", LOG_INFO, ++ "REDFISH_MESSAGE_ID=%s", ++ "OpenBMC.0.1.EventSubscriptionUpdated", ++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL); ++ } ++ + size_t getNumberOfSubscriptions() + { + return subscriptionsMap.size(); +diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp +index 297a4ea..ed4955e 100644 +--- a/redfish-core/lib/event_service.hpp ++++ b/redfish-core/lib/event_service.hpp +@@ -616,7 +616,7 @@ class EventDestination : public Node + subValue->updateRetryPolicy(); + } + +- EventServiceManager::getInstance().updateSubscriptionData(); ++ EventServiceManager::getInstance().updateSubscription(params[0]); + } + + void doDelete(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README index 3954e89c1..ae010dafb 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README @@ -4,16 +4,16 @@ thee gets merged upstream. Upstream revision information: - EventService : Fix retry handling for http-client - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/18 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/20 - EventService: https client support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/38 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/39 - Add Server-Sent-Events support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/5 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/6 - Add SSE style subscription support to eventservice - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/5 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/6 - Add EventService SSE filter support - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/2 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/3 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch index 03feec633..8b08c6c5e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch @@ -1,7 +1,7 @@ -From b6ccf463b4cfb8df4a904f06c5f4852029a96c50 Mon Sep 17 00:00:00 2001 -From: "Wludzik, Jozef" <jozef.wludzik@intel.com> -Date: Tue, 15 Dec 2020 12:28:17 +0100 -Subject: [PATCH 3/4] Add support for MetricDefinition scheme +From d664a145a96a642597c74819c183410d4a04fce0 Mon Sep 17 00:00:00 2001 +From: Krzysztof Grobelny <krzysztof.grobelny@intel.com> +Date: Tue, 13 Apr 2021 13:00:18 +0000 +Subject: [PATCH] Add support for MetricDefinition scheme Added MetricDefinition node to Redfish code. Now user is able to list all available metrics in OpenBMC that are supported @@ -23,16 +23,16 @@ Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00 --- redfish-core/include/redfish.hpp | 3 + .../include/utils/telemetry_utils.hpp | 2 + - redfish-core/lib/metric_definition.hpp | 283 ++++++++++++++++++ + redfish-core/lib/metric_definition.hpp | 335 ++++++++++++++++++ redfish-core/lib/telemetry_service.hpp | 2 + - 4 files changed, 290 insertions(+) + 4 files changed, 342 insertions(+) create mode 100644 redfish-core/lib/metric_definition.hpp diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp -index aad28ac..dfcb8cd 100644 +index 7a14969..d280a86 100644 --- a/redfish-core/include/redfish.hpp +++ b/redfish-core/include/redfish.hpp -@@ -25,6 +25,7 @@ +@@ -26,6 +26,7 @@ #include "../lib/managers.hpp" #include "../lib/memory.hpp" #include "../lib/message_registries.hpp" @@ -40,7 +40,7 @@ index aad28ac..dfcb8cd 100644 #include "../lib/metric_report.hpp" #include "../lib/metric_report_definition.hpp" #include "../lib/network_protocol.hpp" -@@ -215,6 +216,8 @@ class RedfishService +@@ -219,6 +220,8 @@ class RedfishService nodes.emplace_back(std::make_unique<HypervisorResetActionInfo>(app)); nodes.emplace_back(std::make_unique<TelemetryService>(app)); @@ -50,7 +50,7 @@ index aad28ac..dfcb8cd 100644 std::make_unique<MetricReportDefinitionCollection>(app)); nodes.emplace_back(std::make_unique<MetricReportDefinition>(app)); diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp -index 0a3af5f..54b5133 100644 +index 5872350..1b4f75d 100644 --- a/redfish-core/include/utils/telemetry_utils.hpp +++ b/redfish-core/include/utils/telemetry_utils.hpp @@ -10,6 +10,8 @@ namespace telemetry @@ -64,12 +64,13 @@ index 0a3af5f..54b5133 100644 constexpr const char* metricReportUri = diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp new file mode 100644 -index 0000000..f9c7779 +index 0000000..515fe86 --- /dev/null +++ b/redfish-core/lib/metric_definition.hpp -@@ -0,0 +1,283 @@ +@@ -0,0 +1,335 @@ +#pragma once + ++#include "async_resp.hpp" +#include "node.hpp" +#include "sensors.hpp" +#include "utils/telemetry_utils.hpp" @@ -80,150 +81,138 @@ index 0000000..f9c7779 +namespace utils +{ + ++class AsyncRespWithFinalizer ++{ ++ public: ++ AsyncRespWithFinalizer( ++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) : ++ asyncResp(asyncResp) ++ {} ++ ++ AsyncRespWithFinalizer(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ std::function<void(crow::Response&)> finalizer) : ++ asyncResp(asyncResp), ++ finalizer(std::move(finalizer)) ++ {} ++ ++ AsyncRespWithFinalizer(const AsyncRespWithFinalizer&) = delete; ++ AsyncRespWithFinalizer(AsyncRespWithFinalizer&&) = delete; ++ ++ ~AsyncRespWithFinalizer() ++ { ++ if (finalizer) ++ { ++ try ++ { ++ finalizer(asyncResp->res); ++ } ++ catch (const std::exception& e) ++ { ++ BMCWEB_LOG_ERROR << "Executing finalizer failed: " << e.what(); ++ messages::internalError(asyncResp->res); ++ } ++ } ++ } ++ ++ void setFinalizer(std::function<void(crow::Response&)> newFinalizer) ++ { ++ finalizer = std::move(newFinalizer); ++ } ++ ++ private: ++ std::shared_ptr<bmcweb::AsyncResp> asyncResp; ++ std::function<void(crow::Response&)> finalizer; ++ ++ public: ++ crow::Response& res = asyncResp->res; ++}; ++ +template <typename F> -+inline void getChassisNames(F&& cb, const std::shared_ptr<AsyncResp>& asyncResp) ++inline void getChassisNames(F&& cb) +{ + const std::array<const char*, 2> interfaces = { + "xyz.openbmc_project.Inventory.Item.Board", + "xyz.openbmc_project.Inventory.Item.Chassis"}; + + crow::connections::systemBus->async_method_call( -+ [asyncResp, -+ callback = std::move(cb)](const boost::system::error_code ec, -+ std::vector<std::string>& chassis) { ++ [callback = std::move(cb)](const boost::system::error_code ec, ++ const std::vector<std::string>& chassis) { ++ std::vector<std::string> chassisNames; ++ + if (ec) + { -+ messages::internalError(asyncResp->res); -+ BMCWEB_LOG_DEBUG << "DBus call error: " << ec.value(); ++ callback(ec, chassisNames); + return; + } + -+ std::vector<std::string> chassisNames; + chassisNames.reserve(chassis.size()); -+ for (const auto& path : chassis) ++ for (const std::string& path : chassis) + { + sdbusplus::message::object_path dbusPath = path; + std::string name = dbusPath.filename(); + if (name.empty()) + { -+ messages::internalError(asyncResp->res); -+ BMCWEB_LOG_ERROR << "Invalid chassis: " << dbusPath.str; ++ callback(boost::system::errc::make_error_code( ++ boost::system::errc::invalid_argument), ++ chassisNames); + return; + } + chassisNames.emplace_back(std::move(name)); + } + -+ callback(chassisNames); ++ callback(ec, chassisNames); + }, + "xyz.openbmc_project.ObjectMapper", + "/xyz/openbmc_project/object_mapper", + "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", + "/xyz/openbmc_project/inventory", 0, interfaces); +} ++ +} // namespace utils + +namespace telemetry +{ + -+class MetricDefinitionCollectionReduce ++void addMembers(crow::Response& res, ++ const boost::container::flat_map<std::string, std::string>& el) +{ -+ public: -+ MetricDefinitionCollectionReduce( -+ const std::shared_ptr<AsyncResp>& asyncResp) : -+ asyncResp{asyncResp} -+ {} -+ -+ ~MetricDefinitionCollectionReduce() ++ for (const auto& [_, dbusSensor] : el) + { -+ if (asyncResp->res.result() != boost::beast::http::status::ok) ++ sdbusplus::message::object_path path(dbusSensor); ++ sdbusplus::message::object_path parentPath = path.parent_path(); ++ std::string type = parentPath.filename(); ++ if (type.empty()) + { -+ return; ++ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = " ++ << dbusSensor; ++ continue; + } + -+ nlohmann::json& members = asyncResp->res.jsonValue["Members"]; -+ members = nlohmann::json::array(); ++ nlohmann::json& members = res.jsonValue["Members"]; + -+ for (const std::string& type : dbusTypes) -+ { -+ members.push_back( -+ {{"@odata.id", telemetry::metricDefinitionUri + type}}); -+ } -+ asyncResp->res.jsonValue["Members@odata.count"] = members.size(); -+ } ++ const std::string odataId = ++ telemetry::metricDefinitionUri + std::move(type); + -+ void insert(const boost::container::flat_map<std::string, std::string>& el) -+ { -+ for (const auto& [_, dbusSensor] : el) -+ { -+ sdbusplus::message::object_path path(dbusSensor); -+ sdbusplus::message::object_path parentPath = path.parent_path(); -+ std::string type = parentPath.filename(); -+ if (type.empty()) -+ { -+ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = " -+ << dbusSensor; -+ continue; -+ } ++ const auto it = ++ std::find_if(members.begin(), members.end(), ++ [&odataId](const nlohmann::json& item) { ++ auto kt = item.find("@odata.id"); ++ if (kt == item.end()) ++ { ++ return false; ++ } ++ return kt->get<std::string>() == odataId; ++ }); + -+ dbusTypes.insert(std::move(type)); -+ } -+ } -+ -+ private: -+ const std::shared_ptr<AsyncResp> asyncResp; -+ boost::container::flat_set<std::string> dbusTypes; -+}; -+ -+class MetricDefinitionReduce -+{ -+ public: -+ MetricDefinitionReduce(const std::shared_ptr<AsyncResp>& asyncResp, -+ const std::string& id) : -+ id(id), -+ pattern{'/' + id + '/'}, asyncResp{asyncResp} -+ {} -+ ~MetricDefinitionReduce() -+ { -+ if (asyncResp->res.result() != boost::beast::http::status::ok) -+ { -+ return; -+ } -+ if (redfishSensors.empty()) ++ if (it == members.end()) + { -+ messages::resourceNotFound(asyncResp->res, "MetricDefinition", id); -+ return; ++ members.push_back({{"@odata.id", odataId}}); + } + -+ asyncResp->res.jsonValue["MetricProperties"] = redfishSensors; -+ asyncResp->res.jsonValue["Id"] = id; -+ asyncResp->res.jsonValue["Name"] = id; -+ asyncResp->res.jsonValue["@odata.id"] = -+ telemetry::metricDefinitionUri + id; -+ asyncResp->res.jsonValue["@odata.type"] = -+ "#MetricDefinition.v1_0_3.MetricDefinition"; -+ asyncResp->res.jsonValue["MetricDataType"] = "Decimal"; -+ asyncResp->res.jsonValue["MetricType"] = "Numeric"; -+ asyncResp->res.jsonValue["IsLinear"] = true; -+ asyncResp->res.jsonValue["Units"] = sensors::toReadingUnits(id); -+ } -+ -+ void insert(const boost::container::flat_map<std::string, std::string>& el) -+ { -+ for (const auto& [redfishSensor, dbusSensor] : el) -+ { -+ if (dbusSensor.find(pattern) != std::string::npos) -+ { -+ redfishSensors.push_back(redfishSensor); -+ } -+ } ++ res.jsonValue["Members@odata.count"] = members.size(); + } ++} + -+ private: -+ const std::string id; -+ const std::string pattern; -+ const std::shared_ptr<AsyncResp> asyncResp; -+ std::vector<std::string> redfishSensors; -+}; +} // namespace telemetry + +class MetricDefinitionCollection : public Node @@ -242,52 +231,83 @@ index 0000000..f9c7779 + } + + private: -+ void doGet(crow::Response& res, const crow::Request&, -+ const std::vector<std::string>&) override ++ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const crow::Request&, const std::vector<std::string>&) override + { -+ res.jsonValue["@odata.type"] = "#MetricDefinitionCollection." -+ "MetricDefinitionCollection"; -+ res.jsonValue["@odata.id"] = ++ asyncResp->res.jsonValue["@odata.type"] = "#MetricDefinitionCollection." ++ "MetricDefinitionCollection"; ++ asyncResp->res.jsonValue["@odata.id"] = + "/redfish/v1/TelemetryService/MetricDefinitions"; -+ res.jsonValue["Name"] = "Metric Definition Collection"; -+ res.jsonValue["Members"] = nlohmann::json::array(); -+ res.jsonValue["Members@odata.count"] = 0; ++ asyncResp->res.jsonValue["Name"] = "Metric Definition Collection"; ++ asyncResp->res.jsonValue["Members"] = nlohmann::json::array(); ++ asyncResp->res.jsonValue["Members@odata.count"] = 0; ++ ++ auto handleRetrieveUriToDbusMap = ++ [asyncResp]( ++ const boost::beast::http::status status, ++ const boost::container::flat_map<std::string, std::string>& ++ uriToDbus) { ++ if (status != boost::beast::http::status::ok) ++ { ++ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " ++ "sensors map with err " ++ << static_cast<unsigned>(status); ++ messages::internalError(asyncResp->res); ++ return; ++ } ++ telemetry::addMembers(asyncResp->res, uriToDbus); ++ }; + -+ auto asyncResp = std::make_shared<AsyncResp>(res); + utils::getChassisNames( -+ [asyncResp](const std::vector<std::string>& chassisNames) { -+ auto collectionReduce = std::make_shared< -+ telemetry::MetricDefinitionCollectionReduce>(asyncResp); ++ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap), ++ asyncResp](boost::system::error_code ec, ++ const std::vector<std::string>& chassisNames) { ++ if (ec) ++ { ++ messages::internalError(asyncResp->res); ++ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value(); ++ return; ++ } ++ + for (const std::string& chassisName : chassisNames) + { + for (const auto& [sensorNode, _] : sensors::dbus::paths) + { -+ BMCWEB_LOG_INFO << "Chassis: " << chassisName -+ << " sensor: " << sensorNode; -+ retrieveUriToDbusMap( -+ chassisName, sensorNode.data(), -+ [asyncResp, collectionReduce]( -+ const boost::beast::http::status status, -+ const boost::container::flat_map< -+ std::string, std::string>& uriToDbus) { -+ if (status != boost::beast::http::status::ok) -+ { -+ BMCWEB_LOG_ERROR -+ << "Failed to retrieve URI to dbus " -+ "sensors map with err " -+ << static_cast<unsigned>(status); -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ collectionReduce->insert(uriToDbus); -+ }); ++ BMCWEB_LOG_DEBUG << "Chassis: " << chassisName ++ << " sensor: " << sensorNode; ++ retrieveUriToDbusMap(chassisName, sensorNode.data(), ++ handleRetrieveUriToDbusMap); + } + } -+ }, -+ asyncResp); ++ }); + } +}; + ++namespace telemetry ++{ ++ ++void addMetricProperty( ++ utils::AsyncRespWithFinalizer& asyncResp, const std::string& id, ++ const boost::container::flat_map<std::string, std::string>& el) ++{ ++ nlohmann::json& metricProperties = ++ asyncResp.res.jsonValue["MetricProperties"]; ++ ++ for (const auto& [redfishSensor, dbusSensor] : el) ++ { ++ std::string sensorId; ++ if (dbus::utility::getNthStringFromPath(dbusSensor, 3, sensorId)) ++ { ++ if (sensorId == id) ++ { ++ metricProperties.push_back(redfishSensor); ++ } ++ } ++ } ++} ++ ++} // namespace telemetry ++ +class MetricDefinition : public Node +{ + public: @@ -305,65 +325,97 @@ index 0000000..f9c7779 + } + + private: -+ void doGet(crow::Response& res, const crow::Request&, ++ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const crow::Request&, + const std::vector<std::string>& params) override + { -+ auto asyncResp = std::make_shared<AsyncResp>(res); ++ auto telemetryAsyncResp = ++ std::make_shared<utils::AsyncRespWithFinalizer>(asyncResp); ++ + if (params.size() != 1) + { -+ messages::internalError(asyncResp->res); ++ messages::internalError(telemetryAsyncResp->res); + return; + } + + const std::string& id = params[0]; ++ telemetryAsyncResp->setFinalizer([id](crow::Response& res) { ++ if (res.jsonValue["MetricProperties"].empty()) ++ { ++ messages::resourceNotFound(res, "MetricDefinition", id); ++ } ++ }); ++ ++ telemetryAsyncResp->res.jsonValue["MetricProperties"] = ++ nlohmann::json::array(); ++ telemetryAsyncResp->res.jsonValue["Id"] = id; ++ telemetryAsyncResp->res.jsonValue["Name"] = id; ++ telemetryAsyncResp->res.jsonValue["@odata.id"] = ++ telemetry::metricDefinitionUri + id; ++ telemetryAsyncResp->res.jsonValue["@odata.type"] = ++ "#MetricDefinition.v1_0_3.MetricDefinition"; ++ telemetryAsyncResp->res.jsonValue["MetricDataType"] = "Decimal"; ++ telemetryAsyncResp->res.jsonValue["MetricType"] = "Numeric"; ++ telemetryAsyncResp->res.jsonValue["IsLinear"] = true; ++ telemetryAsyncResp->res.jsonValue["Units"] = ++ sensors::toReadingUnits(id); ++ ++ auto handleRetrieveUriToDbusMap = ++ [telemetryAsyncResp, ++ id](const boost::beast::http::status status, ++ const boost::container::flat_map<std::string, std::string>& ++ uriToDbus) { ++ if (status != boost::beast::http::status::ok) ++ { ++ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus " ++ "sensors map with err " ++ << static_cast<unsigned>(status); ++ messages::internalError(telemetryAsyncResp->res); ++ return; ++ } ++ telemetry::addMetricProperty(*telemetryAsyncResp, id, ++ uriToDbus); ++ }; ++ + utils::getChassisNames( -+ [asyncResp, id](const std::vector<std::string>& chassisNames) { -+ auto definitionGather = -+ std::make_shared<telemetry::MetricDefinitionReduce>( -+ asyncResp, id); ++ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap), ++ telemetryAsyncResp, ++ id](boost::system::error_code ec, ++ const std::vector<std::string>& chassisNames) { ++ if (ec) ++ { ++ messages::internalError(telemetryAsyncResp->res); ++ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value(); ++ return; ++ } ++ + for (const std::string& chassisName : chassisNames) + { + for (const auto& [sensorNode, dbusPaths] : + sensors::dbus::paths) + { -+ retrieveUriToDbusMap( -+ chassisName, sensorNode.data(), -+ [asyncResp, definitionGather]( -+ const boost::beast::http::status status, -+ const boost::container::flat_map< -+ std::string, std::string>& uriToDbus) { -+ if (status != boost::beast::http::status::ok) -+ { -+ BMCWEB_LOG_ERROR -+ << "Failed to retrieve URI to dbus " -+ "sensors map with err " -+ << static_cast<unsigned>(status); -+ messages::internalError(asyncResp->res); -+ return; -+ } -+ definitionGather->insert(uriToDbus); -+ }); ++ retrieveUriToDbusMap(chassisName, sensorNode.data(), ++ handleRetrieveUriToDbusMap); + } + } -+ }, -+ asyncResp); ++ }); + } +}; + +} // namespace redfish diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp -index 61ca891..a8c8b03 100644 +index 9ec0737..de9c800 100644 --- a/redfish-core/lib/telemetry_service.hpp +++ b/redfish-core/lib/telemetry_service.hpp @@ -32,6 +32,8 @@ class TelemetryService : public Node - res.jsonValue["Id"] = "TelemetryService"; - res.jsonValue["Name"] = "Telemetry Service"; + asyncResp->res.jsonValue["Id"] = "TelemetryService"; + asyncResp->res.jsonValue["Name"] = "Telemetry Service"; -+ res.jsonValue["MetricDefinitions"]["@odata.id"] = ++ asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] = + "/redfish/v1/TelemetryService/MetricDefinitions"; - res.jsonValue["MetricReportDefinitions"]["@odata.id"] = + asyncResp->res.jsonValue["MetricReportDefinitions"]["@odata.id"] = "/redfish/v1/TelemetryService/MetricReportDefinitions"; - res.jsonValue["MetricReports"]["@odata.id"] = + asyncResp->res.jsonValue["MetricReports"]["@odata.id"] = -- 2.17.1 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch index f2ebce6e3..4119045f1 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch @@ -1,7 +1,7 @@ -From efcd128a3d66fce33200fd4211ba5abf13a81375 Mon Sep 17 00:00:00 2001 +From 0ed9ff4f37e7d3ea81073ad35acd530730104033 Mon Sep 17 00:00:00 2001 From: "Wludzik, Jozef" <jozef.wludzik@intel.com> Date: Tue, 15 Dec 2020 12:30:31 +0100 -Subject: [PATCH 4/4] Sync Telmetry service with EventService +Subject: [PATCH] Sync Telmetry service with EventService Synced the latest changes in Telemetry service with Event Service code. Now assembling MetricReport is covered in single place in @@ -22,7 +22,7 @@ Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com> 2 files changed, 69 insertions(+), 115 deletions(-) diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp -index 148c703..27e41e3 100644 +index c3c110a..dc99cda 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -14,6 +14,7 @@ @@ -33,7 +33,7 @@ index 148c703..27e41e3 100644 #include "node.hpp" #include "registries.hpp" #include "registries/base_message_registry.hpp" -@@ -512,47 +513,32 @@ class Subscription +@@ -529,47 +530,32 @@ class Subscription } #endif @@ -92,7 +92,7 @@ index 148c703..27e41e3 100644 this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); } -@@ -1348,75 +1334,6 @@ class EventServiceManager +@@ -1421,75 +1407,6 @@ class EventServiceManager } #endif @@ -168,7 +168,7 @@ index 148c703..27e41e3 100644 void unregisterMetricReportSignal() { if (matchTelemetryMonitor) -@@ -1436,9 +1353,11 @@ class EventServiceManager +@@ -1509,9 +1426,11 @@ class EventServiceManager } BMCWEB_LOG_DEBUG << "Metrics report signal - Register"; @@ -183,7 +183,7 @@ index 148c703..27e41e3 100644 matchTelemetryMonitor = std::make_shared<sdbusplus::bus::match::match>( *crow::connections::systemBus, matchStr, -@@ -1449,10 +1368,43 @@ class EventServiceManager +@@ -1522,10 +1441,43 @@ class EventServiceManager return; } @@ -232,14 +232,14 @@ index 148c703..27e41e3 100644 } diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp -index 9caf4a3..e79a41c 100644 +index ad15a05..18a6dcc 100644 --- a/redfish-core/lib/metric_report.hpp +++ b/redfish-core/lib/metric_report.hpp @@ -31,16 +31,14 @@ inline nlohmann::json toMetricValues(const Readings& readings) return metricValues; } --inline void fillReport(const std::shared_ptr<AsyncResp>& asyncResp, +-inline void fillReport(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, - const std::string& id, +inline bool fillReport(nlohmann::json& json, const std::string& id, const std::variant<TimestampReadings>& var) @@ -258,7 +258,7 @@ index 9caf4a3..e79a41c 100644 telemetry::metricReportDefinitionUri + id; const TimestampReadings* timestampReadings = -@@ -48,14 +46,14 @@ inline void fillReport(const std::shared_ptr<AsyncResp>& asyncResp, +@@ -48,14 +46,14 @@ inline void fillReport(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, if (!timestampReadings) { BMCWEB_LOG_ERROR << "Property type mismatch or property is missing"; @@ -277,7 +277,7 @@ index 9caf4a3..e79a41c 100644 } } // namespace telemetry -@@ -146,7 +144,11 @@ class MetricReport : public Node +@@ -145,7 +143,11 @@ class MetricReport : public Node return; } 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 46128f7ae..20c93c08e 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README @@ -3,8 +3,8 @@ Until change is integrated they will be manually merged here to enable feature i Current revisions: - Add support for MetricDefinition scheme - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/60 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/72 - Sync Telmetry service with EventService - https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/26 + https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/30 diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch index 3e3f69d1c..3e3f69d1c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch index 01c1c858c..01c1c858c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch index ec6d70df1..41c1c9836 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch @@ -1,4 +1,4 @@ -From 4af788655c5b5a5fae4d85b365a70dc619810fe0 Mon Sep 17 00:00:00 2001 +From d303bfdd6778c43096401ff78fab70f9041cd4cf Mon Sep 17 00:00:00 2001 From: Karol Wachowski <karol.wachowski@intel.com> Date: Thu, 11 Feb 2021 08:35:41 +0000 Subject: [PATCH] Add ConnectedVia property to virtual media item template @@ -12,10 +12,10 @@ Signed-off-by: Karol Wachowski <karol.wachowski@intel.com> 1 file changed, 1 insertion(+) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 188248a..80e7315 100644 +index c45fed2..aa7c639 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp -@@ -192,6 +192,7 @@ static nlohmann::json vmItemTemplate(const std::string& name, +@@ -193,6 +193,7 @@ static nlohmann::json vmItemTemplate(const std::string& name, item["@odata.id"] = "/redfish/v1/Managers/" + name + "/VirtualMedia/" + resName; item["@odata.type"] = "#VirtualMedia.v1_3_0.VirtualMedia"; @@ -23,3 +23,6 @@ index 188248a..80e7315 100644 item["Name"] = "Virtual Removable Media"; item["Id"] = resName; item["WriteProtected"] = true; +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch index c9a4119a1..3a9e67217 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch @@ -1,9 +1,8 @@ - -From 1bbabe4ecdeea20da809b9f1d8e194683629517c Mon Sep 17 00:00:00 2001 +From 805641a2d189da9befc05168f51cef76da1ba326 Mon Sep 17 00:00:00 2001 From: Alicja Rybak <alicja.rybak@intel.com> Date: Tue, 20 Apr 2021 16:32:37 +0200 -Subject: [PATCH] Invalid status code from InsertMedia REST methods GET, PUT, - DELETE, PATCH in proxy mode +Subject: [PATCH] Invalid status code from InsertMedia REST methods GET, + PUT, DELETE, PATCH in proxy mode Add handlers for GET, PUT, DELETE, PATCH method and function that checks which mode is used and set suitable status code: @@ -12,14 +11,14 @@ Not allowed for Legacy and Not found for Proxy. Change-Id: Ib4c0a3e9a2a8853caa74c59239d9fcfed99c5e8b Signed-off-by: Alicja Rybak <alicja.rybak@intel.com> --- - redfish-core/lib/virtual_media.hpp | 154 +++++++++++++++++++++++++++++ - 1 file changed, 154 insertions(+) + redfish-core/lib/virtual_media.hpp | 155 +++++++++++++++++++++++++++++ + 1 file changed, 155 insertions(+) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 8353ce7..66bf220 100644 +index aa7c639..3e28164 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp -@@ -530,6 +530,160 @@ class VirtualMediaActionInsertMedia : public Node +@@ -548,6 +548,161 @@ class VirtualMediaActionInsertMedia : public Node return true; } @@ -28,15 +27,13 @@ index 8353ce7..66bf220 100644 + * and sets suitable response code for unsupported REST method. + * + */ -+ void CheckProxyMode(crow::Response& res, ++ void CheckProxyMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const crow::Request& req, + const std::vector<std::string>& params) + { -+ auto aResp = std::make_shared<AsyncResp>(res); -+ + if (params.size() != 2) + { -+ messages::internalError(res); ++ messages::internalError(aResp->res); + return; + } + @@ -45,7 +42,8 @@ index 8353ce7..66bf220 100644 + + if (params[0] != "bmc") + { -+ messages::resourceNotFound(res, "VirtualMedia.Insert", resName); ++ messages::resourceNotFound(aResp->res, "VirtualMedia.Insert", ++ resName); + + return; + } @@ -58,8 +56,7 @@ index 8353ce7..66bf220 100644 + { + BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " + << ec; -+ aResp->res.result( -+ boost::beast::http::status::not_found); ++ aResp->res.result(boost::beast::http::status::not_found); + + return; + } @@ -109,9 +106,8 @@ index 8353ce7..66bf220 100644 + BMCWEB_LOG_DEBUG << "InsertMedia only allowed " + "with POST method " + "in legacy mode"; -+ aResp->res.result( -+ boost::beast::http::status:: -+ method_not_allowed); ++ aResp->res.result(boost::beast::http::status:: ++ method_not_allowed); + + return; + } @@ -144,39 +140,46 @@ index 8353ce7..66bf220 100644 + /** + * @brief Function handles GET method request. + */ -+ void doGet(crow::Response& res, const crow::Request& req, -+ const std::vector<std::string>& params) override ++ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const crow::Request& req, ++ const std::vector<std::string>& params) override + { -+ CheckProxyMode(res, req, params); ++ CheckProxyMode(asyncResp, req, params); + } + + /** + * @brief Function handles PATCH method request. + */ -+ void doPatch(crow::Response& res, const crow::Request& req, -+ const std::vector<std::string>& params) override ++ void doPatch(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const crow::Request& req, ++ const std::vector<std::string>& params) override + { -+ CheckProxyMode(res, req, params); ++ CheckProxyMode(asyncResp, req, params); + } + + /** + * @brief Function handles PUT method request. + */ -+ void doPut(crow::Response& res, const crow::Request& req, -+ const std::vector<std::string>& params) override ++ void doPut(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const crow::Request& req, ++ const std::vector<std::string>& params) override + { -+ CheckProxyMode(res, req, params); ++ CheckProxyMode(asyncResp, req, params); + } + + /** + * @brief Function handles DELETE method request. + */ -+ void doDelete(crow::Response& res, const crow::Request& req, -+ const std::vector<std::string>& params) override ++ void doDelete(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, ++ const crow::Request& req, ++ const std::vector<std::string>& params) override + { -+ CheckProxyMode(res, req, params); ++ CheckProxyMode(asyncResp, req, params); + } + /** * @brief Function handles POST method request. * +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch index eaba041d5..3d80aeb20 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch @@ -1,4 +1,4 @@ -From dab4adbf211b6867f86fcf6080b34a0e41f6f4a1 Mon Sep 17 00:00:00 2001 +From 89ca38dbc3433b3b734a20068e599809f3bd7b90 Mon Sep 17 00:00:00 2001 From: Karol Wachowski <karol.wachowski@intel.com> Date: Tue, 23 Feb 2021 15:53:16 +0000 Subject: [PATCH] Set Inserted redfish property for not inserted resources @@ -11,10 +11,10 @@ Signed-off-by: Karol Wachowski <karol.wachowski@intel.com> 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 188248a..f477f63 100644 +index 3e28164..4c475b7 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp -@@ -95,6 +95,7 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, +@@ -96,6 +96,7 @@ static void BMCWEB_LOG_DEBUG << "Value Active not found"; return; } @@ -22,7 +22,7 @@ index 188248a..f477f63 100644 const std::string* endpointIdValue = std::get_if<std::string>(&endpointIdProperty->second); -@@ -106,7 +107,6 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, +@@ -107,7 +108,6 @@ static void aResp->res.jsonValue["Oem"]["OpenBMC"]["WebSocketEndpoint"] = *endpointIdValue; aResp->res.jsonValue["TransferProtocolType"] = "OEM"; @@ -30,7 +30,7 @@ index 188248a..f477f63 100644 if (*activeValue == true) { aResp->res.jsonValue["ConnectedVia"] = "Applet"; -@@ -137,7 +137,6 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface, +@@ -138,7 +138,6 @@ static void } aResp->res.jsonValue["Image"] = *imageUrlValue; @@ -38,3 +38,6 @@ index 188248a..f477f63 100644 aResp->res.jsonValue["TransferProtocolType"] = getTransferProtocolTypeFromUri(*imageUrlValue); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch index 074718349..efce3e72c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch @@ -1,4 +1,4 @@ -From 81f2c022b22ef75990f30e5ba5bfd4ba5bd41754 Mon Sep 17 00:00:00 2001 +From e7018ea9e3ad1a17e096aec3717a4764c3feac2e Mon Sep 17 00:00:00 2001 From: Alicja Rybak <alicja.rybak@intel.com> Date: Wed, 14 Apr 2021 16:26:59 +0200 Subject: [PATCH] Bmcweb handle permission denied exception @@ -17,10 +17,10 @@ Signed-off-by: Alicja Rybak <alicja.rybak@intel.com> 1 file changed, 8 insertions(+) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp -index 365290b..bbdc91b 100644 +index 4c475b7..8151ac0 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp -@@ -900,6 +900,10 @@ class VirtualMediaActionInsertMedia : public Node +@@ -1073,6 +1073,10 @@ class VirtualMediaActionInsertMedia : public Node { messages::resourceInUse(asyncResp->res); } @@ -31,7 +31,7 @@ index 365290b..bbdc91b 100644 else { messages::internalError(asyncResp->res); -@@ -1092,6 +1096,10 @@ class VirtualMediaActionEjectMedia : public Node +@@ -1267,6 +1271,10 @@ class VirtualMediaActionEjectMedia : public Node { messages::resourceInUse(asyncResp->res); } @@ -42,3 +42,6 @@ index 365290b..bbdc91b 100644 else { messages::internalError(asyncResp->res); +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch index acfd9225b..88fa89465 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch @@ -1,4 +1,4 @@ -From 9493bb8e2f5c708e187313c86e6033de5f103c51 Mon Sep 17 00:00:00 2001 +From 6f4b5fc1879f39b0f5fee0838f0ecbc481275d5e Mon Sep 17 00:00:00 2001 From: Alicja Rybak <alicja.rybak@intel.com> Date: Fri, 23 Apr 2021 17:35:52 +0200 Subject: [PATCH] Fix unmounting image in proxy mode. @@ -16,10 +16,10 @@ Signed-off-by: Alicja Rybak <alicja.rybak@intel.com> 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp -index 7b90e90..fa7f647 100644 +index 3b28823..897bcf2 100644 --- a/include/nbd_proxy.hpp +++ b/include/nbd_proxy.hpp -@@ -428,9 +428,9 @@ inline void requestRoutes(App& app) +@@ -439,9 +439,9 @@ inline void requestRoutes(App& app) BMCWEB_LOG_DEBUG << "No session to close"; return; } @@ -30,3 +30,6 @@ index 7b90e90..fa7f647 100644 }) .onmessage([](crow::websocket::Connection& conn, const std::string& data, bool) { +-- +2.17.1 + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch new file mode 100644 index 000000000..c188b2105 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch @@ -0,0 +1,37 @@ +From d31d913a8c5dbacf6a36407532cf777852099ced Mon Sep 17 00:00:00 2001 +From: AppaRao Puli <apparao.puli@linux.intel.com> +Date: Sun, 2 May 2021 11:07:16 +0000 +Subject: [PATCH] Fix VM NBDPROXY build issue with AsyncResp + +8d1b46d7 moves bmcweb to using AsyncResp everywhere, and not have +each individual handler creating its own object. + +This commit fixes the build failure when enabling virtual media +compile flag(BMCWEB_ENABLE_VM_NBDPROXY). This is caused by above +mentioned recent change. + +Tested: + - Build is successful with enabled virtual media flag. + +Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> +Change-Id: I363a41a08fae9dc05b3553695b96ffd26948f696 +--- + redfish-core/lib/virtual_media.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp +index 685ee5c..99542c4 100644 +--- a/redfish-core/lib/virtual_media.hpp ++++ b/redfish-core/lib/virtual_media.hpp +@@ -635,7 +635,7 @@ class VirtualMediaActionInsertMedia : public Node + } + + bool paramsValid = validateParams( +- asyncResp->res, imageUrl, inserted, ++ asyncResp, imageUrl, inserted, + transferMethod, transferProtocolType); + + if (paramsValid == false) +-- +2.17.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 d9b32f5ae..7e9d42228 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -1,5 +1,5 @@ SRC_URI = "git://github.com/openbmc/bmcweb.git" -SRCREV = "dab0604af234bdd5010407031a01343d6c242edf" +SRCREV = "2ebb9683287cf6b1a2f2cc3c077bd99aceefa8dd" DEPENDS += "boost-url" RDEPENDS_${PN} += "phosphor-nslcd-authority-cert-config" @@ -14,20 +14,33 @@ GROUPADD_PARAM_${PN} = "web; redfish " SRC_URI += "file://0001-Firmware-update-configuration-changes.patch \ file://0002-Use-chip-id-based-UUID-for-Service-Root.patch \ - file://0004-bmcweb-handle-device-or-resource-busy-exception.patch \ - file://0006-Define-Redfish-interface-Registries-Bios.patch \ - file://0007-BIOS-config-Add-support-for-PATCH-operation.patch \ - file://0008-Add-support-to-ResetBios-action.patch \ - file://0009-Add-support-to-ChangePassword-action.patch \ file://0010-managers-add-attributes-for-Manager.CommandShell.patch \ - file://0034-recommended-fixes-by-crypto-review-team.patch \ file://0011-bmcweb-Add-PhysicalContext-to-Thermal-resources.patch \ file://0012-Log-RedFish-event-for-Invalid-login-attempt.patch \ file://0013-Add-UART-routing-logic-into-host-console-connection-.patch \ + file://0014-recommended-fixes-by-crypto-review-team.patch \ + file://0015-Add-state-sensor-messages-to-the-registry.patch \ + file://0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch \ + file://0017-Add-msg-registry-for-subscription-related-actions.patch \ " -# Temporary downstream mirror of upstream patch to enable feature in Intel builds. -SRC_URI += "file://0037-Add-state-sensor-messages-to-the-registry.patch \ +# OOB Bios Config: +SRC_URI += "file://biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch \ + file://biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch \ + file://biosconfig/0003-Add-support-to-ResetBios-action.patch \ + file://biosconfig/0004-Add-support-to-ChangePassword-action.patch \ + file://biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch \ +" + +# Virtual Media: Backend code is not upstreamed so downstream only patches. +SRC_URI += "file://vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch \ + file://vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch \ + file://vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch \ + file://vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch \ + 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-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch \ " # EventService: Temporary pulled to downstream. See eventservice\README for details @@ -36,26 +49,12 @@ SRC_URI += "file://eventservice/0001-EventService-Fix-retry-handling-for-http-cl file://eventservice/0004-Add-Server-Sent-Events-support.patch \ file://eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch \ file://eventservice/0006-Add-EventService-SSE-filter-support.patch \ + file://eventservice/0007-EventService-Log-events-for-subscription-actions.patch \ " # Temporary downstream mirror of upstream patches, see telemetry\README for details -SRC_URI += "file://telemetry/0003-Add-support-for-MetricDefinition-scheme.patch \ - file://telemetry/0004-Sync-Telmetry-service-with-EventService.patch \ -" - -SRC_URI += "file://0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch \ - file://0002-Invalid-status-code-from-InsertMedia-REST-methods.patch \ - file://0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch \ - file://0004-Bmcweb-handle-permission-denied-exception.patch \ - file://0005-Fix-unmounting-image-in-proxy-mode.patch \ -" - -SRC_URI += "file://0038-Revert-Disable-nbd-proxy-from-the-build.patch \ - file://0039-Fix-comparison-for-proxy-legacy-mode.patch \ -" - -# Fix to avoid bmcweb crash on VM mount -SRC_URI += "file://0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch \ +SRC_URI += " file://telemetry/0003-Add-support-for-MetricDefinition-scheme.patch \ + file://telemetry/0004-Sync-Telmetry-service-with-EventService.patch \ " # Temporary fix: Move it to service file diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json index 656207de6..73fb214a2 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-config/channel_config.json @@ -36,6 +36,7 @@ "name" : "eth0", "is_valid" : true, "active_sessions" : 0, + "is_management_nic" : true, "channel_info" : { "medium_type" : "lan-802.3", "protocol_type" : "ipmb-1.0", diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend index cc9f2d025..a84352929 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-kcs_%.bbappend @@ -11,7 +11,7 @@ SMM_DEVICE = "ipmi_kcs4" SYSTEMD_SERVICE_${PN}_append = " ${PN}@${SMM_DEVICE}.service " SRC_URI = "git://github.com/openbmc/kcsbridge.git" -SRCREV = "3b170152ddc967f270939f4c351be987c451f0ca" +SRCREV = "03e6defcbca99c9c00cd37c4afb1d2b415a92acd" SRC_URI += "file://99-ipmi-kcs.rules" 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 7fe91fd1f..56b581ce7 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net_%.bbappend @@ -3,7 +3,7 @@ inherit useradd # TODO: This should be removed, once up-stream bump up # issue is resolved SRC_URI += "git://github.com/openbmc/phosphor-net-ipmid" -SRCREV = "d4a4bed525f79c39705fa526b20ab663bb2c2069" +SRCREV = "7b645018775b85a0c61148e592d951841809eef9" USERADD_PACKAGES = "${PN}" # add a group called ipmi diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend new file mode 100644 index 000000000..83fd20bdb --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/leds/phosphor-led-manager_%.bbappend @@ -0,0 +1,13 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +RDEPENDS_${PN}_remove = "clear-once" + +do_compile_prepend(){ + install -m 0644 ${STAGING_DATADIR_NATIVE}/${PN}/led.yaml ${S} +} + +do_install_append(){ + rm -f ${S}/led.yaml +} + + diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb index 6c930876f..6881a8065 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libmctp-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libmctp_intel" DESCRIPTION = "Implementation of MCTP(DMTF DSP0236)" SRC_URI = "git://github.com/Intel-BMC/libmctp.git;protocol=ssh" -SRCREV = "37ea118aa8653cc6220c4fd6da0224f0797f4bdc" +SRCREV = "807b80296c9793900f46ba5675e5e739fc18dafd" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb index ee6fd12ee..67b7d2b42 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/libpldm-intel_git.bb @@ -2,7 +2,7 @@ SUMMARY = "libpldm_intel" DESCRIPTION = "Provides encode/decode APIs for PLDM specifications" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "0b73929a2116d9e1386e7e95190787bed7e715a8" S = "${WORKDIR}/git/libpldm_intel" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb index b9d3c0ca4..7527e949d 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-emulator.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" S = "${WORKDIR}/git/mctp_emulator" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb index afe199192..f9c2adcb5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctp-wrapper.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=bcd9ada3a943f58551867d72893cc9ab" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" S = "${WORKDIR}/git/mctp_wrapper" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb index 96582c76e..78244d0ba 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpd.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://${PN}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "e850d4ad2f72698e51f0a95bb949aa7a6055ccd6" S = "${WORKDIR}/git" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb index c36c0d926..055b9b7e4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/mctpwplus.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=615045c30a05cde5c0e924854d43c327" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" S = "${WORKDIR}/git/mctpwplus" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb index 8a73394e5..2f0e2c8e7 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/nvmemi-daemon.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI = "git://github.com/Intel-BMC/nvme-mi.git;protocol=ssh" -SRCREV = "832c63d3db86788859f4afb911840f5ba100d230" +SRCREV = "f3ba26e5fd3542d3c30b1069c4c1439a637f42ba" S = "${WORKDIR}/git" PV = "1.0+git${SRCPV}" 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 4a2a33878..3d747004a 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pldmd.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" SRC_URI += "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "0b73929a2116d9e1386e7e95190787bed7e715a8" S = "${WORKDIR}/git/pldmd" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb index 134cd9fdd..1ad639ba1 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/pmci/pmci-launcher.bb @@ -5,7 +5,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/pmci.git;protocol=ssh" -SRCREV = "196f057fe8efea8080ec71ad4159df0675dd6a4c" +SRCREV = "5ee1b657ccfc61f4dac4a4d59da62a781065b0ad" S = "${WORKDIR}/git/pmci_launcher" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch new file mode 100644 index 000000000..fb38b0348 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors/0006-CPUSensor-create-RequirediTempSensor-if-defined.patch @@ -0,0 +1,234 @@ +From f516fc884fcbc03bf560b4ef975ad236232bd1e6 Mon Sep 17 00:00:00 2001 +From: Zhikui Ren <zhikui.ren@intel.com> +Date: Tue, 11 May 2021 11:14:55 -0700 +Subject: [PATCH] CPUSensor: create RequiredTempSensor if defined + +When BMC fails to talk to CPU through PECI, no +CPU sensors are created. Fan speed control only boost +fan when input sensor is not available. It does not +have the knowledge of which sensors are expected to +be present and can't treat "missing" sensor as failed one. +The failure on PECI goes unnoticed and we can have a thermal +run away. + +Query sensor config for RequiredTempSensor for any present +CPUs. Create a CPU sensor that is not available. +This sensor will be replaced by a normal CPU sensor when +peci detect the CPU and associated hwmon file is discovered. + +This is an initial patch that target to address the particular +failure case. More work will follow to support a more generic +"Required" sensor config. + +Signed-off-by: Zhikui Ren <zhikui.ren@intel.com> +--- + include/CPUSensor.hpp | 9 ++++++ + src/CPUSensor.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++ + src/CPUSensorMain.cpp | 54 ++++++++++++++++++++++++++++----- + 3 files changed, 124 insertions(+), 8 deletions(-) + +diff --git a/include/CPUSensor.hpp b/include/CPUSensor.hpp +index 29b8209..5d09e4e 100644 +--- a/include/CPUSensor.hpp ++++ b/include/CPUSensor.hpp +@@ -26,6 +26,15 @@ class CPUSensor : public Sensor + std::vector<thresholds::Threshold>&& thresholds, + const std::string& configuration, int cpuId, bool show, + double dtsOffset); ++ ++ // Create a CPUSensor without a path to sensor value ++ CPUSensor(const std::string& objectType, ++ sdbusplus::asio::object_server& objectServer, ++ std::shared_ptr<sdbusplus::asio::connection>& conn, ++ boost::asio::io_service& io, const std::string& sensorName, ++ std::vector<thresholds::Threshold>&& thresholdsIn, ++ const std::string& sensorConfiguration); ++ + ~CPUSensor() override; + static constexpr unsigned int sensorScaleFactor = 1000; + static constexpr unsigned int sensorPollMs = 1000; +diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp +index 7f9a2c5..7c29cf0 100644 +--- a/src/CPUSensor.cpp ++++ b/src/CPUSensor.cpp +@@ -99,6 +99,75 @@ CPUSensor::CPUSensor(const std::string& path, const std::string& objectType, + setupRead(); + } + ++// Create a dummy "not available" CPUSensor ++// This is used to indicate a missing required sensor for ++// other services like fan control ++CPUSensor::CPUSensor(const std::string& objectType, ++ sdbusplus::asio::object_server& objectServer, ++ std::shared_ptr<sdbusplus::asio::connection>& conn, ++ boost::asio::io_service& io, const std::string& sensorName, ++ std::vector<thresholds::Threshold>&& thresholdsIn, ++ const std::string& sensorConfiguration) : ++ Sensor(boost::replace_all_copy(sensorName, " ", "_"), ++ std::move(thresholdsIn), sensorConfiguration, objectType, 0, 0, conn, ++ PowerState::on), ++ objServer(objectServer), inputDev(io), waitTimer(io), ++ privTcontrol(std::numeric_limits<double>::quiet_NaN()), dtsOffset(0), ++ show(true), pollTime(CPUSensor::sensorPollMs), minMaxReadCounter(0) ++{ ++ // assume it is a temperature sensor for now ++ // support for other type can be added later ++ std::string interfacePath = ++ "/xyz/openbmc_project/sensors/temperature/" + name; ++ const char* units = sensor_paths::unitDegreesC; ++ minValue = -128; ++ maxValue = 127; ++ ++ sensorInterface = objectServer.add_interface( ++ interfacePath, "xyz.openbmc_project.Sensor.Value"); ++ ++ sensorInterface->register_property("Unit", units); ++ sensorInterface->register_property("MaxValue", maxValue); ++ sensorInterface->register_property("MinValue", minValue); ++ sensorInterface->register_property( ++ "Value", value, [&](const double& newValue, double& oldValue) { ++ return setSensorValue(newValue, oldValue); ++ }); ++ if (!sensorInterface->initialize()) ++ { ++ std::cerr << "error initializing value interface\n"; ++ } ++ ++ if (!availableInterface) ++ { ++ availableInterface = std::make_shared<sdbusplus::asio::dbus_interface>( ++ conn, sensorInterface->get_object_path(), availableInterfaceName); ++ availableInterface->register_property( ++ "Available", false, [this](const bool propIn, bool& old) { ++ if (propIn == old) ++ { ++ return 1; ++ } ++ old = propIn; ++ if (!propIn) ++ { ++ updateValue(std::numeric_limits<double>::quiet_NaN()); ++ } ++ return 1; ++ }); ++ availableInterface->initialize(); ++ } ++ if (!operationalInterface) ++ { ++ operationalInterface = ++ std::make_shared<sdbusplus::asio::dbus_interface>( ++ conn, sensorInterface->get_object_path(), ++ operationalInterfaceName); ++ operationalInterface->register_property("Functional", true); ++ operationalInterface->initialize(); ++ } ++} ++ + CPUSensor::~CPUSensor() + { + // close the input dev to cancel async operations +diff --git a/src/CPUSensorMain.cpp b/src/CPUSensorMain.cpp +index 92c1716..4c00551 100644 +--- a/src/CPUSensorMain.cpp ++++ b/src/CPUSensorMain.cpp +@@ -332,10 +332,9 @@ bool createSensors(boost::asio::io_service& io, + { + if (debug) + { +- std::cout << "Skipped: " << inputPath << ": " << sensorName +- << " is already created\n"; ++ std::cout << "Will be replaced: " << inputPath << ": " ++ << sensorName << " is already created\n"; + } +- continue; + } + + // check hidden properties +@@ -636,9 +635,9 @@ void detectCpuAsync( + }); + } + +-bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, ++bool getCpuConfig(std::shared_ptr<sdbusplus::asio::connection>& systemBus, + boost::container::flat_set<CPUConfig>& cpuConfigs, +- ManagedObjectType& sensorConfigs, ++ ManagedObjectType& sensorConfigs, boost::asio::io_service& io, + sdbusplus::asio::object_server& objectServer) + { + bool useCache = false; +@@ -700,6 +699,45 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, + iface->register_property("Present", *present); + iface->initialize(); + inventoryIfaces[name] = std::move(iface); ++ if (*present) ++ { ++ // create required CPU sensors here in unavailable state ++ auto findRequiredTempSensor = ++ config.second.find("RequiredTempSensor"); ++ auto findCpuId = config.second.find("CpuID"); ++ if (findRequiredTempSensor != config.second.end() && ++ findCpuId != config.second.end()) ++ { ++ std::string label = ++ std::visit(VariantToStringVisitor(), ++ findRequiredTempSensor->second); ++ // for temp sensor hwmon sysfs use input ++ std::string item{"input"}; ++ int cpuId = ++ std::visit(VariantToUnsignedIntVisitor(), ++ findCpuId->second); ++ std::string requiredSensorName = ++ createSensorName(label, item, cpuId); ++ ++ auto& sensorPtr = gCpuSensors[requiredSensorName]; ++ if (sensorPtr == nullptr) ++ { ++ // created a dummy sensor for required sensor, ++ // will be replaced with a real one if it is ++ // detected ++ std::string objectType{}; ++ std::vector<thresholds::Threshold> ++ emptyThreshold{}; ++ std::string emptyConfig{}; ++ sensorPtr = std::make_unique<CPUSensor>( ++ objectType, objectServer, systemBus, io, ++ requiredSensorName, ++ std::move(emptyThreshold), emptyConfig); ++ std::cout << "created required CPU sensor " ++ << requiredSensorName << "\n"; ++ } ++ } ++ } + } + + auto findBus = config.second.find("Bus"); +@@ -728,7 +766,6 @@ bool getCpuConfig(const std::shared_ptr<sdbusplus::asio::connection>& systemBus, + std::cout << "name: " << name << "\n"; + std::cout << "type: " << type << "\n"; + } +- + cpuConfigs.emplace(bus, addr, name, State::OFF); + } + } +@@ -764,7 +801,8 @@ int main() + return; // we're being canceled + } + +- if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, objectServer)) ++ if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, io, ++ objectServer)) + { + detectCpuAsync(pingTimer, creationTimer, io, objectServer, + systemBus, cpuConfigs, sensorConfigs); +@@ -792,7 +830,7 @@ int main() + return; // we're being canceled + } + +- if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, ++ if (getCpuConfig(systemBus, cpuConfigs, sensorConfigs, io, + objectServer)) + { + detectCpuAsync(pingTimer, creationTimer, io, objectServer, +-- +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 c00b5d4cf..361e425e5 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/sensors/dbus-sensors_%.bbappend @@ -1,7 +1,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" PROJECT_SRC_DIR := "${THISDIR}/${PN}" -SRCREV = "6b6891c52e550c42507d4b413cbc4c6a09235535" +SRCREV = "13b63f8f597d396db8b5bd182ac2e5814d599e2f" #SRC_URI = "git://github.com/openbmc/dbus-sensors.git" SRC_URI += "\ @@ -11,6 +11,7 @@ SRC_URI += "\ file://0003-Fix-missing-threshold-de-assert-event-when-threshold.patch \ file://0004-Fan-Tach-Sensor-Threshold-Ignore-Zero.patch \ file://0005-Fix-PECI-ioctl-number.patch \ + file://0006-CPUSensor-create-RequirediTempSensor-if-defined.patch \ " DEPENDS_append = " libgpiod libmctp" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb index c77e5ace6..adcdd0588 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/special-mode-mgr/special-mode-mgr_git.bb @@ -9,7 +9,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e" SRC_URI = "git://github.com/Intel-BMC/special-mode-manager.git;protocol=ssh" -SRCREV = "32ea1e19df9e5179054d87617468664367dfab80" +SRCREV = "4f4f122790b999dc7db973a80727dbc1ca785e57" EXTRA_OECMAKE += "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'validation-unsecure', '-DBMC_VALIDATION_UNSECURE_FEATURE=ON', '', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb index 0dae2be3c..e0e10f7b7 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/system/callback-manager.bb @@ -7,7 +7,7 @@ inherit cmake systemd DEPENDS = "boost sdbusplus" PV = "0.1+git${SRCPV}" -SRCREV = "291d6388e0b770e89091935bc4edc7f371874666" +SRCREV = "52639bebada24990c3514786d65598dc5557477a" S = "${WORKDIR}/git/callback-manager" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend index 42f23dd9e..34a93fb6c 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/telemetry/telemetry_%.bbappend @@ -1,6 +1,6 @@ SRC_URI = "git://github.com/openbmc/telemetry.git" -SRCREV = "f763c9e3bbe0f86a4a41e7bb0dc70bffde0af9b2" +SRCREV = "32859b634e366a015331fb8ab62766340df9c7b8" -EXTRA_OEMESON += " -Dmax-reports=5" +EXTRA_OEMESON += " -Dmax-reports=10" EXTRA_OEMESON += " -Dmax-reading-parameters=200" -EXTRA_OEMESON += " -Dmin-interval=5000" +EXTRA_OEMESON += " -Dmin-interval=1000" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend index c9f14f54c..43fd25df4 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/users/phosphor-user-manager_%.bbappend @@ -1,7 +1,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" SRC_URI = "git://github.com/openbmc/phosphor-user-manager" -SRCREV = "18c1b42c1612e0e8d8f5cd9973bba09b447c7185" +SRCREV = "e6500a493a156dd58a92b384c77aef2cbd3addac" EXTRA_OECONF += "${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], '', '--disable-root_user_mgmt', d)}" diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch index a634b1588..07ac95c89 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/watchdog/phosphor-watchdog/0001-Customize-phosphor-watchdog-for-Intel-platforms.patch @@ -1,4 +1,4 @@ -From 67797d726b6eb6fa8e1dad063c7d2021cec47ab3 Mon Sep 17 00:00:00 2001 +From 5760937ef1ae9a4610b47ba64fdebe594fc2c9df Mon Sep 17 00:00:00 2001 From: James Feist <james.feist@linux.intel.com> Date: Mon, 17 Jun 2019 12:00:58 -0700 Subject: [PATCH] Customize phosphor-watchdog for Intel platforms @@ -22,14 +22,14 @@ Signed-off-by: Sunita Kumari <sunitax.kumari@intel.com> %% original patch: 0001-Customize-phosphor-watchdog-for-Intel-platforms.patch --- - watchdog.cpp | 230 ++++++++++++++++++++++++++++++++++++++++++++++++--- - watchdog.hpp | 23 +++++- + src/watchdog.cpp | 230 ++++++++++++++++++++++++++++++++++++++++++++--- + src/watchdog.hpp | 23 ++++- 2 files changed, 242 insertions(+), 11 deletions(-) -diff --git a/watchdog.cpp b/watchdog.cpp -index 57e9050..1204db4 100644 ---- a/watchdog.cpp -+++ b/watchdog.cpp +diff --git a/src/watchdog.cpp b/src/watchdog.cpp +index 57e905059153..1204db4cab0f 100644 +--- a/src/watchdog.cpp ++++ b/src/watchdog.cpp @@ -1,11 +1,14 @@ #include "watchdog.hpp" @@ -300,10 +300,10 @@ index 57e9050..1204db4 100644 } catch (const SdBusError& e) { -diff --git a/watchdog.hpp b/watchdog.hpp -index 7de9bb3..b004b7a 100644 ---- a/watchdog.hpp -+++ b/watchdog.hpp +diff --git a/src/watchdog.hpp b/src/watchdog.hpp +index 7de9bb38419c..b004b7ab4e3f 100644 +--- a/src/watchdog.hpp ++++ b/src/watchdog.hpp @@ -68,7 +68,18 @@ class Watchdog : public WatchdogInherits WatchdogInherits(bus, objPath), bus(bus), actionTargetMap(std::move(actionTargetMap)), diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend index 7ebf1d4d6..618f4dddb 100644 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/webui/webui-vue_%.bbappend @@ -1,6 +1,6 @@ # Enable downstream autobump SRC_URI = "git://github.com/openbmc/webui-vue.git" -SRCREV = "5ed21f2d1e8b82be699a623bfdef550dfd598dbb" +SRCREV = "71114feb9a800d42f6eeddfa477077a8ab8e44f6" do_compile_prepend() { cp -vf ${S}/.env.intel ${S}/.env diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0001-Force-nbdkit-to-send-PATCH-as-upload-method.patch b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0001-Force-nbdkit-to-send-PATCH-as-upload-method.patch index 83f015a76..dc7f7b924 100644 --- a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0001-Force-nbdkit-to-send-PATCH-as-upload-method.patch +++ b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0001-Force-nbdkit-to-send-PATCH-as-upload-method.patch @@ -23,7 +23,7 @@ diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c index 0ed3984..804ad78 100644 --- a/plugins/curl/curl.c +++ b/plugins/curl/curl.c -@@ -525,6 +525,7 @@ static int +@@ -787,6 +787,7 @@ static int curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) { struct curl_handle *h = handle; @@ -31,10 +31,10 @@ index 0ed3984..804ad78 100644 CURLcode r; char range[128]; -@@ -535,15 +536,21 @@ curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) +@@ -800,15 +801,21 @@ curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) h->read_count = count; - curl_easy_setopt (h->c, CURLOPT_UPLOAD, 1); + curl_easy_setopt (h->c, CURLOPT_UPLOAD, 1L); + curl_easy_setopt (h->c, CURLOPT_CUSTOMREQUEST, "PATCH"); /* Make an HTTP range request. */ @@ -55,7 +55,7 @@ index 0ed3984..804ad78 100644 display_curl_error (h, r, "pwrite: curl_easy_perform"); return -1; } -@@ -554,6 +561,10 @@ curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) +@@ -819,6 +826,10 @@ curl_pwrite (void *handle, const void *buf, uint32_t count, uint64_t offset) /* As far as I understand the cURL API, this should never happen. */ assert (h->read_count == 0); diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0002-Add-support-for-ssl-config.patch b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0002-Add-support-for-ssl-config.patch index c597cb3a4..cec2813e9 100644 --- a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0002-Add-support-for-ssl-config.patch +++ b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit/0002-Add-support-for-ssl-config.patch @@ -3,14 +3,14 @@ index 610511f7..92be4656 100644 --- a/plugins/curl/curl.c +++ b/plugins/curl/curl.c @@ -69,6 +69,8 @@ static const char *proxy = NULL; - static char *proxy_password = NULL; - static const char *proxy_user = NULL; - static bool sslverify = true; -+static const char *ssl_version = NULL; -+static const char *ssl_cipher_list = NULL; - static bool tcp_keepalive = false; - static bool tcp_nodelay = true; - static uint32_t timeout = 0; + char *proxy_password = NULL; + const char *proxy_user = NULL; + bool sslverify = true; ++const char *ssl_version = NULL; ++const char *ssl_cipher_list = NULL; + bool tcp_keepalive = false; + bool tcp_nodelay = true; + uint32_t timeout = 0; @@ -232,6 +234,12 @@ curl_config (const char *key, const char *value) sslverify = r; } diff --git a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit_git.bb b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit_git.bb index 01b3fc27e..89072b090 100644 --- a/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit_git.bb +++ b/meta-openbmc-mods/meta-common/recipes-utilities/nbdkit/nbdkit_git.bb @@ -7,14 +7,14 @@ nbdkit is a toolkit for creating NBD servers." HOMEPAGE = "https://github.com/libguestfs/nbdkit" LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://LICENSE;md5=4332a97808994cf2133a65b6c6f33eaf" +LIC_FILES_CHKSUM = "file://LICENSE;md5=f9dcc2d8acdde215fa4bd6ac12bb14f0" SRC_URI = "git://github.com/libguestfs/nbdkit.git;protocol=https" SRC_URI += "file://0001-Force-nbdkit-to-send-PATCH-as-upload-method.patch" SRC_URI += "file://0002-Add-support-for-ssl-config.patch" -PV = "1.17.5+git${SRCPV}" -SRCREV = "c8406880c6603bb617dae131dd0a8826c05869ca" +PV = "1.25.5+git${SRCPV}" +SRCREV = "c828c6d48ff6b69454cad98054a1920d03c4b4c7" S = "${WORKDIR}/git" |