]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
ARM: KVM: vgic mmio should hold data as LE bytes array in BE case
authorVictor Kamensky <victor.kamensky@linaro.org>
Thu, 12 Jun 2014 16:30:04 +0000 (09:30 -0700)
committerChristoffer Dall <christoffer.dall@linaro.org>
Fri, 11 Jul 2014 11:57:39 +0000 (04:57 -0700)
According to recent clarifications of mmio.data array meaning -
the mmio.data array should hold bytes as they would appear in
memory. Vgic is little endian device. And in case of BE image
kernel side that emulates vgic, holds data in BE form. So we
need to byteswap cpu<->le32 vgic registers when we read/write them
from mmio.data[].

Change has no effect in LE case because cpu already runs in le32.

Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
virt/kvm/arm/vgic.c

index 795ab482333daf3e2521d784c50d571125b3efbb..b0edc8c670f808f5ff2d49a2c8cf52fdf0c2249e 100644 (file)
@@ -238,12 +238,12 @@ static void vgic_cpu_irq_clear(struct kvm_vcpu *vcpu, int irq)
 
 static u32 mmio_data_read(struct kvm_exit_mmio *mmio, u32 mask)
 {
-       return *((u32 *)mmio->data) & mask;
+       return le32_to_cpu(*((u32 *)mmio->data)) & mask;
 }
 
 static void mmio_data_write(struct kvm_exit_mmio *mmio, u32 mask, u32 value)
 {
-       *((u32 *)mmio->data) = value & mask;
+       *((u32 *)mmio->data) = cpu_to_le32(value) & mask;
 }
 
 /**