Skip to content

Commit

Permalink
KVM: arm/arm64: vgic: fix GICD_ICFGR register accesses
Browse files Browse the repository at this point in the history
Since KVM internally represents the ICFGR registers by stuffing two
of them into one word, the offset for accessing the internal
representation and the one for the MMIO based access are different.
So keep the original offset around, but adjust the internal array
offset by one bit.

Reported-by: Haibin Wang <[email protected]>
Signed-off-by: Andre Przywara <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
Signed-off-by: Christoffer Dall <[email protected]>
  • Loading branch information
Andre-ARM authored and chazy committed Apr 28, 2014
1 parent 91021a6 commit f2ae85b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions virt/kvm/arm/vgic.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,10 @@ static bool handle_mmio_cfg_reg(struct kvm_vcpu *vcpu,
u32 val;
u32 *reg;

offset >>= 1;
reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg,
vcpu->vcpu_id, offset);
vcpu->vcpu_id, offset >> 1);

if (offset & 2)
if (offset & 4)
val = *reg >> 16;
else
val = *reg & 0xffff;
Expand All @@ -561,13 +560,13 @@ static bool handle_mmio_cfg_reg(struct kvm_vcpu *vcpu,
vgic_reg_access(mmio, &val, offset,
ACCESS_READ_VALUE | ACCESS_WRITE_VALUE);
if (mmio->is_write) {
if (offset < 4) {
if (offset < 8) {
*reg = ~0U; /* Force PPIs/SGIs to 1 */
return false;
}

val = vgic_cfg_compress(val);
if (offset & 2) {
if (offset & 4) {
*reg &= 0xffff;
*reg |= val << 16;
} else {
Expand Down

0 comments on commit f2ae85b

Please sign in to comment.