Skip to content

Specify runtime access to file-backed variable stores#169

Open
ricardosalveti wants to merge 2 commits into
ARM-software:mainfrom
ricardosalveti:rt-variable-handover
Open

Specify runtime access to file-backed variable stores#169
ricardosalveti wants to merge 2 commits into
ARM-software:mainfrom
ricardosalveti:rt-variable-handover

Conversation

@ricardosalveti

Copy link
Copy Markdown

Specify the mechanism U-Boot uses to provide SetVariable() at runtime with a
file-backed variable store, as requested in #143. The firmware services the
variable runtime services from memory and exports the store file content
through two volatile variables, RTStorageVolatile and VarToFile, which the
OS writes back to the ESP. The same protocol is implemented by EDK2-based
vendor firmware and supported by libefivar since rhboot/efivar#282 (systemd
doesn't use libefivar; equivalent support is proposed in
systemd/systemd#42905).

Chapter 5 defines the vendor GUID, the two variables and the firmware/OS
requirements. Chapter 2 makes GetVariable(), GetNextVariableName() and
SetVariable() required at runtime for file-backed variable stores only;
everything else keeps the existing EFI_UNSUPPORTED fallback, so SetVariable()
at runtime is not unconditionally mandatory.

Firmware that stores EFI variables in a file cannot write that file
once the OS controls the storage device. U-Boot keeps servicing the
variable runtime services from a memory-backed store and delegates
persisting it to the OS: the RTStorageVolatile variable names the
store file on the ESP and VarToFile exports the content the file must
have. The mechanism is also implemented by EDK2-based vendor firmware
and supported by libefivar (rhboot/efivar#282), but it is only
documented in U-Boot.

Specify the mechanism so that firmware and operating systems can
implement it from EBBR alone: define the vendor GUID, the semantics of
the two variables, the firmware requirements including the runtime
SetVariable() restrictions, and the write-back duties of the OS.

While at it, retitle the chapter, whose scope now goes beyond the
store file format, extend the limitations section accordingly, and add
the chapter 2 anchor the new section refers to.

Suggested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
The Runtime Variable Access section only describes the option of not
implementing SetVariable() after ExitBootServices() and claims that
neither U-Boot nor Tianocore have a generic solution for variable
stores on shared media, which is no longer accurate.

Require firmware that stores EFI variables in a file on storage shared
with the OS to implement the mechanism now specified in chapter 5,
keeping GetVariable(), GetNextVariableName() and SetVariable()
available during runtime services, and reflect this conditional
requirement in the runtime services table. Platforms without a
file-backed store keep the existing EFI_UNSUPPORTED /
RuntimeServicesSupported fallback.

Fixes: ARM-software#143
Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant