[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 7/7] vfio-ccw: Add support for the CRW irq
From: |
Cornelia Huck |
Subject: |
Re: [PATCH v3 7/7] vfio-ccw: Add support for the CRW irq |
Date: |
Wed, 22 Apr 2020 12:38:46 +0200 |
On Fri, 17 Apr 2020 04:34:40 +0200
Eric Farman <address@hidden> wrote:
> From: Farhan Ali <address@hidden>
>
> The CRW irq will be used by vfio-ccw to notify the userspace
> about any CRWs the userspace needs to handle. Let's add support
> for it.
>
> Signed-off-by: Farhan Ali <address@hidden>
> Signed-off-by: Eric Farman <address@hidden>
> ---
>
> Notes:
> v2->v3:
> - Remove "size==0" check in CRW notifier [CH]
> - Remove intermediate rsc/erc variables, use css_queue_crw_cont() [CH]
> - s/crw0/crw/ [CH]
>
> v1->v2:
> - Add a loop to continually read region while data is
> present, queueing CRWs as found [CH]
>
> v0->v1: [EF]
> - Check vcdev->crw_region before registering the irq,
> in case host kernel does not have matching support
> - Split the refactoring changes to an earlier (new) patch
> (and don't remove the "num_irqs" check in the register
> routine, but adjust it to the check the input variable)
> - Don't revert the cool vfio_set_irq_signaling() stuff
> - Unregister CRW IRQ before IO IRQ in unrealize
> - s/crw1/crw0/
>
> hw/vfio/ccw.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 50 insertions(+)
>
(...)
> @@ -264,6 +265,39 @@ static void vfio_ccw_reset(DeviceState *dev)
> ioctl(vcdev->vdev.fd, VFIO_DEVICE_RESET);
> }
>
> +static void vfio_ccw_crw_notifier_handler(void *opaque)
> +{
> + VFIOCCWDevice *vcdev = opaque;
> + struct ccw_crw_region *region = vcdev->crw_region;
> + CRW crw;
> + int size;
> +
> + if (!event_notifier_test_and_clear(&vcdev->crw_notifier)) {
> + return;
> + }
> +
> + do {
> + memset(region, 0, sizeof(*region));
> + size = pread(vcdev->vdev.fd, region, vcdev->crw_region_size,
> + vcdev->crw_region_offset);
> +
> + if (size == -1) {
> + error_report("vfio-ccw: Read crw region failed with errno=%d",
> + errno);
> + break;
> + }
> +
> + if (region->crw == 0) {
> + /* No more CRWs to queue */
> + break;
> + }
> +
> + memcpy(&crw, ®ion->crw, sizeof(CRW));
> +
> + css_queue_crw_cont(crw);
> + } while (1);
Do you want to clear the notifier again at the end? If the kernel had
queued more crws, it would have made the notifier pending again.
> +}
> +
> static void vfio_ccw_io_notifier_handler(void *opaque)
> {
> VFIOCCWDevice *vcdev = opaque;
(...)
Else looks good to me.
- [PATCH v3 0/7] s390x/vfio-ccw: Channel Path Handling [QEMU], Eric Farman, 2020/04/16
- [PATCH v3 2/7] vfio-ccw: Refactor cleanup of regions, Eric Farman, 2020/04/16
- [PATCH v3 6/7] s390x/css: Refactor the css_queue_crw() routine, Eric Farman, 2020/04/16
- [PATCH v3 7/7] vfio-ccw: Add support for the CRW irq, Eric Farman, 2020/04/16
- Re: [PATCH v3 7/7] vfio-ccw: Add support for the CRW irq,
Cornelia Huck <=
- [PATCH v3 4/7] vfio-ccw: Add support for the crw region, Eric Farman, 2020/04/16
- [PATCH v3 1/7] linux-headers: update, Eric Farman, 2020/04/16
- [PATCH v3 5/7] vfio-ccw: Refactor ccw irq handler, Eric Farman, 2020/04/16
- [PATCH v3 3/7] vfio-ccw: Add support for the schib region, Eric Farman, 2020/04/16
- Re: [PATCH v3 0/7] s390x/vfio-ccw: Channel Path Handling [QEMU], no-reply, 2020/04/16