All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/7] efi_loader: non-volatile variables support
@ 2019-06-04  6:52 AKASHI Takahiro
  2019-06-04  6:52 ` [U-Boot] [PATCH v3 1/7] env: save UEFI non-volatile variables in dedicated storage AKASHI Takahiro
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: AKASHI Takahiro @ 2019-06-04  6:52 UTC (permalink / raw)
  To: u-boot

This patch set is an attempt to implement non-volatile attribute for
UEFI variables. Under the current implementation,
* SetVariable API doesn't recognize non-volatile attribute
* While some variables are defined non-volatile in UEFI specification,
  they are NOT marked as non-volatile in the code.
* env_save() (or "env save" command) allows us to save all the variables
  into persistent storage, but it may cause volatile UEFI variables,
  along with irrelevant U-Boot variables, to be saved unconditionally.

Those observation rationalizes that the implementation of UEFI variables
should be revamped utilizing dedicated storage for them.

This patch set is yet experimental and rough-edged(See known issues below),
but shows how UEFI variables can be split from U-Boot environment.

Note:
When StMM services is supported as a backing variables storage, 
efi_get_variable/efi_get_next_variable_name/efi_set_variable() will
be replaced with stub functions to communicate with secure world.

Usage:
To enable this feature, the following configs must be enabled:
  CONFIG_ENV_IS_IN_FAT
  CONFIG_ENV_FAT_INTERFACE
  CONFIG_ENV_EFI_FAT_DEVICE_AND_PART
  CONFIG_ENV_EFI_FAT_FILE

You can also define a non-volatile variable from command interface:
=> setenv -e -nv FOO baa

Known issues/restriction/TODO:
* UEFI spec defines "globally defined variables" with specific
  attributes, but with this patch, we don't check against the user-supplied
  attribute for any variable.
* Only FAT can be enabled for persistent storage for UEFI non-volatile
  variables.
* The whole area of storage will be saved at every update of one variable.
  It can be optimized.
* An error during saving may cause inconsistency between cache (hash table)
  and the storage.
* Cache is of fixed size and can be quite big for normal usage.
* I still see some Travis CI errors.

Patch#1 to #4 are core part of changes.
Patch#5 to #6 are to change some existing variables' attributes.
Patch#7 is to extend env command for non-volatile variables.

Changes in v3 (Jun 4, 2019)
* remove already-merged patches
* revamp the code again
* introduce CONFIG_EFI_VARIABLE_USE_ENV for this configuration.
  Once another backing storage, i.e. StMM services for secure boot,
  is supported, another option will be added.

Changes in v2 (Apr 24, 2019)
* rebased on efi-2019-07
* revamp the implementation

v1 (Nov 28, 2018)
* initial

AKASHI Takahiro (7):
  env: save UEFI non-volatile variables in dedicated storage
  efi_loader: variable: support non-volatile attribute
  efi_loader: variable: split UEFI variables from U-Boot environment
  efi_loader: load saved non-volatile variables at init
  efi_loader: bootmgr: make BootNext non-volatile
  cmd: efidebug: make some boot variables non-volatile
  cmd: env: add -nv option for UEFI non-volatile variable

 cmd/efidebug.c                    |   3 +
 cmd/nvedit.c                      |   3 +-
 cmd/nvedit_efi.c                  |  15 +-
 env/Kconfig                       |  39 ++++
 env/env.c                         | 155 ++++++++++++-
 env/fat.c                         | 105 +++++++++
 include/asm-generic/global_data.h |   3 +
 include/environment.h             |  31 +++
 lib/efi_loader/Kconfig            |  10 +
 lib/efi_loader/efi_bootmgr.c      |   3 +-
 lib/efi_loader/efi_setup.c        |   6 +
 lib/efi_loader/efi_variable.c     | 354 +++++++++++++++++++++++-------
 12 files changed, 641 insertions(+), 86 deletions(-)

-- 
2.21.0

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2019-06-25  6:47 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04  6:52 [U-Boot] [PATCH v3 0/7] efi_loader: non-volatile variables support AKASHI Takahiro
2019-06-04  6:52 ` [U-Boot] [PATCH v3 1/7] env: save UEFI non-volatile variables in dedicated storage AKASHI Takahiro
2019-06-04 21:09   ` Heinrich Schuchardt
2019-06-05  0:36     ` AKASHI Takahiro
2019-06-11 10:59   ` Ilias Apalodimas
2019-06-12  5:23     ` AKASHI Takahiro
2019-06-04  6:52 ` [U-Boot] [PATCH v3 2/7] efi_loader: variable: support non-volatile attribute AKASHI Takahiro
2019-06-04 21:15   ` Heinrich Schuchardt
2019-06-04  6:52 ` [U-Boot] [PATCH v3 3/7] efi_loader: variable: split UEFI variables from U-Boot environment AKASHI Takahiro
2019-06-04 21:31   ` Heinrich Schuchardt
2019-06-05  0:48     ` AKASHI Takahiro
2019-06-04  6:52 ` [U-Boot] [PATCH v3 4/7] efi_loader: load saved non-volatile variables at init AKASHI Takahiro
2019-06-04 21:38   ` Heinrich Schuchardt
2019-06-05  0:58     ` AKASHI Takahiro
2019-06-04  6:52 ` [U-Boot] [PATCH v3 5/7] efi_loader: bootmgr: make BootNext non-volatile AKASHI Takahiro
2019-06-04 21:46   ` Heinrich Schuchardt
2019-06-11 10:19   ` Ilias Apalodimas
2019-06-04  6:52 ` [U-Boot] [PATCH v3 6/7] cmd: efidebug: make some boot variables non-volatile AKASHI Takahiro
2019-06-04 21:45   ` Heinrich Schuchardt
2019-06-11 10:20   ` Ilias Apalodimas
2019-06-04  6:52 ` [U-Boot] [PATCH v3 7/7] cmd: env: add -nv option for UEFI non-volatile variable AKASHI Takahiro
2019-06-04 21:53   ` Heinrich Schuchardt
2019-06-25  6:47 ` [U-Boot] [PATCH v3 0/7] efi_loader: non-volatile variables support Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.