coreboot-kgpe-d16/payloads/libpayload/vboot/Makefile.inc
Jeremy Compostella 3dcd0d98e4 libpayload: Add VBOOT_X86_RSA_ACCELERATION config
Add `VBOOT_X86_RSA_ACCELERATION' Kconfig option to enable SSE2
instruction set implementation of modulus exponentiation which is part
of the RSA signature verification process. This option is enabled on
CHROMEOS.

| modpow() function call | original on rex0 | SSE2 on rex0 |
|------------------------+------------------+--------------|
| depthcharge - step 1   |            0.547 |        0.288 |
| depthcharge - step 2   |            0.152 |        0.081 |
| depthcharge - step 3   |            0.164 |        0.079 |
|------------------------+------------------+--------------|
| Total (ms)             |            0.863 |        0.448 |

| modpow() function call | original on brya0 | SSE2 on rex0 |
|------------------------+-------------------+--------------|
| depthcharge - step 1   |             0.693 |        0.248 |
| depthcharge - step 2   |             0.172 |        0.065 |
| depthcharge - step 3   |             0.223 |        0.067 |
|------------------------+-------------------+--------------|
| Total (ms)             |             1.088 |         0.38 |

BUG=b:312709384
TEST=modular exponentiation is about twice faster on rex0 and brya0

Change-Id: I801ebd7839261c6bd07fb218e1e36a7108e219bf
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79290
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
2023-12-28 01:38:44 +00:00

53 lines
1.8 KiB
Makefile

# SPDX-License-Identifier: BSD-3-Clause
VBOOT_BUILD_DIR ?= $(abspath $(obj)/external/vboot)
VBOOT_FW_LIB = $(VBOOT_BUILD_DIR)/vboot_fw.a
TLCL_LIB = $(VBOOT_BUILD_DIR)/tlcl.a
vboot_fw-objs += $(VBOOT_FW_LIB)
tlcl-objs += $(TLCL_LIB)
kconfig-to-binary=$(if $(strip $(1)),1,0)
vboot-fixup-includes = $(filter -I$(coreboottop)/%, $(1)) \
$(patsubst -I%,-I$(top)/%,\
$(patsubst include/%.h,$(top)/include/%.h,\
$(filter-out -I$(obj),\
$(filter-out -I$(coreboottop)/%,$(1)))))
ifeq ($(CONFIG_LP_ARCH_MOCK),)
VBOOT_CFLAGS += $(call vboot-fixup-includes,$(CFLAGS))
VBOOT_CFLAGS += -I$(abspath $(obj))
endif
# Enable vboot debug by default
VBOOT_CFLAGS += -DVBOOT_DEBUG
VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_ARM) := arm
VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_X86) := x86
VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_ARM64) := arm64
ifeq ($(CONFIG_LP_ARCH_MOCK)$(VBOOT_FIRMWARE_ARCH-y),)
$(error vboot requires architecture to be set in the configuration)
endif
ifeq ($(CONFIG_LP_VBOOT_X86_RSA_ACCELERATION),y)
CPPFLAGS_common += -DVB2_X86_RSA_ACCELERATION
endif
$(VBOOT_FW_LIB): $(obj)/libpayload-config.h
@printf " MAKE $(subst $(obj)/,,$(@))\n"
+$(Q) FIRMWARE_ARCH="$(VBOOT_FIRMWARE_ARCH-y)" \
CC="$(CC)" \
CFLAGS="$(VBOOT_CFLAGS)" \
$(MAKE) -C "$(VBOOT_SOURCE)" \
TPM2_MODE=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_TPM2_MODE)) \
X86_SHA_EXT=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_X86_SHA_EXT)) \
VB2_X86_RSA_ACCELERATION=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_X86_RSA_ACCELERATION)) \
ARMV8_CRYPTO_EXT=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_SHA_ARMV8_CE)) \
UNROLL_LOOPS=1 \
BUILD="$(VBOOT_BUILD_DIR)" \
V=$(V) \
$(VBOOT_BUILD_DIR)/vboot_fw.a tlcl
$(TLCL_LIB): $(VBOOT_FW_LIB)
.PHONY: $(VBOOT_FW_LIB) $(TLCL_LIB)