[PATCH 1/3] arm/arm64: KVM: vgic: Bugfix in handle_mmio_cfg_reg

Christoffer Dall christoffer.dall at linaro.org
Fri Nov 22 18:57:17 EST 2013


We shift the offset right by 1 bit because we pretend the register
access is for a register packed with 1 bit per setting and not 2 bits
like the hardware.  However, after we expand the emulated register into
the layout of the real hardware register, we need to use the hardware
offset for accessing the register.  Adjust the code accordingly.

Cc: Haibin Wang <wanghaibin202 at gmail.com>
Reported-by: Haibin Wang <wanghaibin202 at gmail.com>
Signed-off-by: Christoffer Dall <christoffer.dall at linaro.org>
---
 virt/kvm/arm/vgic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 685fc72..6699ed9 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -553,7 +553,7 @@ static bool handle_mmio_cfg_reg(struct kvm_vcpu *vcpu,
 		val = *reg & 0xffff;
 
 	val = vgic_cfg_expand(val);
-	vgic_reg_access(mmio, &val, offset,
+	vgic_reg_access(mmio, &val, offset << 1,
 			ACCESS_READ_VALUE | ACCESS_WRITE_VALUE);
 	if (mmio->is_write) {
 		if (offset < 4) {
-- 
1.8.4.3




More information about the linux-arm-kernel mailing list