ACPI PRM uses the EFI runtime services infrastructure, but currently, it issues the firmware calls directly, instead of going through the wrappers and handing off the call to the EFI workqueue. Given that ACPI PRM is used for vendor code rather than core EFI runtime services, it would be nice if these calls get sandboxed in the same way as EFI runtime services calls are. This ensures that any faults occurring in the firmware are handled gracefully and don't bring down the kernel. Another reason for using the work queue is the fact that on some platforms, the EFI memory regions are remapped into the lower address space, and this means that sampling the instruction pointer in a perf interrupt may cause confusion about whether the task is running in user space or in the firmware. So let's move the ACPI PRM calls into the EFI runtime wrapper infrastructure. Before that, let's clean it up a bit. Changes since v2: - add patches to move EFI runtime setup/teardown sequences out of line - add patch to deduplicate setup/teardown function calls in the workqueue handler - some whitespace cleanup and added a missing __init - add RFC patches to drop EFI runtime asm trampoline from x86 - add Rafael's ack to the patch that touches drivers/acpi/ Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Cc: Paul Walmsley <paul.walmsley@xxxxxxxxxx> Cc: Palmer Dabbelt <palmer@xxxxxxxxxxx> Cc: Albert Ou <aou@xxxxxxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx> Cc: Nathan Chancellor <nathan@xxxxxxxxxx> Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx> Ard Biesheuvel (11): efi/x86: Move EFI runtime call setup/teardown helpers out of line efi/arm64: Move EFI runtime call setup/teardown helpers out of line efi/riscv: Move EFI runtime call setup/teardown helpers out of line efi/runtime-wrappers: Use type safe encapsulation of call arguments efi/runtime-wrapper: Move workqueue manipulation out of line efi/runtime-wrappers: Remove duplicated macro for service returning void efi/runtime-wrappers: Don't duplicate setup/teardown code acpi/prmt: Use EFI runtime sandbox to invoke PRM handlers efi/runtime-wrappers: Clean up white space and add __init annotation efi/x86: Realign EFI runtime stack efi/x86: Rely on compiler to emit MS ABI calls arch/arm64/include/asm/efi.h | 18 +- arch/arm64/kernel/efi.c | 16 +- arch/riscv/include/asm/efi.h | 10 +- arch/x86/Makefile | 3 + arch/x86/include/asm/efi.h | 43 +-- arch/x86/include/asm/uv/bios.h | 3 +- arch/x86/platform/efi/Makefile | 6 +- arch/x86/platform/efi/efi_32.c | 12 + arch/x86/platform/efi/efi_64.c | 21 +- arch/x86/platform/efi/efi_stub_64.S | 27 -- arch/x86/platform/uv/Makefile | 1 + arch/x86/platform/uv/bios_uv.c | 4 +- drivers/acpi/Kconfig | 2 +- drivers/acpi/prmt.c | 8 +- drivers/firmware/efi/Makefile | 1 + drivers/firmware/efi/riscv-runtime.c | 15 +- drivers/firmware/efi/runtime-wrappers.c | 376 +++++++++++++------- include/linux/efi.h | 52 ++- 18 files changed, 353 insertions(+), 265 deletions(-) delete mode 100644 arch/x86/platform/efi/efi_stub_64.S -- 2.39.2