Skip to content

Commit db467fe

Browse files
Marc Zyngiergregkh
Marc Zyngier
authored andcommitted
arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
commit c667186 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 <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Christoffer Dall <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f08bc4d commit db467fe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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)