KVM: arm/arm64: Fix vGICv2 KVM_DEV_ARM_VGIC_GRP_CPU/DIST_REGS
authorEric Auger <eric.auger@redhat.com>
Mon, 18 Jul 2016 10:57:36 +0000 (10:57 +0000)
committerMarc Zyngier <marc.zyngier@arm.com>
Mon, 18 Jul 2016 17:15:15 +0000 (18:15 +0100)
For VGICv2 save and restore the CPU interface registers
are accessed. Restore the modality which has been altered.
Also explicitly set the iodev_type for both the DIST and CPU
interface.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
virt/kvm/arm/vgic/vgic-mmio-v2.c
virt/kvm/arm/vgic/vgic-mmio.c

index 4152348f5e4f14bde512fc8ad1a9669c299f953d..b44b359cbbadeeba46542be870b3e9bbd49f1d26 100644 (file)
@@ -437,6 +437,7 @@ int vgic_v2_cpuif_uaccess(struct kvm_vcpu *vcpu, bool is_write,
        struct vgic_io_device dev = {
                .regions = vgic_v2_cpu_registers,
                .nr_regions = ARRAY_SIZE(vgic_v2_cpu_registers),
+               .iodev_type = IODEV_CPUIF,
        };
 
        return vgic_uaccess(vcpu, &dev, is_write, offset, val);
@@ -448,6 +449,7 @@ int vgic_v2_dist_uaccess(struct kvm_vcpu *vcpu, bool is_write,
        struct vgic_io_device dev = {
                .regions = vgic_v2_dist_registers,
                .nr_regions = ARRAY_SIZE(vgic_v2_dist_registers),
+               .iodev_type = IODEV_DIST,
        };
 
        return vgic_uaccess(vcpu, &dev, is_write, offset, val);
index 26be827bbfcc54d163077f8c5f814a61cfd95c5c..3bad3c5ed431cb47877f7ddee1ee3347795ac597 100644 (file)
@@ -484,7 +484,8 @@ static int dispatch_mmio_read(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,
 
        switch (iodev->iodev_type) {
        case IODEV_CPUIF:
-               return 1;
+               data = region->read(vcpu, addr, len);
+               break;
        case IODEV_DIST:
                data = region->read(vcpu, addr, len);
                break;
@@ -517,6 +518,7 @@ static int dispatch_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,
 
        switch (iodev->iodev_type) {
        case IODEV_CPUIF:
+               region->write(vcpu, addr, len, data);
                break;
        case IODEV_DIST:
                region->write(vcpu, addr, len, data);