diff options
author | Amit Shah <amit.shah@redhat.com> | 2009-12-21 10:33:25 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-02-23 22:52:52 -0500 |
commit | 17634ba25544d60af1968982929150efad755032 (patch) | |
tree | 9ac1acbc260e3421b282b9ebe79f8ae76bb5e14a /include/linux/virtio_console.h | |
parent | f997f00bf8c3ddf748d757105afa1a7dd5297208 (diff) |
virtio: console: Add a new MULTIPORT feature, support for generic ports
This commit adds a new feature, MULTIPORT. If the host supports this
feature as well, the config space has the number of ports defined for
that device. New ports are spawned according to this information.
The config space also has the maximum number of ports that can be
spawned for a particular device. This is useful in initializing the
appropriate number of virtqueues in advance, as ports might be
hot-plugged in later.
Using this feature, generic ports can be created which are not tied to
hvc consoles.
We also open up a private channel between the host and the guest via
which some "control" messages are exchanged for the ports, like whether
the port being spawned is a console port, resizing the console window,
etc.
Next commits will add support for hotplugging and presenting char
devices in /dev/ for bi-directional guest-host communication.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/virtio_console.h')
-rw-r--r-- | include/linux/virtio_console.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h index 9e0da40beae0..f4d183b5b493 100644 --- a/include/linux/virtio_console.h +++ b/include/linux/virtio_console.h | |||
@@ -6,18 +6,39 @@ | |||
6 | /* | 6 | /* |
7 | * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so | 7 | * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so |
8 | * anyone can use the definitions to implement compatible drivers/servers. | 8 | * anyone can use the definitions to implement compatible drivers/servers. |
9 | * | ||
10 | * Copyright (C) Red Hat, Inc., 2009, 2010 | ||
9 | */ | 11 | */ |
10 | 12 | ||
11 | /* Feature bits */ | 13 | /* Feature bits */ |
12 | #define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ | 14 | #define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ |
15 | #define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */ | ||
13 | 16 | ||
14 | struct virtio_console_config { | 17 | struct virtio_console_config { |
15 | /* colums of the screens */ | 18 | /* colums of the screens */ |
16 | __u16 cols; | 19 | __u16 cols; |
17 | /* rows of the screens */ | 20 | /* rows of the screens */ |
18 | __u16 rows; | 21 | __u16 rows; |
22 | /* max. number of ports this device can hold */ | ||
23 | __u32 max_nr_ports; | ||
24 | /* number of ports added so far */ | ||
25 | __u32 nr_ports; | ||
19 | } __attribute__((packed)); | 26 | } __attribute__((packed)); |
20 | 27 | ||
28 | /* | ||
29 | * A message that's passed between the Host and the Guest for a | ||
30 | * particular port. | ||
31 | */ | ||
32 | struct virtio_console_control { | ||
33 | __u32 id; /* Port number */ | ||
34 | __u16 event; /* The kind of control event (see below) */ | ||
35 | __u16 value; /* Extra information for the key */ | ||
36 | }; | ||
37 | |||
38 | /* Some events for control messages */ | ||
39 | #define VIRTIO_CONSOLE_PORT_READY 0 | ||
40 | #define VIRTIO_CONSOLE_CONSOLE_PORT 1 | ||
41 | #define VIRTIO_CONSOLE_RESIZE 2 | ||
21 | 42 | ||
22 | #ifdef __KERNEL__ | 43 | #ifdef __KERNEL__ |
23 | int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); | 44 | int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); |