diff mbox series

[2/2] arm-bsp/corstone1000: support larger secure boot variables

Message ID 20261201100057.136741-3-Oscar.Belshaw@arm.com
State New
Headers show
Series arm-bsp/corstone1000: support larger secure boot variables | expand

Commit Message

Oscar Belshaw Dec. 1, 2026, 10 a.m. UTC
Increase the MM buffer to 16 KiB in both U-Boot defconfigs, SMM gateway
and libts. Move its base to 0x81FFC000 to preserve the end address at
0x82000000. Use the existing UEFI_MAX_VARIABLE_SIZE CMake option to allow
8 KiB stored variables and match that limit in TF-M protected storage.
Increase the crypto iovec buffer for a complete asset and framing.

The new BBSR authenticated db/dbx updates introduced in acs 3.1.2 require
storing a 6776-byte signature database, which exceeds CS1K's current
protected-storage limit of 3500 bytes. Increased this to 8KiB to
accommodate this change.

Signed-off-by: Oscar Belshaw <Oscar.Belshaw@arm.com>
---
 ...000-enlarge-protected-storage-assets.patch | 32 ++++++++++++++
 .../trusted-firmware-m-corstone1000.inc       |  1 +
 .../u-boot/u-boot-corstone1000.inc            |  1 +
 ...1000-enlarge-MM-communication-buffer.patch | 42 +++++++++++++++++++
 .../trusted-services/libts_%.bbappend         |  4 +-
 .../ts-sp-smm-gateway_%.bbappend              |  5 +++
 6 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0015-platform-corstone1000-enlarge-protected-storage-assets.patch
 create mode 100644 meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0054-configs-corstone1000-enlarge-MM-communication-buffer.patch
diff mbox series

Patch

