1. 20 5月, 2020 1 次提交
  2. 28 4月, 2020 1 次提交
  3. 18 3月, 2020 5 次提交
  4. 14 3月, 2020 1 次提交
    • M
      arm64: cpufeature: add cpus_have_final_cap() · 1db5cdec
      Mark Rutland 提交于
      When cpus_have_const_cap() was originally introduced it was intended to
      be safe in hyp context, where it is not safe to access the cpu_hwcaps
      array as cpus_have_cap() did. For more details see commit:
      
        a4023f68 ("arm64: Add hypervisor safe helper for checking constant capabilities")
      
      We then made use of cpus_have_const_cap() throughout the kernel.
      
      Subsequently, we had to defer updating the static_key associated with
      each capability in order to avoid lockdep complaints. To avoid breaking
      kernel-wide usage of cpus_have_const_cap(), this was updated to fall
      back to the cpu_hwcaps array if called before the static_keys were
      updated. As the kvm hyp code was only called later than this, the
      fallback is redundant but not functionally harmful. For more details,
      see commit:
      
        63a1e1c9 ("arm64/cpufeature: don't use mutex in bringup path")
      
      Today we have more users of cpus_have_const_cap() which are only called
      once the relevant static keys are initialized, and it would be
      beneficial to avoid the redundant code.
      
      To that end, this patch adds a new cpus_have_final_cap(), helper which
      is intend to be used in code which is only run once capabilities have
      been finalized, and will never check the cpus_hwcap array. This helps
      the compiler to generate better code as it no longer needs to generate
      code to address and test the cpus_hwcap array. To help catch misuse,
      cpus_have_final_cap() will BUG() if called before capabilities are
      finalized.
      
      In hyp context, BUG() will result in a hyp panic, but the specific BUG()
      instance will not be identified in the usual way.
      
      Comments are added to the various cpus_have_*_cap() helpers to describe
      the constraints on when they can be used. For clarity cpus_have_cap() is
      moved above the other helpers. Similarly the helpers are updated to use
      system_capabilities_finalized() consistently, and this is made
      __always_inline as required by its new callers.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      1db5cdec
  5. 07 3月, 2020 1 次提交
  6. 22 2月, 2020 2 次提交
  7. 15 1月, 2020 1 次提交
    • S
      arm64: Introduce system_capabilities_finalized() marker · b51c6ac2
      Suzuki K Poulose 提交于
      We finalize the system wide capabilities after the SMP CPUs
      are booted by the kernel. This is used as a marker for deciding
      various checks in the kernel. e.g, sanity check the hotplugged
      CPUs for missing mandatory features.
      
      However there is no explicit helper available for this in the
      kernel. There is sys_caps_initialised, which is not exposed.
      The other closest one we have is the jump_label arm64_const_caps_ready
      which denotes that the capabilities are set and the capability checks
      could use the individual jump_labels for fast path. This is
      performed before setting the ELF Hwcaps, which must be checked
      against the new CPUs. We also perform some of the other initialization
      e.g, SVE setup, which is important for the use of FP/SIMD
      where SVE is supported. Normally userspace doesn't get to run
      before we finish this. However the in-kernel users may
      potentially start using the neon mode. So, we need to
      reject uses of neon mode before we are set. Instead of defining
      a new marker for the completion of SVE setup, we could simply
      reuse the arm64_const_caps_ready and enable it once we have
      finished all the setup. Also we could expose this to the
      various users as "system_capabilities_finalized()" to make
      it more meaningful than "const_caps_ready".
      
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Reviewed-by: NArd Biesheuvel <ardb@kernel.org>
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will@kernel.org>
      b51c6ac2
  8. 18 10月, 2019 1 次提交
  9. 15 8月, 2019 1 次提交
  10. 05 8月, 2019 1 次提交
  11. 01 8月, 2019 1 次提交
  12. 05 7月, 2019 1 次提交
  13. 21 6月, 2019 1 次提交
  14. 19 6月, 2019 1 次提交
  15. 15 5月, 2019 1 次提交
    • M
      arm64: mark (__)cpus_have_const_cap as __always_inline · 02166b88
      Masahiro Yamada 提交于
      This prepares to move CONFIG_OPTIMIZE_INLINING from x86 to a common
      place.  We need to eliminate potential issues beforehand.
      
      If it is enabled for arm64, the following errors are reported:
      
        In file included from include/linux/compiler_types.h:68,
                         from <command-line>:
        arch/arm64/include/asm/jump_label.h: In function 'cpus_have_const_cap':
        include/linux/compiler-gcc.h:120:38: warning: asm operand 0 probably doesn't match constraints
         #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
                                              ^~~
        arch/arm64/include/asm/jump_label.h:32:2: note: in expansion of macro 'asm_volatile_goto'
          asm_volatile_goto(
          ^~~~~~~~~~~~~~~~~
        include/linux/compiler-gcc.h:120:38: error: impossible constraint in 'asm'
         #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
                                              ^~~
        arch/arm64/include/asm/jump_label.h:32:2: note: in expansion of macro 'asm_volatile_goto'
          asm_volatile_goto(
          ^~~~~~~~~~~~~~~~~
      
      Link: http://lkml.kernel.org/r/20190423034959.13525-3-yamada.masahiro@socionext.comSigned-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Boris Brezillon <bbrezillon@kernel.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Marek Vasut <marek.vasut@gmail.com>
      Cc: Mathieu Malaterre <malat@debian.org>
      Cc: Miquel Raynal <miquel.raynal@bootlin.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      02166b88
  16. 26 4月, 2019 1 次提交
  17. 16 4月, 2019 2 次提交
    • A
      arm64: HWCAP: encapsulate elf_hwcap · aec0bff7
      Andrew Murray 提交于
      The introduction of AT_HWCAP2 introduced accessors which ensure that
      hwcap features are set and tested appropriately.
      
      Let's now mandate access to elf_hwcap via these accessors by making
      elf_hwcap static within cpufeature.c.
      Signed-off-by: NAndrew Murray <andrew.murray@arm.com>
      Reviewed-by: NDave Martin <Dave.Martin@arm.com>
      Reviewed-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      aec0bff7
    • A
      arm64: HWCAP: add support for AT_HWCAP2 · aaba098f
      Andrew Murray 提交于
      As we will exhaust the first 32 bits of AT_HWCAP let's start
      exposing AT_HWCAP2 to userspace to give us up to 64 caps.
      
      Whilst it's possible to use the remaining 32 bits of AT_HWCAP, we
      prefer to expand into AT_HWCAP2 in order to provide a consistent
      view to userspace between ILP32 and LP64. However internal to the
      kernel we prefer to continue to use the full space of elf_hwcap.
      
      To reduce complexity and allow for future expansion, we now
      represent hwcaps in the kernel as ordinals and use a
      KERNEL_HWCAP_ prefix. This allows us to support automatic feature
      based module loading for all our hwcaps.
      
      We introduce cpu_set_feature to set hwcaps which complements the
      existing cpu_have_feature helper. These helpers allow us to clean
      up existing direct uses of elf_hwcap and reduce any future effort
      required to move beyond 64 caps.
      
      For convenience we also introduce cpu_{have,set}_named_feature which
      makes use of the cpu_feature macro to allow providing a hwcap name
      without a {KERNEL_}HWCAP_ prefix.
      Signed-off-by: NAndrew Murray <andrew.murray@arm.com>
      [will: use const_ilog2() and tweak documentation]
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      aaba098f
  18. 06 2月, 2019 2 次提交
  19. 14 12月, 2018 3 次提交
  20. 06 12月, 2018 2 次提交
  21. 01 10月, 2018 1 次提交
  22. 21 9月, 2018 1 次提交
  23. 18 9月, 2018 1 次提交
    • V
      arm64: mm: Support Common Not Private translations · 5ffdfaed
      Vladimir Murzin 提交于
      Common Not Private (CNP) is a feature of ARMv8.2 extension which
      allows translation table entries to be shared between different PEs in
      the same inner shareable domain, so the hardware can use this fact to
      optimise the caching of such entries in the TLB.
      
      CNP occupies one bit in TTBRx_ELy and VTTBR_EL2, which advertises to
      the hardware that the translation table entries pointed to by this
      TTBR are the same as every PE in the same inner shareable domain for
      which the equivalent TTBR also has CNP bit set. In case CNP bit is set
      but TTBR does not point at the same translation table entries for a
      given ASID and VMID, then the system is mis-configured, so the results
      of translations are UNPREDICTABLE.
      
      For kernel we postpone setting CNP till all cpus are up and rely on
      cpufeature framework to 1) patch the code which is sensitive to CNP
      and 2) update TTBR1_EL1 with CNP bit set. TTBR1_EL1 can be
      reprogrammed as result of hibernation or cpuidle (via __enable_mmu).
      For these two cases we restore CnP bit via __cpu_suspend_exit().
      
      There are a few cases we need to care of changes in TTBR0_EL1:
        - a switch to idmap
        - software emulated PAN
      
      we rule out latter via Kconfig options and for the former we make
      sure that CNP is set for non-zero ASIDs only.
      Reviewed-by: NJames Morse <james.morse@arm.com>
      Reviewed-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NVladimir Murzin <vladimir.murzin@arm.com>
      [catalin.marinas@arm.com: default y for CONFIG_ARM64_CNP]
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      5ffdfaed
  24. 15 9月, 2018 1 次提交
  25. 01 6月, 2018 3 次提交
  26. 25 5月, 2018 1 次提交
  27. 27 3月, 2018 2 次提交
    • S
      arm64: capabilities: Handle shared entries · ba7d9233
      Suzuki K Poulose 提交于
      Some capabilities have different criteria for detection and associated
      actions based on the matching criteria, even though they all share the
      same capability bit. So far we have used multiple entries with the same
      capability bit to handle this. This is prone to errors, as the
      cpu_enable is invoked for each entry, irrespective of whether the
      detection rule applies to the CPU or not. And also this complicates
      other helpers, e.g, __this_cpu_has_cap.
      
      This patch adds a wrapper entry to cover all the possible variations
      of a capability by maintaining list of matches + cpu_enable callbacks.
      To avoid complicating the prototypes for the "matches()", we use
      arm64_cpu_capabilities maintain the list and we ignore all the other
      fields except the matches & cpu_enable.
      
      This ensures :
      
       1) The capabilitiy is set when at least one of the entry detects
       2) Action is only taken for the entries that "matches".
      
      This avoids explicit checks in the cpu_enable() take some action.
      The only constraint here is that, all the entries should have the
      same "type" (i.e, scope and conflict rules).
      
      If a cpu_enable() method is associated with multiple matches for a
      single capability, care should be taken that either the match criteria
      are mutually exclusive, or that the method is robust against being
      called multiple times.
      
      This also reverts the changes introduced by commit 67948af4
      ("arm64: capabilities: Handle duplicate entries for a capability").
      
      Cc: Robin Murphy <robin.murphy@arm.com>
      Reviewed-by: NDave Martin <dave.martin@arm.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      ba7d9233
    • S
      arm64: capabilities: Add support for checks based on a list of MIDRs · be5b2998
      Suzuki K Poulose 提交于
      Add helpers for detecting an errata on list of midr ranges
      of affected CPUs, with the same work around.
      
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NDave Martin <dave.martin@arm.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      be5b2998