diff mbox series

efi_loader: Increase default variable store size to 128K

Message ID 20231106154754.59374-1-ilias.apalodimas@linaro.org
State Accepted
Commit a8062549d6ba81e41596adab83f80e8f819f491d
Headers show
Series efi_loader: Increase default variable store size to 128K | expand

Commit Message

Ilias Apalodimas Nov. 6, 2023, 3:47 p.m. UTC
In commit 9fd3f881c6ed ("efi_loader: Increase default variable store size to 64KiB")
Alper has a detailed explanation of why the size needs to be bumped to at
least 64K.  However enabling Secure boot, writing db, KEK, PK etc keys
will further increase the size so bump it to 128K.

It's worth noting that when U-Boot stores the EFI variables in an RPMB the
available storage is defined statically in StandAloneMM at build time.
The U-Boot code is detecting the available true size on the fly during
writes. When StandAloneMM is present this size defines the reserved
memory U-Boot can use to copy any runtime variables, before booting an
OS.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 lib/efi_loader/Kconfig | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--
2.40.1

Comments

Heinrich Schuchardt Nov. 12, 2023, 11:40 p.m. UTC | #1
On 11/6/23 16:47, Ilias Apalodimas wrote:
> In commit 9fd3f881c6ed ("efi_loader: Increase default variable store size to 64KiB")
> Alper has a detailed explanation of why the size needs to be bumped to at
> least 64K.  However enabling Secure boot, writing db, KEK, PK etc keys
> will further increase the size so bump it to 128K.
>
> It's worth noting that when U-Boot stores the EFI variables in an RPMB the
> available storage is defined statically in StandAloneMM at build time.
> The U-Boot code is detecting the available true size on the fly during
> writes. When StandAloneMM is present this size defines the reserved
> memory U-Boot can use to copy any runtime variables, before booting an
> OS.
>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>   lib/efi_loader/Kconfig | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index 4ccd26f94a93..0d024911b42e 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -133,18 +133,20 @@ endif
>
>   config EFI_VAR_BUF_SIZE
>   	int "Memory size of the UEFI variable store"
> -	default 16384 if EFI_MM_COMM_TEE
> -	default 65536
> +	default 131072
>   	range 4096 2147483647
>   	help
>   	  This defines the size in bytes of the memory area reserved for keeping
>   	  UEFI variables.
>
> -	  When using StandAloneMM (CONFIG_EFI_MM_COMM_TEE=y) this value should
> -	  match the value of PcdFlashNvStorageVariableSize used to compile the
> -	  StandAloneMM module.
> +	  When using StandAloneMM (CONFIG_EFI_MM_COMM_TEE=y) is used the
> +	  available size for storing variables is defined in
> +	  PcdFlashNvStorageVariableSize.
> +	  That value is probed at runtime from U-Boot. In that case,
> +	  EFI_VAR_BUF_SIZE represents the memory U-Boot reserves to present
> +	  runtime variables to the OS.
>
> -	  Minimum 4096, default 65536, or 16384 when using StandAloneMM.
> +	  Minimum 4096, default 131072
>
>   config EFI_GET_TIME
>   	bool "GetTime() runtime service"
> --
> 2.40.1
>
diff mbox series

Patch

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 4ccd26f94a93..0d024911b42e 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -133,18 +133,20 @@  endif

 config EFI_VAR_BUF_SIZE
 	int "Memory size of the UEFI variable store"
-	default 16384 if EFI_MM_COMM_TEE
-	default 65536
+	default 131072
 	range 4096 2147483647
 	help
 	  This defines the size in bytes of the memory area reserved for keeping
 	  UEFI variables.

-	  When using StandAloneMM (CONFIG_EFI_MM_COMM_TEE=y) this value should
-	  match the value of PcdFlashNvStorageVariableSize used to compile the
-	  StandAloneMM module.
+	  When using StandAloneMM (CONFIG_EFI_MM_COMM_TEE=y) is used the
+	  available size for storing variables is defined in
+	  PcdFlashNvStorageVariableSize.
+	  That value is probed at runtime from U-Boot. In that case,
+	  EFI_VAR_BUF_SIZE represents the memory U-Boot reserves to present
+	  runtime variables to the OS.

-	  Minimum 4096, default 65536, or 16384 when using StandAloneMM.
+	  Minimum 4096, default 131072

 config EFI_GET_TIME
 	bool "GetTime() runtime service"