1. 24 2月, 2020 3 次提交
    • A
      efi/x86: Make fw_vendor, config_table and runtime sysfs nodes x86 specific · 9cd437ac
      Ard Biesheuvel 提交于
      There is some code that exposes physical addresses of certain parts of
      the EFI firmware implementation via sysfs nodes. These nodes are only
      used on x86, and are of dubious value to begin with, so let's move
      their handling into the x86 arch code.
      
      Tested-by: Tony Luck <tony.luck@intel.com> # arch/ia64
      Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      9cd437ac
    • A
      efi: Clean up config_parse_tables() · 06c0bd93
      Ard Biesheuvel 提交于
      config_parse_tables() is a jumble of pointer arithmetic, due to the
      fact that on x86, we may be dealing with firmware whose native word
      size differs from the kernel's.
      
      This is not a concern on other architectures, and doesn't quite
      justify the state of the code, so let's clean it up by adding a
      non-x86 code path, constifying statically allocated tables and
      replacing preprocessor conditionals with IS_ENABLED() checks.
      
      Tested-by: Tony Luck <tony.luck@intel.com> # arch/ia64
      Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      06c0bd93
    • A
      efi: Merge EFI system table revision and vendor checks · 14fb4209
      Ard Biesheuvel 提交于
      We have three different versions of the code that checks the EFI system
      table revision and copies the firmware vendor string, and they are
      mostly equivalent, with the exception of the use of early_memremap_ro
      vs. __va() and the lowest major revision to warn about. Let's move this
      into common code and factor out the commonalities.
      
      Tested-by: Tony Luck <tony.luck@intel.com> # arch/ia64
      Signed-off-by: NArd Biesheuvel <ardb@kernel.org>
      14fb4209
  2. 20 1月, 2020 1 次提交
  3. 07 11月, 2019 1 次提交
    • D
      arm/efi: EFI soft reservation to memblock · 16993c0f
      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.
      
      For this patch, update the ARM paths that consider
      EFI_CONVENTIONAL_MEMORY to optionally take the EFI_MEMORY_SP attribute
      into account as a reservation indicator. Publish the soft reservation as
      IORES_DESC_SOFT_RESERVED memory, similar to x86.
      
      (Based on an original patch by Ard)
      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>
      16993c0f
  4. 04 2月, 2019 1 次提交
    • A
      efi: Replace GPL license boilerplate with SPDX headers · 4febfb8d
      Ard Biesheuvel 提交于
      Replace all GPL license blurbs with an equivalent SPDX header (most
      files are GPLv2, some are GPLv2+). While at it, drop some outdated
      header changelogs as well.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: AKASHI Takahiro <takahiro.akashi@linaro.org>
      Cc: Alexander Graf <agraf@suse.de>
      Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Leif Lindholm <leif.lindholm@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20190202094119.13230-7-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      4febfb8d
  5. 15 11月, 2018 1 次提交
    • A
      efi/arm: Revert deferred unmap of early memmap mapping · 33412b86
      Ard Biesheuvel 提交于
      Commit:
      
        3ea86495 ("efi/arm: preserve early mapping of UEFI memory map longer for BGRT")
      
      deferred the unmap of the early mapping of the UEFI memory map to
      accommodate the ACPI BGRT code, which looks up the memory type that
      backs the BGRT table to validate it against the requirements of the UEFI spec.
      
      Unfortunately, this causes problems on ARM, which does not permit
      early mappings to persist after paging_init() is called, resulting
      in a WARN() splat. Since we don't support the BGRT table on ARM anway,
      let's revert ARM to the old behaviour, which is to take down the
      early mapping at the end of efi_init().
      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
      Fixes: 3ea86495 ("efi/arm: preserve early mapping of UEFI memory ...")
      Link: http://lkml.kernel.org/r/20181114175544.12860-3-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      33412b86
  6. 23 7月, 2018 1 次提交
    • A
      efi/arm: preserve early mapping of UEFI memory map longer for BGRT · 3ea86495
      Ard Biesheuvel 提交于
      The BGRT code validates the contents of the table against the UEFI
      memory map, and so it expects it to be mapped when the code runs.
      
      On ARM, this is currently not the case, since we tear down the early
      mapping after efi_init() completes, and only create the permanent
      mapping in arm_enable_runtime_services(), which executes as an early
      initcall, but still leaves a window where the UEFI memory map is not
      mapped.
      
      So move the call to efi_memmap_unmap() from efi_init() to
      arm_enable_runtime_services().
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      [will: fold in EFI_MEMMAP attribute check from Ard]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      3ea86495
  7. 15 6月, 2018 1 次提交
  8. 21 8月, 2017 2 次提交
    • A
      efi/arm/arm64: Add missing assignment of efi.config_table · 9a9de5c0
      Ard Biesheuvel 提交于
      The ARM EFI init code never assigns the config_table member of the
      efi struct, which means the sysfs device node is missing, and other
      in-kernel users will not work correctly. So add the missing assignment.
      
      Note that, for now, the runtime and fw_vendor members are still
      omitted. This is deliberate: exposing physical addresses via sysfs nodes
      encourages behavior that we would like to avoid on ARM (given how it is
      more finicky about using correct memory attributes when mapping memory
      in userland that may be mapped by the kernel already as well).
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20170818194947.19347-6-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      9a9de5c0
    • A
      efi/arm: Don't mark ACPI reclaim memory as MEMBLOCK_NOMAP · f56ab9a5
      Ard Biesheuvel 提交于
      On ARM, regions of memory that are described by UEFI as having special
      significance to the firmware itself are omitted from the linear mapping.
      This is necessary since we cannot guarantee that alternate mappings of
      the same physical region will use attributes that are compatible with
      the ones we use for the linear mapping, and aliases with mismatched
      attributes are prohibited by the architecture.
      
      The above does not apply to ACPI reclaim regions: such regions have no
      special significance to the firmware, and it is up to the OS to decide
      whether or not to preserve them after it has consumed their contents,
      and for how long, after which time the OS can use the memory in any way
      it likes. In the Linux case, such regions are preserved indefinitely,
      and are simply treated the same way as other 'reserved' memory types.
      
      Punching holes into the linear mapping causes page table fragmentation,
      which increases TLB pressure, and so we should avoid doing so if we can.
      So add a special case for regions of type EFI_ACPI_RECLAIM_MEMORY, and
      memblock_reserve() them instead of marking them MEMBLOCK_NOMAP.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20170818194947.19347-2-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      f56ab9a5
  9. 01 2月, 2017 1 次提交
  10. 18 10月, 2016 1 次提交
  11. 09 9月, 2016 3 次提交
    • A
      efi/arm64: Treat regions with WT/WC set but WB cleared as memory · cb82cce7
      Ard Biesheuvel 提交于
      Currently, memory regions are only recorded in the memblock memory table
      if they have the EFI_MEMORY_WB memory type attribute set. In case the
      region is of a reserved type, it is also marked as MEMBLOCK_NOMAP, which
      will leave it out of the linear mapping.
      
      However, memory regions may legally have the EFI_MEMORY_WT or EFI_MEMORY_WC
      attributes set, and the EFI_MEMORY_WB cleared, in which case the region in
      question is obviously backed by normal memory, but is not recorded in the
      memblock memory table at all. Since it would be useful to be able to
      identify any UEFI reported memory region using memblock_is_memory(), it
      makes sense to add all memory to the memblock memory table, and simply mark
      it as MEMBLOCK_NOMAP if it lacks the EFI_MEMORY_WB attribute.
      
      While implementing this, let's refactor the code slightly to make it easier
      to understand: replace is_normal_ram() with is_memory(), and make it return
      true for each region that has any of the WB|WT|WC bits set. (This follows
      the AArch64 bindings in the UEFI spec, which state that those are the
      attributes that map to normal memory)
      
      Also, replace is_reserve_region() with is_usable_memory(), and only invoke
      it if the region in question was identified as memory by is_memory() in the
      first place. The net result is the same (only reserved regions that are
      backed by memory end up in the memblock memory table with the MEMBLOCK_NOMAP
      flag set) but carried out in a more straightforward way.
      
      Finally, we remove the trailing asterisk in the EFI debug output. Keeping it
      clutters the code, and it serves no real purpose now that we no longer
      temporarily reserve BootServices code and data regions like we did in the
      early days of EFI support on arm64 Linux (which it inherited from the x86
      implementation)
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NLeif Lindholm <leif.lindholm@linaro.org>
      Tested-by: NJames Morse <james.morse@arm.com>
      Reviewed-by: NJames Morse <james.morse@arm.com>
      Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
      cb82cce7
    • A
      efi/arm*: esrt: Add missing call to efi_esrt_init() · 2ead3084
      Ard Biesheuvel 提交于
      ESRT support is built by default for all architectures that define
      CONFIG_EFI. However, this support was not wired up yet for ARM/arm64,
      since efi_esrt_init() was never called. So add the missing call.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Leif Lindholm <leif.lindholm@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Jones <pjones@redhat.com>
      Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
      2ead3084
    • M
      efi: Refactor efi_memmap_init_early() into arch-neutral code · 9479c7ce
      Matt Fleming 提交于
      Every EFI architecture apart from ia64 needs to setup the EFI memory
      map at efi.memmap, and the code for doing that is essentially the same
      across all implementations. Therefore, it makes sense to factor this
      out into the common code under drivers/firmware/efi/.
      
      The only slight variation is the data structure out of which we pull
      the initial memory map information, such as physical address, memory
      descriptor size and version, etc. We can address this by passing a
      generic data structure (struct efi_memory_map_data) as the argument to
      efi_memmap_init_early() which contains the minimum info required for
      initialising the memory map.
      
      In the process, this patch also fixes a few undesirable implementation
      differences:
      
       - ARM and arm64 were failing to clear the EFI_MEMMAP bit when
         unmapping the early EFI memory map. EFI_MEMMAP indicates whether
         the EFI memory map is mapped (not the regions contained within) and
         can be traversed.  It's more correct to set the bit as soon as we
         memremap() the passed in EFI memmap.
      
       - Rename efi_unmmap_memmap() to efi_memmap_unmap() to adhere to the
         regular naming scheme.
      
      This patch also uses a read-write mapping for the memory map instead
      of the read-only mapping currently used on ARM and arm64. x86 needs
      the ability to update the memory map in-place when assigning virtual
      addresses to regions (efi_map_region()) and tagging regions when
      reserving boot services (efi_reserve_boot_services()).
      
      There's no way for the generic fake_mem code to know which mapping to
      use without introducing some arch-specific constant/hook, so just use
      read-write since read-only is of dubious value for the EFI memory map.
      
      Tested-by: Dave Young <dyoung@redhat.com> [kexec/kdump]
      Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> [arm]
      Acked-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Leif Lindholm <leif.lindholm@linaro.org>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
      9479c7ce
  12. 03 6月, 2016 1 次提交
    • D
      efi/arm: Fix the format of EFI debug messages · c7534397
      Dennis Chen 提交于
      When both EFI and memblock debugging is enabled on the kernel command line:
      
        'efi=debug memblock=debug'
      
      .. the debug messages for early_con look the following way:
      
       [    0.000000] efi:   0x0000e1050000-0x0000e105ffff [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC]
       [    0.000000] efi:   0x0000e1300000-0x0000e1300fff [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC]
       [    0.000000] efi:   0x0000e8200000-0x0000e827ffff [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC]
       [    0.000000] efi:   0x008000000000-0x008001e7ffff [Runtime Data       |RUN|  |  |  |  |  |  |   |WB|WT|WC|UC]
       [    0.000000] memblock_add: [0x00008000000000-0x00008001e7ffff] flags 0x0 early_init_dt_add_memory_arch+0x54/0x5c
       [    0.000000] *
       ...
      
      Note the misplaced '*' line, which happened because the memblock debug message
      was printed while the EFI debug message was still being constructed..
      
      This patch fixes the output to be the expected:
      
       [    0.000000] efi:   0x0000e1050000-0x0000e105ffff [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC]
       [    0.000000] efi:   0x0000e1300000-0x0000e1300fff [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC]
       [    0.000000] efi:   0x0000e8200000-0x0000e827ffff [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC]
       [    0.000000] efi:   0x008000000000-0x008001e7ffff [Runtime Data       |RUN|  |  |  |  |  |  |   |WB|WT|WC|UC]*
       [    0.000000] memblock_add: [0x00008000000000-0x00008001e7ffff] flags 0x0 early_init_dt_add_memory_arch+0x54/0x5c
       ...
      
      Note how the '*' is now in the proper EFI debug message line.
      Signed-off-by: NDennis Chen <dennis.chen@arm.com>
      Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steve Capper <steve.capper@arm.com>
      Cc: Steve McIntyre <steve@einval.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/1464690224-4503-3-git-send-email-matt@codeblueprint.co.uk
      [ Made the changelog more readable. ]
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      c7534397
  13. 28 4月, 2016 8 次提交
  14. 19 4月, 2016 1 次提交
    • A
      efi: ARM: avoid warning about phys_addr_t cast · 7464b6e3
      Arnd Bergmann 提交于
      memblock_remove() takes a phys_addr_t, which may be narrower than 64 bits,
      causing a harmless warning:
      
      drivers/firmware/efi/arm-init.c: In function 'reserve_regions':
      include/linux/kernel.h:29:20: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
       #define ULLONG_MAX (~0ULL)
                          ^
      drivers/firmware/efi/arm-init.c:152:21: note: in expansion of macro 'ULLONG_MAX'
        memblock_remove(0, ULLONG_MAX);
      
      This adds an explicit typecast to avoid the warning
      
      Fixes: 500899c2 ("efi: ARM/arm64: ignore DT memory nodes instead of removing them")
      Acked-by Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NMatt Fleming <matt@codeblueprint.co.uk>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      7464b6e3
  15. 16 4月, 2016 1 次提交
  16. 01 4月, 2016 1 次提交
    • A
      efi/arm64: Don't apply MEMBLOCK_NOMAP to UEFI memory map mapping · 7cc8cbcf
      Ard Biesheuvel 提交于
      Commit 4dffbfc4 ("arm64/efi: mark UEFI reserved regions as
      MEMBLOCK_NOMAP") updated the mapping logic of both the RuntimeServices
      regions as well as the kernel's copy of the UEFI memory map to set the
      MEMBLOCK_NOMAP flag, which causes these regions to be omitted from the
      kernel direct mapping, and from being covered by a struct page.
      For the RuntimeServices regions, this is an obvious win, since the contents
      of these regions have significance to the firmware executable code itself,
      and are mapped in the EFI page tables using attributes that are described in
      the UEFI memory map, and which may differ from the attributes we use for
      mapping system RAM. It also prevents the contents from being modified
      inadvertently, since the EFI page tables are only live during runtime
      service invocations.
      
      None of these concerns apply to the allocation that covers the UEFI memory
      map, since it is entirely owned by the kernel. Setting the MEMBLOCK_NOMAP on
      the region did allow us to use ioremap_cache() to map it both on arm64 and
      on ARM, since the latter does not allow ioremap_cache() to be used on
      regions that are covered by a struct page.
      
      The ioremap_cache() on ARM restriction will be lifted in the v4.7 timeframe,
      but in the mean time, it has been reported that commit 4dffbfc4 causes
      a regression on 64k granule kernels. This is due to the fact that, given
      the 64 KB page size, the region that we end up removing from the kernel
      direct mapping is rounded up to 64 KB, and this 64 KB page frame may be
      shared with the initrd when booting via GRUB (which does not align its
      EFI_LOADER_DATA allocations to 64 KB like the stub does). This will crash
      the kernel as soon as it tries to access the initrd.
      
      Since the issue is specific to arm64, revert back to memblock_reserve()'ing
      the UEFI memory map when running on arm64. This is a temporary fix for v4.5
      and v4.6, and will be superseded in the v4.7 timeframe when we will be able
      to move back to memblock_reserve() unconditionally.
      
      Fixes: 4dffbfc4 ("arm64/efi: mark UEFI reserved regions as MEMBLOCK_NOMAP")
      Reported-by: NMark Salter <msalter@redhat.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Cc: Leif Lindholm <leif.lindholm@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Jeremy Linton <jeremy.linton@arm.com>
      Cc: Mark Langsdorf <mlangsdo@redhat.com>
      Cc: <stable@vger.kernel.org> # v4.5
      Signed-off-by: NMatt Fleming <matt@codeblueprint.co.uk>
      7cc8cbcf
  17. 22 2月, 2016 1 次提交
  18. 10 12月, 2015 3 次提交
  19. 27 11月, 2015 2 次提交
  20. 25 11月, 2015 1 次提交
    • M
      arm64: efi: correctly map runtime regions · 3b12acf4
      Mark Rutland 提交于
      The kernel may use a page granularity of 4K, 16K, or 64K depending on
      configuration.
      
      When mapping EFI runtime regions, we use memrange_efi_to_native to round
      the physical base address of a region down to a kernel page boundary,
      and round the size up to a kernel page boundary, adding the residue left
      over from rounding down the physical base address. We do not round down
      the virtual base address.
      
      In __create_mapping we account for the offset of the virtual base from a
      granule boundary, adding the residue to the size before rounding the
      base down to said granule boundary.
      
      Thus we account for the residue twice, and when the residue is non-zero
      will cause __create_mapping to map an additional page at the end of the
      region. Depending on the memory map, this page may be in a region we are
      not intended/permitted to map, or may clash with a different region that
      we wish to map. In typical cases, mapping the next item in the memory
      map will overwrite the erroneously created entry, as we sort the memory
      map in the stub.
      
      As __create_mapping can cope with base addresses which are not page
      aligned, we can instead rely on it to map the region appropriately, and
      simplify efi_virtmap_init by removing the unnecessary code.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Reviewed-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Leif Lindholm <leif.lindholm@linaro.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      3b12acf4
  21. 18 11月, 2015 1 次提交
  22. 28 10月, 2015 1 次提交
    • A
      efi: Use correct type for struct efi_memory_map::phys_map · 44511fb9
      Ard Biesheuvel 提交于
      We have been getting away with using a void* for the physical
      address of the UEFI memory map, since, even on 32-bit platforms
      with 64-bit physical addresses, no truncation takes place if the
      memory map has been allocated by the firmware (which only uses
      1:1 virtually addressable memory), which is usually the case.
      
      However, commit:
      
        0f96a99d ("efi: Add "efi_fake_mem" boot option")
      
      adds code that clones and modifies the UEFI memory map, and the
      clone may live above 4 GB on 32-bit platforms.
      
      This means our use of void* for struct efi_memory_map::phys_map has
      graduated from 'incorrect but working' to 'incorrect and
      broken', and we need to fix it.
      
      So redefine struct efi_memory_map::phys_map as phys_addr_t, and
      get rid of a bunch of casts that are now unneeded.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NMatt Fleming <matt@codeblueprint.co.uk>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: izumi.taku@jp.fujitsu.com
      Cc: kamezawa.hiroyu@jp.fujitsu.com
      Cc: linux-efi@vger.kernel.org
      Cc: matt.fleming@intel.com
      Link: http://lkml.kernel.org/r/1445593697-1342-1-git-send-email-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      44511fb9
  23. 12 10月, 2015 2 次提交
  24. 07 10月, 2015 1 次提交
    • W
      arm64: mm: rewrite ASID allocator and MM context-switching code · 5aec715d
      Will Deacon 提交于
      Our current switch_mm implementation suffers from a number of problems:
      
        (1) The ASID allocator relies on IPIs to synchronise the CPUs on a
            rollover event
      
        (2) Because of (1), we cannot allocate ASIDs with interrupts disabled
            and therefore make use of a TIF_SWITCH_MM flag to postpone the
            actual switch to finish_arch_post_lock_switch
      
        (3) We run context switch with a reserved (invalid) TTBR0 value, even
            though the ASID and pgd are updated atomically
      
        (4) We take a global spinlock (cpu_asid_lock) during context-switch
      
        (5) We use h/w broadcast TLB operations when they are not required
            (e.g. in flush_context)
      
      This patch addresses these problems by rewriting the ASID algorithm to
      match the bitmap-based arch/arm/ implementation more closely. This in
      turn allows us to remove much of the complications surrounding switch_mm,
      including the ugly thread flag.
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      5aec715d