diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2023-07-02 11:57:34 +0200 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2023-08-22 10:39:26 +0200 |
commit | 5894cf571e14fb393a4d0a82538de032127b9d8b (patch) | |
tree | 6dbdfaf1d23db2b428cc0c6a03d59f52764c9350 /drivers/firmware | |
parent | 3c17ae4161093fa2263b70064e34a033dc16fef5 (diff) | |
download | linux-5894cf571e14fb393a4d0a82538de032127b9d8b.tar.gz linux-5894cf571e14fb393a4d0a82538de032127b9d8b.tar.bz2 linux-5894cf571e14fb393a4d0a82538de032127b9d8b.zip |
acpi/prmt: Use EFI runtime sandbox to invoke PRM handlers
Instead of bypassing the kernel's adaptation layer for performing EFI
runtime calls, wire up ACPI PRM handling into it. This means these calls
can no longer occur concurrently with EFI runtime calls, and will be
made from the EFI runtime workqueue. It also means any page faults
occurring during PRM handling will be identified correctly as
originating in firmware code.
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/efi/runtime-wrappers.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c index afe9248cc5bc..e89484af9740 100644 --- a/drivers/firmware/efi/runtime-wrappers.c +++ b/drivers/firmware/efi/runtime-wrappers.c @@ -108,6 +108,12 @@ union efi_rts_args { u64 *max_size; int *reset_type; } QUERY_CAPSULE_CAPS; + + struct { + efi_status_t (__efiapi *acpi_prm_handler)(u64, void *); + u64 param_buffer_addr; + void *context; + } ACPI_PRM_HANDLER; }; struct efi_runtime_work efi_rts_work; @@ -283,6 +289,13 @@ static void efi_call_rts(struct work_struct *work) args->QUERY_CAPSULE_CAPS.max_size, args->QUERY_CAPSULE_CAPS.reset_type); break; + case EFI_ACPI_PRM_HANDLER: +#ifdef CONFIG_ACPI_PRMT + status = arch_efi_call_virt(args, ACPI_PRM_HANDLER.acpi_prm_handler, + args->ACPI_PRM_HANDLER.param_buffer_addr, + args->ACPI_PRM_HANDLER.context); + break; +#endif default: /* * Ideally, we should never reach here because a caller of this @@ -560,3 +573,21 @@ void efi_native_runtime_setup(void) efi.update_capsule = virt_efi_update_capsule; efi.query_capsule_caps = virt_efi_query_capsule_caps; } + +#ifdef CONFIG_ACPI_PRMT + +efi_status_t +efi_call_acpi_prm_handler(efi_status_t (__efiapi *handler_addr)(u64, void *), + u64 param_buffer_addr, void *context) +{ + efi_status_t status; + + if (down_interruptible(&efi_runtime_lock)) + return EFI_ABORTED; + status = efi_queue_work(ACPI_PRM_HANDLER, handler_addr, + param_buffer_addr, context); + up(&efi_runtime_lock); + return status; +} + +#endif |