• Dan Williams's avatar
    x86/efi: EFI soft reservation to E820 enumeration · 262b45ae
    Dan Williams authored
    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.
    
    This patch introduces 2 new concepts at once given the entanglement
    between early boot enumeration relative to memory that can optionally be
    reserved from the kernel page allocator by default. The new concepts
    are:
    
    - E820_TYPE_SOFT_RESERVED: Upon detecting the EFI_MEMORY_SP
      attribute on EFI_CONVENTIONAL memory, update the E820 map with this
      new type. Only perform this classification if the
      CONFIG_EFI_SOFT_RESERVE=y policy is enabled, otherwise treat it as
      typical ram.
    
    - IORES_DESC_SOFT_RESERVED: Add a new I/O resource descriptor for
      a device driver to search iomem resources for application specific
      memory. Teach the iomem code to identify such ranges as "Soft Reserved".
    
    Note that the comment for do_add_efi_memmap() needed refreshing since it
    seemed to imply that the efi map might overflow the e820 table, but that
    is not an issue as of commit 7b6e4ba3 "x86/boot/e820: Clean up the
    E820_X_MAX definition" that removed the 128 entry limit for
    e820__range_add().
    
    A follow-on change integrates parsing of the ACPI HMAT to identify the
    node and sub-range boundaries of EFI_MEMORY_SP designated memory. For
    now, just identify and reserve memory of this type.
    Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Reported-by: default avatarkbuild test robot <lkp@intel.com>
    Reviewed-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    262b45ae
eboot.c 23 KB