Skip to content

efi: Clean up runtime wrapper and wire it up for PRM

Ard Biesheuvel linux-efi 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 4 repliesIn review
  2. v14 patches 1 replySuperseded

Changes since v2 from the cover letter

- 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/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11efi/x86: Move EFI runtime call setup/teardown helpers out of linearch/x86/include/asm/efi.h arch/x86/platform/efi/efi_32.c arch/x86/platform/efi/efi_64.c+31 -320 replies
2/11efi/arm64: Move EFI runtime call setup/teardown helpers out of linearch/arm64/include/asm/efi.h arch/arm64/kernel/efi.c+18 -161 reply
3/11efi/riscv: Move EFI runtime call setup/teardown helpers out of linearch/riscv/include/asm/efi.h drivers/firmware/efi/riscv-runtime.c+15 -100 replies
4/11efi/runtime-wrappers: Use type safe encapsulation of call argumentsdrivers/firmware/efi/runtime-wrappers.c include/linux/efi.h+138 -760 replies
5/11efi/runtime-wrapper: Move workqueue manipulation out of linedrivers/firmware/efi/runtime-wrappers.c+33 -280 replies
6/11efi/runtime-wrappers: Remove duplicated macro for service returning voidarch/x86/include/asm/uv/bios.h drivers/acpi/prmt.c drivers/firmware/efi/runtime-wrappers.c +1 more+13 -240 replies
7/11efi/runtime-wrappers: Don't duplicate setup/teardown codedrivers/firmware/efi/runtime-wrappers.c include/linux/efi.h+22 -100 replies
8/11acpi/prmt: Use EFI runtime sandbox to invoke PRM handlersdrivers/acpi/Kconfig drivers/acpi/prmt.c drivers/firmware/efi/runtime-wrappers.c +1 more+41 -40 replies
9/11efi/runtime-wrappers: Clean up white space and add __init annotationdrivers/firmware/efi/runtime-wrappers.c+19 -220 replies
10/11efi/x86: Realign EFI runtime stackarch/x86/Makefile arch/x86/include/asm/efi.h arch/x86/platform/efi/Makefile +5 more+22 -100 replies
11/11efi/x86: Rely on compiler to emit MS ABI callsarch/x86/include/asm/efi.h arch/x86/platform/efi/Makefile arch/x86/platform/efi/efi_stub_64.S+5 -370 replies

Reviews trailers per patch

2 of 11 patches have a Reviewed-by or Acked-by.

PatchRafael J. WysockiCatalin Marinas
1/11
2/11A-b
3/11
4/11
5/11
6/11
7/11
8/11A-b
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/11] efi: Clean up runtime wrapper and wire it up for PRM

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 <[email protected]>
Cc Will Deacon <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Albert Ou <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Nick Desaulniers <[email protected]>

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
Signature · 1 line
2.39.2