linux-stable/arch/arm64/kvm
Mark Rutland bd37419f4f KVM: arm64: Extract ESR_ELx.EC only
commit 8bb084119f upstream.

Since ARMv8.0 the upper 32 bits of ESR_ELx have been RES0, and recently
some of the upper bits gained a meaning and can be non-zero. For
example, when FEAT_LS64 is implemented, ESR_ELx[36:32] contain ISS2,
which for an ST64BV or ST64BV0 can be non-zero. This can be seen in ARM
DDI 0487G.b, page D13-3145, section D13.2.37.

Generally, we must not rely on RES0 bit remaining zero in future, and
when extracting ESR_ELx.EC we must mask out all other bits.

All C code uses the ESR_ELx_EC() macro, which masks out the irrelevant
bits, and therefore no alterations are required to C code to avoid
consuming irrelevant bits.

In a couple of places the KVM assembly extracts ESR_ELx.EC using LSR on
an X register, and so could in theory consume previously RES0 bits. In
both cases this is for comparison with EC values ESR_ELx_EC_HVC32 and
ESR_ELx_EC_HVC64, for which the upper bits of ESR_ELx must currently be
zero, but this could change in future.

This patch adjusts the KVM vectors to use UBFX rather than LSR to
extract ESR_ELx.EC, ensuring these are robust to future additions to
ESR_ELx.

Cc: stable@vger.kernel.org
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211103110545.4613-1-mark.rutland@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-18 14:03:48 +01:00
..
hyp KVM: arm64: Extract ESR_ELx.EC only 2021-11-18 14:03:48 +01:00
vgic treewide: Change list_sort to use const pointers 2021-09-30 10:11:04 +02:00
aarch32.c KVM: arm64: Synchronize sysreg state on injecting an AArch32 exception 2020-06-10 16:04:08 +01:00
arch_timer.c KVM: arm64: timers: Move timer registers to the sys_regs file 2020-07-07 09:28:38 +01:00
arm.c KVM: arm64: Handle PSCI resets before userspace touches vCPU state 2021-09-22 12:28:04 +02:00
debug.c KVM: arm64: Initialize VCPU mdcr_el2 before loading it 2021-05-14 09:50:33 +02:00
fpsimd.c KVM: arm64: Make struct kvm_regs userspace-only 2020-07-07 09:28:38 +01:00
guest.c KVM: arm64: Move SPSR_EL1 to the system register array 2020-07-07 09:28:38 +01:00
handle_exit.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
hypercalls.c KVM: arm64: ARM_SMCCC_ARCH_WORKAROUND_1 doesn't return SMCCC_RET_NOT_REQUIRED 2020-10-28 11:13:36 +00:00
inject_fault.c KVM: arm64: Fix inject_fault.c kernel-doc warnings 2020-09-18 16:17:22 +01:00
irq.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
Kconfig KVM: arm64: Replace CONFIG_KVM_INDIRECT_VECTORS with CONFIG_RANDOMIZE_BASE 2020-09-29 16:08:15 +01:00
Makefile KVM: arm64: nVHE: Migrate hyp-init to SMCCC 2020-09-15 18:39:04 +01:00
mmio.c KVM/arm64 updates for Linux 5.9: 2020-08-09 12:58:23 -04:00
mmu.c KVM: arm64: Fix exclusive limit for IPA size 2021-03-17 17:06:36 +01:00
perf.c KVM: arm64: Move virt/kvm/arm to arch/arm64 2020-05-16 15:03:59 +01:00
pmu-emul.c KVM: arm64: Don't zero the cycle count register when PMCR_EL0.P is set 2021-07-14 16:56:08 +02:00
pmu.c kvm: arm64: Set up hyp percpu data for nVHE 2020-09-30 08:37:14 +01:00
psci.c KVM: arm64: Convert ARCH_WORKAROUND_2 to arm64_get_spectre_v4_state() 2020-09-29 16:08:17 +01:00
pvtime.c arm64/x86: KVM: Introduce steal-time cap 2020-08-21 14:05:19 +01:00
regmap.c KVM: arm64: Move SPSR_EL1 to the system register array 2020-07-07 09:28:38 +01:00
reset.c KVM: arm64: Fix read-side race on updates to vcpu reset state 2021-09-22 12:28:03 +02:00
sys_regs.c KVM: arm64: Fix debug register indexing 2021-06-10 13:39:28 +02:00
sys_regs.h KVM: arm64: Check RAZ visibility in ID register accessors 2020-11-06 16:00:29 +00:00
trace.h KVM: arm64: Move virt/kvm/arm to arch/arm64 2020-05-16 15:03:59 +01:00
trace_arm.h KVM: arm64: Fix address truncation in traces 2020-09-04 10:53:48 +01:00
trace_handle_exit.h KVM: arm64: Fix address truncation in traces 2020-09-04 10:53:48 +01:00
va_layout.c KVM: arm64: Make nVHE ASLR conditional on RANDOMIZE_BASE 2020-07-28 10:41:11 +01:00
vgic-sys-reg-v3.c KVM: arm64: Move virt/kvm/arm to arch/arm64 2020-05-16 15:03:59 +01:00