1. 09 9月, 2016 12 次提交
    • S
      arm64: Refactor sysinstr exception handling · 9dbd5bb2
      Suzuki K Poulose 提交于
      Right now we trap some of the user space data cache operations
      based on a few Errata (ARM 819472, 826319, 827319 and 824069).
      We need to trap userspace access to CTR_EL0, if we detect mismatched
      cache line size. Since both these traps share the EC, refactor
      the handler a little bit to make it a bit more reader friendly.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Acked-by: NAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      9dbd5bb2
    • S
      arm64: Introduce raw_{d,i}cache_line_size · 072f0a63
      Suzuki K Poulose 提交于
      On systems with mismatched i/d cache min line sizes, we need to use
      the smallest size possible across all CPUs. This will be done by fetching
      the system wide safe value from CPU feature infrastructure.
      However the some special users(e.g kexec, hibernate) would need the line
      size on the CPU (rather than the system wide), when either the system
      wide feature may not be accessible or it is guranteed that the caller
      executes with a gurantee of no migration.
      Provide another helper which will fetch cache line size on the current CPU.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Acked-by: NJames Morse <james.morse@arm.com>
      Reviewed-by: NGeoff Levand <geoff@infradead.org>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      072f0a63
    • S
      arm64: insn: Add helpers for adrp offsets · 46084bc2
      Suzuki K Poulose 提交于
      Adds helpers for decoding/encoding the PC relative addresses for adrp.
      This will be used for handling dynamic patching of 'adrp' instructions
      in alternative code patching.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      46084bc2
    • S
      arm64: Rearrange CPU errata workaround checks · c47a1900
      Suzuki K Poulose 提交于
      Right now we run through the work around checks on a CPU
      from __cpuinfo_store_cpu. There are some problems with that:
      
      1) We initialise the system wide CPU feature registers only after the
      Boot CPU updates its cpuinfo. Now, if a work around depends on the
      variance of a CPU ID feature (e.g, check for Cache Line size mismatch),
      we have no way of performing it cleanly for the boot CPU.
      
      2) It is out of place, invoked from __cpuinfo_store_cpu() in cpuinfo.c. It
      is not an obvious place for that.
      
      This patch rearranges the CPU specific capability(aka work around) checks.
      
      1) At the moment we use verify_local_cpu_capabilities() to check if a new
      CPU has all the system advertised features. Use this for the secondary CPUs
      to perform the work around check. For that we rename
        verify_local_cpu_capabilities() => check_local_cpu_capabilities()
      which:
      
         If the system wide capabilities haven't been initialised (i.e, the CPU
         is activated at the boot), update the system wide detected work arounds.
      
         Otherwise (i.e a CPU hotplugged in later) verify that this CPU conforms to the
         system wide capabilities.
      
      2) Boot CPU updates the work arounds from smp_prepare_boot_cpu() after we have
      initialised the system wide CPU feature values.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Andre Przywara <andre.przywara@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      c47a1900
    • S
      arm64: Use consistent naming for errata handling · 89ba2645
      Suzuki K Poulose 提交于
      This is a cosmetic change to rename the functions dealing with
      the errata work arounds to be more consistent with their naming.
      
      1) check_local_cpu_errata() => update_cpu_errata_workarounds()
      check_local_cpu_errata() actually updates the system's errata work
      arounds. So rename it to reflect the same.
      
      2) verify_local_cpu_errata() => verify_local_cpu_errata_workarounds()
      Use errata_workarounds instead of _errata.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Acked-by: NAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      89ba2645
    • S
      arm64: Set the safe value for L1 icache policy · ee7bc638
      Suzuki K Poulose 提交于
      Right now we use 0 as the safe value for CTR_EL0:L1Ip, which is
      not defined at the moment. The safer value for the L1Ip should be
      the weakest of the policies, which happens to be AIVIVT. While at it,
      fix the comment about safe_val.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Catalin Marinas <catalin.marinas@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>
      ee7bc638
    • M
      arm64: simplify contextidr_thread_switch · d3ea42aa
      Mark Rutland 提交于
      When CONFIG_PID_IN_CONTEXTIDR is not selected, we use an empty stub
      definition of contextidr_thread_switch(). As everything we rely upon
      exists regardless of CONFIG_PID_IN_CONTEXTIDR, we don't strictly require
      an empty stub.
      
      By using IS_ENABLED() rather than ifdeffery, we avoid duplication, and
      get compiler coverage on all the code even when CONFIG_PID_IN_CONTEXTIDR
      is not selected and the code is optimised away.
      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>
      d3ea42aa
    • M
      arm64: simplify sysreg manipulation · adf75899
      Mark Rutland 提交于
      A while back we added {read,write}_sysreg accessors to handle accesses
      to system registers, without the usual boilerplate asm volatile,
      temporary variable, etc.
      
      This patch makes use of these across arm64 to make code shorter and
      clearer. For sequences with a trailing ISB, the existing isb() macro is
      also used so that asm blocks can be removed entirely.
      
      A few uses of inline assembly for msr/mrs are left as-is. Those
      manipulating sp_el0 for the current thread_info value have special
      clobber requiremends.
      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>
      adf75899
    • M
      arm64/kvm: use {read,write}_sysreg() · 1f3d8699
      Mark Rutland 提交于
      A while back we added {read,write}_sysreg accessors to handle accesses
      to system registers, without the usual boilerplate asm volatile,
      temporary variable, etc.
      
      This patch makes use of these in the arm64 KVM code to make the code
      shorter and clearer.
      
      At the same time, a comment style violation next to a system register
      access is fixed up in reset_pmcr, and comments describing whether
      operations are reads or writes are removed as this is now painfully
      obvious.
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Acked-by: NChristoffer Dall <christoffer.dall@linaro.org>
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      1f3d8699
    • M
      arm64: dcc: simplify accessors · d0a69d9f
      Mark Rutland 提交于
      A while back we added {read,write}_sysreg accessors to handle accesses
      to system registers, without the usual boilerplate asm volatile,
      temporary variable, etc.
      
      This patch makes use of these in the arm64 DCC accessors to make the
      code shorter and clearer.
      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>
      d0a69d9f
    • M
      arm64: arch_timer: simplify accessors · cd5f22d7
      Mark Rutland 提交于
      A while back we added {read,write}_sysreg accessors to handle accesses
      to system registers, without the usual boilerplate asm volatile,
      temporary variable, etc.
      
      This patch makes use of these in the arm64 arch timer accessors to make
      the code shorter and clearer.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      cd5f22d7
    • M
      arm64: sysreg: allow write_sysreg to use XZR · 7aff4a2d
      Mark Rutland 提交于
      Currently write_sysreg has to allocate a temporary register to write
      zero to a system register, which is unfortunate given that the MSR
      instruction accepts XZR as an operand.
      
      Allow XZR to be used when appropriate by fiddling with the assembly
      constraints.
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      7aff4a2d
  2. 08 9月, 2016 1 次提交
    • R
      arm64/io: Allow I/O writes to use {W,X}ZR · ee5e41b5
      Robin Murphy 提交于
      When zeroing an I/O location, the current accessors are forced to
      allocate a temporary register to store the zero for the write. By
      tweaking the assembly constraints, we can allow the compiler to use
      the zero register directly in such cases, and save some juggling.
      Compiling a representative kernel configuration with GCC 6 shows
      that 2.3KB worth of code can be wasted just on that!
      
        text     data    bss      dec      hex     filename
       13316776 3248256 18176769 34741801 2121e29 vmlinux.o.new
       13319140 3248256 18176769 34744165 2122765 vmlinux.o.old
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      ee5e41b5
  3. 07 9月, 2016 1 次提交
    • C
      arm64: Use static keys for CPU features · efd9e03f
      Catalin Marinas 提交于
      This patch adds static keys transparently for all the cpu_hwcaps
      features by implementing an array of default-false static keys and
      enabling them when detected. The cpus_have_cap() check uses the static
      keys if the feature being checked is a constant, otherwise the compiler
      generates the bitmap test.
      
      Because of the early call to static_branch_enable() via
      check_local_cpu_errata() -> update_cpu_capabilities(), the jump labels
      are initialised in cpuinfo_store_boot_cpu().
      
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Suzuki K. Poulose <Suzuki.Poulose@arm.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      efd9e03f
  4. 05 9月, 2016 1 次提交
  5. 01 9月, 2016 1 次提交
  6. 31 8月, 2016 4 次提交
  7. 26 8月, 2016 6 次提交
  8. 22 8月, 2016 2 次提交
    • M
      arm64: remove traces of perf_ops_bp · da752563
      Mark Rutland 提交于
      Even though perf_ops_bp was removed/renamed back in commit
      b0a873eb ("perf: Register PMU implementations"), as part of
      v2.6.37, its definition still lives on in some arch headers.
      
      This patch removes the vestigal definition from arm64.
      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>
      da752563
    • K
      arm64: mm: convert __dma_* routines to use start, size · d34fdb70
      Kwangwoo Lee 提交于
      __dma_* routines have been converted to use start and size instread of
      start and end addresses. The patch was origianlly for adding
      __clean_dcache_area_poc() which will be used in pmem driver to clean
      dcache to the PoC(Point of Coherency) in arch_wb_cache_pmem().
      
      The functionality of __clean_dcache_area_poc()  was equivalent to
      __dma_clean_range(). The difference was __dma_clean_range() uses the end
      address, but __clean_dcache_area_poc() uses the size to clean.
      
      Thus, __clean_dcache_area_poc() has been revised with a fallthrough
      function of __dma_clean_range() after the change that __dma_* routines
      use start and size instead of using start and end.
      
      As a consequence of using start and size, the name of __dma_* routines
      has also been altered following the terminology below:
          area: takes a start and size
          range: takes a start and end
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NKwangwoo Lee <kwangwoo.lee@sk.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      d34fdb70
  9. 12 8月, 2016 1 次提交
  10. 04 8月, 2016 1 次提交
    • S
      arm64: Fix copy-on-write referencing in HugeTLB · 747a70e6
      Steve Capper 提交于
      set_pte_at(.) will set or unset the PTE_RDONLY hardware bit before
      writing the entry to the table.
      
      This can cause problems with the copy-on-write logic in hugetlb_cow:
       *) hugetlb_cow(.) called to handle a write fault on read only pte,
       *) Before the copy-on-write updates the new page table a call is
          made to pte_same(huge_ptep_get(ptep), pte)), to check for a race,
       *) Because set_pte_at(.) changed the pte, *ptep != pte, and the
          hugetlb_cow(.) code erroneously assumes that it lost the race,
       *) The new page is subsequently freed without being used.
      
      On arm64 this problem only becomes apparent when we apply:
      67961f9d mm/hugetlb: fix huge page reserve accounting for private
      mappings
      
      When one runs the libhugetlbfs test suite, there are allocation errors
      and hugetlbfs pages become erroneously locked in memory as reserved.
      (There is a high HugePages_Rsvd: count).
      
      In this patch we introduce pte_same which ignores the PTE_RDONLY bit,
      allowing for the libhugetlbfs test suite to pass as expected and
      without leaking any reserved HugeTLB pages.
      Reported-by: NHuang Shijie <shijie.huang@arm.com>
      Signed-off-by: NSteve Capper <steve.capper@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      747a70e6
  11. 29 7月, 2016 1 次提交
    • J
      arm64: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO · 3146bc64
      James Hogan 提交于
      AT_VECTOR_SIZE_ARCH should be defined with the maximum number of
      NEW_AUX_ENT entries that ARCH_DLINFO can contain, but it wasn't defined
      for arm64 at all even though ARCH_DLINFO will contain one NEW_AUX_ENT
      for the VDSO address.
      
      This shouldn't be a problem as AT_VECTOR_SIZE_BASE includes space for
      AT_BASE_PLATFORM which arm64 doesn't use, but lets define it now and add
      the comment above ARCH_DLINFO as found in several other architectures to
      remind future modifiers of ARCH_DLINFO to keep AT_VECTOR_SIZE_ARCH up to
      date.
      
      Fixes: f668cd16 ("arm64: ELF definitions")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      3146bc64
  12. 27 7月, 2016 2 次提交
  13. 19 7月, 2016 7 次提交