diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2013-08-29 06:08:23 -0400 |
---|---|---|
committer | Gleb Natapov <gleb@redhat.com> | 2013-08-30 09:12:16 -0400 |
commit | 6545eae3d7a1b6dc2edb8ede9107998aee1207ef (patch) | |
tree | c7d47b4095192db5a10f4b3c91937d42c89c88f6 /virt/kvm/arm | |
parent | 986af8e0789a41ac4844e6eefed4a33e86524918 (diff) |
ARM: KVM: vgic: fix GICD_ICFGRn access
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>
Diffstat (limited to 'virt/kvm/arm')
-rw-r--r-- | virt/kvm/arm/vgic.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index a2d478aec046..902789ff4abb 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c | |||
@@ -541,8 +541,12 @@ static bool handle_mmio_cfg_reg(struct kvm_vcpu *vcpu, | |||
541 | struct kvm_exit_mmio *mmio, phys_addr_t offset) | 541 | struct kvm_exit_mmio *mmio, phys_addr_t offset) |
542 | { | 542 | { |
543 | u32 val; | 543 | u32 val; |
544 | u32 *reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg, | 544 | u32 *reg; |
545 | vcpu->vcpu_id, offset >> 1); | 545 | |
546 | offset >>= 1; | ||
547 | reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg, | ||
548 | vcpu->vcpu_id, offset); | ||
549 | |||
546 | if (offset & 2) | 550 | if (offset & 2) |
547 | val = *reg >> 16; | 551 | val = *reg >> 16; |
548 | else | 552 | else |