提交 21a4d962 编写于 作者: C Cornelia Huck 提交者: Michael S. Tsirkin

virtio-bus: remove old set_host_notifier callback

All users have been converted to the new ioevent callbacks.
Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: NFam Zheng <famz@redhat.com>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 c0971bcb
...@@ -79,8 +79,7 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf, ...@@ -79,8 +79,7 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
} }
/* Don't try if transport does not support notifiers. */ /* Don't try if transport does not support notifiers. */
if (!k->set_guest_notifiers || if (!k->set_guest_notifiers || !k->ioeventfd_started) {
(!k->set_host_notifier && !k->ioeventfd_started)) {
error_setg(errp, error_setg(errp,
"device is incompatible with dataplane " "device is incompatible with dataplane "
"(transport does not support notifiers)"); "(transport does not support notifiers)");
...@@ -159,9 +158,6 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) ...@@ -159,9 +158,6 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
/* Set up virtqueue notify */ /* Set up virtqueue notify */
r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), 0, true); r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), 0, true);
if (r == -ENOSYS) {
r = k->set_host_notifier(qbus->parent, 0, true);
}
if (r != 0) { if (r != 0) {
fprintf(stderr, "virtio-blk failed to set host notifier (%d)\n", r); fprintf(stderr, "virtio-blk failed to set host notifier (%d)\n", r);
goto fail_host_notifier; goto fail_host_notifier;
...@@ -197,7 +193,6 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) ...@@ -197,7 +193,6 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev)));
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
VirtIOBlock *vblk = VIRTIO_BLK(s->vdev); VirtIOBlock *vblk = VIRTIO_BLK(s->vdev);
int r;
if (!vblk->dataplane_started || s->stopping) { if (!vblk->dataplane_started || s->stopping) {
return; return;
...@@ -222,10 +217,7 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) ...@@ -222,10 +217,7 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s)
aio_context_release(s->ctx); aio_context_release(s->ctx);
r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), 0, false); virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), 0, false);
if (r == -ENOSYS) {
k->set_host_notifier(qbus->parent, 0, false);
}
/* Clean up guest notifier (irq) */ /* Clean up guest notifier (irq) */
k->set_guest_notifiers(qbus->parent, 1, false); k->set_guest_notifiers(qbus->parent, 1, false);
......
...@@ -31,8 +31,7 @@ void virtio_scsi_set_iothread(VirtIOSCSI *s, IOThread *iothread) ...@@ -31,8 +31,7 @@ void virtio_scsi_set_iothread(VirtIOSCSI *s, IOThread *iothread)
s->ctx = iothread_get_aio_context(vs->conf.iothread); s->ctx = iothread_get_aio_context(vs->conf.iothread);
/* Don't try if transport does not support notifiers. */ /* Don't try if transport does not support notifiers. */
if (!k->set_guest_notifiers || if (!k->set_guest_notifiers || !k->ioeventfd_started) {
(!k->set_host_notifier && !k->ioeventfd_started)) {
fprintf(stderr, "virtio-scsi: Failed to set iothread " fprintf(stderr, "virtio-scsi: Failed to set iothread "
"(transport does not support notifiers)"); "(transport does not support notifiers)");
exit(1); exit(1);
...@@ -70,14 +69,10 @@ static int virtio_scsi_vring_init(VirtIOSCSI *s, VirtQueue *vq, int n, ...@@ -70,14 +69,10 @@ static int virtio_scsi_vring_init(VirtIOSCSI *s, VirtQueue *vq, int n,
void (*fn)(VirtIODevice *vdev, VirtQueue *vq)) void (*fn)(VirtIODevice *vdev, VirtQueue *vq))
{ {
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s))); BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s)));
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
int rc; int rc;
/* Set up virtqueue notify */ /* Set up virtqueue notify */
rc = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), n, true); rc = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), n, true);
if (rc == -ENOSYS) {
rc = k->set_host_notifier(qbus->parent, n, true);
}
if (rc != 0) { if (rc != 0) {
fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n", fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n",
rc); rc);
...@@ -163,10 +158,7 @@ fail_vrings: ...@@ -163,10 +158,7 @@ fail_vrings:
virtio_scsi_clear_aio(s); virtio_scsi_clear_aio(s);
aio_context_release(s->ctx); aio_context_release(s->ctx);
for (i = 0; i < vs->conf.num_queues + 2; i++) { for (i = 0; i < vs->conf.num_queues + 2; i++) {
rc = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
if (rc == -ENOSYS) {
k->set_host_notifier(qbus->parent, i, false);
}
} }
k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false); k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false);
fail_guest_notifiers: fail_guest_notifiers:
...@@ -181,7 +173,7 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s) ...@@ -181,7 +173,7 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s))); BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s)));
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
int i, rc; int i;
if (!s->dataplane_started || s->dataplane_stopping) { if (!s->dataplane_started || s->dataplane_stopping) {
return; return;
...@@ -205,10 +197,7 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s) ...@@ -205,10 +197,7 @@ void virtio_scsi_dataplane_stop(VirtIOSCSI *s)
aio_context_release(s->ctx); aio_context_release(s->ctx);
for (i = 0; i < vs->conf.num_queues + 2; i++) { for (i = 0; i < vs->conf.num_queues + 2; i++) {
rc = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false); virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
if (rc == -ENOSYS) {
k->set_host_notifier(qbus->parent, i, false);
}
} }
/* Clean up guest notifier (irq) */ /* Clean up guest notifier (irq) */
......
...@@ -1110,7 +1110,7 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev) ...@@ -1110,7 +1110,7 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
VirtioBusState *vbus = VIRTIO_BUS(qbus); VirtioBusState *vbus = VIRTIO_BUS(qbus);
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
int i, r, e; int i, r, e;
if (!k->set_host_notifier || !k->ioeventfd_started) { if (!k->ioeventfd_started) {
fprintf(stderr, "binding does not support host notifiers\n"); fprintf(stderr, "binding does not support host notifiers\n");
r = -ENOSYS; r = -ENOSYS;
goto fail; goto fail;
...@@ -1119,9 +1119,6 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev) ...@@ -1119,9 +1119,6 @@ int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
for (i = 0; i < hdev->nvqs; ++i) { for (i = 0; i < hdev->nvqs; ++i) {
r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i, r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i,
true); true);
if (r == -ENOSYS) {
r = k->set_host_notifier(qbus->parent, hdev->vq_index + i, true);
}
if (r < 0) { if (r < 0) {
fprintf(stderr, "vhost VQ %d notifier binding failed: %d\n", i, -r); fprintf(stderr, "vhost VQ %d notifier binding failed: %d\n", i, -r);
goto fail_vq; goto fail_vq;
...@@ -1133,9 +1130,6 @@ fail_vq: ...@@ -1133,9 +1130,6 @@ fail_vq:
while (--i >= 0) { while (--i >= 0) {
e = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i, e = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i,
false); false);
if (e == -ENOSYS) {
e = k->set_host_notifier(qbus->parent, hdev->vq_index + i, false);
}
if (e < 0) { if (e < 0) {
fprintf(stderr, "vhost VQ %d notifier cleanup error: %d\n", i, -r); fprintf(stderr, "vhost VQ %d notifier cleanup error: %d\n", i, -r);
fflush(stderr); fflush(stderr);
...@@ -1154,16 +1148,11 @@ fail: ...@@ -1154,16 +1148,11 @@ fail:
void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev) void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
{ {
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
VirtioBusState *vbus = VIRTIO_BUS(qbus);
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
int i, r; int i, r;
for (i = 0; i < hdev->nvqs; ++i) { for (i = 0; i < hdev->nvqs; ++i) {
r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i, r = virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), hdev->vq_index + i,
false); false);
if (r == -ENOSYS) {
r = k->set_host_notifier(qbus->parent, hdev->vq_index + i, false);
}
if (r < 0) { if (r < 0) {
fprintf(stderr, "vhost VQ %d notifier cleanup failed: %d\n", i, -r); fprintf(stderr, "vhost VQ %d notifier cleanup failed: %d\n", i, -r);
fflush(stderr); fflush(stderr);
......
...@@ -52,7 +52,6 @@ typedef struct VirtioBusClass { ...@@ -52,7 +52,6 @@ typedef struct VirtioBusClass {
bool (*has_extra_state)(DeviceState *d); bool (*has_extra_state)(DeviceState *d);
bool (*query_guest_notifiers)(DeviceState *d); bool (*query_guest_notifiers)(DeviceState *d);
int (*set_guest_notifiers)(DeviceState *d, int nvqs, bool assign); int (*set_guest_notifiers)(DeviceState *d, int nvqs, bool assign);
int (*set_host_notifier)(DeviceState *d, int n, bool assigned);
void (*vmstate_change)(DeviceState *d, bool running); void (*vmstate_change)(DeviceState *d, bool running);
/* /*
* transport independent init function. * transport independent init function.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册