diff options
author | Victor Kamensky <victor.kamensky@linaro.org> | 2014-06-12 12:30:04 -0400 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2014-07-11 07:57:39 -0400 |
commit | 1c9f04717ca8326e8df759d5dda9cd1b3d968b5b (patch) | |
tree | 624fd2368ee1a94dedf3bef41965b5778312f5f7 /virt/kvm/arm/vgic.c | |
parent | 6d7311b520864531c81f0e0237e96146d8057d77 (diff) |
ARM: KVM: vgic mmio should hold data as LE bytes array in BE case
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>
Diffstat (limited to 'virt/kvm/arm/vgic.c')
-rw-r--r-- | virt/kvm/arm/vgic.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 795ab482333d..b0edc8c670f8 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c | |||
@@ -238,12 +238,12 @@ static void vgic_cpu_irq_clear(struct kvm_vcpu *vcpu, int irq) | |||
238 | 238 | ||
239 | static u32 mmio_data_read(struct kvm_exit_mmio *mmio, u32 mask) | 239 | static u32 mmio_data_read(struct kvm_exit_mmio *mmio, u32 mask) |
240 | { | 240 | { |
241 | return *((u32 *)mmio->data) & mask; | 241 | return le32_to_cpu(*((u32 *)mmio->data)) & mask; |
242 | } | 242 | } |
243 | 243 | ||
244 | static void mmio_data_write(struct kvm_exit_mmio *mmio, u32 mask, u32 value) | 244 | static void mmio_data_write(struct kvm_exit_mmio *mmio, u32 mask, u32 value) |
245 | { | 245 | { |
246 | *((u32 *)mmio->data) = value & mask; | 246 | *((u32 *)mmio->data) = cpu_to_le32(value) & mask; |
247 | } | 247 | } |
248 | 248 | ||
249 | /** | 249 | /** |