1. 12 11月, 2014 1 次提交
    • A
      efi/x86: Move x86 back to libstub · 243b6754
      Ard Biesheuvel 提交于
      This reverts commit 84be8805, which itself reverted my original
      attempt to move x86 from #include'ing .c files from across the tree
      to using the EFI stub built as a static library.
      
      The issue that affected the original approach was that splitting
      the implementation into several .o files resulted in the variable
      'efi_early' becoming a global with external linkage, which under
      -fPIC implies that references to it must go through the GOT. However,
      dealing with this additional GOT entry turned out to be troublesome
      on some EFI implementations. (GCC's visibility=hidden attribute is
      supposed to lift this requirement, but it turned out not to work on
      the 32-bit build.)
      
      Instead, use a pure getter function to get a reference to efi_early.
      This approach results in no additional GOT entries being generated,
      so there is no need for any changes in the early GOT handling.
      Tested-by: NMaarten Lankhorst <maarten.lankhorst@canonical.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      243b6754
  2. 04 10月, 2014 2 次提交
    • A
      x86/efi: Adding efi_printks on memory allocationa and pci.reads · 77e21e87
      Andre Müller 提交于
      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: NAndre Müller <andre.muller@web.de>
      Cc: Ulf Winkelvos <ulf@winkelvos.de>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      77e21e87
    • M
      efi: Add efi= parameter parsing to the EFI boot stub · 5a17dae4
      Matt Fleming 提交于
      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: NArd 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: NMatt Fleming <matt.fleming@intel.com>
      5a17dae4
  3. 02 10月, 2014 1 次提交
  4. 25 9月, 2014 1 次提交
    • M
      x86/efi: Truncate 64-bit values when calling 32-bit OutputString() · 115c6628
      Matt Fleming 提交于
      If we're executing the 32-bit efi_char16_printk() code path (i.e.
      running on top of 32-bit firmware) we know that efi_early->text_output
      will be a 32-bit value, even though ->text_output has type u64.
      
      Unfortunately, we currently pass ->text_output directly to
      efi_early->call() so for CONFIG_X86_32 the compiler will push a 64-bit
      value onto the stack, causing the other parameters to be misaligned.
      
      The way we handle this in the rest of the EFI boot stub is to pass
      pointers as arguments to efi_early->call(), which automatically do the
      right thing (pointers are 32-bit on CONFIG_X86_32, and we simply ignore
      the upper 32-bits of the argument register if running in 64-bit mode
      with 32-bit firmware).
      
      This fixes a corruption bug when printing strings from the 32-bit EFI
      boot stub.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=84241Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      115c6628
  5. 24 9月, 2014 2 次提交
    • M
      x86/efi: Delete misleading efi_printk() error message · 56394ab8
      Matt Fleming 提交于
      A number of people are reporting seeing the "setup_efi_pci() failed!"
      error message in what used to be a quiet boot,
      
        https://bugzilla.kernel.org/show_bug.cgi?id=81891
      
      The message isn't all that helpful because setup_efi_pci() can return a
      non-success error code for a variety of reasons, not all of them fatal.
      
      Let's drop the return code from setup_efi_pci*() altogether, since
      there's no way to process it in any meaningful way outside of the inner
      __setup_efi_pci*() functions.
      Reported-by: NDarren Hart <dvhart@linux.intel.com>
      Reported-by: NJosh Boyer <jwboyer@fedoraproject.org>
      Cc: Ulf Winkelvos <ulf@winkelvos.de>
      Cc: Andre Müller <andre.muller@web.de>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      56394ab8
    • M
      Revert "efi/x86: efistub: Move shared dependencies to <asm/efi.h>" · 84be8805
      Matt Fleming 提交于
      This reverts commit f23cf8bd ("efi/x86: efistub: Move shared
      dependencies to <asm/efi.h>") as well as the x86 parts of commit
      f4f75ad5 ("efi: efistub: Convert into static library").
      
      The road leading to these two reverts is long and winding.
      
      The above two commits were merged during the v3.17 merge window and
      turned the common EFI boot stub code into a static library. This
      necessitated making some symbols global in the x86 boot stub which
      introduced new entries into the early boot GOT.
      
      The problem was that we weren't fixing up the newly created GOT entries
      before invoking the EFI boot stub, which sometimes resulted in hangs or
      resets. This failure was reported by Maarten on his Macbook pro.
      
      The proposed fix was commit 9cb0e394 ("x86/efi: Fixup GOT in all
      boot code paths"). However, that caused issues for Linus when booting
      his Sony Vaio Pro 11. It was subsequently reverted in commit
      f3670394.
      
      So that leaves us back with Maarten's Macbook pro not booting.
      
      At this stage in the release cycle the least risky option is to revert
      the x86 EFI boot stub to the pre-merge window code structure where we
      explicitly #include efi-stub-helper.c instead of linking with the static
      library. The arm64 code remains unaffected.
      
      We can take another swing at the x86 parts for v3.18.
      
      Conflicts:
      	arch/x86/include/asm/efi.h
      Tested-by: NJosh Boyer <jwboyer@fedoraproject.org>
      Tested-by: NMaarten Lankhorst <maarten.lankhorst@canonical.com>
      Tested-by: Leif Lindholm <leif.lindholm@linaro.org> [arm64]
      Tested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
      Cc: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      84be8805
  6. 23 9月, 2014 1 次提交
  7. 19 9月, 2014 1 次提交
  8. 12 9月, 2014 1 次提交
    • D
      x86: Introduce disabled-features · 381aa07a
      Dave Hansen 提交于
      I believe the REQUIRED_MASK aproach was taken so that it was
      easier to consult in assembly (arch/x86/kernel/verify_cpu.S).
      DISABLED_MASK does not have the same restriction, but I
      implemented it the same way for consistency.
      
      We have a REQUIRED_MASK... which does two things:
      1. Keeps a list of cpuid bits to check in very early boot and
         refuse to boot if those are not present.
      2. Consulted during cpu_has() checks, which allows us to
         optimize out things at compile-time.  In other words, if we
         *KNOW* we will not boot with the feature off, then we can
         safely assume that it will be present forever.
      
      But, we don't have a similar mechanism for CPU features which
      may be present but that we know we will not use.  We simply
      use our existing mechanisms to repeatedly check the status of
      the bit at runtime (well, the alternatives patching helps here
      but it does not provide compile-time optimization).
      
      Adding a feature to disabled-features.h allows the bit to be
      checked via a new macro: cpu_feature_enabled().  Note that
      for features in DISABLED_MASK, checks with this macro have
      all of the benefits of an #ifdef.  Before, we would have done
      this in a header:
      
      #ifdef CONFIG_X86_INTEL_MPX
      #define cpu_has_mpx cpu_has(X86_FEATURE_MPX)
      #else
      #define cpu_has_mpx 0
      #endif
      
      and this in the code:
      
      	if (cpu_has_mpx)
      		do_some_mpx_thing();
      
      Now, just add your feature to DISABLED_MASK and you can do this
      everywhere, and get the same benefits you would have from
      #ifdefs:
      
      	if (cpu_feature_enabled(X86_FEATURE_MPX))
      		do_some_mpx_thing();
      
      We need a new function and *not* a modification to cpu_has()
      because there are cases where we actually need to check the CPU
      itself, despite what features the kernel supports.  The best
      example of this is a hypervisor which has no control over what
      features its guests are using and where the guest does not depend
      on the host for support.
      Signed-off-by: NDave Hansen <dave.hansen@linux.intel.com>
      Link: http://lkml.kernel.org/r/20140911211513.9E35E931@viggo.jf.intel.comAcked-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      381aa07a
  9. 09 9月, 2014 2 次提交
    • M
      x86/efi: Fixup GOT in all boot code paths · 9cb0e394
      Matt Fleming 提交于
      Maarten reported that his Macbook pro 8.2 stopped booting after commit
      f23cf8bd ("efi/x86: efistub: Move shared dependencies to
      <asm/efi.h>"), the main feature of which is changing the visibility of
      symbol 'efi_early' from local to global.
      
      By making 'efi_early' global we end up requiring an entry in the Global
      Offset Table. Unfortunately, while we do include code to fixup GOT
      entries in the early boot code, it's only called after we've executed
      the EFI boot stub.
      
      What this amounts to is that references to 'efi_early' in the EFI boot
      stub don't point to the correct place.
      
      Since we've got multiple boot entry points we need to be prepared to
      fixup the GOT in multiple places, while ensuring that we never do it
      more than once, otherwise the GOT entries will still point to the wrong
      place.
      Reported-by: NMaarten Lankhorst <maarten.lankhorst@canonical.com>
      Tested-by: NMaarten Lankhorst <maarten.lankhorst@canonical.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      9cb0e394
    • Y
      x86/efi: Only load initrd above 4g on second try · 47226ad4
      Yinghai Lu 提交于
      Mantas found that after commit 4bf7111f ("x86/efi: Support initrd
      loaded above 4G"), the kernel freezes at the earliest possible moment
      when trying to boot via UEFI on Asus laptop.
      
      Revert to old way to load initrd under 4G on first try, second try will
      use above 4G buffer when initrd is too big and does not fit under 4G.
      
      [ The cause of the freeze appears to be a firmware bug when reading
        file data into buffers above 4GB, though the exact reason is unknown.
        Mantas reports that the hang can be avoid if the file size is a
        multiple of 512 bytes, but I've seen some ASUS firmware simply
        corrupting the file data rather than freezing.
      
        Laszlo fixed an issue in the upstream EDK2 DiskIO code in Aug 2013
        which may possibly be related, commit 4e39b75e ("MdeModulePkg/DiskIoDxe:
        fix source/destination pointer of overrun transfer").
      
        Whatever the cause, it's unlikely that a fix will be forthcoming
        from the vendor, hence the workaround - Matt ]
      
      Cc: Laszlo Ersek <lersek@redhat.com>
      Reported-by: NMantas Mikulėnas <grawity@gmail.com>
      Reported-by: NHarald Hoyer <harald@redhat.com>
      Tested-by: NAnders Darander <anders@chargestorm.se>
      Tested-by: NCalvin Walton <calvin.walton@kepstin.ca>
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      47226ad4
  10. 18 8月, 2014 4 次提交
  11. 19 7月, 2014 3 次提交
  12. 10 7月, 2014 1 次提交
    • M
      x86/efi: Include a .bss section within the PE/COFF headers · c7fb93ec
      Michael Brown 提交于
      The PE/COFF headers currently describe only the initialised-data
      portions of the image, and result in no space being allocated for the
      uninitialised-data portions.  Consequently, the EFI boot stub will end
      up overwriting unexpected areas of memory, with unpredictable results.
      
      Fix by including a .bss section in the PE/COFF headers (functionally
      equivalent to the init_size field in the bzImage header).
      Signed-off-by: NMichael Brown <mbrown@fensystems.co.uk>
      Cc: Thomas Bächler <thomas@archlinux.org>
      Cc: Josh Boyer <jwboyer@fedoraproject.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      c7fb93ec
  13. 08 7月, 2014 2 次提交
    • A
      efi: efistub: Refactor stub components · bd669475
      Ard Biesheuvel 提交于
      In order to move from the #include "../../../xxxxx.c" anti-pattern used
      by both the x86 and arm64 versions of the stub to a static library
      linked into either the kernel proper (arm64) or a separate boot
      executable (x86), there is some prepatory work required.
      
      This patch does the following:
      - move forward declarations of functions shared between the arch
        specific and the generic parts of the stub to include/linux/efi.h
      - move forward declarations of functions shared between various .c files
        of the generic stub code to a new local header file called "efistub.h"
      - add #includes to all .c files which were formerly relying on the
        #includor to include the correct header files
      - remove all static modifiers from functions which will need to be
        externally visible once we move to a static library
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      bd669475
    • A
      efi/x86: efistub: Move shared dependencies to <asm/efi.h> · f23cf8bd
      Ard Biesheuvel 提交于
      This moves definitions depended upon both by code under arch/x86/boot
      and under drivers/firmware/efi to <asm/efi.h>. This is in preparation of
      turning the stub code under drivers/firmware/efi into a static library.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      f23cf8bd
  14. 19 6月, 2014 1 次提交
  15. 17 6月, 2014 1 次提交
  16. 08 6月, 2014 1 次提交
    • M
      x86/boot: EFI_MIXED should not prohibit loading above 4G · 745c5167
      Matt Fleming 提交于
      commit 7d453eee ("x86/efi: Wire up CONFIG_EFI_MIXED") introduced a
      regression for the functionality to load kernels above 4G. The relevant
      (incorrect) reasoning behind this change can be seen in the commit
      message,
      
        "The xloadflags field in the bzImage header is also updated to reflect
        that the kernel supports both entry points by setting both of
        XLF_EFI_HANDOVER_32 and XLF_EFI_HANDOVER_64 when CONFIG_EFI_MIXED=y.
        XLF_CAN_BE_LOADED_ABOVE_4G is disabled so that the kernel text is
        guaranteed to be addressable with 32-bits."
      
      This is obviously bogus since 32-bit EFI loaders will never place the
      kernel above the 4G mark. So this restriction is entirely unnecessary.
      
      But things are worse than that - since we want to encourage people to
      always compile with CONFIG_EFI_MIXED=y so that their kernels work out of
      the box for both 32-bit and 64-bit firmware, commit 7d453eee
      effectively disables XLF_CAN_BE_LOADED_ABOVE_4G completely.
      
      Remove the overzealous and superfluous restriction and restore the
      XLF_CAN_BE_LOADED_ABOVE_4G functionality.
      
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      Link: http://lkml.kernel.org/r/1402140380-15377-1-git-send-email-matt@console-pimps.orgSigned-off-by: NH. Peter Anvin <hpa@zytor.com>
      745c5167
  17. 05 6月, 2014 1 次提交
  18. 08 5月, 2014 2 次提交
  19. 06 5月, 2014 2 次提交
  20. 17 4月, 2014 2 次提交
  21. 11 4月, 2014 3 次提交
  22. 27 3月, 2014 1 次提交
  23. 21 3月, 2014 1 次提交
  24. 20 3月, 2014 3 次提交