efi: Implement mandatory locking for UEFI Runtime Services
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 4 Aug 2014 16:16:00 +0000 (18:16 +0200)
committerMatt Fleming <matt.fleming@intel.com>
Fri, 3 Oct 2014 17:40:57 +0000 (18:40 +0100)
commit161485e8273001e56b2f20755ad9b6217b601fb3
tree3e99e9f4a6515c0382c7ccb3e7a3888382f4c3b3
parent7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9
efi: Implement mandatory locking for UEFI Runtime Services

According to section 7.1 of the UEFI spec, Runtime Services are not fully
reentrant, and there are particular combinations of calls that need to be
serialized. Use a spinlock to serialize all Runtime Services with respect
to all others, even if this is more than strictly needed.

We've managed to get away without requiring a runtime services lock
until now because most of the interactions with EFI involve EFI
variables, and those operations are already serialised with
__efivars->lock.

Some of the assumptions underlying the decision whether locks are
needed or not (e.g., SetVariable() against ResetSystem()) may not
apply universally to all [new] architectures that implement UEFI.
Rather than try to reason our way out of this, let's just implement at
least what the spec requires in terms of locking.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
arch/x86/include/asm/efi.h
drivers/firmware/efi/runtime-wrappers.c