diff mbox

virtio: add VIRTIO_CONFIG_S_NEEDS_RESET device status bit

Message ID 1459266225-9088-1-git-send-email-stefanha@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Hajnoczi March 29, 2016, 3:43 p.m. UTC
The VIRTIO 1.0 specification added the DEVICE_NEEDS_RESET device status
bit in "VIRTIO-98: Add DEVICE_NEEDS_RESET".  This patch defines the
device status bit in the uapi header file so that both the kernel and
userspace applications can use it.

The bit is currently unused by the virtio guest drivers and vhost.
According to the spec "a good implementation will try to recover by
issuing a reset".  This is not attempted here because it requires
auditing the virtio drivers to ensure there are no resource leaks or
crashes if the device needs to be reset mid-operation.

See "2.1 Device Status Field" in the VIRTIO 1.0 specification for
details.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 include/uapi/linux/virtio_config.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Cornelia Huck March 29, 2016, 4:45 p.m. UTC | #1
On Tue, 29 Mar 2016 16:43:45 +0100
Stefan Hajnoczi <stefanha@redhat.com> wrote:

> The VIRTIO 1.0 specification added the DEVICE_NEEDS_RESET device status
> bit in "VIRTIO-98: Add DEVICE_NEEDS_RESET".  This patch defines the
> device status bit in the uapi header file so that both the kernel and
> userspace applications can use it.
> 
> The bit is currently unused by the virtio guest drivers and vhost.
> According to the spec "a good implementation will try to recover by
> issuing a reset".  This is not attempted here because it requires
> auditing the virtio drivers to ensure there are no resource leaks or
> crashes if the device needs to be reset mid-operation.
> 
> See "2.1 Device Status Field" in the VIRTIO 1.0 specification for
> details.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  include/uapi/linux/virtio_config.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
> index c18264d..4cb65bb 100644
> --- a/include/uapi/linux/virtio_config.h
> +++ b/include/uapi/linux/virtio_config.h
> @@ -40,6 +40,8 @@
>  #define VIRTIO_CONFIG_S_DRIVER_OK	4
>  /* Driver has finished configuring features */
>  #define VIRTIO_CONFIG_S_FEATURES_OK	8
> +/* Device entered invalid state, driver must reset it */
> +#define VIRTIO_CONFIG_S_NEEDS_RESET	0x40
>  /* We've given up on this device. */
>  #define VIRTIO_CONFIG_S_FAILED		0x80
> 

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index c18264d..4cb65bb 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -40,6 +40,8 @@ 
 #define VIRTIO_CONFIG_S_DRIVER_OK	4
 /* Driver has finished configuring features */
 #define VIRTIO_CONFIG_S_FEATURES_OK	8
+/* Device entered invalid state, driver must reset it */
+#define VIRTIO_CONFIG_S_NEEDS_RESET	0x40
 /* We've given up on this device. */
 #define VIRTIO_CONFIG_S_FAILED		0x80