]> Pileus Git - ~andy/linux/commitdiff
ARM: KVM: vgic: fix GICD_ICFGRn access
authorMarc Zyngier <marc.zyngier@arm.com>
Thu, 29 Aug 2013 10:08:23 +0000 (11:08 +0100)
committerGleb Natapov <gleb@redhat.com>
Fri, 30 Aug 2013 13:12:16 +0000 (16:12 +0300)
All the code in handle_mmio_cfg_reg() assumes the offset has
been shifted right to accomodate for the 2:1 bit compression,
but this is only done when getting the register address.

Shift the offset early so the code works mostly unchanged.

Reported-by: Zhaobo (Bob, ERC) <zhaobo@huawei.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
virt/kvm/arm/vgic.c

index a2d478aec046ce1cec7cfc8a3ddc5ed968acdb57..902789ff4abb5d3fa8fa54de20458ce27ba8ea94 100644 (file)
@@ -541,8 +541,12 @@ static bool handle_mmio_cfg_reg(struct kvm_vcpu *vcpu,
                                struct kvm_exit_mmio *mmio, phys_addr_t offset)
 {
        u32 val;
-       u32 *reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg,
-                                      vcpu->vcpu_id, offset >> 1);
+       u32 *reg;
+
+       offset >>= 1;
+       reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg,
+                                 vcpu->vcpu_id, offset);
+
        if (offset & 2)
                val = *reg >> 16;
        else