1. 18 3月, 2014 3 次提交
  2. 05 3月, 2014 13 次提交
    • B
      x86/efi: Quirk out SGI UV · a5d90c92
      Borislav Petkov 提交于
      Alex reported hitting the following BUG after the EFI 1:1 virtual
      mapping work was merged,
      
       kernel BUG at arch/x86/mm/init_64.c:351!
       invalid opcode: 0000 [#1] SMP
       Call Trace:
        [<ffffffff818aa71d>] init_extra_mapping_uc+0x13/0x15
        [<ffffffff818a5e20>] uv_system_init+0x22b/0x124b
        [<ffffffff8108b886>] ? clockevents_register_device+0x138/0x13d
        [<ffffffff81028dbb>] ? setup_APIC_timer+0xc5/0xc7
        [<ffffffff8108b620>] ? clockevent_delta2ns+0xb/0xd
        [<ffffffff818a3a92>] ? setup_boot_APIC_clock+0x4a8/0x4b7
        [<ffffffff8153d955>] ? printk+0x72/0x74
        [<ffffffff818a1757>] native_smp_prepare_cpus+0x389/0x3d6
        [<ffffffff818957bc>] kernel_init_freeable+0xb7/0x1fb
        [<ffffffff81535530>] ? rest_init+0x74/0x74
        [<ffffffff81535539>] kernel_init+0x9/0xff
        [<ffffffff81541dfc>] ret_from_fork+0x7c/0xb0
        [<ffffffff81535530>] ? rest_init+0x74/0x74
      
      Getting this thing to work with the new mapping scheme would need more
      work, so automatically switch to the old memmap layout for SGI UV.
      Acked-by: NRuss Anderson <rja@sgi.com>
      Cc: Alex Thorlton <athorlton@sgi.com
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      a5d90c92
    • M
      x86/efi: Re-disable interrupts after calling firmware services · 18c46461
      Matt Fleming 提交于
      Some firmware appears to enable interrupts during boot service calls,
      even if we've explicitly disabled them prior to the call. This is
      actually allowed per the UEFI spec because boottime services expect to
      be called with interrupts enabled.
      
      So that's fine, we just need to ensure that we disable them again in
      efi_enter32() before switching to a 64-bit GDT, otherwise an interrupt
      may fire causing a 32-bit IRQ handler to run after we've left
      compatibility mode.
      
      Despite efi_enter32() being called both for boottime and runtime
      services, this really only affects boottime because the runtime services
      callchain is executed with interrupts disabled. See efi_thunk().
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      18c46461
    • M
      x86/efi: Wire up CONFIG_EFI_MIXED · 7d453eee
      Matt Fleming 提交于
      Add the Kconfig option and bump the kernel header version so that boot
      loaders can check whether the handover code is available if they want.
      
      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.
      
      Note that no boot loaders should be using the bits set in xloadflags to
      decide which entry point to jump to. The entire scheme is based on the
      concept that 32-bit bootloaders always jump to ->handover_offset and
      64-bit loaders always jump to ->handover_offset + 512. We set both bits
      merely to inform the boot loader that it's safe to use the native
      handover offset even if the machine type in the PE/COFF header claims
      otherwise.
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      7d453eee
    • M
      x86/efi: Add mixed runtime services support · 4f9dbcfc
      Matt Fleming 提交于
      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: NMatt Fleming <matt.fleming@intel.com>
      4f9dbcfc
    • M
      x86/efi: Add early thunk code to go from 64-bit to 32-bit · 0154416a
      Matt Fleming 提交于
      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: NMatt Fleming <matt.fleming@intel.com>
      0154416a
    • M
      x86/efi: Delete dead code when checking for non-native · 099240ac
      Matt Fleming 提交于
      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: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      099240ac
    • B
      x86/efi: Split efi_enter_virtual_mode · fabb37c7
      Borislav Petkov 提交于
      ... into a kexec flavor for better code readability and simplicity. The
      original one was getting ugly with ifdeffery.
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      fabb37c7
    • B
      x86/efi: Make efi virtual runtime map passing more robust · b7b898ae
      Borislav Petkov 提交于
      Currently, running SetVirtualAddressMap() and passing the physical
      address of the virtual map array was working only by a lucky coincidence
      because the memory was present in the EFI page table too. Until Toshi
      went and booted this on a big HP box - the krealloc() manner of resizing
      the memmap we're doing did allocate from such physical addresses which
      were not mapped anymore and boom:
      
      http://lkml.kernel.org/r/1386806463.1791.295.camel@misato.fc.hp.com
      
      One way to take care of that issue is to reimplement the krealloc thing
      but with pages. We start with contiguous pages of order 1, i.e. 2 pages,
      and when we deplete that memory (shouldn't happen all that often but you
      know firmware) we realloc the next power-of-two pages.
      
      Having the pages, it is much more handy and easy to map them into the
      EFI page table with the already existing mapping code which we're using
      for building the virtual mappings.
      
      Thanks to Toshi Kani and Matt for the great debugging help.
      Reported-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      b7b898ae
    • B
      x86/efi: Dump the EFI page table · 11cc8512
      Borislav Petkov 提交于
      This is very useful for debugging issues with the recently added
      pagetable switching code for EFI virtual mode.
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      11cc8512
    • J
      x86/efi: Style neatening · 9b7d2049
      Joe Perches 提交于
      Coalesce formats and remove spaces before tabs.
      Move __initdata after the variable declaration.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      9b7d2049
    • M
      x86/efi: Delete out-of-date comments of efi_query_variable_store · 5db80c65
      Madper Xie 提交于
      For now we only ensure about 5kb free space for avoiding our board
      refusing boot. But the comment lies that we retain 50% space.
      Signed-off-by: NMadper Xie <cxie@redhat.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      5db80c65
    • M
      efi: Set feature flags inside feature init functions · 0f8093a9
      Matt Fleming 提交于
      It makes more sense to set the feature flag in the success path of the
      detection function than it does to rely on the caller doing it. Apart
      from it being more logical to group the code and data together, it sets
      a much better example for new EFI architectures.
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      0f8093a9
    • M
      efi: Move facility flags to struct efi · 3e909599
      Matt Fleming 提交于
      As we grow support for more EFI architectures they're going to want the
      ability to query which EFI features are available on the running system.
      Instead of storing this information in an architecture-specific place,
      stick it in the global 'struct efi', which is already the central
      location for EFI state.
      
      While we're at it, let's change the return value of efi_enabled() to be
      bool and replace all references to 'facility' with 'feature', which is
      the usual word used to describe the attributes of the running system.
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      3e909599
  3. 14 2月, 2014 3 次提交
  4. 06 2月, 2014 1 次提交
    • M
      x86/efi: Allow mapping BGRT on x86-32 · 081cd62a
      Matt Fleming 提交于
      CONFIG_X86_32 doesn't map the boot services regions into the EFI memory
      map (see commit 70087011 ("x86, efi: Don't map Boot Services on
      i386")), and so efi_lookup_mapped_addr() will fail to return a valid
      address. Executing the ioremap() path in efi_bgrt_init() causes the
      following warning on x86-32 because we're trying to ioremap() RAM,
      
       WARNING: CPU: 0 PID: 0 at arch/x86/mm/ioremap.c:102 __ioremap_caller+0x2ad/0x2c0()
       Modules linked in:
       CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.13.0-0.rc5.git0.1.2.fc21.i686 #1
       Hardware name: DellInc. Venue 8 Pro 5830/09RP78, BIOS A02 10/17/2013
        00000000 00000000 c0c0df08 c09a5196 00000000 c0c0df38 c0448c1e c0b41310
        00000000 00000000 c0b37bc1 00000066 c043bbfd c043bbfd 00e7dfe0 00073eff
        00073eff c0c0df48 c0448ce2 00000009 00000000 c0c0df9c c043bbfd 00078d88
       Call Trace:
        [<c09a5196>] dump_stack+0x41/0x52
        [<c0448c1e>] warn_slowpath_common+0x7e/0xa0
        [<c043bbfd>] ? __ioremap_caller+0x2ad/0x2c0
        [<c043bbfd>] ? __ioremap_caller+0x2ad/0x2c0
        [<c0448ce2>] warn_slowpath_null+0x22/0x30
        [<c043bbfd>] __ioremap_caller+0x2ad/0x2c0
        [<c0718f92>] ? acpi_tb_verify_table+0x1c/0x43
        [<c0719c78>] ? acpi_get_table_with_size+0x63/0xb5
        [<c087cd5e>] ? efi_lookup_mapped_addr+0xe/0xf0
        [<c043bc2b>] ioremap_nocache+0x1b/0x20
        [<c0cb01c8>] ? efi_bgrt_init+0x83/0x10c
        [<c0cb01c8>] efi_bgrt_init+0x83/0x10c
        [<c0cafd82>] efi_late_init+0x8/0xa
        [<c0c9bab2>] start_kernel+0x3ae/0x3c3
        [<c0c9b53b>] ? repair_env_string+0x51/0x51
        [<c0c9b378>] i386_start_kernel+0x12e/0x131
      
      Switch to using early_memremap(), which won't trigger this warning, and
      has the added benefit of more accurately conveying what we're trying to
      do - map a chunk of memory.
      
      This patch addresses the following bug report,
      
        https://bugzilla.kernel.org/show_bug.cgi?id=67911Reported-by: NAdam Williamson <awilliam@redhat.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      081cd62a
  5. 29 1月, 2014 1 次提交
  6. 25 1月, 2014 3 次提交
  7. 23 1月, 2014 3 次提交
  8. 17 1月, 2014 4 次提交
  9. 16 1月, 2014 3 次提交
  10. 13 1月, 2014 1 次提交
    • P
      sched/clock, x86: Rewrite cyc2ns() to avoid the need to disable IRQs · 20d1c86a
      Peter Zijlstra 提交于
      Use a ring-buffer like multi-version object structure which allows
      always having a coherent object; we use this to avoid having to
      disable IRQs while reading sched_clock() and avoids a problem when
      getting an NMI while changing the cyc2ns data.
      
                              MAINLINE   PRE        POST
      
          sched_clock_stable: 1          1          1
          (cold) sched_clock: 329841     331312     257223
          (cold) local_clock: 301773     310296     309889
          (warm) sched_clock: 38375      38247      25280
          (warm) local_clock: 100371     102713     85268
          (warm) rdtsc:       27340      27289      24247
          sched_clock_stable: 0          0          0
          (cold) sched_clock: 382634     372706     301224
          (cold) local_clock: 396890     399275     399870
          (warm) sched_clock: 38194      38124      25630
          (warm) local_clock: 143452     148698     129629
          (warm) rdtsc:       27345      27365      24307
      Signed-off-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/n/tip-s567in1e5ekq2nlyhn8f987r@git.kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      20d1c86a
  11. 07 1月, 2014 1 次提交
  12. 29 12月, 2013 2 次提交
    • M
      x86/efi: Delete superfluous global variables · 518548ab
      Matt Fleming 提交于
      There's no need to save the runtime map details in global variables, the
      values are only required to pass to efi_runtime_map_setup().
      
      And because 'nr_efi_runtime_map' isn't needed, get_nr_runtime_map() can
      be deleted along with 'efi_data_len'.
      
      Cc: Dave Young <dyoung@redhat.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      518548ab
    • D
      x86/efi: Pass necessary EFI data for kexec via setup_data · 1fec0533
      Dave Young 提交于
      Add a new setup_data type SETUP_EFI for kexec use.  Passing the saved
      fw_vendor, runtime, config tables and EFI runtime mappings.
      
      When entering virtual mode, directly mapping the EFI runtime regions
      which we passed in previously. And skip the step to call
      SetVirtualAddressMap().
      
      Specially for HP z420 workstation we need save the smbios physical
      address.  The kernel boot sequence proceeds in the following order.
      Step 2 requires efi.smbios to be the physical address.  However, I found
      that on HP z420 EFI system table has a virtual address of SMBIOS in step
      1.  Hence, we need set it back to the physical address with the smbios
      in efi_setup_data.  (When it is still the physical address, it simply
      sets the same value.)
      
      1. efi_init() - Set efi.smbios from EFI system table
      2. dmi_scan_machine() - Temporary map efi.smbios to access SMBIOS table
      3. efi_enter_virtual_mode() - Map EFI ranges
      
      Tested on ovmf+qemu, lenovo thinkpad, a dell laptop and an
      HP z420 workstation.
      Signed-off-by: NDave Young <dyoung@redhat.com>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      1fec0533
  13. 21 12月, 2013 2 次提交