1. 23 7月, 2018 8 次提交
    • W
      rseq/selftests: Add support for arm64 · b9657463
      Will Deacon 提交于
      Hook up arm64 support to the rseq selftests.
      Acked-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      b9657463
    • A
      arm64: acpi: fix alignment fault in accessing ACPI · 09ffcb0d
      AKASHI Takahiro 提交于
      This is a fix against the issue that crash dump kernel may hang up
      during booting, which can happen on any ACPI-based system with "ACPI
      Reclaim Memory."
      
      (kernel messages after panic kicked off kdump)
      	   (snip...)
      	Bye!
      	   (snip...)
      	ACPI: Core revision 20170728
      	pud=000000002e7d0003, *pmd=000000002e7c0003, *pte=00e8000039710707
      	Internal error: Oops: 96000021 [#1] SMP
      	Modules linked in:
      	CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.0-rc6 #1
      	task: ffff000008d05180 task.stack: ffff000008cc0000
      	PC is at acpi_ns_lookup+0x25c/0x3c0
      	LR is at acpi_ds_load1_begin_op+0xa4/0x294
      	   (snip...)
      	Process swapper/0 (pid: 0, stack limit = 0xffff000008cc0000)
      	Call trace:
      	   (snip...)
      	[<ffff0000084a6764>] acpi_ns_lookup+0x25c/0x3c0
      	[<ffff00000849b4f8>] acpi_ds_load1_begin_op+0xa4/0x294
      	[<ffff0000084ad4ac>] acpi_ps_build_named_op+0xc4/0x198
      	[<ffff0000084ad6cc>] acpi_ps_create_op+0x14c/0x270
      	[<ffff0000084acfa8>] acpi_ps_parse_loop+0x188/0x5c8
      	[<ffff0000084ae048>] acpi_ps_parse_aml+0xb0/0x2b8
      	[<ffff0000084a8e10>] acpi_ns_one_complete_parse+0x144/0x184
      	[<ffff0000084a8e98>] acpi_ns_parse_table+0x48/0x68
      	[<ffff0000084a82cc>] acpi_ns_load_table+0x4c/0xdc
      	[<ffff0000084b32f8>] acpi_tb_load_namespace+0xe4/0x264
      	[<ffff000008baf9b4>] acpi_load_tables+0x48/0xc0
      	[<ffff000008badc20>] acpi_early_init+0x9c/0xd0
      	[<ffff000008b70d50>] start_kernel+0x3b4/0x43c
      	Code: b9008fb9 2a000318 36380054 32190318 (b94002c0)
      	---[ end trace c46ed37f9651c58e ]---
      	Kernel panic - not syncing: Fatal exception
      	Rebooting in 10 seconds..
      
      (diagnosis)
      * This fault is a data abort, alignment fault (ESR=0x96000021)
        during reading out ACPI table.
      * Initial ACPI tables are normally stored in system ram and marked as
        "ACPI Reclaim memory" by the firmware.
      * After the commit f56ab9a5 ("efi/arm: Don't mark ACPI reclaim
        memory as MEMBLOCK_NOMAP"), those regions are differently handled
        as they are "memblock-reserved", without NOMAP bit.
      * So they are now excluded from device tree's "usable-memory-range"
        which kexec-tools determines based on a current view of /proc/iomem.
      * When crash dump kernel boots up, it tries to accesses ACPI tables by
        mapping them with ioremap(), not ioremap_cache(), in acpi_os_ioremap()
        since they are no longer part of mapped system ram.
      * Given that ACPI accessor/helper functions are compiled in without
        unaligned access support (ACPI_MISALIGNMENT_NOT_SUPPORTED),
        any unaligned access to ACPI tables can cause a fatal panic.
      
      With this patch, acpi_os_ioremap() always honors memory attribute
      information provided by the firmware (EFI) and retaining cacheability
      allows the kernel safe access to ACPI tables.
      Signed-off-by: NAKASHI Takahiro <takahiro.akashi@linaro.org>
      Reviewed-by: NJames Morse <james.morse@arm.com>
      Reviewed-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reported-by and Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      09ffcb0d
    • A
      efi/arm: map UEFI memory map even w/o runtime services enabled · 20d12cf9
      AKASHI Takahiro 提交于
      Under the current implementation, UEFI memory map will be mapped and made
      available in virtual mappings only if runtime services are enabled.
      But in a later patch, we want to use UEFI memory map in acpi_os_ioremap()
      to create mappings of ACPI tables using memory attributes described in
      UEFI memory map.
      See the following commit:
          arm64: acpi: fix alignment fault in accessing ACPI tables
      
      So, as a first step, arm_enter_runtime_services() is modified, alongside
      Ard's patch[1], so that UEFI memory map will not be freed even if
      efi=noruntime.
      
      [1] https://marc.info/?l=linux-efi&m=152930773507524&w=2Signed-off-by: NAKASHI Takahiro <takahiro.akashi@linaro.org>
      Reviewed-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      20d12cf9
    • 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
    • A
      drivers: acpi: add dependency of EFI for arm64 · 5bcd4408
      AKASHI Takahiro 提交于
      As Ard suggested, CONFIG_ACPI && !CONFIG_EFI doesn't make sense on arm64,
      while CONFIG_ACPI and CONFIG_CPU_BIG_ENDIAN doesn't make sense either.
      
      As CONFIG_EFI already has a dependency of !CONFIG_CPU_BIG_ENDIAN, it is
      good enough to add a dependency of CONFIG_EFI to avoid any useless
      combination of configuration.
      
      This bug, reported by Will, will be revealed when my patch series,
      "arm64: kexec,kdump: fix boot failures on acpi-only system," is applied
      and the kernel is built under allmodconfig.
      Signed-off-by: NAKASHI Takahiro <takahiro.akashi@linaro.org>
      Suggested-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      5bcd4408
    • J
      arm64: export memblock_reserve()d regions via /proc/iomem · 50d7ba36
      James Morse 提交于
      There has been some confusion around what is necessary to prevent kexec
      overwriting important memory regions. memblock: reserve, or nomap?
      Only memblock nomap regions are reported via /proc/iomem, kexec's
      user-space doesn't know about memblock_reserve()d regions.
      
      Until commit f56ab9a5 ("efi/arm: Don't mark ACPI reclaim memory
      as MEMBLOCK_NOMAP") the ACPI tables were nomap, now they are reserved
      and thus possible for kexec to overwrite with the new kernel or initrd.
      But this was always broken, as the UEFI memory map is also reserved
      and not marked as nomap.
      
      Exporting both nomap and reserved memblock types is a nuisance as
      they live in different memblock structures which we can't walk at
      the same time.
      
      Take a second walk over memblock.reserved and add new 'reserved'
      subnodes for the memblock_reserved() regions that aren't already
      described by the existing code. (e.g. Kernel Code)
      
      We use reserve_region_with_split() to find the gaps in existing named
      regions. This handles the gap between 'kernel code' and 'kernel data'
      which is memblock_reserve()d, but already partially described by
      request_standard_resources(). e.g.:
      | 80000000-dfffffff : System RAM
      |   80080000-80ffffff : Kernel code
      |   81000000-8158ffff : reserved
      |   81590000-8237efff : Kernel data
      |   a0000000-dfffffff : Crash kernel
      | e00f0000-f949ffff : System RAM
      
      reserve_region_with_split needs kzalloc() which isn't available when
      request_standard_resources() is called, use an initcall.
      Reported-by: NBhupesh Sharma <bhsharma@redhat.com>
      Reported-by: NTyler Baicar <tbaicar@codeaurora.org>
      Suggested-by: NAkashi Takahiro <takahiro.akashi@linaro.org>
      Signed-off-by: NJames Morse <james.morse@arm.com>
      Fixes: d28f6df1 ("arm64/kexec: Add core kexec support")
      Reviewed-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      CC: Mark Rutland <mark.rutland@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      50d7ba36
    • O
      arm64: build with baremetal linker target instead of Linux when available · c931d34e
      Olof Johansson 提交于
      Not all toolchains have the baremetal elf targets, RedHat/Fedora ones
      in particular. So, probe for whether it's available and use the previous
      (linux) targets if it isn't.
      Reported-by: NLaura Abbott <labbott@redhat.com>
      Tested-by: NLaura Abbott <labbott@redhat.com>
      Acked-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Paul Kocialkowski <contact@paulk.fr>
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      c931d34e
    • M
      arm64: fix possible spectre-v1 write in ptrace_hbp_set_event() · 14d6e289
      Mark Rutland 提交于
      It's possible for userspace to control idx. Sanitize idx when using it
      as an array index, to inhibit the potential spectre-v1 write gadget.
      
      Found by smatch.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      14d6e289
  2. 12 7月, 2018 23 次提交
  3. 11 7月, 2018 3 次提交
  4. 10 7月, 2018 1 次提交
    • L
      arm64: numa: rework ACPI NUMA initialization · e1896249
      Lorenzo Pieralisi 提交于
      Current ACPI ARM64 NUMA initialization code in
      
      acpi_numa_gicc_affinity_init()
      
      carries out NUMA nodes creation and cpu<->node mappings at the same time
      in the arch backend so that a single SRAT walk is needed to parse both
      pieces of information.  This implies that the cpu<->node mappings must
      be stashed in an array (sized NR_CPUS) so that SMP code can later use
      the stashed values to avoid another SRAT table walk to set-up the early
      cpu<->node mappings.
      
      If the kernel is configured with a NR_CPUS value less than the actual
      processor entries in the SRAT (and MADT), the logic in
      acpi_numa_gicc_affinity_init() is broken in that the cpu<->node mapping
      is only carried out (and stashed for future use) only for a number of
      SRAT entries up to NR_CPUS, which do not necessarily correspond to the
      possible cpus detected at SMP initialization in
      acpi_map_gic_cpu_interface() (ie MADT and SRAT processor entries order
      is not enforced), which leaves the kernel with broken cpu<->node
      mappings.
      
      Furthermore, given the current ACPI NUMA code parsing logic in
      acpi_numa_gicc_affinity_init(), PXM domains for CPUs that are not parsed
      because they exceed NR_CPUS entries are not mapped to NUMA nodes (ie the
      PXM corresponding node is not created in the kernel) leaving the system
      with a broken NUMA topology.
      
      Rework the ACPI ARM64 NUMA initialization process so that the NUMA
      nodes creation and cpu<->node mappings are decoupled. cpu<->node
      mappings are moved to SMP initialization code (where they are needed),
      at the cost of an extra SRAT walk so that ACPI NUMA mappings can be
      batched before being applied, fixing current parsing pitfalls.
      Acked-by: NHanjun Guo <hanjun.guo@linaro.org>
      Tested-by: NJohn Garry <john.garry@huawei.com>
      Fixes: d8b47fca ("arm64, ACPI, NUMA: NUMA support based on SRAT and
      SLIT")
      Link: http://lkml.kernel.org/r/1527768879-88161-2-git-send-email-xiexiuqi@huawei.comReported-by: NXie XiuQi <xiexiuqi@huawei.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Punit Agrawal <punit.agrawal@arm.com>
      Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
      Cc: Jeremy Linton <jeremy.linton@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Xie XiuQi <xiexiuqi@huawei.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      e1896249
  5. 09 7月, 2018 2 次提交
  6. 06 7月, 2018 3 次提交