efi: Replace runtime services spinlock with semaphore
The purpose of the efi_runtime_lock is to prevent concurrent calls into the firmware. There is no need to use spinlocks here, as long as we ensure that runtime service invocations from an atomic context (i.e., EFI pstore) cannot block. So use a semaphore instead, and use down_trylock() in the nonblocking case. We don't use a mutex here because the mutex_trylock() function must not be called from interrupt context, whereas the down_trylock() can. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Sylvain Chouleur <sylvain.chouleur@gmail.com> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
This commit is contained in:

committed by
Matt Fleming

parent
21b3ddd39f
commit
dce48e351c
@@ -810,6 +810,9 @@ int efi_status_to_err(efi_status_t status)
|
||||
case EFI_NOT_FOUND:
|
||||
err = -ENOENT;
|
||||
break;
|
||||
case EFI_ABORTED:
|
||||
err = -EINTR;
|
||||
break;
|
||||
default:
|
||||
err = -EINVAL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user