summaryrefslogtreecommitdiff
path: root/arch/arm64/kvm
diff options
context:
space:
mode:
authorVictor Kamensky <victor.kamensky@linaro.org>2014-07-02 17:19:30 +0100
committerChristoffer Dall <christoffer.dall@linaro.org>2014-07-11 04:57:43 -0700
commitf0a3eaff71b8bd5d5acfda1f0cf3eedf49755622 (patch)
tree151ffee47494baad44c4f6838219d4852579bf2d /arch/arm64/kvm
parent26c99af1018c35020cfad1d20f02acb224807655 (diff)
ARM64: KVM: fix big endian issue in access_vm_reg for 32bit guest
Fix issue with 32bit guests running on top of BE KVM host. Indexes of high and low words of 64bit cp15 register are swapped in case of big endian code, since 64bit cp15 state is restored or saved with double word write or read instruction. Define helper macro to access low words of 64bit cp15 register. Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r--arch/arm64/kvm/sys_regs.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index f0ceceffa95a..56288f31c12d 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -134,13 +134,11 @@ static bool access_vm_reg(struct kvm_vcpu *vcpu,
BUG_ON(!p->is_write);
val = *vcpu_reg(vcpu, p->Rt);
- if (!p->is_aarch32) {
+ if (!p->is_aarch32 || !p->is_32bit)
vcpu_sys_reg(vcpu, r->reg) = val;
- } else {
- vcpu_cp15(vcpu, r->reg) = val & 0xffffffffUL;
- if (!p->is_32bit)
- vcpu_cp15(vcpu, r->reg + 1) = val >> 32;
- }
+ else
+ vcpu_cp15_64_low(vcpu, r->reg) = val & 0xffffffffUL;
+
return true;
}