From 020f32e4026f3041477eaf7dbc9f270af94376ed Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Wed, 4 Dec 2019 14:10:10 -0800 Subject: Makefile: Make loop unrolling fully controllable by the caller We recently reactivated the -DUNROLL_LOOPS code for x86 devices. Unfortunatley, this seems to lead to code size problems for early firmware stages on certain x86 boards (CB:37475). The biggest speedup with unrolled loops was observed during kernel verification anyway (which hashes orders of magnitude more data than firmware verification), so let's make this fully configurable by the calling firmware and only enable it from depthcharge. Pre-RAM coreboot changes are probably better served with the smaller implementation anyway (and this will only become more important as we move to CBFS per-file hashing and need hash algorithms in every stage). BRANCH=None BUG=None TEST=None Cq-Depend: chromium:1951413 Change-Id: I87eaa14299cae0ee0d0b4a098d638b6bccdaf75b Signed-off-by: Julius Werner Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1951782 Reviewed-by: Aaron Durbin Reviewed-by: Subrata Banik (cherry picked from commit 695c56dc50a59e5c9098c94f41b3d86b8f99baf1) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1954965 Reviewed-by: Hung-Te Lin Commit-Queue: Hung-Te Lin Tested-by: Hung-Te Lin Auto-Submit: Hung-Te Lin --- Makefile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 398baa97..006767da 100644 --- a/Makefile +++ b/Makefile @@ -839,18 +839,14 @@ ${FWLIB_OBJS}: CFLAGS += -DTPM_BLOCKING_CONTINUESELFTEST # CFLAGS += -DTPM_MANUAL_SELFTEST -ifneq ($(filter $(FIRMWARE_ARCH),x86 x86_64),) -# Unrolling loops in cryptolib makes it faster +ifneq ($(filter-out 0,$(UNROLL_LOOPS)),) +$(info vboot hash algos built with unrolled loops (faster, larger code size)) ${FWLIB_OBJS}: CFLAGS += -DUNROLL_LOOPS ${FWLIB2X_OBJS}: CFLAGS += -DUNROLL_LOOPS ${FWLIB20_OBJS}: CFLAGS += -DUNROLL_LOOPS ${FWLIB21_OBJS}: CFLAGS += -DUNROLL_LOOPS - -# Workaround for coreboot on x86, which will power off asynchronously -# without giving us a chance to react. This is not an example of the Right -# Way to do things. See chrome-os-partner:7689, and the commit message -# that made this change. -${FWLIB_OBJS}: CFLAGS += -DSAVE_LOCALE_IMMEDIATELY +else +$(info vboot hash algos built with tight loops (slower, smaller code size)) endif ${FWLIB21_OBJS}: INCLUDES += -Ifirmware/lib21/include -- cgit v1.2.1