diff --git a/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0015-platform-corstone1000-enlarge-protected-storage-assets.patch b/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0015-platform-corstone1000-enlarge-protected-storage-assets.patch
new file mode 100644
index 0000000000..1982bce495
--- /dev/null
+++ b/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0015-platform-corstone1000-enlarge-protected-storage-assets.patch
@@ -0,0 +1,32 @@ 
+From: Oscar Belshaw <Oscar.Belshaw@arm.com>
+Date: Tue, 17 Nov 2026 15:00:00 +0000
+Subject: [PATCH] platform: corstone1000: enlarge protected storage assets
+
+The BBSR signed db/dbx updates store a 6776-byte signature database,
+which exceeds the 3500-byte protected storage asset limit. Match the
+SMM gateway limit of 8 KiB and allow crypto input/output vectors for
+encrypting and decrypting an entire asset, including framing overhead.
+Keep the existing isolation level and security partitions enabled.
+
+Upstream-Status: Pending
+Signed-off-by: Oscar Belshaw <Oscar.Belshaw@arm.com>
+---
+diff --git a/platform/ext/target/arm/corstone1000/config_tfm_target.h b/platform/ext/target/arm/corstone1000/config_tfm_target.h
+--- a/platform/ext/target/arm/corstone1000/config_tfm_target.h
++++ b/platform/ext/target/arm/corstone1000/config_tfm_target.h
+@@ -27,13 +27,13 @@
+ #define ITS_MAX_ASSET_SIZE   2048
+
+ /* The maximum asset size to be stored in the Protected Storage */
+-#define PS_MAX_ASSET_SIZE   3500
++#define PS_MAX_ASSET_SIZE   8192
+
+ /* This is needed to be able to process the EFI variables during PS writes. */
+ #define CRYPTO_ENGINE_BUF_SIZE 0x5000
+
+ /* This is also has to be increased to fit the EFI variables into the iovecs. */
+-#define CRYPTO_IOVEC_BUFFER_SIZE    7200
++#define CRYPTO_IOVEC_BUFFER_SIZE    (2 * PS_MAX_ASSET_SIZE + 256)
+
+ /* The Mailbox partition is used as an NS Agent so its stack size is used to
+  * determine the PSP and PSPLIM during the SFN backend initialization. It has to
diff --git a/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc b/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc
index a12435fd9c..df42d60671 100644
--- a/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc
+++ b/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc
@@ -49,6 +49,7 @@  SRC_URI:append:corstone1000 = " \
     file://0012-plat-cs1k-Add-flash-erase-protection.patch \
     file://0013-platform-corstone1000-Increase-FIP-partition-size.patch \
     file://0014-platform-corstone1000-keep-CM-during-secure-debug.patch \
+    file://0015-platform-corstone1000-enlarge-protected-storage-assets.patch \
     "
 
 FILESEXTRAPATHS:prepend:corstone1000-mps3 := "${THISDIR}/files/corstone1000/psa-adac:"
diff --git a/meta-arm-bsp/recipes-bsp/u-boot/u-boot-corstone1000.inc b/meta-arm-bsp/recipes-bsp/u-boot/u-boot-corstone1000.inc
index f9251c96d5..7c5d4085f0 100644
--- a/meta-arm-bsp/recipes-bsp/u-boot/u-boot-corstone1000.inc
+++ b/meta-arm-bsp/recipes-bsp/u-boot/u-boot-corstone1000.inc
@@ -101,6 +101,7 @@  SRC_URI:append = " \
     file://0051-doc-bootefi-note-two-phase-runtime-variables-selftes.patch \
     file://0052-efi_loader-align-FF-A-cache-maintenance-with-runtime.patch \
     file://0053-corstone1000-a320-enable-bootefi-selftest.patch \
+    file://0054-configs-corstone1000-enlarge-MM-communication-buffer.patch \
 "
 
 uboot_configure_config:append() {
diff --git a/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0054-configs-corstone1000-enlarge-MM-communication-buffer.patch b/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0054-configs-corstone1000-enlarge-MM-communication-buffer.patch
new file mode 100644
index 0000000000..bd61152b51
--- /dev/null
+++ b/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0054-configs-corstone1000-enlarge-MM-communication-buffer.patch
@@ -0,0 +1,42 @@ 
+From: Oscar Belshaw <Oscar.Belshaw@arm.com>
+Date: Tue, 17 Nov 2026 15:00:00 +0000
+Subject: [PATCH] configs: corstone1000: enlarge MM communication buffer
+
+The BBSR signed db/dbx updates contain 7982 bytes, before MM request
+headers. Reserve 16 KiB for the complete authenticated request and move
+the base down so the buffer still ends at 0x82000000. Keep this region
+in sync with the Trusted Services SMM gateway and libts.
+
+Upstream-Status: Pending
+Signed-off-by: Oscar Belshaw <Oscar.Belshaw@arm.com>
+---
+diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
+--- a/configs/corstone1000_defconfig
++++ b/configs/corstone1000_defconfig
+@@ -16,9 +16,9 @@
+ # CONFIG_EFI_DEBUG_SUPPORT is not set
+ CONFIG_EFI_SET_TIME=y
+ CONFIG_EFI_MM_COMM_TEE=y
+-CONFIG_FFA_SHARED_MM_BUF_SIZE=4096
++CONFIG_FFA_SHARED_MM_BUF_SIZE=16384
+ CONFIG_FFA_SHARED_MM_BUF_OFFSET=0
+-CONFIG_FFA_SHARED_MM_BUF_ADDR=0x81FFF000
++CONFIG_FFA_SHARED_MM_BUF_ADDR=0x81FFC000
+ CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
+ CONFIG_EFI_CAPSULE_ON_DISK=y
+ CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+diff --git a/configs/corstone1000-a320_defconfig b/configs/corstone1000-a320_defconfig
+--- a/configs/corstone1000-a320_defconfig
++++ b/configs/corstone1000-a320_defconfig
+@@ -16,9 +16,9 @@
+ # CONFIG_EFI_DEBUG_SUPPORT is not set
+ CONFIG_EFI_SET_TIME=y
+ CONFIG_EFI_MM_COMM_TEE=y
+-CONFIG_FFA_SHARED_MM_BUF_SIZE=4096
++CONFIG_FFA_SHARED_MM_BUF_SIZE=16384
+ CONFIG_FFA_SHARED_MM_BUF_OFFSET=0
+-CONFIG_FFA_SHARED_MM_BUF_ADDR=0x81FFF000
++CONFIG_FFA_SHARED_MM_BUF_ADDR=0x81FFC000
+ CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
+ CONFIG_EFI_CAPSULE_ON_DISK=y
+ CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
diff --git a/meta-arm-bsp/recipes-security/trusted-services/libts_%.bbappend b/meta-arm-bsp/recipes-security/trusted-services/libts_%.bbappend
index 7871b1e5e5..e708f8c4f8 100644
--- a/meta-arm-bsp/recipes-security/trusted-services/libts_%.bbappend
+++ b/meta-arm-bsp/recipes-security/trusted-services/libts_%.bbappend
@@ -1,7 +1,7 @@ 
 require ts-arm-platforms.inc
 
-EXTRA_OECMAKE:append:corstone1000 = "-DMM_COMM_BUFFER_ADDRESS=0x81FFF000 \
-                                     -DMM_COMM_BUFFER_SIZE=0x1000 \
+EXTRA_OECMAKE:append:corstone1000 = "-DMM_COMM_BUFFER_ADDRESS=0x81FFC000 \
+                                     -DMM_COMM_BUFFER_SIZE=0x4000 \
                                     "
 
 EXTRA_OECMAKE:append:fvp-base = " -DMM_COMM_BUFFER_ADDRESS=0x81000000 \
diff --git a/meta-arm-bsp/recipes-security/trusted-services/ts-sp-smm-gateway_%.bbappend b/meta-arm-bsp/recipes-security/trusted-services/ts-sp-smm-gateway_%.bbappend
index b4de372555..f7087992af 100644
--- a/meta-arm-bsp/recipes-security/trusted-services/ts-sp-smm-gateway_%.bbappend
+++ b/meta-arm-bsp/recipes-security/trusted-services/ts-sp-smm-gateway_%.bbappend
@@ -1,6 +1,11 @@ 
 require ts-arm-platforms.inc
 
+# Keep the MM region in sync with U-Boot and libts. The stored database
+# excludes the authentication descriptor carried in the larger MM request.
 EXTRA_OECMAKE:append:corstone1000 = " -DSMM_GATEWAY_MAX_UEFI_VARIABLES=60 \
+    -DUEFI_MAX_VARIABLE_SIZE=8192 \
+    -DMM_COMM_BUFFER_ADDRESS="0x00000000 0x81FFC000" \
+    -DMM_COMM_BUFFER_PAGE_COUNT=4 \
     "
 
 EXTRA_OECMAKE:append:fvp-base = " -DMM_COMM_BUFFER_ADDRESS="0x00000000 0x81000000" \