Patch "arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses" has been added to the 4.9-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
arm64-kvm-fix-decoding-of-rt-rt2-when-trapping-aarch32-cp-accesses.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
c667186f1c01ca8970c785888868b7ffd74e51eeMon Sep 17 00:00:00 2001
From: Marc Zyngier <[email protected]>
Date: Thu, 27 Apr 2017 19:06:48 +0100
Subject: arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
From: Marc Zyngier <[email protected]>
commit c667186f1c01ca8970c785888868b7ffd74e51ee upstream.
Our 32bit CP14/15 handling inherited some of the ARMv7 code for handling the trapped system registers, completely missing the fact that the fields for Rt and Rt2 are now 5 bit wide, and not 4...
Let's fix it, and provide an accessor for the most common Rt case.
--- arch/arm64/include/asm/kvm_emulate.h | 6 ++++++ arch/arm64/kvm/sys_regs.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
arch/arm64/include/asm/kvm_emulate.h +6 -0
@@ -240,6 +240,12 @@ static inline u8 kvm_vcpu_trap_get_faultreturn kvm_vcpu_get_hsr (vcpu) & ESR_ELx_FSC_TYPE; } +static inline int kvm_vcpu_sys_get_rt (struct kvm_vcpu *vcpu) +{ +u32 esr =kvm_vcpu_get_hsr (vcpu); +return (esr & ESR_ELx_SYS64_ISS_RT_MASK) >> ESR_ELx_SYS64_ISS_RT_SHIFT; +} +static inline unsigned long kvm_vcpu_get_mpidr_aff (struct kvm_vcpu *vcpu) {return vcpu_sys_reg (vcpu,MPIDR_EL1 ) &MPIDR_HWID_BITMASK ;
arch/arm64/kvm/sys_regs.c +4 -4
@@ -1573,8 +1573,8 @@ static int kvm_handle_cp_64(struct kvm_v {struct sys_reg_params params;u32 hsr =kvm_vcpu_get_hsr (vcpu); -int Rt = (hsr >>5 ) &0xf ; -int Rt2 = (hsr >>10 ) &0xf ; +int Rt =kvm_vcpu_sys_get_rt (vcpu); +int Rt2 = (hsr >>10 ) &0x1f ; params.is_aarch32 = true; params.is_32bit = false;
@@ -1625,7 +1625,7 @@ static int kvm_handle_cp_32(struct kvm_v {struct sys_reg_params params;u32 hsr =kvm_vcpu_get_hsr (vcpu); -int Rt = (hsr >>5 ) &0xf ; +int Rt =kvm_vcpu_sys_get_rt (vcpu); params.is_aarch32 = true; params.is_32bit = true;
@@ -1740,7 +1740,7 @@ int kvm_handle_sys_reg(struct kvm_vcpu * {struct sys_reg_params params;unsigned long esr =kvm_vcpu_get_hsr (vcpu); -int Rt = (esr >>5 ) &0x1f ; +int Rt =kvm_vcpu_sys_get_rt (vcpu);int ret;trace_kvm_handle_sys_reg (esr);
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/arm64-kvm-fix-decoding-of-rt-rt2-when-trapping-aarch32-cp-accesses.patch queue-4.9/kvm-arm-arm64-fix-races-in-kvm_psci_vcpu_on.patch