Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

virtio: virtio_break_device() to mark all virtqueues broken.

Good for post-apocalyptic scenarios, like S/390 hotplug.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

+17
+15
drivers/virtio/virtio_ring.c
··· 865 865 } 866 866 EXPORT_SYMBOL_GPL(virtqueue_is_broken); 867 867 868 + /* 869 + * This should prevent the device from being used, allowing drivers to 870 + * recover. You may need to grab appropriate locks to flush. 871 + */ 872 + void virtio_break_device(struct virtio_device *dev) 873 + { 874 + struct virtqueue *_vq; 875 + 876 + list_for_each_entry(_vq, &dev->vqs, list) { 877 + struct vring_virtqueue *vq = to_vvq(_vq); 878 + vq->broken = true; 879 + } 880 + } 881 + EXPORT_SYMBOL_GPL(virtio_break_device); 882 + 868 883 MODULE_LICENSE("GPL");
+2
include/linux/virtio.h
··· 106 106 int register_virtio_device(struct virtio_device *dev); 107 107 void unregister_virtio_device(struct virtio_device *dev); 108 108 109 + void virtio_break_device(struct virtio_device *dev); 110 + 109 111 /** 110 112 * virtio_driver - operations for a virtio I/O driver 111 113 * @driver: underlying device driver (populate name and owner).