Skip to contentSkip to conversation

EFI updates for v4.17

GIT PULL Ingo Molnar 2 participants 2 messages Apr 2, 2018 – Apr 3, 2018 EFI

lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest efi-core-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-core-for-linus

# HEAD: 03781e40890c18bdea40092355b61431d0073c1d x86/efi: Use efi_switch_mm() rather than manually twiddling with %cr3

NOTE: this tree depends on the x86/mm tree - if you have not pulled that tree
then please disregard this pull request.

The main EFI changes in this cycle were:

- Fix the apple-properties code (Andy Shevchenko)

- Add WARN() on arm64 if UEFI Runtime Services corrupt the reserved x18 register
(Ard Biesheuvel)

- Use efi_switch_mm() on x86 instead of manipulating %cr3 directly

(Sai Praneeth)

- Fix early memremap leak in ESRT code (Ard Biesheuvel)

- Switch to L"xxx" notation for wide string literals

(Ard Biesheuvel)

- ... plus misc other cleanups and bugfixes

Thanks,

Ingo

------------------>
Andy Shevchenko (2):
efi/apple-properties: Remove redundant attribute initialization from unmarshal_key_value_pairs() efi/apple-properties: Use memremap() instead of ioremap()

Ard Biesheuvel (5):
efi/arm*: Stop printing addresses of virtual mappings efi/arm64: Check whether x18 is preserved by runtime services calls
efi: Reorder pr_notice() with add_device_randomness() call efi/esrt: Fix handling of early ESRT table mapping
efi: Use string literals for efi_char16_t variable initializers

Colin Ian King (1):
efi: Make const array 'apple' static

Ingo Molnar (1):
Merge branch 'x86/mm' into efi/core

Jia-Ju Bai (1):
x86/efi: Replace GFP_ATOMIC with GFP_KERNEL in efi_query_variable_store()

Mark Rutland (1):
efi/arm*: Only register page tables when they exist

Sai Praneeth (3):
efi: Use efi_mm in x86 as well as ARM
x86/efi: Replace efi_pgd with efi_mm.pgd
x86/efi: Use efi_switch_mm() rather than manually twiddling with %cr3

 arch/arm64/include/asm/efi.h              |  4 +++-
 arch/arm64/kernel/Makefile                |  3 ++-
 arch/arm64/kernel/efi-rt-wrapper.S        | 41 +++++++++++++++++++++++++++++++++++++++++
 arch/arm64/kernel/efi.c                   |  6 ++++++
 arch/x86/boot/compressed/eboot.c          |  3 ++-
 arch/x86/include/asm/efi.h                | 26 +++++++++++---------------
 arch/x86/mm/debug_pagetables.c            |  6 +++---
 arch/x86/platform/efi/efi_64.c            | 60 +++++++++++++++++++++++++++++++++---------------------------
 arch/x86/platform/efi/efi_thunk_64.S      |  2 +-
 arch/x86/platform/efi/quirks.c            | 10 ++++++----
 drivers/firmware/efi/apple-properties.c   | 20 +++++++-------------
 drivers/firmware/efi/arm-runtime.c        | 17 ++++-------------
 drivers/firmware/efi/efi.c                | 11 ++++++++++-
 drivers/firmware/efi/esrt.c               | 17 ++++-------------
 drivers/firmware/efi/libstub/Makefile     |  2 +-
 drivers/firmware/efi/libstub/secureboot.c | 12 +++---------
 drivers/firmware/efi/libstub/tpm.c        |  7 ++-----
 include/linux/efi.h                       |  2 ++
 18 files changed, 141 insertions(+), 108 deletions(-)
 create mode 100644 arch/arm64/kernel/efi-rt-wrapper.S
#1 lore raw
Quoted 2 lines · Ingo Molnar

- Use efi_switch_mm() on x86 instead of manipulating %cr3 directly

This seems to cause new warnings, both on my laptop and my desktop. I'm surprised you don't see them.

Looks like this:

    WARNING: CPU: 0 PID: 0 at arch/x86/include/asm/tlbflush.h:134
load_new_mm_cr3+0x114/0x170
    Modules linked in:
    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.16.0-02277-gbc16d4052f1a #1
    Hardware name: System manufacturer System Product Name/Z170-K,
BIOS 3301 02/08/2017
    RIP: 0010:load_new_mm_cr3+0x114/0x170
    RSP: 0000:ffffffff9b203e38 EFLAGS: 00010046
    RAX: 0000000000000000 RBX: ffffffff9b26f5a0 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff9b20a000
    RBP: ffffffff9b203e90 R08: 0000000000000000 R09: 000000000f63eb29
    R10: ffffffff9b203ea8 R11: 00000000c3292018 R12: 0000000000000000
    R13: ffffffff9b2e1180 R14: 000000000001ee80 R15: 0000000000000000
    FS:  0000000000000000(0000) GS:ffff968df6c00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffff968df6fff000 CR3: 00000004261e6002 CR4: 00000000000606b0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     switch_mm_irqs_off+0x267/0x590
     switch_mm+0xe/0x20
     efi_switch_mm+0x3e/0x50
     efi_enter_virtual_mode+0x43f/0x4da
     start_kernel+0x3bf/0x458
     secondary_startup_64+0xa5/0xb0

and the reason seems to be some oddity of secondary_startup() doing this very early, because the warning is this:

        VM_WARN_ON_ONCE(!this_cpu_has(X86_FEATURE_PCID));

and obviously I *do* have X86_FEATURE_PCID on my machine, but presumably that bit hasn't been set yet this early in the secondary CPU boot.

The above is a pure guess from the call trace, maybe there's something else going on.

Everything seems to *work* despite the warning, but this needs fixing.

Linus