Skip to content
Snippets Groups Projects
  1. Mar 04, 2014
    • Matt Fleming's avatar
      x86/efi: Add mixed runtime services support · 4f9dbcfc
      Matt Fleming authored
      
      Setup the runtime services based on whether we're booting in EFI native
      mode or not. For non-native mode we need to thunk from 64-bit into
      32-bit mode before invoking the EFI runtime services.
      
      Using the runtime services after SetVirtualAddressMap() is slightly more
      complicated because we need to ensure that all the addresses we pass to
      the firmware are below the 4GB boundary so that they can be addressed
      with 32-bit pointers, see efi_setup_page_tables().
      
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      4f9dbcfc
    • Matt Fleming's avatar
      x86/efi: Firmware agnostic handover entry points · b8ff87a6
      Matt Fleming authored
      
      The EFI handover code only works if the "bitness" of the firmware and
      the kernel match, i.e. 64-bit firmware and 64-bit kernel - it is not
      possible to mix the two. This goes against the tradition that a 32-bit
      kernel can be loaded on a 64-bit BIOS platform without having to do
      anything special in the boot loader. Linux distributions, for one thing,
      regularly run only 32-bit kernels on their live media.
      
      Despite having only one 'handover_offset' field in the kernel header,
      EFI boot loaders use two separate entry points to enter the kernel based
      on the architecture the boot loader was compiled for,
      
          (1) 32-bit loader: handover_offset
          (2) 64-bit loader: handover_offset + 512
      
      Since we already have two entry points, we can leverage them to infer
      the bitness of the firmware we're running on, without requiring any boot
      loader modifications, by making (1) and (2) valid entry points for both
      CONFIG_X86_32 and CONFIG_X86_64 kernels.
      
      To be clear, a 32-bit boot loader will always use (1) and a 64-bit boot
      loader will always use (2). It's just that, if a single kernel image
      supports (1) and (2) that image can be used with both 32-bit and 64-bit
      boot loaders, and hence both 32-bit and 64-bit EFI.
      
      (1) and (2) must be 512 bytes apart at all times, but that is already
      part of the boot ABI and we could never change that delta without
      breaking existing boot loaders anyhow.
      
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      b8ff87a6
    • Matt Fleming's avatar
      x86/efi: Split the boot stub into 32/64 code paths · c116e8d6
      Matt Fleming authored
      
      Make the decision which code path to take at runtime based on
      efi_early->is64.
      
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      c116e8d6
    • Matt Fleming's avatar
      x86/efi: Add early thunk code to go from 64-bit to 32-bit · 0154416a
      Matt Fleming authored
      
      Implement the transition code to go from IA32e mode to protected mode in
      the EFI boot stub. This is required to use 32-bit EFI services from a
      64-bit kernel.
      
      Since EFI boot stub is executed in an identity-mapped region, there's
      not much we need to do before invoking the 32-bit EFI boot services.
      However, we do reload the firmware's global descriptor table
      (efi32_boot_gdt) in case things like timer events are still running in
      the firmware.
      
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      0154416a
    • Matt Fleming's avatar
      x86/efi: Build our own EFI services pointer table · 54b52d87
      Matt Fleming authored
      
      It's not possible to dereference the EFI System table directly when
      booting a 64-bit kernel on a 32-bit EFI firmware because the size of
      pointers don't match.
      
      In preparation for supporting the above use case, build a list of
      function pointers on boot so that callers don't have to worry about
      converting pointer sizes through multiple levels of indirection.
      
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      54b52d87
    • Matt Fleming's avatar
      efi: Add separate 32-bit/64-bit definitions · 677703ce
      Matt Fleming authored
      
      The traditional approach of using machine-specific types such as
      'unsigned long' does not allow the kernel to interact with firmware
      running in a different CPU mode, e.g. 64-bit kernel with 32-bit EFI.
      
      Add distinct EFI structure definitions for both 32-bit and 64-bit so
      that we can use them in the 32-bit and 64-bit code paths.
      
      Acked-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      677703ce
    • Matt Fleming's avatar
      x86/efi: Delete dead code when checking for non-native · 099240ac
      Matt Fleming authored
      
      Both efi_free_boot_services() and efi_enter_virtual_mode() are invoked
      from init/main.c, but only if the EFI runtime services are available.
      This is not the case for non-native boots, e.g. where a 64-bit kernel is
      booted with 32-bit EFI firmware.
      
      Delete the dead code.
      
      Acked-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      099240ac
    • Matt Fleming's avatar
      x86/mm/pageattr: Always dump the right page table in an oops · 426e34cc
      Matt Fleming authored
      
      Now that we have EFI-specific page tables we need to lookup the pgd when
      dumping those page tables, rather than assuming that swapper_pgdir is
      the current pgdir.
      
      Remove the double underscore prefix, which is usually reserved for
      static functions.
      
      Acked-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      426e34cc
    • Matt Fleming's avatar
      x86, tools: Consolidate #ifdef code · 993c30a0
      Matt Fleming authored
      
      Instead of littering main() with #ifdef CONFIG_EFI_STUB, move the logic
      into separate functions that do nothing if the config option isn't set.
      This makes main() much easier to read.
      
      Acked-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      993c30a0
    • Matt Fleming's avatar
      x86/boot: Cleanup header.S by removing some #ifdefs · 86134a1b
      Matt Fleming authored
      
      handover_offset is now filled out by build.c. Don't set a default value
      as it will be overwritten anyway.
      
      Acked-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      86134a1b
  2. Feb 14, 2014
  3. Feb 13, 2014
  4. Feb 12, 2014
    • Steven Rostedt (Red Hat)'s avatar
      ftrace/x86: Use breakpoints for converting function graph caller · 87fbb2ac
      Steven Rostedt (Red Hat) authored
      
      When the conversion was made to remove stop machine and use the breakpoint
      logic instead, the modification of the function graph caller is still
      done directly as though it was being done under stop machine.
      
      As it is not converted via stop machine anymore, there is a possibility
      that the code could be layed across cache lines and if another CPU is
      accessing that function graph call when it is being updated, it could
      cause a General Protection Fault.
      
      Convert the update of the function graph caller to use the breakpoint
      method as well.
      
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: stable@vger.kernel.org # 3.5+
      Fixes: 08d636b6 "ftrace/x86: Have arch x86_64 use breakpoints instead of stop machine"
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      87fbb2ac
  5. Feb 11, 2014
  6. Feb 10, 2014
Loading