From: Jared Rossi <[email protected]> The existing virtio_ccw_run() actually has no dependency on CCW. Rather than add a case for non-ccw devices, we can just put the main logic right in the virtio_run() call so that it can be used for other bus types directly.
Reviewed-by: Eric Farman <[email protected]> Signed-off-by: Jared Rossi <[email protected]> --- pc-bios/s390-ccw/virtio-ccw.c | 17 ----------------- pc-bios/s390-ccw/virtio-ccw.h | 1 - pc-bios/s390-ccw/virtio.c | 16 +++++++++++----- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/pc-bios/s390-ccw/virtio-ccw.c b/pc-bios/s390-ccw/virtio-ccw.c index 5cb2158ed2..ea5dbc2857 100644 --- a/pc-bios/s390-ccw/virtio-ccw.c +++ b/pc-bios/s390-ccw/virtio-ccw.c @@ -107,23 +107,6 @@ long virtio_ccw_notify(SubChannelId schid, int vq_idx, long cookie) vq_idx, cookie); } -int virtio_ccw_run(VDev *vdev, int vqid, VirtioCmd *cmd) -{ - VRing *vr = &vdev->vrings[vqid]; - int i = 0; - - do { - vring_send_buf(vr, cmd[i].data, cmd[i].size, - cmd[i].flags | (i ? VRING_HIDDEN_IS_CHAIN : 0)); - } while (cmd[i++].flags & VRING_DESC_F_NEXT); - - vring_wait_reply(); - if (drain_irqs()) { - return -1; - } - return 0; -} - int virtio_ccw_reset(VDev *vdev) { return run_ccw(vdev, CCW_CMD_VDEV_RESET, NULL, 0, false); diff --git a/pc-bios/s390-ccw/virtio-ccw.h b/pc-bios/s390-ccw/virtio-ccw.h index a506767eaa..43d21906e5 100644 --- a/pc-bios/s390-ccw/virtio-ccw.h +++ b/pc-bios/s390-ccw/virtio-ccw.h @@ -16,7 +16,6 @@ extern SubChannelId blk_schid; /* virtio-ccw.c */ int drain_irqs_ccw(SubChannelId schid); bool virtio_ccw_is_supported(VDev *vdev); -int virtio_ccw_run(VDev *vdev, int vqid, VirtioCmd *cmd); long virtio_ccw_notify(SubChannelId schid, int vq_idx, long cookie); int virtio_ccw_setup(VDev *vdev); int virtio_ccw_reset(VDev *vdev); diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index 0b33544144..34c5e6ee22 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -70,13 +70,19 @@ int drain_irqs(void) int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd) { - switch (vdev->ipl_type) { - case S390_IPL_TYPE_QEMU_SCSI: - case S390_IPL_TYPE_CCW: - return virtio_ccw_run(vdev, vqid, cmd); - default: + VRing *vr = &vdev->vrings[vqid]; + int i = 0; + + do { + vring_send_buf(vr, cmd[i].data, cmd[i].size, + cmd[i].flags | (i ? VRING_HIDDEN_IS_CHAIN : 0)); + } while (cmd[i++].flags & VRING_DESC_F_NEXT); + + vring_wait_reply(); + if (drain_irqs()) { return -1; } + return 0; } void vring_init(VRing *vr, VqInfo *info) -- 2.54.0
