linux/arch/arm64/include/asm
Mark Rutland bde8fff82e arm64: initialize all of CNTHCTL_EL2
In __init_el2_timers we initialize CNTHCTL_EL2.{EL1PCEN,EL1PCTEN} with a
RMW sequence, leaving all other bits UNKNOWN.

In general, we should initialize all bits in a register rather than
using an RMW sequence, since most bits are UNKNOWN out of reset, and as
new bits are added to the reigster their reset value might not result in
expected behaviour.

In the case of CNTHCTL_EL2, FEAT_ECV added a number of new control bits
in previously RES0 bits, which reset to UNKNOWN values, and may cause
issues for EL1 and EL0:

* CNTHCTL_EL2.ECV enables the CNTPOFF_EL2 offset (which itself resets to
  an UNKNOWN value) at EL0 and EL1. Since the offset could reset to
  distinct values across CPUs, when the control bit resets to 1 this
  could break timekeeping generally.

* CNTHCTL_EL2.{EL1TVT,EL1TVCT} trap EL0 and EL1 accesses to the EL1
  virtual timer/counter registers to EL2. When reset to 1, this could
  cause unexpected traps to EL2.

Initializing these bits to zero avoids these problems, and all other
bits in CNTHCTL_EL2 other than EL1PCEN and EL1PCTEN can safely be reset
to zero.

This patch ensures we initialize CNTHCTL_EL2 accordingly, only setting
EL1PCEN and EL1PCTEN, and setting all other bits to zero.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oupton@google.com>
Cc: Will Deacon <will@kernel.org>
Reviewed-by: Oliver Upton <oupton@google.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210818161535.52786-1-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
2021-08-19 10:02:10 +01:00
..
vdso powerpc updates for 5.13 2021-04-30 12:22:28 -07:00
xen
Kbuild set_memory: allow querying whether set_direct_map_*() is actually enabled 2021-07-08 11:48:20 -07:00
acenv.h
acpi.h
alternative-macros.h Merge branch 'for-next/insn' into for-next/core 2021-06-24 14:03:24 +01:00
alternative.h
arch_gicv3.h arm64: Rename arm64-internal cache maintenance functions 2021-05-25 19:27:49 +01:00
arch_timer.h
archrandom.h
arm-cci.h
arm_dsu_pmu.h
asm-bug.h
asm-offsets.h
asm-prototypes.h kasan: arm64: support specialized outlined tag mismatch checks 2021-05-26 23:31:26 +01:00
asm-uaccess.h
asm_pointer_auth.h arm64: Conditionally configure PTR_AUTH key of the kernel. 2021-06-15 11:32:31 +01:00
assembler.h Merge branch 'for-next/caches' into for-next/core 2021-06-24 13:33:02 +01:00
atomic.h locking/atomic: make ARCH_ATOMIC a Kconfig symbol 2021-05-26 13:20:49 +02:00
atomic_ll_sc.h
atomic_lse.h
barrier.h arm64: Fix stale link in the arch_counter_enforce_ordering() comment 2021-05-18 10:47:13 +01:00
bitops.h
bitrev.h
boot.h
brk-imm.h
bug.h
cache.h Revert "arm64: cache: Lower ARCH_DMA_MINALIGN to 64 (L1_CACHE_BYTES)" 2021-07-12 13:37:34 +01:00
cacheflush.h set_memory: allow querying whether set_direct_map_*() is actually enabled 2021-07-08 11:48:20 -07:00
checksum.h
clocksource.h
cmpxchg.h
compat.h
compiler.h CFI: Move function_nocfi() into compiler.h 2021-06-14 09:12:09 -07:00
cpu.h arm64: cpuinfo: Split AArch32 registers out into a separate struct 2021-06-11 13:25:40 +01:00
cpu_ops.h
cpufeature.h arm64: Allow mismatched 32-bit EL0 support 2021-06-11 13:25:40 +01:00
cpuidle.h arm64: Add cpuidle context save/restore helpers 2021-06-17 18:00:39 +01:00
cputype.h
current.h
daifflags.h arm64: entry: always set GIC_PRIO_PSR_I_SET during entry 2021-05-05 18:13:58 +01:00
dcc.h
debug-monitors.h
device.h
dmi.h
efi.h arm64: Rename arm64-internal cache maintenance functions 2021-05-25 19:27:49 +01:00
el2_setup.h arm64: initialize all of CNTHCTL_EL2 2021-08-19 10:02:10 +01:00
elf.h
esr.h
exception.h arm64: entry: make NMI entry/exit functions static 2021-06-07 11:35:56 +01:00
exec.h
extable.h
fb.h
fixmap.h
fpsimd.h arm64/sve: Skip flushing Z registers with 128 bit vectors 2021-05-26 20:04:28 +01:00
fpsimdmacros.h arm64/sve: Split _sve_flush macro into separate Z and predicate flushes 2021-05-26 20:04:28 +01:00
ftrace.h
futex.h
hardirq.h
hugetlb.h mm/hugetlb: change parameters of arch_make_huge_pte() 2021-06-30 20:47:26 -07:00
hw_breakpoint.h
hwcap.h
hyp_image.h
hypervisor.h
image.h
insn-def.h arm64: insn: avoid circular include dependency 2021-06-21 11:58:03 +01:00
insn.h arm64: insn: avoid circular include dependency 2021-06-21 11:58:03 +01:00
io.h
irq.h
irq_work.h
irqflags.h
jump_label.h
kasan.h
kernel-pgtable.h arm64/mm: Rename ARM64_SWAPPER_USES_SECTION_MAPS 2021-06-21 18:22:23 +01:00
kexec.h
kfence.h set_memory: allow querying whether set_direct_map_*() is actually enabled 2021-07-08 11:48:20 -07:00
kgdb.h
kprobes.h
kvm_arm.h KVM: arm64: Save/restore MTE registers 2021-06-22 14:08:05 +01:00
kvm_asm.h arm64 updates for 5.14 2021-06-28 14:04:24 -07:00
kvm_emulate.h KVM: arm64: Introduce MTE VM feature 2021-06-22 14:08:05 +01:00
kvm_host.h KVM/arm64 updates for v5.14. 2021-06-25 11:24:24 -04:00
kvm_hyp.h
kvm_mmu.h Merge branch arm64/for-next/caches into kvmarm-master/next 2021-06-18 17:30:39 +01:00
kvm_mte.h KVM: arm64: Save/restore MTE registers 2021-06-22 14:08:05 +01:00
kvm_pgtable.h KVM: arm64: Introduce two cache maintenance callbacks 2021-06-18 12:34:52 +01:00
kvm_ptrauth.h
kvm_ras.h
kvm_types.h
linkage.h arm64: Add assembly annotations for weak-PI-alias madness 2021-06-01 18:34:38 +01:00
lse.h
memory.h Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
mman.h
mmu.h
mmu_context.h arm64/mm: Fix ttbr0 values stored in struct thread_info for software-pan 2021-06-15 19:03:24 +01:00
mmzone.h
module.h
module.lds.h kasan: arm64: support specialized outlined tag mismatch checks 2021-05-26 23:31:26 +01:00
mte-def.h KVM: arm64: Add ioctl to fetch/store tags in a guest 2021-06-22 14:08:06 +01:00
mte-kasan.h kasan: speed up mte_set_mem_tag_range 2021-05-25 19:21:58 +01:00
mte.h ARM: 2021-06-28 15:40:51 -07:00
neon-intrinsics.h
neon.h
numa.h
page-def.h
page.h Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
paravirt.h
patching.h arm64: insn: decouple patching from insn code 2021-06-11 11:19:27 +01:00
pci.h
percpu.h
perf_event.h arm64: perf: Add more support on caps under sysfs 2021-06-03 09:53:17 +01:00
pgalloc.h mm/thp: define default pmd_pgtable() 2021-07-01 11:06:03 -07:00
pgtable-hwdef.h arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK] 2021-06-15 12:08:39 +01:00
pgtable-prot.h arm64: mm: Remove unused support for Normal-WT memory type 2021-06-01 18:53:53 +01:00
pgtable-types.h
pgtable.h mm: rename p4d_page_vaddr to p4d_pgtable and make it return pud_t * 2021-07-08 11:48:22 -07:00
pointer_auth.h arm64: Conditionally configure PTR_AUTH key of the kernel. 2021-06-15 11:32:31 +01:00
preempt.h sched/core: Initialize the idle task with preemption disabled 2021-05-12 13:01:45 +02:00
probes.h
proc-fns.h
processor.h Merge branch 'for-next/ptrauth' into for-next/core 2021-06-24 14:06:23 +01:00
ptdump.h
ptrace.h arm64: fix compat syscall return truncation 2021-08-03 10:35:03 +01:00
pvclock-abi.h
rwonce.h
scs.h arm64: scs: Drop unused 'tmp' argument to scs_{load, save} asm macros 2021-05-27 17:55:33 +01:00
sdei.h Merge branch 'for-next/entry' into for-next/core 2021-06-24 14:01:55 +01:00
seccomp.h
sections.h
set_memory.h set_memory: allow querying whether set_direct_map_*() is actually enabled 2021-07-08 11:48:20 -07:00
setup.h
shmparam.h
signal.h
signal32.h
simd.h
smp.h arm64: smp: remove stack from secondary_data 2021-05-26 22:45:46 +01:00
smp_plat.h arm64: Add missing header <asm/smp.h> in two files 2021-07-12 13:37:34 +01:00
sparsemem.h
spectre.h
spinlock.h
spinlock_types.h
stack_pointer.h
stackprotector.h
stacktrace.h arm64: stacktrace: fix comment 2021-08-03 10:39:35 +01:00
stage2_pgtable.h
stat.h
string.h
suspend.h
sync_bitops.h
syscall.h arm64: fix compat syscall return truncation 2021-08-03 10:35:03 +01:00
syscall_wrapper.h
sysreg.h ARM: 2021-06-28 15:40:51 -07:00
system_misc.h ARM: 9095/1: ARM64: Remove arm_pm_restart() 2021-06-13 18:16:47 +01:00
thread_info.h
timex.h
tlb.h arm64: tlb: fix the TTL value of tlb_get_level 2021-06-23 14:52:57 +01:00
tlbflush.h
topology.h
trans_pgd.h
traps.h
uaccess.h
unistd.h
unistd32.h quota: Wire up quotactl_fd syscall 2021-06-07 12:11:24 +02:00
uprobes.h
vdso.h
vermagic.h
virt.h
vmalloc.h mm/vmalloc: provide fallback arch huge vmap support functions 2021-04-30 11:20:40 -07:00
vmap_stack.h
word-at-a-time.h arm64 updates for 5.13: 2021-04-26 10:25:03 -07:00
xor.h