Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eaeff960 authored by Amit Shah's avatar Amit Shah Committed by Rusty Russell
Browse files

virtio: console: Let host know of port or device add failures



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: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 3425e706
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -1210,6 +1210,8 @@ static int add_port(struct ports_device *portdev, u32 id)
free_port:
free_port:
	kfree(port);
	kfree(port);
fail:
fail:
	/* The host might want to notify management sw about port add failure */
	send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 0);
	return err;
	return err;
}
}


@@ -1488,6 +1490,9 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
free:
free:
	kfree(portdev);
	kfree(portdev);
fail:
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;
	return err;
}
}


+3 −0
Original line number Original line Diff line number Diff line
@@ -14,6 +14,8 @@
#define VIRTIO_CONSOLE_F_SIZE	0	/* Does host provide console size? */
#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_F_MULTIPORT 1	/* Does host provide multiple ports? */


#define VIRTIO_CONSOLE_BAD_ID		(~(u32)0)

struct virtio_console_config {
struct virtio_console_config {
	/* colums of the screens */
	/* colums of the screens */
	__u16 cols;
	__u16 cols;
@@ -42,6 +44,7 @@ struct virtio_console_control {
#define VIRTIO_CONSOLE_PORT_OPEN	3
#define VIRTIO_CONSOLE_PORT_OPEN	3
#define VIRTIO_CONSOLE_PORT_NAME	4
#define VIRTIO_CONSOLE_PORT_NAME	4
#define VIRTIO_CONSOLE_PORT_REMOVE	5
#define VIRTIO_CONSOLE_PORT_REMOVE	5
#define VIRTIO_CONSOLE_DEVICE_READY	6


#ifdef __KERNEL__
#ifdef __KERNEL__
int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));