diff options
author | Sjur Brændeland <sjur.brandeland@stericsson.com> | 2013-03-18 04:49:14 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-03-18 04:50:46 -0400 |
commit | aabd6a8fa5a933bdf968cd86e34122745c1960e8 (patch) | |
tree | 0ad6aacfb51136986e6d3c328e63015c8dee4f11 /drivers/char | |
parent | e84e7a56a3aa2963db506299e29a5f3f09377f9b (diff) |
Revert "virtio_console: Initialize guest_connected=true for rproc_serial"
This reverts commit 8078db789a92b10ff6e2d713231b5367e014c53b, and
adds a lengthy comment explaining the problem area.
The reverted patch caused opening of ports to fail for rproc_serial.
In probe guest_connected was set to true, but port_fops_open()
fails with -EMFILE if guest_connected already is true.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/virtio_console.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index e905d5f53051..e6ba6b7887e9 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1436,7 +1436,7 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
1436 | * rproc_serial does not want the console port, only | 1436 | * rproc_serial does not want the console port, only |
1437 | * the generic port implementation. | 1437 | * the generic port implementation. |
1438 | */ | 1438 | */ |
1439 | port->host_connected = port->guest_connected = true; | 1439 | port->host_connected = true; |
1440 | else if (!use_multiport(port->portdev)) { | 1440 | else if (!use_multiport(port->portdev)) { |
1441 | /* | 1441 | /* |
1442 | * If we're not using multiport support, | 1442 | * If we're not using multiport support, |
@@ -1752,13 +1752,23 @@ static void in_intr(struct virtqueue *vq) | |||
1752 | port->inbuf = get_inbuf(port); | 1752 | port->inbuf = get_inbuf(port); |
1753 | 1753 | ||
1754 | /* | 1754 | /* |
1755 | * Don't queue up data when port is closed. This condition | 1755 | * Normally the port should not accept data when the port is |
1756 | * closed. For generic serial ports, the host won't (shouldn't) | ||
1757 | * send data till the guest is connected. But this condition | ||
1756 | * can be reached when a console port is not yet connected (no | 1758 | * can be reached when a console port is not yet connected (no |
1757 | * tty is spawned) and the host sends out data to console | 1759 | * tty is spawned) and the other side sends out data over the |
1758 | * ports. For generic serial ports, the host won't | 1760 | * vring, or when a remote devices start sending data before |
1759 | * (shouldn't) send data till the guest is connected. | 1761 | * the ports are opened. |
1762 | * | ||
1763 | * A generic serial port will discard data if not connected, | ||
1764 | * while console ports and rproc-serial ports accepts data at | ||
1765 | * any time. rproc-serial is initiated with guest_connected to | ||
1766 | * false because port_fops_open expects this. Console ports are | ||
1767 | * hooked up with an HVC console and is initialized with | ||
1768 | * guest_connected to true. | ||
1760 | */ | 1769 | */ |
1761 | if (!port->guest_connected) | 1770 | |
1771 | if (!port->guest_connected && !is_rproc_serial(port->portdev->vdev)) | ||
1762 | discard_port_data(port); | 1772 | discard_port_data(port); |
1763 | 1773 | ||
1764 | spin_unlock_irqrestore(&port->inbuf_lock, flags); | 1774 | spin_unlock_irqrestore(&port->inbuf_lock, flags); |