aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/docker-builds-checks.yml2
-rw-r--r--hw/ipmi/ipmi-rtc.c117
-rw-r--r--hw/lpc-uart.c10
-rw-r--r--libstb/Makefile.inc15
l---------opal-ci/Dockerfile-docs2
-rw-r--r--opal-ci/Dockerfile-fedora-rawhide2
-rw-r--r--opal-ci/Dockerfile-fedora42 (renamed from opal-ci/Dockerfile-fedora40)2
-rw-r--r--opal-ci/Dockerfile-ubuntu-24.04 (renamed from opal-ci/Dockerfile-ubuntu-20.04)4
-rwxr-xr-xopal-ci/build-fedora42.sh (renamed from opal-ci/build-fedora40.sh)0
-rwxr-xr-xopal-ci/build-ubuntu-24.04.sh (renamed from opal-ci/build-ubuntu-20.04.sh)2
10 files changed, 115 insertions, 41 deletions
diff --git a/.github/workflows/docker-builds-checks.yml b/.github/workflows/docker-builds-checks.yml
index e80f27b..22fdbc8 100644
--- a/.github/workflows/docker-builds-checks.yml
+++ b/.github/workflows/docker-builds-checks.yml
@@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
- os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-rolling, fedora40, fedora41, fedora-rawhide, docs ]
+ os: [ ubuntu-22.04, ubuntu-24.04, ubuntu-rolling, fedora41, fedora42, fedora-rawhide, docs ]
steps:
- uses: actions/checkout@v4
diff --git a/hw/ipmi/ipmi-rtc.c b/hw/ipmi/ipmi-rtc.c
index 52da294..9373e89 100644
--- a/hw/ipmi/ipmi-rtc.c
+++ b/hw/ipmi/ipmi-rtc.c
@@ -8,17 +8,29 @@
#include <stdlib.h>
#include <string.h>
#include <ipmi.h>
+#include <lock.h>
#include <time.h>
#include <time-utils.h>
#include <device.h>
#include <opal.h>
#include <rtc.h>
-static enum {idle, waiting, updated, error} time_status;
+static struct lock time_lock = LOCK_UNLOCKED;
+static enum {
+ idle,
+ waiting,
+ read_updated,
+ write_success,
+ read_error,
+ write_error,
+ write_wrong_state,
+} time_status;
static void get_sel_time_error(struct ipmi_msg *msg)
{
- time_status = error;
+ lock(&time_lock);
+ time_status = read_error;
+ unlock(&time_lock);
ipmi_free_msg(msg);
}
@@ -31,8 +43,31 @@ static void get_sel_time_complete(struct ipmi_msg *msg)
memcpy(&result, msg->data, 4);
time = le32_to_cpu(result);
gmtime_r(&time, &tm);
+ lock(&time_lock);
rtc_cache_update(&tm);
- time_status = updated;
+ time_status = read_updated;
+ unlock(&time_lock);
+ ipmi_free_msg(msg);
+}
+
+static void set_sel_time_error(struct ipmi_msg *msg)
+{
+ lock(&time_lock);
+ if (msg->cc == IPMI_NOT_IN_MY_STATE_ERR) {
+ /* BMC in NTP mode does not allow this */
+ time_status = write_wrong_state;
+ } else {
+ time_status = write_error;
+ }
+ unlock(&time_lock);
+ ipmi_free_msg(msg);
+}
+
+static void set_sel_time_complete(struct ipmi_msg *msg)
+{
+ lock(&time_lock);
+ time_status = write_success;
+ unlock(&time_lock);
ipmi_free_msg(msg);
}
@@ -55,49 +90,52 @@ static int64_t ipmi_set_sel_time(uint32_t _tv)
struct ipmi_msg *msg;
const le32 tv = cpu_to_le32(_tv);
- msg = ipmi_mkmsg_simple(IPMI_SET_SEL_TIME, (void*)&tv, sizeof(tv));
+ msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE, IPMI_SET_SEL_TIME,
+ set_sel_time_complete, NULL, (void *)&tv, sizeof(tv), 0);
if (!msg)
return OPAL_HARDWARE;
+ msg->error = set_sel_time_error;
+
return ipmi_queue_msg(msg);
}
static int64_t ipmi_opal_rtc_read(__be32 *__ymd, __be64 *__hmsm)
{
- int ret = 0;
uint32_t ymd;
uint64_t hmsm;
if (!__ymd || !__hmsm)
return OPAL_PARAMETER;
- switch(time_status) {
+ lock(&time_lock);
+ switch (time_status) {
case idle:
- if (ipmi_get_sel_time() < 0)
- return OPAL_HARDWARE;
time_status = waiting;
- ret = OPAL_BUSY_EVENT;
- break;
-
- case waiting:
- ret = OPAL_BUSY_EVENT;
- break;
-
- case updated:
+ unlock(&time_lock);
+ return ipmi_get_sel_time();
+ case read_updated:
rtc_cache_get_datetime(&ymd, &hmsm);
*__ymd = cpu_to_be32(ymd);
*__hmsm = cpu_to_be64(hmsm);
time_status = idle;
- ret = OPAL_SUCCESS;
- break;
-
- case error:
+ unlock(&time_lock);
+ return OPAL_SUCCESS;
+ case waiting:
+ unlock(&time_lock);
+ return OPAL_BUSY_EVENT;
+ case read_error:
+ time_status = idle;
+ unlock(&time_lock);
+ return OPAL_HARDWARE;
+ default:
+ /* Clear out stale write status */
time_status = idle;
- ret = OPAL_HARDWARE;
- break;
+ unlock(&time_lock);
+ return OPAL_BUSY;
}
- return ret;
+ return OPAL_INTERNAL_ERROR;
}
static int64_t ipmi_opal_rtc_write(uint32_t year_month_day,
@@ -106,12 +144,37 @@ static int64_t ipmi_opal_rtc_write(uint32_t year_month_day,
time_t t;
struct tm tm;
- datetime_to_tm(year_month_day, hour_minute_second_millisecond, &tm);
- t = mktime(&tm);
- if (ipmi_set_sel_time(t))
+ lock(&time_lock);
+ switch (time_status) {
+ case idle:
+ time_status = waiting;
+ unlock(&time_lock);
+ datetime_to_tm(year_month_day, hour_minute_second_millisecond, &tm);
+ t = mktime(&tm);
+ return ipmi_set_sel_time(t);
+ case write_success:
+ time_status = idle;
+ unlock(&time_lock);
+ return OPAL_SUCCESS;
+ case waiting:
+ unlock(&time_lock);
+ return OPAL_BUSY_EVENT;
+ case write_error:
+ time_status = idle;
+ unlock(&time_lock);
return OPAL_HARDWARE;
+ case write_wrong_state:
+ time_status = idle;
+ unlock(&time_lock);
+ return OPAL_WRONG_STATE;
+ default:
+ /* Clear out stale read status */
+ time_status = idle;
+ unlock(&time_lock);
+ return OPAL_BUSY;
+ }
- return OPAL_SUCCESS;
+ return OPAL_INTERNAL_ERROR;
}
void ipmi_rtc_init(void)
diff --git a/hw/lpc-uart.c b/hw/lpc-uart.c
index c0f9c52..859d654 100644
--- a/hw/lpc-uart.c
+++ b/hw/lpc-uart.c
@@ -98,10 +98,16 @@ static inline void uart_write(unsigned int reg, uint8_t val)
static bool uart_check_tx_room(void)
{
+ uint8_t reg;
+
if (tx_room)
return true;
- if (uart_read(REG_LSR) & LSR_THRE) {
+ reg = uart_read(REG_LSR);
+ if (reg == 0xff)
+ return false;
+
+ if (reg & LSR_THRE) {
/* FIFO is 16 entries */
tx_room = 16;
tx_full = false;
@@ -337,7 +343,7 @@ static int64_t uart_opal_write_buffer_space(int64_t term_number,
lock(&uart_lock);
tx_buf_len = uart_tx_buf_space();
- if ((tx_buf_len < be64_to_cpu(*__length)) && uart_timed_out(1000))
+ if (uart_timed_out(1000))
ret = OPAL_TIMEOUT;
*__length = cpu_to_be64(tx_buf_len);
diff --git a/libstb/Makefile.inc b/libstb/Makefile.inc
index f8df787..8c4536f 100644
--- a/libstb/Makefile.inc
+++ b/libstb/Makefile.inc
@@ -19,18 +19,23 @@ CPPFLAGS += -I$(SRC)/$(LIBSTB_DIR)/crypto/mbedtls/include
CPPFLAGS += -I$(SRC)/$(LIBSTB_DIR)/ibmtpm20tss/utils
CFLAGS += -DTPM_SKIBOOT
+ifneq ($(SSL_DIR),)
+HOSTCFLAGS += -I$(SSL_DIR)/include
+HOSTLDFLAGS += -L$(SSL_DIR)/lib -Wl,-rpath,$(SSL_DIR)/lib
+endif
+
$(LIBSTB): $(LIBSTB_OBJS:%=$(LIBSTB_DIR)/%) $(DRIVERS) $(SECVAR) $(CRYPTO) $(TSS2)
libstb/create-container: libstb/create-container.c libstb/container-utils.c
- $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) \
+ $(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) \
-Wpadded -O0 -g -I$(SRC) -I$(SRC)/include -o $@ $^ -lssl -lcrypto,$<)
libstb/print-container: HOSTCFLAGS += -Wno-error=deprecated-declarations
libstb/print-container: libstb/print-container.c libstb/container-utils.c
- $(call Q, HOSTCC , $(HOSTCC) $(HOSTCFLAGS) \
+ $(call Q, HOSTCC , $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) \
-O0 -g -I$(SRC) -I$(SRC)/include -o $@ $^ -lssl -lcrypto, $<)
-clean: create-container-clean
+clean: container-utils-clean
-create-container-clean:
- $(RM) libstb/create-container
+container-utils-clean:
+ $(RM) libstb/create-container libstb/print-container
diff --git a/opal-ci/Dockerfile-docs b/opal-ci/Dockerfile-docs
index 90ccf09..e6a1ba5 120000
--- a/opal-ci/Dockerfile-docs
+++ b/opal-ci/Dockerfile-docs
@@ -1 +1 @@
-Dockerfile-fedora40 \ No newline at end of file
+Dockerfile-fedora41 \ No newline at end of file
diff --git a/opal-ci/Dockerfile-fedora-rawhide b/opal-ci/Dockerfile-fedora-rawhide
index b97ec50..43e6bf6 100644
--- a/opal-ci/Dockerfile-fedora-rawhide
+++ b/opal-ci/Dockerfile-fedora-rawhide
@@ -3,7 +3,7 @@ RUN dnf -y update
RUN dnf -y install --allowerasing wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache dtc openssl openssl-devel gcc-powerpc64-linux-gnu mbedtls-devel which qemu-system-ppc
# for building documentation and the coverage report
RUN dnf -y install python-pip lcov
-RUN if [ `arch` = "x86_64" ]; then dnf -y install https://public.dhe.ibm.com/software/server/powerfuncsim/p9/packages/v1.1-0/systemsim-p9-1.1-0.f22.x86_64.rpm; fi
+RUN if [ `arch` = "x86_64" ]; then rpm -i --define "_pkgverify_flags 0" https://public.dhe.ibm.com/software/server/powerfuncsim/p9/packages/v1.1-0/systemsim-p9-1.1-0.f22.x86_64.rpm; fi
RUN if [ `arch` = "x86_64" ]; then dnf -y install https://public.dhe.ibm.com/software/server/powerfuncsim/p10/packages/v1.2-1/rhel8/systemsim-p10-1.2-1.x86_64.rpm; fi
COPY . /build/
WORKDIR /build
diff --git a/opal-ci/Dockerfile-fedora40 b/opal-ci/Dockerfile-fedora42
index efd43a7..9c4e581 100644
--- a/opal-ci/Dockerfile-fedora40
+++ b/opal-ci/Dockerfile-fedora42
@@ -1,4 +1,4 @@
-FROM registry.fedoraproject.org/fedora:40
+FROM registry.fedoraproject.org/fedora:42
RUN dnf -y update
RUN dnf -y install --allowerasing wget curl xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel ccache dtc openssl openssl-devel gcc-powerpc64-linux-gnu mbedtls-devel which qemu-system-ppc
# for building documentation and the coverage report
diff --git a/opal-ci/Dockerfile-ubuntu-20.04 b/opal-ci/Dockerfile-ubuntu-24.04
index 8333b12..18d4d83 100644
--- a/opal-ci/Dockerfile-ubuntu-20.04
+++ b/opal-ci/Dockerfile-ubuntu-24.04
@@ -1,9 +1,9 @@
-FROM ubuntu:20.04
+FROM ubuntu:24.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -qq
RUN if [ `arch` != "ppc64le" ]; then apt-get install -y gcc-powerpc64le-linux-gnu; fi
RUN apt-get install -y gcc-arm-linux-gnueabi || true
-RUN apt-get install -y gcc ccache expect libssl-dev wget curl xterm device-tree-compiler build-essential gcc python g++ pkg-config libz-dev libglib2.0-dev libpixman-1-dev libfdt-dev git libstdc++6 valgrind libtcl8.6 libmbedtls-dev
+RUN apt-get install -y gcc ccache expect libssl-dev wget curl xterm device-tree-compiler build-essential gcc python3 g++ pkg-config libz-dev libglib2.0-dev libpixman-1-dev libfdt-dev git libstdc++6 valgrind libtcl8.6 libmbedtls-dev
RUN if [ `arch` = "x86_64" ]; then curl -O https://public.dhe.ibm.com/software/server/powerfuncsim/p9/packages/v1.1-0/systemsim-p9-1.1-0-trusty_amd64.deb; dpkg -i systemsim-p9-1.1-0-trusty_amd64.deb; fi
RUN if [ `arch` = "x86_64" ]; then curl -O https://public.dhe.ibm.com/software/server/powerfuncsim/p10/packages/v1.2-1/ubuntu2004/systemsim-p10_1.2-1_amd64.deb; dpkg -i systemsim-p10_1.2-1_amd64.deb; fi
COPY . /build/
diff --git a/opal-ci/build-fedora40.sh b/opal-ci/build-fedora42.sh
index 7c607a1..7c607a1 100755
--- a/opal-ci/build-fedora40.sh
+++ b/opal-ci/build-fedora42.sh
diff --git a/opal-ci/build-ubuntu-20.04.sh b/opal-ci/build-ubuntu-24.04.sh
index 48eb825..ba070b4 100755
--- a/opal-ci/build-ubuntu-20.04.sh
+++ b/opal-ci/build-ubuntu-24.04.sh
@@ -4,7 +4,7 @@ set -uo pipefail
set -e
set -vx
-MAKE_J=$(grep -c processor /proc/cpuinfo)
+MAKE_J=$(nproc)
export CROSS="ccache powerpc64le-linux-gnu-"