[RFC PATCH v3 5/5] arm/arm64: vgic-new: Implement KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO ioctl

Vijay Kilari vijay.kilari at gmail.com
Tue Sep 6 07:12:19 PDT 2016


On Tue, Aug 30, 2016 at 7:30 PM, Christoffer Dall
<christoffer.dall at linaro.org> wrote:
>
> On Wed, Aug 24, 2016 at 04:50:09PM +0530, vijay.kilari at gmail.com wrote:
> > From: Vijaya Kumar K <Vijaya.Kumar at cavium.com>
> >  }
> > diff --git a/virt/kvm/arm/vgic/vgic-mmio-v3.c b/virt/kvm/arm/vgic/vgic-mmio-v3.c
> > index 61abea0..fde1472 100644
> > --- a/virt/kvm/arm/vgic/vgic-mmio-v3.c
> > +++ b/virt/kvm/arm/vgic/vgic-mmio-v3.c
> > @@ -789,3 +789,22 @@ int vgic_v3_redist_uaccess(struct kvm_vcpu *vcpu, bool is_write,
> >
> >       return vgic_v3_uaccess(vcpu, dev, is_write, offset, val);
> >  }
> > +
> > +int vgic_v3_line_level_info_uaccess(struct kvm_vcpu *vcpu, bool is_write,
> > +                                 u32 intid, u32 *val)
> > +{
> > +     unsigned int len = 4;
> > +     u8 buf[4];
> > +     int ret;
> > +
> > +     if (is_write) {
> > +             vgic_data_host_to_mmio_bus(buf, len, *val);
>
> why do you involve the mmio bus in this?

This is doing LE conversion. This is being done by vgic_uaccess function.
IRC, This sys register access in not following vgic_uaccess path. Hence
added it here.
>
>
> > +             ret = vgic_write_irq_line_level_info(vcpu, intid, len, buf);
> > +     } else {
> > +             ret = vgic_read_irq_line_level_info(vcpu, intid, len, buf);
> > +             if (!ret)
> > +                     *val = vgic_data_mmio_bus_to_host(buf, len);
> > +     }
> > +
> > +     return ret;
> > +}
> > diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c
> > index 38f2c75..74d0449 100644
> > --- a/virt/kvm/arm/vgic/vgic-mmio.c
> > +++ b/virt/kvm/arm/vgic/vgic-mmio.c
> > @@ -391,6 +391,40 @@ void vgic_mmio_write_config(struct kvm_vcpu *vcpu,
> >       }
> >  }
> >
> > +int vgic_read_irq_line_level_info(struct kvm_vcpu *vcpu, u32 intid,
> > +                               unsigned int len, void *val)
> > +{
> > +     unsigned long data = 0;
> > +     int i;
> > +
> > +     for (i = 0; i < len * 8; i++) {
> > +             struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i);
> > +
> > +             if (irq->line_level)
> > +                     data |= (1U << i);
> > +     }
> > +     vgic_data_host_to_mmio_bus(val, len, data);
>
> why???

Same as above reason
>
>
> > +
> > +     return 0;
> > +}
> > +
> > +int vgic_write_irq_line_level_info(struct kvm_vcpu *vcpu, u32 intid,
> > +                                unsigned int len, const void *val)
> > +{
> > +     int i;
> > +     unsigned long data = vgic_data_mmio_bus_to_host(val, len);
>
> why???

Same as above reason



More information about the linux-arm-kernel mailing list