EFI pull requests for v5.20
Ard Biesheuvel
maintainerHello Linus,
I am sending this cycle's EFI changes as two separate pull requests:
- the first one covers the normal updates accumulated this cycle, including some cleanup of the 'efivars' layer;
- the second one removes the obsolete 'efivars' sysfs driver, and consolidates the remaining code related to manipulating arbitrary EFI variables from user space into the efivarfs pseudo-filesystem driver.
The 'efivars' sysfs interface and the 'efivarfs' (note the 'f') pseudo-filesystem are both based on an abstraction which is also called 'efivars' that caches EFI variables, and permits the backend to be swapped out, for backing the EFI variable store by, e.g., SMI calls or other secure firmware calls. (only used by Google SMI at the moment, but new uses are being proposed).
Using two cached views of the same variable store leads to the problems you might expect, and other users also exist that (ab)use the efivars layer for non-obvious reasons.
Most of the quirks are being cleaned up in 1/2 of this PR series. However, to really address this thoroughly, we should get rid of the obsolete sysfs based EFI variable interface for user space, and only keep the efivarfs pseudo-filesystem. This is what is implemented by 2/2 of this PR series, which also moves the remaining efivars logic that efivarfs relies on into the efivarfs driver, and no longer exports it to other parts of the kernel.
Obviously, removing the sysfs interface could potentially break someone's workflow somewhere, and so it is not without risk. However, as far as I can infer from things like Debian code search etc, all support libraries that are in use to access EFI variables will prefer the efivarfs pseudo-filesystem, and fall back to the sysfs interface otherwise.
The efivarfs pseudo-FS is 'default m' when CONFIG_EFI=y, and all the distros have switched to it a very long time ago. But individual cases might exist where a script accesses /sys/firmware/efi/vars/... directly, and this will no longer work after merging PR 2/2 of this series.
In summary, I am leaving it up to you to pull the trigger on PR 2/2 - if you prefer to deal with this in a different way, please feel free to disregard the second PR, and make a suggestion how to address this instead.
Note that the 2/2 changes were put at the end so reverting this should be quite straight-forward, in case we do decide to merge them and they turn out to be causing problems.
Thanks,
Ard.
Ard Biesheuvel
maintainer[GIT PULL 2/2] EFI removal of efivars sysfs driver
The following changes since commit 5ac941367a6f85777ef34ec15d60e17ea8e446d4:
efi: vars: Drop __efivar_entry_iter() helper which is no longer used (2022-06-24 20:40:19 +0200)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git tags/efi-efivars-removal-for-v5.20
for you to fetch changes up to 2d82e6227ea189c0589e7383a36616ac2a2d248c:
efi: vars: Move efivar caching layer into efivarfs (2022-06-24 20:40:19 +0200)
----------------------------------------------------------------
EFI efivars sysfs interface removal
Remove the obsolete 'efivars' sysfs based interface to the EFI variable store, now that all users have moved to the efivarfs pseudo file system, which was created ~10 years ago to address some fundamental shortcomings in the sysfs based driver.
Move the 'business logic' related to which EFI variables are important and may affect the boot flow from the efivars support layer into the efivarfs pseudo file system, so it is no longer exposed to other parts of the kernel.
----------------------------------------------------------------
Ard Biesheuvel (3):
efi: vars: Remove deprecated 'efivars' sysfs interface
efi: vars: Switch to new wrapper layer
efi: vars: Move efivar caching layer into efivarfs
Documentation/x86/x86_64/uefi.rst | 2 +- arch/arm/configs/milbeaut_m10v_defconfig | 1 - arch/ia64/configs/bigsur_defconfig | 1 - arch/ia64/configs/generic_defconfig | 1 - arch/ia64/configs/gensparse_defconfig | 1 - arch/ia64/configs/tiger_defconfig | 1 - arch/ia64/configs/zx1_defconfig | 1 - arch/x86/configs/i386_defconfig | 1 - arch/x86/configs/x86_64_defconfig | 1 - drivers/firmware/efi/Kconfig | 12 - drivers/firmware/efi/Makefile | 1 - drivers/firmware/efi/efi.c | 1 + drivers/firmware/efi/efivars.c | 660 ------------------- drivers/firmware/efi/vars.c | 1023 ------------------------------ fs/efivarfs/Makefile | 2 +- fs/efivarfs/internal.h | 40 ++ fs/efivarfs/vars.c | 738 +++++++++++++++++++++ include/linux/efi.h | 56 -- 18 files changed, 781 insertions(+), 1762 deletions(-) delete mode 100644 drivers/firmware/efi/efivars.c create mode 100644 fs/efivarfs/vars.c
Re: [GIT PULL 2/2] EFI removal of efivars sysfs driver
Quoted 2 lines · Ard Biesheuvel
EFI efivars sysfs interface removal
I've pulled this, but let's see if somebody screams. We may have to reinstate it if it's still used.
Linus
Re: [GIT PULL 2/2] EFI removal of efivars sysfs driver
In reply to Ard BiesheuvelThe pull request you sent on Mon, 1 Aug 2022 15:41:17 +0200:
The pull request you sent on Mon, 1 Aug 2022 15:41:17 +0200:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.gittags/efi-efivars-removal-for-v5.20
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ab17c0cd376f240bb8ead6f03be2bb4748bbc61a
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html
Ard Biesheuvel
maintainer[GIT PULL 1/2] EFI updates for v5.20
In reply to Ard BiesheuvelThe following changes since commit f2906aa863381afb0015a9eb7fefad885d4e5a56:
Linux 5.19-rc1 (2022-06-05 17:18:54 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git tags/efi-next-for-v5.20
for you to fetch changes up to e3435fff6ae03ca3ec1279299664f968478067e2:
ACPI: Move PRM config option under the main ACPI config (2022-06-30 17:36:03 +0200)
----------------------------------------------------------------
EFI updates for v5.20
- Enable mirrored memory for arm64
- Fix up several abuses of the efivar API
- Refactor the efivar API in preparation for moving the 'business logic' part of it into efivarfs
- Enable ACPI PRM on arm64
----------------------------------------------------------------
Ard Biesheuvel (13):
efi: avoid efivars layer when loading SSDTs from variables
efi: efibc: avoid efivar API for setting variables
media: atomisp_gmin_platform: stop abusing efivar API
iwlwifi: Switch to proper EFI variable store interface
brcmfmac: Switch to appropriate helper to load EFI variable contents selftests/kexec: remove broken EFI_VARS secure boot fallback check
Input: applespi - avoid efivars API and invoke EFI services directly
pstore: Add priv field to pstore_record for backend specific use
efi: vars: Don't drop lock in the middle of efivar_init()
efi: vars: Add thin wrapper around EFI get/set variable interface
efi: pstore: Omit efivars caching EFI varstore access layer
efi: vars: Use locking version to iterate over efivars linked lists
efi: vars: Drop __efivar_entry_iter() helper which is no longer used
Liu Zixian (1):
efi: Correct comment on efi_memmap_alloc
Ma Wupeng (5):
efi: Make code to find mirrored memory ranges generic
mm: Ratelimited mirrored memory related warning messages
mm: Limit warning message in vmemmap_verify() to once
arm64: mm: Only remove nomap flag for initrd
memblock: Disable mirror feature if kernelcore is not specified
Sudeep Holla (4):
efi: Simplify arch_efi_call_virt() macro
ACPI: PRM: Change handler_addr type to void pointer
ACPI: Enable Platform Runtime Mechanism(PRM) support on ARM64
ACPI: Move PRM config option under the main ACPI config
Zheng Zhi Yuan (1):
drivers: fix typo in firmware/efi/memmap.c
arch/arm/include/asm/efi.h | 7 - arch/arm64/include/asm/efi.h | 7 +- arch/arm64/mm/init.c | 2 +- arch/loongarch/include/asm/efi.h | 16 +- arch/riscv/include/asm/efi.h | 2 - arch/x86/include/asm/efi.h | 7 +- arch/x86/platform/efi/efi.c | 23 -- drivers/acpi/Kconfig | 30 +- drivers/acpi/prmt.c | 4 +- drivers/firmware/efi/Kconfig | 2 + drivers/firmware/efi/efi-init.c | 1 + drivers/firmware/efi/efi-pstore.c | 377 +++++---------------- drivers/firmware/efi/efi.c | 126 +++---- drivers/firmware/efi/efibc.c | 76 ++--- drivers/firmware/efi/efivars.c | 25 +- drivers/firmware/efi/memmap.c | 5 +- drivers/firmware/efi/vars.c | 258 +++++++++----- drivers/input/keyboard/applespi.c | 42 +-- .../broadcom/brcm80211/brcmfmac/firmware.c | 25 +- drivers/net/wireless/intel/iwlwifi/fw/uefi.c | 96 ++---- .../media/atomisp/pci/atomisp_gmin_platform.c | 27 +- fs/efivarfs/super.c | 15 +- fs/pstore/inode.c | 1 + fs/pstore/platform.c | 1 + include/linux/efi.h | 33 +- include/linux/pstore.h | 4 + mm/internal.h | 2 + mm/memblock.c | 7 +- mm/page_alloc.c | 2 +- mm/sparse-vmemmap.c | 2 +- tools/testing/selftests/kexec/kexec_common_lib.sh | 36 +- 31 files changed, 486 insertions(+), 775 deletions(-)
Re: [GIT PULL 1/2] EFI updates for v5.20
The pull request you sent on Mon, 1 Aug 2022 15:41:16 +0200:
The pull request you sent on Mon, 1 Aug 2022 15:41:16 +0200:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.gittags/efi-next-for-v5.20
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/97a77ab14ffac749ec2419c92ec2954111c22d22
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html