1. 03 Oct, 2014 25 commits
    • Matt Fleming's avatar
      Merge branch 'next' into efi-next-merge · 75b12857
      Matt Fleming authored
      Conflicts:
      	arch/x86/boot/compressed/eboot.c
      75b12857
    • Matt Fleming's avatar
      rtc: Disable EFI rtc for x86 · 7efe6659
      Matt Fleming authored
      commit da167ad7 ("rtc: ia64: allow other architectures to use EFI
      RTC") inadvertently introduced a regression for x86 because we've been
      careful not to enable the EFI rtc driver due to the generally buggy
      implementations of the time-related EFI runtime services.
      
      In fact, since the above commit was merged we've seen reports of crashes
      on 32-bit tablets,
      
        https://bugzilla.kernel.org/show_bug.cgi?id=84241#c21
      
      Disable it explicitly for x86 so that we don't give users false hope
      that this driver will work - it won't, and your machine is likely to
      crash.
      Acked-by: default avatarMark Salter <msalter@redhat.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: <stable@vger.kernel.org> # v3.17
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      7efe6659
    • Ard Biesheuvel's avatar
      efi: rtc-efi: Export platform:rtc-efi as module alias · 3f71f6da
      Ard Biesheuvel authored
      When the rtc-efi driver is built as a module, we already register the
      EFI rtc as a platform device if UEFI Runtime Services are enabled.
      To wire it up to udev, and let the module be loaded automatically, we
      need to export the 'platform:rtc-efi' alias from the module.
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Dave Young <dyoung@redhat.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      3f71f6da
    • Matt Fleming's avatar
      efi: Delete the in_nmi() conditional runtime locking · 60b4dc77
      Matt Fleming authored
      commit 5dc3826d9f08 ("efi: Implement mandatory locking for UEFI Runtime
      Services") implemented some conditional locking when accessing variable
      runtime services that Ingo described as "pretty disgusting".
      
      The intention with the !efi_in_nmi() checks was to avoid live-locks when
      trying to write pstore crash data into an EFI variable. Such lockless
      accesses are allowed according to the UEFI specification when we're in a
      "non-recoverable" state, but whether or not things are implemented
      correctly in actual firmware implementations remains an unanswered
      question, and so it would seem sensible to avoid doing any kind of
      unsynchronized variable accesses.
      
      Furthermore, the efi_in_nmi() tests are inadequate because they don't
      account for the case where we call EFI variable services from panic or
      oops callbacks and aren't executing in NMI context. In other words,
      live-locking is still possible.
      
      Let's just remove the conditional locking altogether. Now we've got the
      ->set_variable_nonblocking() EFI variable operation we can abort if the
      runtime lock is already held. Aborting is by far the safest option.
      
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      60b4dc77
    • Matt Fleming's avatar
      efi: Provide a non-blocking SetVariable() operation · 6d80dba1
      Matt Fleming authored
      There are some circumstances that call for trying to write an EFI
      variable in a non-blocking way. One such scenario is when writing pstore
      data in efi_pstore_write() via the pstore_dump() kdump callback.
      
      Now that we have an EFI runtime spinlock we need a way of aborting if
      there is contention instead of spinning, since when writing pstore data
      from the kdump callback, the runtime lock may already be held by the CPU
      that's running the callback if we crashed in the middle of an EFI
      variable operation.
      
      The situation is sufficiently special that a new EFI variable operation
      is warranted.
      
      Introduce ->set_variable_nonblocking() for this use case. It is an
      optional EFI backend operation, and need only be implemented by those
      backends that usually acquire locks to serialize access to EFI
      variables, as is the case for virt_efi_set_variable() where we now grab
      the EFI runtime spinlock.
      
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      6d80dba1
    • Andre Müller's avatar
      x86/efi: Adding efi_printks on memory allocationa and pci.reads · 77e21e87
      Andre Müller authored
      All other calls to allocate memory seem to make some noise already, with the
      exception of two calls (for gop, uga) in the setup_graphics path.
      
      The purpose is to be noisy on worrysome errors immediately.
      
      commit fb86b244 ("x86/efi: Add better error logging to EFI boot
      stub") introduces printing false alarms for lots of hardware. Rather
      than playing Whack a Mole with non-fatal exit conditions, try the other
      way round.
      
      This is per Matt Fleming's suggestion:
      
      > Where I think we could improve things
      > is by adding efi_printk() message in certain error paths. Clearly, not
      > all error paths need such messages, e.g. the EFI_INVALID_PARAMETER path
      > you highlighted above, but it makes sense for memory allocation and PCI
      > read failures.
      
      Link: http://article.gmane.org/gmane.linux.kernel.efi/4628Signed-off-by: default avatarAndre Müller <andre.muller@web.de>
      Cc: Ulf Winkelvos <ulf@winkelvos.de>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      77e21e87
    • Mathias Krause's avatar
      x86/efi: Mark initialization code as such · 4e78eb05
      Mathias Krause authored
      The 32 bit and 64 bit implementations differ in their __init annotations
      for some functions referenced from the common EFI code. Namely, the 32
      bit variant is missing some of the __init annotations the 64 bit variant
      has.
      
      To solve the colliding annotations, mark the corresponding functions in
      efi_32.c as initialization code, too -- as it is such.
      
      Actually, quite a few more functions are only used during initialization
      and therefore can be marked __init. They are therefore annotated, too.
      Also add the __init annotation to the prototypes in the efi.h header so
      users of those functions will see it's meant as initialization code
      only.
      
      This patch also fixes the "prelog" typo. ("prologue" / "epilogue" might
      be more appropriate but this is C code after all, not an opera! :D)
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      4e78eb05
    • Mathias Krause's avatar
      x86/efi: Update comment regarding required phys mapped EFI services · 0ce4605c
      Mathias Krause authored
      Commit 3f4a7836 ("x86/efi: Rip out phys_efi_get_time()") left
      set_virtual_address_map as the only runtime service needed with a
      phys mapping but missed to update the preceding comment. Fix that.
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      0ce4605c
    • Mathias Krause's avatar
      x86/efi: Unexport add_efi_memmap variable · 60920685
      Mathias Krause authored
      This variable was accidentally exported, even though it's only used in
      this compilation unit and only during initialization.
      
      Remove the bogus export, make the variable static instead and mark it
      as __initdata.
      
      Fixes: 200001eb ("x86 boot: only pick up additional EFI memmap...")
      Cc: Paul Jackson <pj@sgi.com>
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      60920685
    • Mathias Krause's avatar
      x86/efi: Remove unused efi_call* macros · 24ffd84b
      Mathias Krause authored
      Complement commit 62fa6e69 ("x86/efi: Delete most of the efi_call*
      macros") and delete the stub macros for the !CONFIG_EFI case, too. In
      fact, there are no EFI calls in this case so we don't need a dummy for
      efi_call() even.
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      24ffd84b
    • Mark Rustad's avatar
      efi: Resolve some shadow warnings · b2fce819
      Mark Rustad authored
      It is a really bad idea to declare variables or parameters that
      have the same name as common types. It is valid C, but it gets
      surprising if a macro expansion attempts to declare an inner
      local with that type. Change the local names to eliminate the
      hazard.
      
      Change s16 => str16, s8 => str8.
      
      This resolves warnings seen when using W=2 during make, for instance:
      
      drivers/firmware/efi/vars.c: In function ‘dup_variable_bug’:
      drivers/firmware/efi/vars.c:324:44: warning: declaration of ‘s16’ shadows a global declaration [-Wshadow]
       static void dup_variable_bug(efi_char16_t *s16, efi_guid_t *vendor_guid,
      
      drivers/firmware/efi/vars.c:328:8: warning: declaration of ‘s8’ shadows a global declaration [-Wshadow]
        char *s8;
      Signed-off-by: default avatarMark Rustad <mark.d.rustad@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      b2fce819
    • Laszlo Ersek's avatar
      arm64: efi: Format EFI memory type & attrs with efi_md_typeattr_format() · 65ba758f
      Laszlo Ersek authored
      An example log excerpt demonstrating the change:
      
      Before the patch:
      
      > Processing EFI memory map:
      >   0x000040000000-0x000040000fff [Loader Data]
      >   0x000040001000-0x00004007ffff [Conventional Memory]
      >   0x000040080000-0x00004072afff [Loader Data]
      >   0x00004072b000-0x00005fdfffff [Conventional Memory]
      >   0x00005fe00000-0x00005fe0ffff [Loader Data]
      >   0x00005fe10000-0x0000964e8fff [Conventional Memory]
      >   0x0000964e9000-0x0000964e9fff [Loader Data]
      >   0x0000964ea000-0x000096c52fff [Loader Code]
      >   0x000096c53000-0x00009709dfff [Boot Code]*
      >   0x00009709e000-0x0000970b3fff [Runtime Code]*
      >   0x0000970b4000-0x0000970f4fff [Runtime Data]*
      >   0x0000970f5000-0x000097117fff [Runtime Code]*
      >   0x000097118000-0x000097199fff [Runtime Data]*
      >   0x00009719a000-0x0000971dffff [Runtime Code]*
      >   0x0000971e0000-0x0000997f8fff [Conventional Memory]
      >   0x0000997f9000-0x0000998f1fff [Boot Data]*
      >   0x0000998f2000-0x0000999eafff [Conventional Memory]
      >   0x0000999eb000-0x00009af09fff [Boot Data]*
      >   0x00009af0a000-0x00009af21fff [Conventional Memory]
      >   0x00009af22000-0x00009af46fff [Boot Data]*
      >   0x00009af47000-0x00009af5bfff [Conventional Memory]
      >   0x00009af5c000-0x00009afe1fff [Boot Data]*
      >   0x00009afe2000-0x00009afe2fff [Conventional Memory]
      >   0x00009afe3000-0x00009c01ffff [Boot Data]*
      >   0x00009c020000-0x00009efbffff [Conventional Memory]
      >   0x00009efc0000-0x00009f14efff [Boot Code]*
      >   0x00009f14f000-0x00009f162fff [Runtime Code]*
      >   0x00009f163000-0x00009f194fff [Runtime Data]*
      >   0x00009f195000-0x00009f197fff [Boot Data]*
      >   0x00009f198000-0x00009f198fff [Runtime Data]*
      >   0x00009f199000-0x00009f1acfff [Conventional Memory]
      >   0x00009f1ad000-0x00009f1affff [Boot Data]*
      >   0x00009f1b0000-0x00009f1b0fff [Runtime Data]*
      >   0x00009f1b1000-0x00009fffffff [Boot Data]*
      >   0x000004000000-0x000007ffffff [Memory Mapped I/O]
      >   0x000009010000-0x000009010fff [Memory Mapped I/O]
      
      After the patch:
      
      > Processing EFI memory map:
      >   0x000040000000-0x000040000fff [Loader Data        |   |  |  |  |   |WB|WT|WC|UC]
      >   0x000040001000-0x00004007ffff [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC]
      >   0x000040080000-0x00004072afff [Loader Data        |   |  |  |  |   |WB|WT|WC|UC]
      >   0x00004072b000-0x00005fdfffff [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC]
      >   0x00005fe00000-0x00005fe0ffff [Loader Data        |   |  |  |  |   |WB|WT|WC|UC]
      >   0x00005fe10000-0x0000964e8fff [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC]
      >   0x0000964e9000-0x0000964e9fff [Loader Data        |   |  |  |  |   |WB|WT|WC|UC]
      >   0x0000964ea000-0x000096c52fff [Loader Code        |   |  |  |  |   |WB|WT|WC|UC]
      >   0x000096c53000-0x00009709dfff [Boot Code          |   |  |  |  |   |WB|WT|WC|UC]*
      >   0x00009709e000-0x0000970b3fff [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC]*
      >   0x0000970b4000-0x0000970f4fff [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC]*
      >   0x0000970f5000-0x000097117fff [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC]*
      >   0x000097118000-0x000097199fff [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC]*
      >   0x00009719a000-0x0000971dffff [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC]*
      >   0x0000971e0000-0x0000997f8fff [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC]
      >   0x0000997f9000-0x0000998f1fff [Boot Data          |   |  |  |  |   |WB|WT|WC|UC]*
      >   0x0000998f2000-0x0000999eafff [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC]
      >   0x0000999eb000-0x00009af09fff [Boot Data          |   |  |  |  |   |WB|WT|WC|UC]*
      >   0x00009af0a000-0x00009af21fff [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC]
      >   0x00009af22000-0x00009af46fff [Boot Data          |   |  |  |  |   |WB|WT|WC|UC]*
      >   0x00009af47000-0x00009af5bfff [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC]
      >   0x00009af5c000-0x00009afe1fff [Boot Data          |   |  |  |  |   |WB|WT|WC|UC]*
      >   0x00009afe2000-0x00009afe2fff [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC]
      >   0x00009afe3000-0x00009c01ffff [Boot Data          |   |  |  |  |   |WB|WT|WC|UC]*
      >   0x00009c020000-0x00009efbffff [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC]
      >   0x00009efc0000-0x00009f14efff [Boot Code          |   |  |  |  |   |WB|WT|WC|UC]*
      >   0x00009f14f000-0x00009f162fff [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC]*
      >   0x00009f163000-0x00009f194fff [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC]*
      >   0x00009f195000-0x00009f197fff [Boot Data          |   |  |  |  |   |WB|WT|WC|UC]*
      >   0x00009f198000-0x00009f198fff [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC]*
      >   0x00009f199000-0x00009f1acfff [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC]
      >   0x00009f1ad000-0x00009f1affff [Boot Data          |   |  |  |  |   |WB|WT|WC|UC]*
      >   0x00009f1b0000-0x00009f1b0fff [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC]*
      >   0x00009f1b1000-0x00009fffffff [Boot Data          |   |  |  |  |   |WB|WT|WC|UC]*
      >   0x000004000000-0x000007ffffff [Memory Mapped I/O  |RUN|  |  |  |   |  |  |  |UC]
      >   0x000009010000-0x000009010fff [Memory Mapped I/O  |RUN|  |  |  |   |  |  |  |UC]
      
      The attribute bitmap is now displayed, in decoded form.
      Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      65ba758f
    • Laszlo Ersek's avatar
      ia64: efi: Format EFI memory type & attrs with efi_md_typeattr_format() · 77b12bcf
      Laszlo Ersek authored
      The effects of the patch on the i64 memory map log are similar to those
      visible in the previous (x86) patch: the type enum and the attribute
      bitmap are decoded.
      Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      77b12bcf
    • Laszlo Ersek's avatar
      x86: efi: Format EFI memory type & attrs with efi_md_typeattr_format() · ace1d121
      Laszlo Ersek authored
      An example log excerpt demonstrating the change:
      
      Before the patch:
      
      > efi: mem00: type=7, attr=0xf, range=[0x0000000000000000-0x000000000009f000) (0MB)
      > efi: mem01: type=2, attr=0xf, range=[0x000000000009f000-0x00000000000a0000) (0MB)
      > efi: mem02: type=7, attr=0xf, range=[0x0000000000100000-0x0000000000400000) (3MB)
      > efi: mem03: type=2, attr=0xf, range=[0x0000000000400000-0x0000000000800000) (4MB)
      > efi: mem04: type=10, attr=0xf, range=[0x0000000000800000-0x0000000000808000) (0MB)
      > efi: mem05: type=7, attr=0xf, range=[0x0000000000808000-0x0000000000810000) (0MB)
      > efi: mem06: type=10, attr=0xf, range=[0x0000000000810000-0x0000000000900000) (0MB)
      > efi: mem07: type=4, attr=0xf, range=[0x0000000000900000-0x0000000001100000) (8MB)
      > efi: mem08: type=7, attr=0xf, range=[0x0000000001100000-0x0000000001400000) (3MB)
      > efi: mem09: type=2, attr=0xf, range=[0x0000000001400000-0x0000000002613000) (18MB)
      > efi: mem10: type=7, attr=0xf, range=[0x0000000002613000-0x0000000004000000) (25MB)
      > efi: mem11: type=4, attr=0xf, range=[0x0000000004000000-0x0000000004020000) (0MB)
      > efi: mem12: type=7, attr=0xf, range=[0x0000000004020000-0x00000000068ea000) (40MB)
      > efi: mem13: type=2, attr=0xf, range=[0x00000000068ea000-0x00000000068f0000) (0MB)
      > efi: mem14: type=3, attr=0xf, range=[0x00000000068f0000-0x0000000006c7b000) (3MB)
      > efi: mem15: type=6, attr=0x800000000000000f, range=[0x0000000006c7b000-0x0000000006c7d000) (0MB)
      > efi: mem16: type=5, attr=0x800000000000000f, range=[0x0000000006c7d000-0x0000000006c85000) (0MB)
      > efi: mem17: type=6, attr=0x800000000000000f, range=[0x0000000006c85000-0x0000000006c87000) (0MB)
      > efi: mem18: type=3, attr=0xf, range=[0x0000000006c87000-0x0000000006ca3000) (0MB)
      > efi: mem19: type=6, attr=0x800000000000000f, range=[0x0000000006ca3000-0x0000000006ca6000) (0MB)
      > efi: mem20: type=10, attr=0xf, range=[0x0000000006ca6000-0x0000000006cc6000) (0MB)
      > efi: mem21: type=6, attr=0x800000000000000f, range=[0x0000000006cc6000-0x0000000006d95000) (0MB)
      > efi: mem22: type=5, attr=0x800000000000000f, range=[0x0000000006d95000-0x0000000006e22000) (0MB)
      > efi: mem23: type=7, attr=0xf, range=[0x0000000006e22000-0x0000000007165000) (3MB)
      > efi: mem24: type=4, attr=0xf, range=[0x0000000007165000-0x0000000007d22000) (11MB)
      > efi: mem25: type=7, attr=0xf, range=[0x0000000007d22000-0x0000000007d25000) (0MB)
      > efi: mem26: type=3, attr=0xf, range=[0x0000000007d25000-0x0000000007ea2000) (1MB)
      > efi: mem27: type=5, attr=0x800000000000000f, range=[0x0000000007ea2000-0x0000000007ed2000) (0MB)
      > efi: mem28: type=6, attr=0x800000000000000f, range=[0x0000000007ed2000-0x0000000007ef6000) (0MB)
      > efi: mem29: type=7, attr=0xf, range=[0x0000000007ef6000-0x0000000007f00000) (0MB)
      > efi: mem30: type=9, attr=0xf, range=[0x0000000007f00000-0x0000000007f02000) (0MB)
      > efi: mem31: type=10, attr=0xf, range=[0x0000000007f02000-0x0000000007f06000) (0MB)
      > efi: mem32: type=4, attr=0xf, range=[0x0000000007f06000-0x0000000007fd0000) (0MB)
      > efi: mem33: type=6, attr=0x800000000000000f, range=[0x0000000007fd0000-0x0000000007ff0000) (0MB)
      > efi: mem34: type=7, attr=0xf, range=[0x0000000007ff0000-0x0000000008000000) (0MB)
      
      After the patch:
      
      > efi: mem00: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x000000000009f000) (0MB)
      > efi: mem01: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x000000000009f000-0x00000000000a0000) (0MB)
      > efi: mem02: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000100000-0x0000000000400000) (3MB)
      > efi: mem03: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000400000-0x0000000000800000) (4MB)
      > efi: mem04: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000800000-0x0000000000808000) (0MB)
      > efi: mem05: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000808000-0x0000000000810000) (0MB)
      > efi: mem06: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000810000-0x0000000000900000) (0MB)
      > efi: mem07: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000900000-0x0000000001100000) (8MB)
      > efi: mem08: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000001100000-0x0000000001400000) (3MB)
      > efi: mem09: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000001400000-0x0000000002613000) (18MB)
      > efi: mem10: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000002613000-0x0000000004000000) (25MB)
      > efi: mem11: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000004000000-0x0000000004020000) (0MB)
      > efi: mem12: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000004020000-0x00000000068ea000) (40MB)
      > efi: mem13: [Loader Data        |   |  |  |  |   |WB|WT|WC|UC] range=[0x00000000068ea000-0x00000000068f0000) (0MB)
      > efi: mem14: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x00000000068f0000-0x0000000006c7b000) (3MB)
      > efi: mem15: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x0000000006c7b000-0x0000000006c7d000) (0MB)
      > efi: mem16: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x0000000006c7d000-0x0000000006c85000) (0MB)
      > efi: mem17: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x0000000006c85000-0x0000000006c87000) (0MB)
      > efi: mem18: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000006c87000-0x0000000006ca3000) (0MB)
      > efi: mem19: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x0000000006ca3000-0x0000000006ca6000) (0MB)
      > efi: mem20: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000006ca6000-0x0000000006cc6000) (0MB)
      > efi: mem21: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x0000000006cc6000-0x0000000006d95000) (0MB)
      > efi: mem22: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x0000000006d95000-0x0000000006e22000) (0MB)
      > efi: mem23: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000006e22000-0x0000000007165000) (3MB)
      > efi: mem24: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000007165000-0x0000000007d22000) (11MB)
      > efi: mem25: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000007d22000-0x0000000007d25000) (0MB)
      > efi: mem26: [Boot Code          |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000007d25000-0x0000000007ea2000) (1MB)
      > efi: mem27: [Runtime Code       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x0000000007ea2000-0x0000000007ed2000) (0MB)
      > efi: mem28: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x0000000007ed2000-0x0000000007ef6000) (0MB)
      > efi: mem29: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000007ef6000-0x0000000007f00000) (0MB)
      > efi: mem30: [ACPI Reclaim Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000007f00000-0x0000000007f02000) (0MB)
      > efi: mem31: [ACPI Memory NVS    |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000007f02000-0x0000000007f06000) (0MB)
      > efi: mem32: [Boot Data          |   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000007f06000-0x0000000007fd0000) (0MB)
      > efi: mem33: [Runtime Data       |RUN|  |  |  |   |WB|WT|WC|UC] range=[0x0000000007fd0000-0x0000000007ff0000) (0MB)
      > efi: mem34: [Conventional Memory|   |  |  |  |   |WB|WT|WC|UC] range=[0x0000000007ff0000-0x0000000008000000) (0MB)
      
      Both the type enum and the attribute bitmap are decoded, with the
      additional benefit that the memory ranges line up as well.
      Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      ace1d121
    • Laszlo Ersek's avatar
      efi: Introduce efi_md_typeattr_format() · 98d2a6ca
      Laszlo Ersek authored
      At the moment, there are three architectures debug-printing the EFI memory
      map at initialization: x86, ia64, and arm64. They all use different format
      strings, plus the EFI memory type and the EFI memory attributes are
      similarly hard to decode for a human reader.
      
      Introduce a helper __init function that formats the memory type and the
      memory attributes in a unified way, to a user-provided character buffer.
      
      The array "memory_type_name" is copied from the arm64 code, temporarily
      duplicating it. The (otherwise optional) braces around each string literal
      in the initializer list are dropped in order to match the kernel coding
      style more closely. The element size is tightened from 32 to 20 bytes
      (maximum actual string length + 1) so that we can derive the field width
      from the element size.
      Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      [ Dropped useless 'register' keyword, which compiler will ignore ]
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      98d2a6ca
    • Laszlo Ersek's avatar
      efi: Add macro for EFI_MEMORY_UCE memory attribute · 9c97e0bd
      Laszlo Ersek authored
      Add the following macro from the UEFI spec, for completeness:
      
        EFI_MEMORY_UCE  Memory cacheability attribute: The memory region
                        supports being configured as not cacheable, exported,
                        and supports the "fetch and add" semaphore mechanism.
      Signed-off-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      9c97e0bd
    • Dave Young's avatar
      x86/efi: Clear EFI_RUNTIME_SERVICES if failing to enter virtual mode · a5a750a9
      Dave Young authored
      If enter virtual mode failed due to some reason other than the efi call
      the EFI_RUNTIME_SERVICES bit in efi.flags should be cleared thus users
      of efi runtime services can check the bit and handle the case instead of
      assume efi runtime is ok.
      
      Per Matt, if efi call SetVirtualAddressMap fails we will be not sure
      it's safe to make any assumptions about the state of the system. So
      kernel panics instead of clears EFI_RUNTIME_SERVICES bit.
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      a5a750a9
    • Dave Young's avatar
      arm64/efi: Do not enter virtual mode if booting with efi=noruntime or noefi · 6632210f
      Dave Young authored
      In case efi runtime disabled via noefi kernel cmdline
      arm64_enter_virtual_mode should error out.
      
      At the same time move early_memunmap(memmap.map, mapsize) to the
      beginning of the function or it will leak early mem.
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Reviewed-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      6632210f
    • Dave Young's avatar
      arm64/efi: uefi_init error handling fix · 88f8abd5
      Dave Young authored
      There's one early memmap leak in uefi_init error path, fix it and
      slightly tune the error handling code.
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Acked-by: default avatarMark Salter <msalter@redhat.com>
      Reported-by: default avatarWill Deacon <will.deacon@arm.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      88f8abd5
    • Dave Young's avatar
      efi: Add kernel param efi=noruntime · 5ae3683c
      Dave Young authored
      noefi kernel param means actually disabling efi runtime, Per suggestion
      from Leif Lindholm efi=noruntime should be better. But since noefi is
      already used in X86 thus just adding another param efi=noruntime for
      same purpose.
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      5ae3683c
    • Dave Young's avatar
      lib: Add a generic cmdline parse function parse_option_str · 6ccc72b8
      Dave Young authored
      There should be a generic function to parse params like a=b,c
      Adding parse_option_str in lib/cmdline.c which will return true
      if there's specified option set in the params.
      
      Also updated efi=old_map parsing code to use the new function
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      6ccc72b8
    • Dave Young's avatar
      efi: Move noefi early param code out of x86 arch code · b2e0a54a
      Dave Young authored
      noefi param can be used for arches other than X86 later, thus move it
      out of x86 platform code.
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      b2e0a54a
    • Josh Triplett's avatar
      efi-bgrt: Add error handling; inform the user when ignoring the BGRT · 1282278e
      Josh Triplett authored
      Gracefully handle failures to allocate memory for the image, which might
      be arbitrarily large.
      
      efi_bgrt_init can fail in various ways as well, usually because the
      BIOS-provided BGRT structure does not match expectations.  Add
      appropriate error messages rather than failing silently.
      Reported-by: default avatarSrihari Vijayaraghavan <linux.bug.reporting@gmail.com>
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=81321Signed-off-by: default avatarJosh Triplett <josh@joshtriplett.org>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      1282278e
    • Matt Fleming's avatar
      efi: Add efi= parameter parsing to the EFI boot stub · 5a17dae4
      Matt Fleming authored
      We need a way to customize the behaviour of the EFI boot stub, in
      particular, we need a way to disable the "chunking" workaround, used
      when reading files from the EFI System Partition.
      
      One of my machines doesn't cope well when reading files in 1MB chunks to
      a buffer above the 4GB mark - it appears that the "chunking" bug
      workaround triggers another firmware bug. This was only discovered with
      commit 4bf7111f ("x86/efi: Support initrd loaded above 4G"), and
      that commit is perfectly valid. The symptom I observed was a corrupt
      initrd rather than any kind of crash.
      
      efi= is now used to specify EFI parameters in two very different
      execution environments, the EFI boot stub and during kernel boot.
      
      There is also a slight performance optimization by enabling efi=nochunk,
      but that's offset by the fact that you're more likely to run into
      firmware issues, at least on x86. This is the rationale behind leaving
      the workaround enabled by default.
      
      Also provide some documentation for EFI_READ_CHUNK_SIZE and why we're
      using the current value of 1MB.
      Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Roy Franz <roy.franz@linaro.org>
      Cc: Maarten Lankhorst <m.b.lankhorst@gmail.com>
      Cc: Leif Lindholm <leif.lindholm@linaro.org>
      Cc: Borislav Petkov <bp@suse.de>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      5a17dae4
    • Ard Biesheuvel's avatar
      efi: Implement mandatory locking for UEFI Runtime Services · 161485e8
      Ard Biesheuvel authored
      According to section 7.1 of the UEFI spec, Runtime Services are not fully
      reentrant, and there are particular combinations of calls that need to be
      serialized. Use a spinlock to serialize all Runtime Services with respect
      to all others, even if this is more than strictly needed.
      
      We've managed to get away without requiring a runtime services lock
      until now because most of the interactions with EFI involve EFI
      variables, and those operations are already serialised with
      __efivars->lock.
      
      Some of the assumptions underlying the decision whether locks are
      needed or not (e.g., SetVariable() against ResetSystem()) may not
      apply universally to all [new] architectures that implement UEFI.
      Rather than try to reason our way out of this, let's just implement at
      least what the spec requires in terms of locking.
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      161485e8
  2. 28 Sep, 2014 3 commits
  3. 27 Sep, 2014 12 commits