1. 14 Mar, 2022 11 commits
    • Will Deacon's avatar
      Merge branch 'for-next/perf' into for-next/core · b5ef94fb
      Will Deacon authored
      * for-next/perf: (25 commits)
        perf/marvell: Fix !CONFIG_OF build for CN10K DDR PMU driver
        drivers/perf: Add Apple icestorm/firestorm CPU PMU driver
        drivers/perf: arm_pmu: Handle 47 bit counters
        arm64: perf: Consistently make all event numbers as 16-bits
        arm64: perf: Expose some Armv9 common events under sysfs
        perf/marvell: cn10k DDR perf event core ownership
        perf/marvell: cn10k DDR perfmon event overflow handling
        perf/marvell: CN10k DDR performance monitor support
        dt-bindings: perf: marvell: cn10k ddr performance monitor
        perf/arm-cmn: Update watchpoint format
        perf/arm-cmn: Hide XP PUB events for CMN-600
        perf: replace bitmap_weight with bitmap_empty where appropriate
        perf: Replace acpi_bus_get_device()
        perf/marvell_cn10k: Fix unused variable warning when W=1 and CONFIG_OF=n
        perf/arm-cmn: Make arm_cmn_debugfs static
        perf: MARVELL_CN10K_TAD_PMU should depend on ARCH_THUNDER
        perf/arm-ccn: Use platform_get_irq() to get the interrupt
        irqchip/apple-aic: Move PMU-specific registers to their own include file
        arm64: dts: apple: Add t8303 PMU nodes
        arm64: dts: apple: Add t8103 PMU interrupt affinities
        ...
      b5ef94fb
    • Will Deacon's avatar
      Merge branch 'for-next/pauth' into for-next/core · 292ca2d8
      Will Deacon authored
      * for-next/pauth:
        arm64: Add support of PAuth QARMA3 architected algorithm
        arm64: cpufeature: Mark existing PAuth architected algorithm as QARMA5
        arm64: cpufeature: Account min_field_value when cheking secondaries for PAuth
      292ca2d8
    • Will Deacon's avatar
      Merge branch 'for-next/mte' into for-next/core · bf587af2
      Will Deacon authored
      * for-next/mte:
        docs: sysfs-devices-system-cpu: document "asymm" value for mte_tcf_preferred
        arm64/mte: Remove asymmetric mode from the prctl() interface
        kasan: fix a missing header include of static_keys.h
        arm64/mte: Add userspace interface for enabling asymmetric mode
        arm64/mte: Add hwcap for asymmetric mode
        arm64/mte: Add a little bit of documentation for mte_update_sctlr_user()
        arm64/mte: Document ABI for asymmetric mode
        arm64: mte: avoid clearing PSTATE.TCO on entry unless necessary
        kasan: split kasan_*enabled() functions into a separate header
      bf587af2
    • Will Deacon's avatar
      Merge branch 'for-next/mm' into for-next/core · 20fd2ed1
      Will Deacon authored
      * for-next/mm:
        Documentation: vmcoreinfo: Fix htmldocs warning
        arm64/mm: Drop use_1G_block()
        arm64: avoid flushing icache multiple times on contiguous HugeTLB
        arm64: crash_core: Export MODULES, VMALLOC, and VMEMMAP ranges
        arm64/hugetlb: Define __hugetlb_valid_size()
        arm64/mm: avoid fixmap race condition when create pud mapping
        arm64/mm: Consolidate TCR_EL1 fields
      20fd2ed1
    • Will Deacon's avatar
      Merge branch 'for-next/misc' into for-next/core · b3ea0eaf
      Will Deacon authored
      * for-next/misc:
        arm64: mm: Drop 'const' from conditional arm64_dma_phys_limit definition
        arm64: clean up tools Makefile
        arm64: drop unused includes of <linux/personality.h>
        arm64: Do not defer reserve_crashkernel() for platforms with no DMA memory zones
        arm64: prevent instrumentation of bp hardening callbacks
        arm64: cpufeature: Remove cpu_has_fwb() check
        arm64: atomics: remove redundant static branch
        arm64: entry: Save some nops when CONFIG_ARM64_PSEUDO_NMI is not set
      b3ea0eaf
    • Will Deacon's avatar
      Merge branch 'for-next/linkage' into for-next/core · 563c4635
      Will Deacon authored
      * for-next/linkage:
        arm64: module: remove (NOLOAD) from linker script
        linkage: remove SYM_FUNC_{START,END}_ALIAS()
        x86: clean up symbol aliasing
        arm64: clean up symbol aliasing
        linkage: add SYM_FUNC_ALIAS{,_LOCAL,_WEAK}()
      563c4635
    • Will Deacon's avatar
      Merge branch 'for-next/kselftest' into for-next/core · 839d0758
      Will Deacon authored
      * for-next/kselftest:
        kselftest/arm64: Log the PIDs of the parent and child in sve-ptrace
        kselftest/arm64: signal: Allow tests to be incompatible with features
        kselftest/arm64: mte: user_mem: test a wider range of values
        kselftest/arm64: mte: user_mem: add more test types
        kselftest/arm64: mte: user_mem: add test type enum
        kselftest/arm64: mte: user_mem: check different offsets and sizes
        kselftest/arm64: mte: user_mem: rework error handling
        kselftest/arm64: mte: user_mem: introduce tag_offset and tag_len
        kselftest/arm64: Remove local definitions of MTE prctls
        kselftest/arm64: Remove local ARRAY_SIZE() definitions
      839d0758
    • Will Deacon's avatar
      Merge branch 'for-next/insn' into for-next/core · b7323ae6
      Will Deacon authored
      * for-next/insn:
        arm64: insn: add encoders for atomic operations
        arm64: move AARCH64_BREAK_FAULT into insn-def.h
        arm64: insn: Generate 64 bit mask immediates correctly
      b7323ae6
    • Will Deacon's avatar
      Merge branch 'for-next/errata' into for-next/core · cd92fdfc
      Will Deacon authored
      * for-next/errata:
        arm64: Add cavium_erratum_23154_cpus missing sentinel
        irqchip/gic-v3: Workaround Marvell erratum 38545 when reading IAR
      cd92fdfc
    • Will Deacon's avatar
      Merge branch 'for-next/docs' into for-next/core · b523d6b8
      Will Deacon authored
      * for-next/docs:
        arm64/mte: Clarify mode reported by PR_GET_TAGGED_ADDR_CTRL
        arm64: booting.rst: Clarify on requiring non-secure EL2
      b523d6b8
    • Will Deacon's avatar
      Merge branch 'for-next/coredump' into for-next/core · 0d3d0315
      Will Deacon authored
      * for-next/coredump:
        arm64: Change elfcore for_each_mte_vma() to use VMA iterator
        arm64: mte: Document the core dump file format
        arm64: mte: Dump the MTE tags in the core file
        arm64: mte: Define the number of bytes for storing the tags in a page
        elf: Introduce the ARM MTE ELF segment type
        elfcore: Replace CONFIG_{IA64, UML} checks with a new option
      0d3d0315
  2. 10 Mar, 2022 1 commit
  3. 09 Mar, 2022 6 commits
  4. 08 Mar, 2022 15 commits
  5. 07 Mar, 2022 6 commits
    • Mark Brown's avatar
      kselftest/arm64: Log the PIDs of the parent and child in sve-ptrace · e2dc49ef
      Mark Brown authored
      If the test triggers a problem it may well result in a log message from
      the kernel such as a WARN() or BUG(). If these include a PID it can help
      with debugging to know if it was the parent or child process that triggered
      the issue, since the test is just creating a new thread the process name
      will be the same either way. Print the PIDs of the parent and child on
      startup so users have this information to hand should it be needed.
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20220303192817.2732509-1-broonie@kernel.orgSigned-off-by: default avatarWill Deacon <will@kernel.org>
      e2dc49ef
    • Linu Cherian's avatar
      irqchip/gic-v3: Workaround Marvell erratum 38545 when reading IAR · 24a147bc
      Linu Cherian authored
      When a IAR register read races with a GIC interrupt RELEASE event,
      GIC-CPU interface could wrongly return a valid INTID to the CPU
      for an interrupt that is already released(non activated) instead of 0x3ff.
      
      As a side effect, an interrupt handler could run twice, once with
      interrupt priority and then with idle priority.
      
      As a workaround, gic_read_iar is updated so that it will return a
      valid interrupt ID only if there is a change in the active priority list
      after the IAR read on all the affected Silicons.
      
      Since there are silicon variants where both 23154 and 38545 are applicable,
      workaround for erratum 23154 has been extended to address both of them.
      Signed-off-by: default avatarLinu Cherian <lcherian@marvell.com>
      Reviewed-by: default avatarMarc Zyngier <maz@kernel.org>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220307143014.22758-1-lcherian@marvell.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
      24a147bc
    • Anshuman Khandual's avatar
      arm64/mm: Drop use_1G_block() · 1310222c
      Anshuman Khandual authored
      pud_sect_supported() already checks for PUD level block mapping support i.e
      on ARM64_4K_PAGES config. Hence pud_sect_supported(), along with some other
      required alignment checks can help completely drop use_1G_block().
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/1644988012-25455-1-git-send-email-anshuman.khandual@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
      1310222c
    • Muchun Song's avatar
      arm64: avoid flushing icache multiple times on contiguous HugeTLB · cf5a501d
      Muchun Song authored
      When a contiguous HugeTLB page is mapped, set_pte_at() will be called
      CONT_PTES/CONT_PMDS times.  Therefore, __sync_icache_dcache() will
      flush cache multiple times if the page is executable (to ensure
      the I-D cache coherency).  However, the first flushing cache already
      covers subsequent cache flush operations.  So only flusing cache
      for the head page if it is a HugeTLB page to avoid redundant cache
      flushing.  In the next patch, it is also depends on this change
      since the tail vmemmap pages of HugeTLB is mapped with read-only
      meanning only head page struct can be modified.
      Signed-off-by: default avatarMuchun Song <songmuchun@bytedance.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20220302084624.33340-1-songmuchun@bytedance.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
      cf5a501d
    • Mark Rutland's avatar
      arm64: prevent instrumentation of bp hardening callbacks · 614c0b9f
      Mark Rutland authored
      We may call arm64_apply_bp_hardening() early during entry (e.g. in
      el0_ia()) before it is safe to run instrumented code. Unfortunately this
      may result in running instrumented code in two cases:
      
      * The hardening callbacks called by arm64_apply_bp_hardening() are not
        marked as `noinstr`, and have been observed to be instrumented when
        compiled with either GCC or LLVM.
      
      * Since arm64_apply_bp_hardening() itself is only marked as `inline`
        rather than `__always_inline`, it is possible that the compiler
        decides to place it out-of-line, whereupon it may be instrumented.
      
      For example, with defconfig built with clang 13.0.0,
      call_hvc_arch_workaround_1() is compiled as:
      
      | <call_hvc_arch_workaround_1>:
      |        d503233f        paciasp
      |        f81f0ffe        str     x30, [sp, #-16]!
      |        320183e0        mov     w0, #0x80008000
      |        d503201f        nop
      |        d4000002        hvc     #0x0
      |        f84107fe        ldr     x30, [sp], #16
      |        d50323bf        autiasp
      |        d65f03c0        ret
      
      ... but when CONFIG_FTRACE=y and CONFIG_KCOV=y this is compiled as:
      
      | <call_hvc_arch_workaround_1>:
      |        d503245f        bti     c
      |        d503201f        nop
      |        d503201f        nop
      |        d503233f        paciasp
      |        a9bf7bfd        stp     x29, x30, [sp, #-16]!
      |        910003fd        mov     x29, sp
      |        94000000        bl      0 <__sanitizer_cov_trace_pc>
      |        320183e0        mov     w0, #0x80008000
      |        d503201f        nop
      |        d4000002        hvc     #0x0
      |        a8c17bfd        ldp     x29, x30, [sp], #16
      |        d50323bf        autiasp
      |        d65f03c0        ret
      
      ... with a patchable function entry registered with ftrace, and a direct
      call to __sanitizer_cov_trace_pc(). Neither of these are safe early
      during entry sequences.
      
      This patch avoids the unsafe instrumentation by marking
      arm64_apply_bp_hardening() as `__always_inline` and by marking the
      hardening functions as `noinstr`. This avoids the potential for
      instrumentation, and causes clang to consistently generate the function
      as with the defconfig sample.
      
      Note: in the defconfig compilation, when CONFIG_SVE=y, x30 is spilled to
      the stack without being placed in a frame record, which will result in a
      missing entry if call_hvc_arch_workaround_1() is backtraced. Similar is
      true of qcom_link_stack_sanitisation(), where inline asm spills the LR
      to a GPR prior to corrupting it. This is not a significant issue
      presently as we will only backtrace here if an exception is taken, and
      in such cases we may omit entries for other reasons today.
      
      The relevant hardening functions were introduced in commits:
      
        ec82b567 ("arm64: Implement branch predictor hardening for Falkor")
        b092201e ("arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support")
      
      ... and these were subsequently moved in commit:
      
        d4647f0a ("arm64: Rewrite Spectre-v2 mitigation code")
      
      The arm64_apply_bp_hardening() function was introduced in commit:
      
        0f15adbb ("arm64: Add skeleton to harden the branch predictor against aliasing attacks")
      
      ... and was subsequently moved and reworked in commit:
      
        6279017e ("KVM: arm64: Move BP hardening helpers into spectre.h")
      
      Fixes: ec82b567 ("arm64: Implement branch predictor hardening for Falkor")
      Fixes: b092201e ("arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support")
      Fixes: d4647f0a ("arm64: Rewrite Spectre-v2 mitigation code")
      Fixes: 0f15adbb ("arm64: Add skeleton to harden the branch predictor against aliasing attacks")
      Fixes: 6279017e ("KVM: arm64: Move BP hardening helpers into spectre.h")
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Ard Biesheuvel <ardb@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: James Morse <james.morse@arm.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Reviewed-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20220224181028.512873-1-mark.rutland@arm.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
      614c0b9f
    • Huang Shijie's avatar
      arm64: crash_core: Export MODULES, VMALLOC, and VMEMMAP ranges · 2369f171
      Huang Shijie authored
      The following interrelated ranges are needed by the kdump crash tool:
      	MODULES_VADDR ~ MODULES_END,
      	VMALLOC_START ~ VMALLOC_END,
      	VMEMMAP_START ~ VMEMMAP_END
      
      Since these values change from time to time, it is preferable to export
      them via vmcoreinfo than to change the crash's code frequently.
      Signed-off-by: default avatarHuang Shijie <shijie@os.amperecomputing.com>
      Link: https://lore.kernel.org/r/20220209092642.9181-1-shijie@os.amperecomputing.comSigned-off-by: default avatarWill Deacon <will@kernel.org>
      2369f171
  6. 25 Feb, 2022 1 commit
    • Mark Brown's avatar
      arm64/mte: Add userspace interface for enabling asymmetric mode · 766121ba
      Mark Brown authored
      The architecture provides an asymmetric mode for MTE where tag mismatches
      are checked asynchronously for stores but synchronously for loads. Allow
      userspace processes to select this and make it available as a default mode
      via the existing per-CPU sysfs interface.
      
      Since there PR_MTE_TCF_ values are a bitmask (allowing the kernel to choose
      between the multiple modes) and there are no free bits adjacent to the
      existing PR_MTE_TCF_ bits the set of bits used to specify the mode becomes
      disjoint. Programs using the new interface should be aware of this and
      programs that do not use it will not see any change in behaviour.
      
      When userspace requests two possible modes but the system default for the
      CPU is the third mode (eg, default is synchronous but userspace requests
      either asynchronous or asymmetric) the preference order is:
      
         ASYMM > ASYNC > SYNC
      
      This situation is not currently possible since there are only two modes and
      it is mandatory to have a system default so there could be no ambiguity and
      there is no ABI change. The chosen order is basically arbitrary as we do not
      have a clear metric for what is better here.
      
      If userspace requests specifically asymmetric mode via the prctl() and the
      system does not support it then we will return an error, this mirrors
      how we handle the case where userspace enables MTE on a system that does
      not support MTE at all and the behaviour that will be seen if running on
      an older kernel that does not support userspace use of asymmetric mode.
      
      Attempts to set asymmetric mode as the default mode will result in an error
      if the system does not support it.
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: default avatarVincenzo Frascino <Vincenzo.Frascino@arm.com>
      Tested-by: default avatarBranislav Rankov <branislav.rankov@arm.com>
      Link: https://lore.kernel.org/r/20220216173224.2342152-5-broonie@kernel.orgSigned-off-by: default avatarWill Deacon <will@kernel.org>
      766121ba