Commit cb06e367 authored by Amit Shah's avatar Amit Shah Committed by Rusty Russell

virtio: console: ensure console size is updated on hvc open

When multiple console support is added, ensure each port's size gets
updated when a new one is opened via hvc.
Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 1c85bf35
...@@ -251,27 +251,28 @@ static int get_chars(u32 vtermno, char *buf, int count) ...@@ -251,27 +251,28 @@ static int get_chars(u32 vtermno, char *buf, int count)
return count; return count;
} }
/* static void resize_console(struct port *port)
* virtio console configuration. This supports:
* - console resize
*/
static void virtcons_apply_config(struct virtio_device *dev)
{ {
struct virtio_device *vdev;
struct winsize ws; struct winsize ws;
if (virtio_has_feature(dev, VIRTIO_CONSOLE_F_SIZE)) { vdev = port->portdev->vdev;
dev->config->get(dev, if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)) {
offsetof(struct virtio_console_config, cols), vdev->config->get(vdev,
&ws.ws_col, sizeof(u16)); offsetof(struct virtio_console_config, cols),
dev->config->get(dev, &ws.ws_col, sizeof(u16));
offsetof(struct virtio_console_config, rows), vdev->config->get(vdev,
&ws.ws_row, sizeof(u16)); offsetof(struct virtio_console_config, rows),
/* This is the pre-multiport style: we use control messages &ws.ws_row, sizeof(u16));
* these days which specify the port. So this means port 0. */ hvc_resize(port->hvc, ws);
hvc_resize(find_port_by_vtermno(0)->hvc, ws);
} }
} }
static void virtcons_apply_config(struct virtio_device *vdev)
{
resize_console(find_port_by_vtermno(0));
}
/* We set the configuration at this point, since we now have a tty */ /* We set the configuration at this point, since we now have a tty */
static int notifier_add_vio(struct hvc_struct *hp, int data) static int notifier_add_vio(struct hvc_struct *hp, int data)
{ {
...@@ -282,7 +283,7 @@ static int notifier_add_vio(struct hvc_struct *hp, int data) ...@@ -282,7 +283,7 @@ static int notifier_add_vio(struct hvc_struct *hp, int data)
return -EINVAL; return -EINVAL;
hp->irq_requested = 1; hp->irq_requested = 1;
virtcons_apply_config(port->portdev->vdev); resize_console(port);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment