diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2022-01-14 15:54:01 -0500 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-03-04 08:33:22 -0500 |
commit | c46eccdaadabb7822080a04e633f81b2ad37f358 (patch) | |
tree | 4a8e2dd2f29bfc189a2d12ab32da30d41587909a | |
parent | 4fa59ede95195f267101a1b8916992cf3f245cdb (diff) |
virtio: document virtio_reset_device
Looks like most callers get driver/device removal wrong.
Document what's expected of callers.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r-- | drivers/virtio/virtio.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index d6396be0ea83..22f15f444f75 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -202,6 +202,22 @@ static int virtio_features_ok(struct virtio_device *dev) return 0; } +/** + * virtio_reset_device - quiesce device for removal + * @dev: the device to reset + * + * Prevents device from sending interrupts and accessing memory. + * + * Generally used for cleanup during driver / device removal. + * + * Once this has been invoked, caller must ensure that + * virtqueue_notify / virtqueue_kick are not in progress. + * + * Note: this guarantees that vq callbacks are not in progress, however caller + * is responsible for preventing access from other contexts, such as a system + * call/workqueue/bh. Invoking virtio_break_device then flushing any such + * contexts is one way to handle that. + * */ void virtio_reset_device(struct virtio_device *dev) { dev->config->reset(dev); |