1. 05 3月, 2018 2 次提交
    • K
      arm64: cpufeature: Remove redundant "feature" in reports · e0f6429d
      Kees Cook 提交于
      The word "feature" is repeated in the CPU features reporting. This drops it
      for improved readability.
      
      Before (redundant "feature" word):
      
       SMP: Total of 4 processors activated.
       CPU features: detected feature: 32-bit EL0 Support
       CPU features: detected feature: Kernel page table isolation (KPTI)
       CPU features: emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching
       CPU: All CPU(s) started at EL2
      
      After:
      
       SMP: Total of 4 processors activated.
       CPU features: detected: 32-bit EL0 Support
       CPU features: detected: Kernel page table isolation (KPTI)
       CPU features: emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching
       CPU: All CPU(s) started at EL2
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      e0f6429d
    • K
      arm64: cpufeature: Relocate PAN emulation report · 2e6f549f
      Kees Cook 提交于
      The PAN emulation notification was only happening for non-boot CPUs
      if CPU capabilities had already been configured. This seems to be the
      wrong place, as it's system-wide and isn't attached to capabilities,
      so its reporting didn't normally happen. Instead, report it once from
      the boot CPU.
      
      Before (missing PAN emulation report):
      
       SMP: Total of 4 processors activated.
       CPU features: detected feature: 32-bit EL0 Support
       CPU features: detected feature: Kernel page table isolation (KPTI)
       CPU: All CPU(s) started at EL2
      
      After:
      
       SMP: Total of 4 processors activated.
       CPU features: detected feature: 32-bit EL0 Support
       CPU features: detected feature: Kernel page table isolation (KPTI)
       CPU features: emulated: Privileged Access Never (PAN) using TTBR0_EL1 switching
       CPU: All CPU(s) started at EL2
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      2e6f549f
  2. 20 2月, 2018 1 次提交
    • W
      arm64: cpufeature: Fix CTR_EL0 field definitions · be68a8aa
      Will Deacon 提交于
      Our field definitions for CTR_EL0 suffer from a number of problems:
      
        - The IDC and DIC fields are missing, which causes us to enable CTR
          trapping on CPUs with either of these returning non-zero values.
      
        - The ERG is FTR_LOWER_SAFE, whereas it should be treated like CWG as
          FTR_HIGHER_SAFE so that applications can use it to avoid false sharing.
      
        - [nit] A RES1 field is described as "RAO"
      
      This patch updates the CTR_EL0 field definitions to fix these issues.
      
      Cc: <stable@vger.kernel.org>
      Cc: Shanker Donthineni <shankerd@codeaurora.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      be68a8aa
  3. 07 2月, 2018 2 次提交
  4. 24 1月, 2018 1 次提交
  5. 16 1月, 2018 5 次提交
  6. 13 1月, 2018 1 次提交
  7. 09 1月, 2018 3 次提交
  8. 05 1月, 2018 1 次提交
  9. 14 12月, 2017 1 次提交
    • D
      arm64/sve: Report SVE to userspace via CPUID only if supported · 3fab3999
      Dave Martin 提交于
      Currently, the SVE field in ID_AA64PFR0_EL1 is visible
      unconditionally to userspace via the CPU ID register emulation,
      irrespective of the kernel config.  This means that if a kernel
      configured with CONFIG_ARM64_SVE=n is run on SVE-capable hardware,
      userspace will see SVE reported as present in the ID regs even
      though the kernel forbids execution of SVE instructions.
      
      This patch makes the exposure of the SVE field in ID_AA64PFR0_EL1
      conditional on CONFIG_ARM64_SVE=y.
      
      Since future architecture features are likely to encounter a
      similar requirement, this patch adds a suitable helper macros for
      use when declaring config-conditional ID register fields.
      
      Fixes: 43994d82 ("arm64/sve: Detect SVE and activate runtime support")
      Reviewed-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Reported-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NDave Martin <Dave.Martin@arm.com>
      Cc: Suzuki Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      3fab3999
  10. 11 12月, 2017 1 次提交
  11. 03 11月, 2017 3 次提交
  12. 25 10月, 2017 1 次提交
  13. 20 10月, 2017 1 次提交
    • S
      arm64: Fix the feature type for ID register fields · 5bdecb79
      Suzuki K Poulose 提交于
      Now that the ARM ARM clearly specifies the rules for inferring
      the values of the ID register fields, fix the types of the
      feature bits we have in the kernel.
      
      As per ARM ARM DDI0487B.b, section D10.1.4 "Principles of the
      ID scheme for fields in ID registers" lists the registers to
      which the scheme applies along with the exceptions.
      
      This patch changes the relevant feature bits from FTR_EXACT
      to FTR_LOWER_SAFE to select the safer value. This will enable
      an older kernel running on a new CPU detect the safer option
      rather than completely disabling the feature.
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Martin <dave.martin@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      5bdecb79
  14. 11 10月, 2017 1 次提交
    • S
      arm64: Expose support for optional ARMv8-A features · f5e035f8
      Suzuki K Poulose 提交于
      ARMv8-A adds a few optional features for ARMv8.2 and ARMv8.3.
      Expose them to the userspace via HWCAPs and mrs emulation.
      
      SHA2-512  - Instruction support for SHA512 Hash algorithm (e.g SHA512H,
      	    SHA512H2, SHA512U0, SHA512SU1)
      SHA3 	  - SHA3 crypto instructions (EOR3, RAX1, XAR, BCAX).
      SM3	  - Instruction support for Chinese cryptography algorithm SM3
      SM4 	  - Instruction support for Chinese cryptography algorithm SM4
      DP	  - Dot Product instructions (UDOT, SDOT).
      
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Dave Martin <dave.martin@arm.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      f5e035f8
  15. 06 10月, 2017 1 次提交
    • S
      arm64: Ensure the instruction emulation is ready for userspace · c0d8832e
      Suzuki K Poulose 提交于
      We trap and emulate some instructions (e.g, mrs, deprecated instructions)
      for the userspace. However the handlers for these are registered as
      late_initcalls and the userspace could be up and running from the initramfs
      by that time (with populate_rootfs, which is a rootfs_initcall()). This
      could cause problems for the early applications ending up in failure
      like :
      
      [   11.152061] modprobe[93]: undefined instruction: pc=0000ffff8ca48ff4
      
      This patch promotes the specific calls to core_initcalls, which are
      guaranteed to be completed before we hit userspace.
      
      Cc: stable@vger.kernel.org
      Cc: Dave Martin <dave.martin@arm.com>
      Cc: Matthias Brugger <mbrugger@suse.com>
      Cc: James Morse <james.morse@arm.com>
      Reported-by: NMatwey V. Kornilov <matwey.kornilov@gmail.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      c0d8832e
  16. 09 8月, 2017 2 次提交
  17. 22 6月, 2017 1 次提交
    • M
      arm64: dump cpu_hwcaps at panic time · 8effeaaf
      Mark Rutland 提交于
      When debugging a kernel panic(), it can be useful to know which CPU
      features have been detected by the kernel, as some code paths can depend
      on these (and may have been patched at runtime).
      
      This patch adds a notifier to dump the detected CPU caps (as a hex
      string) at panic(), when we log other information useful for debugging.
      On a Juno R1 system running v4.12-rc5, this looks like:
      
      [  615.431249] Kernel panic - not syncing: Fatal exception in interrupt
      [  615.437609] SMP: stopping secondary CPUs
      [  615.441872] Kernel Offset: disabled
      [  615.445372] CPU features: 0x02086
      [  615.448522] Memory Limit: none
      
      A developer can decode this by looking at the corresponding
      <asm/cpucaps.h> bits. For example, the above decodes as:
      
      * bit  1: ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE
      * bit  2: ARM64_WORKAROUND_845719
      * bit  7: ARM64_WORKAROUND_834220
      * bit 13: ARM64_HAS_32BIT_EL0
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Acked-by: NSteve Capper <steve.capper@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      8effeaaf
  18. 05 6月, 2017 1 次提交
  19. 30 5月, 2017 1 次提交
  20. 18 5月, 2017 1 次提交
    • M
      arm64/cpufeature: don't use mutex in bringup path · 63a1e1c9
      Mark Rutland 提交于
      Currently, cpus_set_cap() calls static_branch_enable_cpuslocked(), which
      must take the jump_label mutex.
      
      We call cpus_set_cap() in the secondary bringup path, from the idle
      thread where interrupts are disabled. Taking a mutex in this path "is a
      NONO" regardless of whether it's contended, and something we must avoid.
      We didn't spot this until recently, as ___might_sleep() won't warn for
      this case until all CPUs have been brought up.
      
      This patch avoids taking the mutex in the secondary bringup path. The
      poking of static keys is deferred until enable_cpu_capabilities(), which
      runs in a suitable context on the boot CPU. To account for the static
      keys being set later, cpus_have_const_cap() is updated to use another
      static key to check whether the const cap keys have been initialised,
      falling back to the caps bitmap until this is the case.
      
      This means that users of cpus_have_const_cap() gain should only gain a
      single additional NOP in the fast path once the const caps are
      initialised, but should always see the current cap value.
      
      The hyp code should never dereference the caps array, since the caps are
      initialized before we run the module initcall to initialise hyp. A check
      is added to the hyp init code to document this requirement.
      
      This change will sidestep a number of issues when the upcoming hotplug
      locking rework is merged.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Reviewed-by: NMarc Zyniger <marc.zyngier@arm.com>
      Reviewed-by: NSuzuki Poulose <suzuki.poulose@arm.com>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Cc: Christoffer Dall <christoffer.dall@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sebastian Sewior <bigeasy@linutronix.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      63a1e1c9
  21. 07 4月, 2017 1 次提交
  22. 04 4月, 2017 1 次提交
  23. 21 3月, 2017 4 次提交
  24. 15 2月, 2017 1 次提交
    • M
      arm64: cpufeature: correctly handle MRS to XZR · 521c6461
      Mark Rutland 提交于
      In emulate_mrs() we may erroneously write back to the user SP rather
      than XZR if we trap an MRS instruction where Xt == 31.
      
      Use the new pt_regs_write_reg() helper to handle this correctly.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Fixes: 77c97b4e ("arm64: cpufeature: Expose CPUID registers by emulation")
      Cc: Andre Przywara <andre.przywara@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      521c6461
  25. 03 2月, 2017 2 次提交
    • M
      arm64: ensure __raw_read_system_reg() is self-consistent · 965861d6
      Mark Rutland 提交于
      We recently discovered that __raw_read_system_reg() erroneously mapped
      sysreg IDs to the wrong registers.
      
      To ensure that we don't get hit by a similar issue in future, this patch
      makes __raw_read_system_reg() use a macro for each case statement,
      ensuring that each case reads the correct register.
      
      To ensure that this patch hasn't introduced an issue, I've binary-diffed
      the object files before and after this patch. No code or data sections
      differ (though some debug section differ due to line numbering
      changing).
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      965861d6
    • M
      arm64: fix erroneous __raw_read_system_reg() cases · 7d0928f1
      Mark Rutland 提交于
      Since it was introduced in commit da8d02d1 ("arm64/capabilities:
      Make use of system wide safe value"), __raw_read_system_reg() has
      erroneously mapped some sysreg IDs to other registers.
      
      For the fields in ID_ISAR5_EL1, our local feature detection will be
      erroneous. We may spuriously detect that a feature is uniformly
      supported, or may fail to detect when it actually is, meaning some
      compat hwcaps may be erroneous (or not enforced upon hotplug).
      
      This patch corrects the erroneous entries.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Fixes: da8d02d1 ("arm64/capabilities: Make use of system wide safe value")
      Reported-by: NCatalin Marinas <catalin.marinas@arm.com>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      7d0928f1