aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-05-20 00:15:46 -0400
committerRusty Russell <rusty@rustcorp.com.au>2010-05-19 08:45:46 -0400
commitb99fa815d71023b2e330d63cd7f47d6247ffa321 (patch)
treeaf39e4a1c6f2364ff2c52933c27ac8c35328ac2a
parentbbd603efb4238cf78083c00f0a81adfa8994aa33 (diff)
virtio: Revert "virtio: disable multiport console support."
This reverts commit b7a413015d2986edf020fba765c906cc9cbcbfc9. Multiport support was disabled for 2.6.34 because we wanted to introduce a new ABI and since we didn't have any released kernel with the older ABI and were out of the merge window, it didn't make sense keeping the older ABI around. Now we revert the patch disabling multiport and rework the ABI in the following patches. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--drivers/char/virtio_console.c49
-rw-r--r--include/linux/virtio_console.h23
2 files changed, 31 insertions, 41 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 48ce834306b5..e53c52b904fb 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -33,35 +33,6 @@
33#include <linux/workqueue.h> 33#include <linux/workqueue.h>
34#include "hvc_console.h" 34#include "hvc_console.h"
35 35
36/* Moved here from .h file in order to disable MULTIPORT. */
37#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
38
39struct virtio_console_multiport_conf {
40 struct virtio_console_config config;
41 /* max. number of ports this device can hold */
42 __u32 max_nr_ports;
43 /* number of ports added so far */
44 __u32 nr_ports;
45} __attribute__((packed));
46
47/*
48 * A message that's passed between the Host and the Guest for a
49 * particular port.
50 */
51struct virtio_console_control {
52 __u32 id; /* Port number */
53 __u16 event; /* The kind of control event (see below) */
54 __u16 value; /* Extra information for the key */
55};
56
57/* Some events for control messages */
58#define VIRTIO_CONSOLE_PORT_READY 0
59#define VIRTIO_CONSOLE_CONSOLE_PORT 1
60#define VIRTIO_CONSOLE_RESIZE 2
61#define VIRTIO_CONSOLE_PORT_OPEN 3
62#define VIRTIO_CONSOLE_PORT_NAME 4
63#define VIRTIO_CONSOLE_PORT_REMOVE 5
64
65/* 36/*
66 * This is a global struct for storing common data for all the devices 37 * This is a global struct for storing common data for all the devices
67 * this driver handles. 38 * this driver handles.
@@ -150,7 +121,7 @@ struct ports_device {
150 spinlock_t cvq_lock; 121 spinlock_t cvq_lock;
151 122
152 /* The current config space is stored here */ 123 /* The current config space is stored here */
153 struct virtio_console_multiport_conf config; 124 struct virtio_console_config config;
154 125
155 /* The virtio device we're associated with */ 126 /* The virtio device we're associated with */
156 struct virtio_device *vdev; 127 struct virtio_device *vdev;
@@ -1243,7 +1214,7 @@ fail:
1243 */ 1214 */
1244static void config_work_handler(struct work_struct *work) 1215static void config_work_handler(struct work_struct *work)
1245{ 1216{
1246 struct virtio_console_multiport_conf virtconconf; 1217 struct virtio_console_config virtconconf;
1247 struct ports_device *portdev; 1218 struct ports_device *portdev;
1248 struct virtio_device *vdev; 1219 struct virtio_device *vdev;
1249 int err; 1220 int err;
@@ -1252,8 +1223,7 @@ static void config_work_handler(struct work_struct *work)
1252 1223
1253 vdev = portdev->vdev; 1224 vdev = portdev->vdev;
1254 vdev->config->get(vdev, 1225 vdev->config->get(vdev,
1255 offsetof(struct virtio_console_multiport_conf, 1226 offsetof(struct virtio_console_config, nr_ports),
1256 nr_ports),
1257 &virtconconf.nr_ports, 1227 &virtconconf.nr_ports,
1258 sizeof(virtconconf.nr_ports)); 1228 sizeof(virtconconf.nr_ports));
1259 1229
@@ -1445,19 +1415,16 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
1445 multiport = false; 1415 multiport = false;
1446 portdev->config.nr_ports = 1; 1416 portdev->config.nr_ports = 1;
1447 portdev->config.max_nr_ports = 1; 1417 portdev->config.max_nr_ports = 1;
1448#if 0 /* Multiport is not quite ready yet --RR */
1449 if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) { 1418 if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) {
1450 multiport = true; 1419 multiport = true;
1451 vdev->features[0] |= 1 << VIRTIO_CONSOLE_F_MULTIPORT; 1420 vdev->features[0] |= 1 << VIRTIO_CONSOLE_F_MULTIPORT;
1452 1421
1453 vdev->config->get(vdev, 1422 vdev->config->get(vdev, offsetof(struct virtio_console_config,
1454 offsetof(struct virtio_console_multiport_conf, 1423 nr_ports),
1455 nr_ports),
1456 &portdev->config.nr_ports, 1424 &portdev->config.nr_ports,
1457 sizeof(portdev->config.nr_ports)); 1425 sizeof(portdev->config.nr_ports));
1458 vdev->config->get(vdev, 1426 vdev->config->get(vdev, offsetof(struct virtio_console_config,
1459 offsetof(struct virtio_console_multiport_conf, 1427 max_nr_ports),
1460 max_nr_ports),
1461 &portdev->config.max_nr_ports, 1428 &portdev->config.max_nr_ports,
1462 sizeof(portdev->config.max_nr_ports)); 1429 sizeof(portdev->config.max_nr_ports));
1463 if (portdev->config.nr_ports > portdev->config.max_nr_ports) { 1430 if (portdev->config.nr_ports > portdev->config.max_nr_ports) {
@@ -1473,7 +1440,6 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
1473 1440
1474 /* Let the Host know we support multiple ports.*/ 1441 /* Let the Host know we support multiple ports.*/
1475 vdev->config->finalize_features(vdev); 1442 vdev->config->finalize_features(vdev);
1476#endif
1477 1443
1478 err = init_vqs(portdev); 1444 err = init_vqs(portdev);
1479 if (err < 0) { 1445 if (err < 0) {
@@ -1556,6 +1522,7 @@ static struct virtio_device_id id_table[] = {
1556 1522
1557static unsigned int features[] = { 1523static unsigned int features[] = {
1558 VIRTIO_CONSOLE_F_SIZE, 1524 VIRTIO_CONSOLE_F_SIZE,
1525 VIRTIO_CONSOLE_F_MULTIPORT,
1559}; 1526};
1560 1527
1561static struct virtio_driver virtio_console = { 1528static struct virtio_driver virtio_console = {
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index 92228a8fbcbc..ae4f039515b4 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -12,14 +12,37 @@
12 12
13/* Feature bits */ 13/* Feature bits */
14#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? */
15 16
16struct virtio_console_config { 17struct virtio_console_config {
17 /* colums of the screens */ 18 /* colums of the screens */
18 __u16 cols; 19 __u16 cols;
19 /* rows of the screens */ 20 /* rows of the screens */
20 __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;
21} __attribute__((packed)); 26} __attribute__((packed));
22 27
28/*
29 * A message that's passed between the Host and the Guest for a
30 * particular port.
31 */
32struct 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
42#define VIRTIO_CONSOLE_PORT_OPEN 3
43#define VIRTIO_CONSOLE_PORT_NAME 4
44#define VIRTIO_CONSOLE_PORT_REMOVE 5
45
23#ifdef __KERNEL__ 46#ifdef __KERNEL__
24int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); 47int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
25#endif /* __KERNEL__ */ 48#endif /* __KERNEL__ */