1. 10 12月, 2019 1 次提交
  2. 08 12月, 2019 1 次提交
  3. 07 11月, 2019 2 次提交
    • D
      efi: Common enable/disable infrastructure for EFI soft reservation · b617c526
      Dan Williams 提交于
      UEFI 2.8 defines an EFI_MEMORY_SP attribute bit to augment the
      interpretation of the EFI Memory Types as "reserved for a specific
      purpose".
      
      The proposed Linux behavior for specific purpose memory is that it is
      reserved for direct-access (device-dax) by default and not available for
      any kernel usage, not even as an OOM fallback.  Later, through udev
      scripts or another init mechanism, these device-dax claimed ranges can
      be reconfigured and hot-added to the available System-RAM with a unique
      node identifier. This device-dax management scheme implements "soft" in
      the "soft reserved" designation by allowing some or all of the
      reservation to be recovered as typical memory. This policy can be
      disabled at compile-time with CONFIG_EFI_SOFT_RESERVE=n, or runtime with
      efi=nosoftreserve.
      
      As for this patch, define the common helpers to determine if the
      EFI_MEMORY_SP attribute should be honored. The determination needs to be
      made early to prevent the kernel from being loaded into soft-reserved
      memory, or otherwise allowing early allocations to land there. Follow-on
      changes are needed per architecture to leverage these helpers in their
      respective mem-init paths.
      Reviewed-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b617c526
    • D
      efi: Enumerate EFI_MEMORY_SP · fe3e5e65
      Dan Williams 提交于
      UEFI 2.8 defines an EFI_MEMORY_SP attribute bit to augment the
      interpretation of the EFI Memory Types as "reserved for a specific
      purpose". The intent of this bit is to allow the OS to identify precious
      or scarce memory resources and optionally manage it separately from
      EfiConventionalMemory. As defined older OSes that do not know about this
      attribute are permitted to ignore it and the memory will be handled
      according to the OS default policy for the given memory type.
      
      In other words, this "specific purpose" hint is deliberately weaker than
      EfiReservedMemoryType in that the system continues to operate if the OS
      takes no action on the attribute. The risk of taking no action is
      potentially unwanted / unmovable kernel allocations from the designated
      resource that prevent the full realization of the "specific purpose".
      For example, consider a system with a high-bandwidth memory pool. Older
      kernels are permitted to boot and consume that memory as conventional
      "System-RAM" newer kernels may arrange for that memory to be set aside
      (soft reserved) by the system administrator for a dedicated
      high-bandwidth memory aware application to consume.
      
      Specifically, this mechanism allows for the elimination of scenarios
      where platform firmware tries to game OS policy by lying about ACPI SLIT
      values, i.e. claiming that a precious memory resource has a high
      distance to trigger the OS to avoid it by default. This reservation hint
      allows platform-firmware to instead tell the truth about performance
      characteristics by indicate to OS memory management to put immovable
      allocations elsewhere.
      
      Implement simple detection of the bit for EFI memory table dumps and
      save the kernel policy for a follow-on change.
      Reviewed-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NDave Hansen <dave.hansen@linux.intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      fe3e5e65
  4. 31 10月, 2019 1 次提交
  5. 29 10月, 2019 1 次提交
  6. 07 10月, 2019 1 次提交
    • A
      efivar/ssdt: Don't iterate over EFI vars if no SSDT override was specified · c05f8f92
      Ard Biesheuvel 提交于
      The kernel command line option efivar_ssdt= allows the name to be
      specified of an EFI variable containing an ACPI SSDT table that should
      be loaded into memory by the OS, and treated as if it was provided by
      the firmware.
      
      Currently, that code will always iterate over the EFI variables and
      compare each name with the provided name, even if the command line
      option wasn't set to begin with.
      
      So bail early when no variable name was provided. This works around a
      boot regression on the 2012 Mac Pro, as reported by Scott.
      Tested-by: NScott Talbert <swt@techie.net>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: <stable@vger.kernel.org> # v4.9+
      Cc: Ben Dooks <ben.dooks@codethink.co.uk>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Cc: Jerry Snitselaar <jsnitsel@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Lyude Paul <lyude@redhat.com>
      Cc: Matthew Garrett <mjg59@google.com>
      Cc: Octavian Purdila <octavian.purdila@intel.com>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Cc: linux-integrity@vger.kernel.org
      Fixes: 475fb4e8 ("efi / ACPI: load SSTDs from EFI variables")
      Link: https://lkml.kernel.org/r/20191002165904.8819-3-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      c05f8f92
  7. 20 8月, 2019 1 次提交
  8. 08 8月, 2019 4 次提交
  9. 25 6月, 2019 1 次提交
  10. 11 6月, 2019 1 次提交
  11. 05 6月, 2019 1 次提交
  12. 25 5月, 2019 1 次提交
  13. 16 2月, 2019 1 次提交
  14. 30 11月, 2018 2 次提交
    • A
      efi: Reduce the amount of memblock reservations for persistent allocations · 80424b02
      Ard Biesheuvel 提交于
      The current implementation of efi_mem_reserve_persistent() is rather
      naive, in the sense that for each invocation, it creates a separate
      linked list entry to describe the reservation. Since the linked list
      entries themselves need to persist across subsequent kexec reboots,
      every reservation created this way results in two memblock_reserve()
      calls at the next boot.
      
      On arm64 systems with 100s of CPUs, this may result in a excessive
      number of memblock reservations, and needless fragmentation.
      
      So instead, make use of the newly updated struct linux_efi_memreserve
      layout to put multiple reservations into a single linked list entry.
      This should get rid of the numerous tiny memblock reservations, and
      effectively cut the total number of reservations in half on arm64
      systems with many CPUs.
      
       [ mingo: build warning fix. ]
      Tested-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arend van Spriel <arend.vanspriel@broadcom.com>
      Cc: Bhupesh Sharma <bhsharma@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Eric Snowberg <eric.snowberg@oracle.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Jon Hunter <jonathanh@nvidia.com>
      Cc: Julien Thierry <julien.thierry@arm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Nathan Chancellor <natechancellor@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Cc: Sedat Dilek <sedat.dilek@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: YiFei Zhu <zhuyifei1999@gmail.com>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20181129171230.18699-11-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      80424b02
    • A
      efi: Permit multiple entries in persistent memreserve data structure · 5f0b0ecf
      Ard Biesheuvel 提交于
      In preparation of updating efi_mem_reserve_persistent() to cause less
      fragmentation when dealing with many persistent reservations, update
      the struct definition and the code that handles it currently so it
      can describe an arbitrary number of reservations using a single linked
      list entry. The actual optimization will be implemented in a subsequent
      patch.
      Tested-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arend van Spriel <arend.vanspriel@broadcom.com>
      Cc: Bhupesh Sharma <bhsharma@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Eric Snowberg <eric.snowberg@oracle.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Jon Hunter <jonathanh@nvidia.com>
      Cc: Julien Thierry <julien.thierry@arm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Nathan Chancellor <natechancellor@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Cc: Sedat Dilek <sedat.dilek@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: YiFei Zhu <zhuyifei1999@gmail.com>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20181129171230.18699-10-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      5f0b0ecf
  15. 27 11月, 2018 1 次提交
  16. 15 11月, 2018 2 次提交
  17. 26 9月, 2018 2 次提交
  18. 17 7月, 2018 1 次提交
  19. 16 7月, 2018 2 次提交
    • A
      efi: Drop type and attribute checks in efi_mem_desc_lookup() · 7e1550b8
      Ard Biesheuvel 提交于
      The current implementation of efi_mem_desc_lookup() includes the
      following check on the memory descriptor it returns:
      
          if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
              md->type != EFI_BOOT_SERVICES_DATA &&
              md->type != EFI_RUNTIME_SERVICES_DATA) {
                  continue;
          }
      
      This means that only EfiBootServicesData or EfiRuntimeServicesData
      regions are considered, or any other region type provided that it
      has the EFI_MEMORY_RUNTIME attribute set.
      
      Given what the name of the function implies, and the fact that any
      physical address can be described in the UEFI memory map only a single
      time, it does not make sense to impose this condition in the body of the
      loop, but instead, should be imposed by the caller depending on the value
      that is returned to it.
      
      Two such callers exist at the moment:
      
      - The BGRT code when running on x86, via efi_mem_reserve() and
        efi_arch_mem_reserve(). In this case, the region is already known to
        be EfiBootServicesData, and so the check is redundant.
      
      - The ESRT handling code which introduced this function, which calls it
        both directly from efi_esrt_init() and again via efi_mem_reserve() and
        efi_arch_mem_reserve() [on x86].
      
      So let's move this check into the callers instead. This preserves the
      current behavior both for BGRT and ESRT handling, and allows the lookup
      routine to be reused by other [upcoming] users that don't have this
      limitation.
      
      In the ESRT case, keep the entire condition, so that platforms that
      deviate from the UEFI spec and use something other than
      EfiBootServicesData for the ESRT table will keep working as before.
      
      For x86's efi_arch_mem_reserve() implementation, limit the type to
      EfiBootServicesData, since it is the only type the reservation code
      expects to operate on in the first place.
      
      While we're at it, drop the __init annotation so that drivers can use it
      as well.
      Tested-by: NLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20180711094040.12506-8-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      7e1550b8
    • S
      efi: Use a work queue to invoke EFI Runtime Services · 3eb420e7
      Sai Praneeth 提交于
      Presently, when a user process requests the kernel to execute any
      UEFI runtime service, the kernel temporarily switches to a separate
      set of page tables that describe the virtual mapping of the UEFI
      runtime services regions in memory. Since UEFI runtime services are
      typically invoked with interrupts enabled, any code that may be called
      during this time, will have an incorrect view of the process's address
      space. Although it is unusual for code running in interrupt context to
      make assumptions about the process context it runs in, there are cases
      (such as the perf subsystem taking samples) where this causes problems.
      
      So let's set up a work queue for calling UEFI runtime services, so that
      the actual calls are made when the work queue items are dispatched by a
      work queue worker running in a separate kernel thread. Such threads are
      not expected to have userland mappings in the first place, and so the
      additional mappings created for the UEFI runtime services can never
      clash with any.
      
      The ResetSystem() runtime service is not covered by the work queue
      handling, since it is not expected to return, and may be called at a
      time when the kernel is torn down to the point where we cannot expect
      work queues to still be operational.
      
      The non-blocking variants of SetVariable() and QueryVariableInfo()
      are also excluded: these are intended to be used from atomic context,
      which obviously rules out waiting for a completion to be signalled by
      another thread. Note that these variants are currently only used for
      UEFI runtime services calls that occur very early in the boot, and
      for ones that occur in critical conditions, e.g., to flush kernel logs
      to UEFI variables via efi-pstore.
      Suggested-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      [ardb: exclude ResetSystem() from the workqueue treatment
             merge from 2 separate patches and rewrite commit log]
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20180711094040.12506-4-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      3eb420e7
  20. 12 3月, 2018 1 次提交
  21. 09 3月, 2018 1 次提交
  22. 08 1月, 2018 1 次提交
  23. 03 1月, 2018 1 次提交
  24. 07 12月, 2017 2 次提交
  25. 26 8月, 2017 2 次提交
  26. 21 8月, 2017 1 次提交
  27. 18 7月, 2017 1 次提交
  28. 23 6月, 2017 1 次提交
  29. 18 3月, 2017 1 次提交
    • D
      efi/esrt: Cleanup bad memory map log messages · 822f5845
      Daniel Drake 提交于
      The Intel Compute Stick STCK1A8LFC and Weibu F3C platforms both
      log 2 error messages during boot:
      
         efi: requested map not found.
         esrt: ESRT header is not in the memory map.
      
      Searching the web, this seems to affect many other platforms too.
      Since these messages are logged as errors, they appear on-screen during
      the boot process even when using the "quiet" boot parameter used by
      distros.
      
      Demote the ESRT error to a warning so that it does not appear on-screen,
      and delete the error logging from efi_mem_desc_lookup; both callsites
      of that function log more specific messages upon failure.
      
      Out of curiosity I looked closer at the Weibu F3C. There is no entry in
      the UEFI-provided memory map which corresponds to the ESRT pointer, but
      hacking the code to map it anyway, the ESRT does appear to be valid with
      2 entries.
      Signed-off-by: NDaniel Drake <drake@endlessm.com>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Acked-by: NPeter Jones <pjones@redhat.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      822f5845
  30. 01 2月, 2017 1 次提交