]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
virtio: console: Let host know of port or device add failures
authorAmit Shah <amit.shah@redhat.com>
Thu, 20 May 2010 04:15:47 +0000 (22:15 -0600)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 19 May 2010 12:45:47 +0000 (22:15 +0930)
The host may want to know and let management apps notify of port or
device add failures. Send a control message saying the device or port is
not ready in this case.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/char/virtio_console.c
include/linux/virtio_console.h

index 8c24b86aadc9f4ca4dc660b8409e04dc09547885..f63bf77a48252de15bcc57c05485559b54f71efb 100644 (file)
@@ -1210,6 +1210,8 @@ free_cdev:
 free_port:
        kfree(port);
 fail:
+       /* The host might want to notify management sw about port add failure */
+       send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 0);
        return err;
 }
 
@@ -1488,6 +1490,9 @@ free_chrdev:
 free:
        kfree(portdev);
 fail:
+       /* The host might want to notify mgmt sw about device add failure */
+       __send_control_msg(portdev, VIRTIO_CONSOLE_BAD_ID,
+                          VIRTIO_CONSOLE_DEVICE_READY, 0);
        return err;
 }
 
index ae4f039515b441f3407d88da1e2172a78bab2e5b..015736113c2577bcb3b19c177afa26bedd1fb4db 100644 (file)
@@ -14,6 +14,8 @@
 #define VIRTIO_CONSOLE_F_SIZE  0       /* Does host provide console size? */
 #define VIRTIO_CONSOLE_F_MULTIPORT 1   /* Does host provide multiple ports? */
 
+#define VIRTIO_CONSOLE_BAD_ID          (~(u32)0)
+
 struct virtio_console_config {
        /* colums of the screens */
        __u16 cols;
@@ -42,6 +44,7 @@ struct virtio_console_control {
 #define VIRTIO_CONSOLE_PORT_OPEN       3
 #define VIRTIO_CONSOLE_PORT_NAME       4
 #define VIRTIO_CONSOLE_PORT_REMOVE     5
+#define VIRTIO_CONSOLE_DEVICE_READY    6
 
 #ifdef __KERNEL__
 int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));