提交 e2dcdfe9 编写于 作者: R Rusty Russell

virtio: virtio_break_device() to mark all virtqueues broken.

Good for post-apocalyptic scenarios, like S/390 hotplug.
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 ec6931b2
...@@ -865,4 +865,19 @@ bool virtqueue_is_broken(struct virtqueue *_vq) ...@@ -865,4 +865,19 @@ bool virtqueue_is_broken(struct virtqueue *_vq)
} }
EXPORT_SYMBOL_GPL(virtqueue_is_broken); EXPORT_SYMBOL_GPL(virtqueue_is_broken);
/*
* This should prevent the device from being used, allowing drivers to
* recover. You may need to grab appropriate locks to flush.
*/
void virtio_break_device(struct virtio_device *dev)
{
struct virtqueue *_vq;
list_for_each_entry(_vq, &dev->vqs, list) {
struct vring_virtqueue *vq = to_vvq(_vq);
vq->broken = true;
}
}
EXPORT_SYMBOL_GPL(virtio_break_device);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -106,6 +106,8 @@ static inline struct virtio_device *dev_to_virtio(struct device *_dev) ...@@ -106,6 +106,8 @@ static inline struct virtio_device *dev_to_virtio(struct device *_dev)
int register_virtio_device(struct virtio_device *dev); int register_virtio_device(struct virtio_device *dev);
void unregister_virtio_device(struct virtio_device *dev); void unregister_virtio_device(struct virtio_device *dev);
void virtio_break_device(struct virtio_device *dev);
/** /**
* virtio_driver - operations for a virtio I/O driver * virtio_driver - operations for a virtio I/O driver
* @driver: underlying device driver (populate name and owner). * @driver: underlying device driver (populate name and owner).
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册