Revision 1c819449 hw/block/dataplane/virtio-blk.c
b/hw/block/dataplane/virtio-blk.c | ||
---|---|---|
23 | 23 |
#include "hw/virtio/virtio-blk.h" |
24 | 24 |
#include "virtio-blk.h" |
25 | 25 |
#include "block/aio.h" |
26 |
#include "hw/virtio/virtio-bus.h" |
|
26 | 27 |
|
27 | 28 |
enum { |
28 | 29 |
SEG_MAX = 126, /* maximum number of I/O segments */ |
... | ... | |
455 | 456 |
|
456 | 457 |
void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) |
457 | 458 |
{ |
459 |
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); |
|
460 |
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); |
|
458 | 461 |
VirtQueue *vq; |
459 | 462 |
int i; |
460 | 463 |
|
... | ... | |
470 | 473 |
s->ctx = aio_context_new(); |
471 | 474 |
|
472 | 475 |
/* Set up guest notifier (irq) */ |
473 |
if (s->vdev->binding->set_guest_notifiers(s->vdev->binding_opaque, 1, |
|
474 |
true) != 0) { |
|
476 |
if (k->set_guest_notifiers(qbus->parent, 1, true) != 0) { |
|
475 | 477 |
fprintf(stderr, "virtio-blk failed to set guest notifier, " |
476 | 478 |
"ensure -enable-kvm is set\n"); |
477 | 479 |
exit(1); |
... | ... | |
479 | 481 |
s->guest_notifier = virtio_queue_get_guest_notifier(vq); |
480 | 482 |
|
481 | 483 |
/* Set up virtqueue notify */ |
482 |
if (s->vdev->binding->set_host_notifier(s->vdev->binding_opaque, |
|
483 |
0, true) != 0) { |
|
484 |
if (k->set_host_notifier(qbus->parent, 0, true) != 0) { |
|
484 | 485 |
fprintf(stderr, "virtio-blk failed to set host notifier\n"); |
485 | 486 |
exit(1); |
486 | 487 |
} |
... | ... | |
508 | 509 |
|
509 | 510 |
void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) |
510 | 511 |
{ |
512 |
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s->vdev))); |
|
513 |
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); |
|
511 | 514 |
if (!s->started || s->stopping) { |
512 | 515 |
return; |
513 | 516 |
} |
... | ... | |
527 | 530 |
ioq_cleanup(&s->ioqueue); |
528 | 531 |
|
529 | 532 |
aio_set_event_notifier(s->ctx, &s->host_notifier, NULL, NULL); |
530 |
s->vdev->binding->set_host_notifier(s->vdev->binding_opaque, 0, false);
|
|
533 |
k->set_host_notifier(qbus->parent, 0, false);
|
|
531 | 534 |
|
532 | 535 |
aio_context_unref(s->ctx); |
533 | 536 |
|
534 | 537 |
/* Clean up guest notifier (irq) */ |
535 |
s->vdev->binding->set_guest_notifiers(s->vdev->binding_opaque, 1, false);
|
|
538 |
k->set_guest_notifiers(qbus->parent, 1, false);
|
|
536 | 539 |
|
537 | 540 |
vring_teardown(&s->vring); |
538 | 541 |
s->started = false; |
Also available in: Unified diff