[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 09/13] vfio/ccw: get irqs info and set the ev
From: |
Dong Jia Shi |
Subject: |
Re: [Qemu-devel] [PATCH v7 09/13] vfio/ccw: get irqs info and set the eventfd fd |
Date: |
Mon, 15 May 2017 10:31:48 +0800 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
* Alex Williamson <address@hidden> [2017-05-11 15:49:04 -0600]:
Hi Alex,
[...]
> > diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> > index 7ddcfd7..6760cee 100644
> > --- a/hw/vfio/ccw.c
> > +++ b/hw/vfio/ccw.c
[...]
> > +static void vfio_ccw_register_io_notifier(VFIOCCWDevice *vcdev, Error
> > **errp)
> > +{
> > + VFIODevice *vdev = &vcdev->vdev;
> > + struct vfio_irq_info *irq_info;
> > + struct vfio_irq_set *irq_set;
> > + size_t argsz;
> > + int32_t *pfd;
> > +
> > + if (vdev->num_irqs < VFIO_CCW_IO_IRQ_INDEX + 1) {
> > + error_setg(errp, "vfio: unexpected number of io irqs %u",
> > + vdev->num_irqs);
> > + return;
> > + }
> > +
> > + argsz = sizeof(*irq_set);
> > + irq_info = g_malloc0(argsz);
> > + irq_info->index = VFIO_CCW_IO_IRQ_INDEX;
> > + irq_info->argsz = argsz;
> > + if (ioctl(vdev->fd, VFIO_DEVICE_GET_IRQ_INFO,
> > + irq_info) < 0 || irq_info->count < 1) {
> > + error_setg_errno(errp, errno, "vfio: Error getting irq info");
> > + goto get_error;
> > + }
> > +
> > + if (event_notifier_init(&vcdev->io_notifier, 0)) {
> > + error_setg_errno(errp, errno,
> > + "vfio: Unable to init event notifier for IO");
> > + goto get_error;
> > + }
> > +
> > + argsz = sizeof(*irq_set) + sizeof(*pfd);
> > + irq_set = g_malloc0(argsz);
> > + irq_set->argsz = argsz;
> > + irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD |
> > + VFIO_IRQ_SET_ACTION_TRIGGER;
> > + irq_set->index = VFIO_CCW_IO_IRQ_INDEX;
> > + irq_set->start = 0;
> > + irq_set->count = 1;
> > + pfd = (int32_t *) &irq_set->data;
> > +
> > + *pfd = event_notifier_get_fd(&vcdev->io_notifier);
> > + qemu_set_fd_handler(*pfd, vfio_ccw_io_notifier_handler, NULL, vcdev);
> > + if (ioctl(vdev->fd, VFIO_DEVICE_SET_IRQS, irq_set)) {
> > + error_setg(errp, "vfio: Failed to set up io notification");
> > + qemu_set_fd_handler(*pfd, NULL, NULL, vcdev);
> > + event_notifier_cleanup(&vcdev->io_notifier);
> > + goto set_error;
>
>
> nit, unnecessary goto here. set_error label is unused if removed.
Ok, I will remove both this goto line and the set_error label line!
>
> Otherwise,
>
> Acked-by: Alex Williamson <address@hidden>
>
>
Thanks for all of your A-Bs! I will add them in next version.
> > + }
> > +
> > +set_error:
> > + g_free(irq_set);
> > +
> > +get_error:
> > + g_free(irq_info);
> > +}
> > +
[...]
--
Dong Jia Shi