Martin Roth has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46903 )
Change subject: soc/amd/picasso: Set vboot hashing block size to 36k
......................................................................
soc/amd/picasso: Set vboot hashing block size to 36k
On picasso's psp_verstage, the vboot hash is being calculated by
hardware using relatively expensive system calls. By increasing the
block size, we can save roughly 150ms of boot and S3 resume time.
TEST=Build & boot see that boot time has decreased.
BRANCH=Zork
BUG=b:169217270 - Zork: SHA calculation in vboot takes too long
Signed-off-by: Martin Roth <martinroth(a)chromium.org>
Change-Id: I6642073357327811b415dcbcad6930ac6d2598f9
---
M src/soc/amd/picasso/Kconfig
1 file changed, 16 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/46903/1
diff --git a/src/soc/amd/picasso/Kconfig b/src/soc/amd/picasso/Kconfig
index 6a5b932..2e35a4b 100644
--- a/src/soc/amd/picasso/Kconfig
+++ b/src/soc/amd/picasso/Kconfig
@@ -541,6 +541,22 @@
Runs verstage on the PSP. Only available on
certain Chrome OS branded parts from AMD.
+config VBOOT_HASH_BLOCK_SIZE
+ hex
+ default 0x9000
+ depends on VBOOT_STARTS_BEFORE_BOOTBLOCK
+ help
+ Because the bulk of the time in psp_verstage to hash the RO cbfs is
+ spent in the overhead of doing svc calls, increasing the hash block
+ size significantly cuts the verstage hashing time as seen below.
+
+ 4k takes 180ms
+ 16k takes 44ms
+ 32k takes 33.7ms
+ 36k takes 32.5ms
+ There's actually still room for an even bigger stack, but we've
+ reached a point of diminishing returns.
+
config CMOS_RECOVERY_BYTE
hex
default 0x51
--
To view, visit https://review.coreboot.org/c/coreboot/+/46903
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I6642073357327811b415dcbcad6930ac6d2598f9
Gerrit-Change-Number: 46903
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth(a)google.com>
Gerrit-MessageType: newchange
Martin Roth has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46902 )
Change subject: soc/amd/picasso: Up stack size to 40k for vboot hash buffer
......................................................................
soc/amd/picasso: Up stack size to 40k for vboot hash buffer
Increasing the vboot hash buffer size greatly speeds up the SHA
calculations. Going from a standard 4k buffer to a 36k buffer
takes ~150ms of the boot and resume time.
TEST=Build & boot see that boot time has decreased.
BRANCH=Zork
BUG=b:169217270 - Zork: SHA calculation in vboot takes too long
Signed-off-by: Martin Roth <martinroth(a)chromium.org>
Change-Id: Ibca868ad7be639c2a0ca1c4ba6d71123d8b83c92
---
M src/soc/amd/picasso/memlayout_psp_verstage.ld
M src/soc/amd/picasso/psp_verstage/Makefile.inc
2 files changed, 4 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/46902/1
diff --git a/src/soc/amd/picasso/memlayout_psp_verstage.ld b/src/soc/amd/picasso/memlayout_psp_verstage.ld
index 1da07df..0036e9b 100644
--- a/src/soc/amd/picasso/memlayout_psp_verstage.ld
+++ b/src/soc/amd/picasso/memlayout_psp_verstage.ld
@@ -19,15 +19,15 @@
* should be sufficient. This is just for the function mapping the
* actual stack.
*/
-#define PSP_VERSTAGE_TEMP_STACK_START 0x39000
+#define PSP_VERSTAGE_TEMP_STACK_START 0x32000
#define PSP_VERSTAGE_TEMP_STACK_SIZE 4K
/*
* The top of the stack must be 4k aligned, so set the bottom as 4k aligned
* and make the size a multiple of 4k
*/
-#define PSP_VERSTAGE_STACK_START 0x3B000
-#define PSP_VERSTAGE_STACK_SIZE 8K
+#define PSP_VERSTAGE_STACK_START 0x33000
+#define PSP_VERSTAGE_STACK_SIZE 40K
ENTRY(_psp_vs_start)
SECTIONS
diff --git a/src/soc/amd/picasso/psp_verstage/Makefile.inc b/src/soc/amd/picasso/psp_verstage/Makefile.inc
index 4f1642b..19083cdaf 100644
--- a/src/soc/amd/picasso/psp_verstage/Makefile.inc
+++ b/src/soc/amd/picasso/psp_verstage/Makefile.inc
@@ -4,6 +4,7 @@
verstage-generic-ccopts += -I$(src)/vendorcode/amd/fsp/picasso/include
verstage-generic-ccopts += -D__USER_SPACE__
CPPFLAGS_common += -I$(VBOOT_SOURCE)/firmware/2lib/include/
+CFLAGS_arm += -Wstack-usage=40960
verstage-y += delay.c
verstage-y += fch.c
--
To view, visit https://review.coreboot.org/c/coreboot/+/46902
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ibca868ad7be639c2a0ca1c4ba6d71123d8b83c92
Gerrit-Change-Number: 46902
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: newchange
Martin Roth has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46901 )
Change subject: security/vboot: Add Kconfig symbol to set hashing block size
......................................................................
security/vboot: Add Kconfig symbol to set hashing block size
Generally, this size probably doesn't matter very much, but in the
case of picasso's psp_verstage, the hash is being calculated by
hardware using relatively expensive system calls. By increasing the
block size, we can save roughly 140ms of boot and resume time.
TEST=Build & boot see that boot time has decreased.
BRANCH=Zork
BUG=b:169217270 - Zork: SHA calculation in vboot takes too long
Signed-off-by: Martin Roth <martinroth(a)chromium.org>
Change-Id: I68eecbbdfadcbf14288dc6e849397724fb66e0b2
---
M src/security/vboot/Kconfig
M src/security/vboot/vboot_logic.c
2 files changed, 8 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/01/46901/1
diff --git a/src/security/vboot/Kconfig b/src/security/vboot/Kconfig
index 094cbb9..024a746 100644
--- a/src/security/vboot/Kconfig
+++ b/src/security/vboot/Kconfig
@@ -369,6 +369,13 @@
hex "Keyblock preamble flags"
default 0x0
+config VBOOT_HASH_BLOCK_SIZE
+ hex
+ default 0x400
+ help
+ Set the default hash size. Generally 1k is reasonable, but in some
+ cases it may improve hashing speed to increase the size.
+
endmenu # Keys
endif # VBOOT
endmenu # Verified Boot (vboot)
diff --git a/src/security/vboot/vboot_logic.c b/src/security/vboot/vboot_logic.c
index dbaa883..54c8224 100644
--- a/src/security/vboot/vboot_logic.c
+++ b/src/security/vboot/vboot_logic.c
@@ -19,8 +19,6 @@
/* The max hash size to expect is for SHA512. */
#define VBOOT_MAX_HASH_SIZE VB2_SHA512_DIGEST_SIZE
-#define TODO_BLOCK_SIZE 1024
-
/* exports */
vb2_error_t vb2ex_read_resource(struct vb2_context *ctx,
@@ -144,7 +142,7 @@
{
uint64_t load_ts;
uint32_t remaining;
- uint8_t block[TODO_BLOCK_SIZE];
+ uint8_t block[CONFIG_VBOOT_HASH_BLOCK_SIZE];
uint8_t hash_digest[VBOOT_MAX_HASH_SIZE];
const size_t hash_digest_sz = sizeof(hash_digest);
size_t block_size = sizeof(block);
--
To view, visit https://review.coreboot.org/c/coreboot/+/46901
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I68eecbbdfadcbf14288dc6e849397724fb66e0b2
Gerrit-Change-Number: 46901
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Aaron Durbin <adurbin(a)chromium.org>
Gerrit-MessageType: newchange