From: Amit Shah <amit.shah@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Kusanagi Kouichi <slash@ac.auone-net.jp>,
qemu list <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [PATCH 2/2] virtio-console: Notify resize to the guest.
Date: Mon, 3 May 2010 13:33:45 +0530 [thread overview]
Message-ID: <20100503080345.GA4536@amit-x200.redhat.com> (raw)
In-Reply-To: <1272868593-3795-2-git-send-email-amit.shah@redhat.com>
On (Mon) May 03 2010 [12:06:33], Amit Shah wrote:
> From: Kusanagi Kouichi <slash@ac.auone-net.jp>
>
> I tested this patch as follows: I put printf()s into involved
> functions. Then ran qemu on a terminal emulator, and resized it. The
> guest kernel gets initial size, and follows host resize. Both singleport
> and multiport work.
>
> Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
> hw/virtio-console.c | 3 +++
> hw/virtio-serial-bus.c | 15 +++++++++++++++
> hw/virtio-serial.h | 11 +++++++++--
> 3 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/hw/virtio-console.c b/hw/virtio-console.c
> index caea11f..58246d1 100644
> --- a/hw/virtio-console.c
> +++ b/hw/virtio-console.c
> @@ -55,6 +55,9 @@ static void chr_event(void *opaque, int event)
> case CHR_EVENT_CLOSED:
> virtio_serial_close(&vcon->port);
> break;
> + case CHR_EVENT_RESIZE:
> + virtio_serial_resize_console(&vcon->port, vcon->chr->rows, vcon->chr->cols);
> + break;
> }
> }
>
> diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
> index 97694d5..8766f1d 100644
> --- a/hw/virtio-serial-bus.c
> +++ b/hw/virtio-serial-bus.c
> @@ -205,6 +205,20 @@ int virtio_serial_close(VirtIOSerialPort *port)
> return 0;
> }
>
> +void virtio_serial_resize_console(VirtIOSerialPort *port, int rows, int cols)
> +{
> + VirtIOSerial *vser = port->vser;
> +
> + vser->config.rows = rows;
> + vser->config.cols = cols;
> +
> + if (use_multiport(vser)) {
> + send_control_event(port, VIRTIO_CONSOLE_RESIZE, 0);
Thinking about this, this isn't the right way of sending console resize
updates: we write in the config space and send an update event via
control messages. The control message could be processed after another
config-space update for another port, leading to races.
I think it's better to send the row and column sizes along with the
resize message. We do something similar for sending the 'name'; we could
also imbed a struct within the VIRTIO_CONSOLE_RESIZE message similarly.
This would need some guest kernel changes too.
Kusanagi, can you do it? For guest kernel changes, please work off
linux-next.git for your changes.
If not, I'll get to this in a couple of weeks' time.
Thanks,
Amit
prev parent reply other threads:[~2010-05-03 8:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-03 6:36 [Qemu-devel] [PATCH 1/2] char: Handle resize Amit Shah
2010-05-03 6:36 ` [Qemu-devel] [PATCH 2/2] virtio-console: Notify resize to the guest Amit Shah
2010-05-03 8:03 ` Amit Shah [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100503080345.GA4536@amit-x200.redhat.com \
--to=amit.shah@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
--cc=slash@ac.auone-net.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).