Skip to content

Commit ef5a294

Browse files
James MorseMarc Zyngier
authored andcommitted
KVM: arm64: Add emulation for 32bit guests accessing ACTLR2
ACTLR_EL1 is a 64bit register while the 32bit ACTLR is obviously 32bit. For 32bit software, the extra bits are accessible via ACTLR2... which KVM doesn't emulate. Suggested-by: Marc Zyngier <[email protected]> Signed-off-by: James Morse <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7c582bf commit ef5a294

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

arch/arm64/kvm/sys_regs_generic_v8.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ static bool access_actlr(struct kvm_vcpu *vcpu,
2727
return ignore_write(vcpu, p);
2828

2929
p->regval = vcpu_read_sys_reg(vcpu, ACTLR_EL1);
30+
31+
if (p->is_aarch32) {
32+
if (r->Op2 & 2)
33+
p->regval = upper_32_bits(p->regval);
34+
else
35+
p->regval = lower_32_bits(p->regval);
36+
}
37+
3038
return true;
3139
}
3240

@@ -47,6 +55,8 @@ static const struct sys_reg_desc genericv8_cp15_regs[] = {
4755
/* ACTLR */
4856
{ Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b001),
4957
access_actlr },
58+
{ Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b011),
59+
access_actlr },
5060
};
5161

5262
static struct kvm_sys_reg_target_table genericv8_target_table = {

0 commit comments

Comments
 (0)