[bug-fix] when vm access GICD_ICFGRn, the offset is wrong for accessing.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I use the kernel:
	https://github.com/virtualopensystems/linux-kvm-arm.git
	branch:  kvm-arm-master.

About the vgic module, in the handle_mmio_cfg_reg function :

In program, we all know that we use the bitmap to save the GICD_ICFGRn
value (the real hardware register need two bits pre irq), and we use
the vgic_cfg_expand and the vgic_cfg_compress functions.

But, i think we pass the wrong parameter about offset in caller the
vgic_reg_access function.

Here is the patch:

diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index be456ce..907345c 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -557,7 +557,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) {


if not, in vgic_reg_access function, there will be a wrong value to set to word_offset:

	int word_offset = (offset & 3) * 8;
		...
and affect the value to read & write :
	read : u32 data = mmio_data_read_32bits(mmio, mask) << word_offset;

	write : mmio_data_write_32bits(mmio, mask, regval >> word_offset);

Thanks !



_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux