| Submitter | Kusanagi Kouichi |
|---|---|
| Date | April 16, 2010, 11:42 a.m. |
| Message ID | <20100416114248.A001562C03A@msa106.auone-net.jp> |
| Download | mbox | patch |
| Permalink | /patch/50324/ |
| State | New |
| Headers | show |
Comments
On (Fri) Apr 16 2010 [20:42:47], Kusanagi Kouichi wrote: > > Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> > --- > hw/virtio-console.c | 3 +++ > hw/virtio-serial-bus.c | 8 ++++++++ > hw/virtio-serial.h | 9 +++++++-- > 3 files changed, 18 insertions(+), 2 deletions(-) Hello, The patches look good. How did you test them? Just one comment here: > diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c > index 17c1ec1..66891ee 100644 > --- a/hw/virtio-serial-bus.c > +++ b/hw/virtio-serial-bus.c > @@ -163,6 +163,13 @@ int virtio_serial_close(VirtIOSerialPort *port) > return 0; > } > > +void virtio_serial_resize(VirtIOSerialPort *port, int rows, int cols) Would virtio_serial_resize_console() be better, since this is only to be used for console ports? Amit
On 2010-04-16 18:32:19 +0530, Amit Shah wrote: > On (Fri) Apr 16 2010 [20:42:47], Kusanagi Kouichi wrote: > > > > Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> > > --- > > hw/virtio-console.c | 3 +++ > > hw/virtio-serial-bus.c | 8 ++++++++ > > hw/virtio-serial.h | 9 +++++++-- > > 3 files changed, 18 insertions(+), 2 deletions(-) > > Hello, > > The patches look good. How did you test them? > > Just one comment here: > > > diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c > > index 17c1ec1..66891ee 100644 > > --- a/hw/virtio-serial-bus.c > > +++ b/hw/virtio-serial-bus.c > > @@ -163,6 +163,13 @@ int virtio_serial_close(VirtIOSerialPort *port) > > return 0; > > } > > > > +void virtio_serial_resize(VirtIOSerialPort *port, int rows, int cols) > > Would virtio_serial_resize_console() be better, since this is only to be > used for console ports? > It is better, I think. I will update the patch. Thanks. > Amit
On (Thu) Apr 29 2010 [16:12:38], Kusanagi Kouichi wrote: > On 2010-04-16 18:32:19 +0530, Amit Shah wrote: > > On (Fri) Apr 16 2010 [20:42:47], Kusanagi Kouichi wrote: > > > > > > Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> > > > --- > > > hw/virtio-console.c | 3 +++ > > > hw/virtio-serial-bus.c | 8 ++++++++ > > > hw/virtio-serial.h | 9 +++++++-- > > > 3 files changed, 18 insertions(+), 2 deletions(-) > > > > Hello, > > > > The patches look good. How did you test them? > > > > Just one comment here: > > > > > diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c > > > index 17c1ec1..66891ee 100644 > > > --- a/hw/virtio-serial-bus.c > > > +++ b/hw/virtio-serial-bus.c > > > @@ -163,6 +163,13 @@ int virtio_serial_close(VirtIOSerialPort *port) > > > return 0; > > > } > > > > > > +void virtio_serial_resize(VirtIOSerialPort *port, int rows, int cols) > > > > Would virtio_serial_resize_console() be better, since this is only to be > > used for console ports? > > > > It is better, I think. I will update the patch. Thanks. Thanks. Please include me in the CC when you send it. Also please mention how you test this feature. Amit
On 2010-04-29 16:17:18 +0530, Amit Shah wrote: > On (Thu) Apr 29 2010 [16:12:38], Kusanagi Kouichi wrote: > > On 2010-04-16 18:32:19 +0530, Amit Shah wrote: > > > On (Fri) Apr 16 2010 [20:42:47], Kusanagi Kouichi wrote: > > > > > > > > Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> > > > > --- > > > > hw/virtio-console.c | 3 +++ > > > > hw/virtio-serial-bus.c | 8 ++++++++ > > > > hw/virtio-serial.h | 9 +++++++-- > > > > 3 files changed, 18 insertions(+), 2 deletions(-) > > > > > > Hello, > > > > > > The patches look good. How did you test them? > > > > > > Just one comment here: > > > > > > > diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c > > > > index 17c1ec1..66891ee 100644 > > > > --- a/hw/virtio-serial-bus.c > > > > +++ b/hw/virtio-serial-bus.c > > > > @@ -163,6 +163,13 @@ int virtio_serial_close(VirtIOSerialPort *port) > > > > return 0; > > > > } > > > > > > > > +void virtio_serial_resize(VirtIOSerialPort *port, int rows, int cols) > > > > > > Would virtio_serial_resize_console() be better, since this is only to be > > > used for console ports? > > > > > > > It is better, I think. I will update the patch. Thanks. > > Thanks. > > Please include me in the CC when you send it. Also please mention how > you test this feature. > > Amit I put printf()s into involved functions. Then ran qemu on a terminal emulator, and resized it. That's how I did. Is this what you need?
On (Thu) Apr 29 2010 [21:36:30], Kusanagi Kouichi wrote: > > Please include me in the CC when you send it. Also please mention how > > you test this feature. > > > > Amit > > I put printf()s into involved functions. Then ran qemu on a terminal > emulator, and resized it. > That's how I did. Is this what you need? Yes, I'm also wondering if it works ok: as in the guest kernel sees the updates and resizes the screen accordingly. Amit
Patch
diff --git a/hw/virtio-console.c b/hw/virtio-console.c index bd44ec6..92dd03e 100644 --- a/hw/virtio-console.c +++ b/hw/virtio-console.c @@ -58,6 +58,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(&vcon->port, vcon->chr->rows, vcon->chr->cols); + break; } } diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 17c1ec1..66891ee 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -163,6 +163,13 @@ int virtio_serial_close(VirtIOSerialPort *port) return 0; } +void virtio_serial_resize(VirtIOSerialPort *port, int rows, int cols) +{ + port->vser->config.rows = rows; + port->vser->config.cols = cols; + send_control_event(port, VIRTIO_CONSOLE_RESIZE, 0); +} + /* Individual ports/apps call this function to write to the guest. */ ssize_t virtio_serial_write(VirtIOSerialPort *port, const uint8_t *buf, size_t size) @@ -336,6 +343,7 @@ static void handle_input(VirtIODevice *vdev, VirtQueue *vq) static uint32_t get_features(VirtIODevice *vdev, uint32_t features) { VirtIOSerial *vser = DO_UPCAST(VirtIOSerial, vdev, vdev); + features |= (1 << VIRTIO_CONSOLE_F_SIZE); if (vser->bus->max_nr_ports > 1) { features |= (1 << VIRTIO_CONSOLE_F_MULTIPORT); } diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h index f297b00..8af83b8 100644 --- a/hw/virtio-serial.h +++ b/hw/virtio-serial.h @@ -25,12 +25,12 @@ #define VIRTIO_ID_CONSOLE 3 /* Features supported */ +#define VIRTIO_CONSOLE_F_SIZE 0 #define VIRTIO_CONSOLE_F_MULTIPORT 1 struct virtio_console_config { /* - * These two fields are used by VIRTIO_CONSOLE_F_SIZE which - * isn't implemented here yet + * These two fields are used by VIRTIO_CONSOLE_F_SIZE */ uint16_t cols; uint16_t rows; @@ -160,6 +160,11 @@ int virtio_serial_open(VirtIOSerialPort *port); int virtio_serial_close(VirtIOSerialPort *port); /* + * Notify resize to the guest + */ +void virtio_serial_resize(VirtIOSerialPort *port, int rows, int cols); + +/* * Send data to Guest */ ssize_t virtio_serial_write(VirtIOSerialPort *port, const uint8_t *buf,
Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> --- hw/virtio-console.c | 3 +++ hw/virtio-serial-bus.c | 8 ++++++++ hw/virtio-serial.h | 9 +++++++-- 3 files changed, 18 insertions(+), 2 deletions(-)