Skip to content

Commit db467fe

Browse files
Marc Zyngiergregkh
authored andcommitted
arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
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. Reviewed-by: Christoffer Dall <cdall@linaro.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f08bc4d commit db467fe

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

arch/arm64/kvm/sys_regs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,8 +1054,8 @@ static int kvm_handle_cp_64(struct kvm_vcpu *vcpu,
10541054
{
10551055
struct sys_reg_params params;
10561056
u32 hsr = kvm_vcpu_get_hsr(vcpu);
1057-
int Rt = (hsr >> 5) & 0xf;
1058-
int Rt2 = (hsr >> 10) & 0xf;
1057+
int Rt = (hsr >> 5) & 0x1f;
1058+
int Rt2 = (hsr >> 10) & 0x1f;
10591059

10601060
params.is_aarch32 = true;
10611061
params.is_32bit = false;
@@ -1106,7 +1106,7 @@ static int kvm_handle_cp_32(struct kvm_vcpu *vcpu,
11061106
{
11071107
struct sys_reg_params params;
11081108
u32 hsr = kvm_vcpu_get_hsr(vcpu);
1109-
int Rt = (hsr >> 5) & 0xf;
1109+
int Rt = (hsr >> 5) & 0x1f;
11101110

11111111
params.is_aarch32 = true;
11121112
params.is_32bit = true;

0 commit comments

Comments
 (0)