From: Maximilian Immanuel Brandtner <maxbr@linux.ibm.com>
To: filip.hejsek@gmail.com
Cc: amit@kernel.org, armbru@redhat.com, berrange@redhat.com,
eblake@redhat.com, eduardo@habkost.net, lvivier@redhat.com,
marcandre.lureau@redhat.com, marcel.apfelbaum@gmail.com,
mst@redhat.com, noh4hss@gmail.com, pbonzini@redhat.com,
philmd@mailo.com, qemu-devel@nongnu.org, wangyanan55@huawei.com,
zhao1.liu@intel.com, pasic@linux.ibm.com,
borntraeger@linux.ibm.com, jjherne@linux.ibm.com,
qemu-s390x@nongnu.org, mjrosato@linux.ibm.com,
brueckner@linux.ibm.com, farman@linux.ibm.com, cohuck@redhat.com,
maximilian.immanuel.brandtner@protonmail.com
Subject: [PATCH] s390x/sclpconsole: implement resizing for vt220 consoles
Date: Mon, 21 Sep 2026 14:16:41 +0200 [thread overview]
Message-ID: <20260921121641.1354712-1-maxbr@linux.ibm.com> (raw)
In-Reply-To: <20260609-console-resize-v7-0-0c550fdcec15@gmail.com>
Adds a tty code to indicate a resize frame. The body contains two big
endian 16-bit integers rows and columns.
Signed-off-by: Maximilian Immanuel Brandtner <maxbr@linux.ibm.com>
---
Requires the following pre-req:
[PATCH v7 00/12] virtio-console: notify about the terminal size
(https://lore.kernel.org/qemu-devel/20260609-console-resize-v7-0-0c550fdcec15@gmail.com/)
Testing:
- Tested on QEMU: commit 38879a667f with the following patches applied:
[PATCH v7 00/12] virtio-console: notify about the terminal size
- Tested on linux-next (commit c1f49dea2b8f) with the following patches
applied:
[PATCH 0/2] s390/sclp: Resize for sclp-vt220 console
---
hw/char/sclpconsole.c | 52 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)
diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c
index 179d12745c..acf1fea6b5 100644
--- a/hw/char/sclpconsole.c
+++ b/hw/char/sclpconsole.c
@@ -42,6 +42,7 @@ struct SCLPConsole {
uint32_t iov_data_len; /* length of byte stream in buffer */
uint32_t iov_sclp_rest; /* length of byte stream not read via SCLP */
bool notify; /* qemu_notify_event() req'd if true */
+ bool resize;
};
typedef struct SCLPConsole SCLPConsole;
@@ -81,6 +82,28 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
sclp_service_interrupt(0);
}
+static void chr_event(void *opaque, QEMUChrEvent event)
+{
+ SCLPConsole *scon = opaque;
+
+ assert(scon);
+
+ switch(event) {
+ case CHR_EVENT_RESIZE:
+ case CHR_EVENT_MUX_IN:
+ scon->resize = true;
+ scon->event.event_pending = true;
+ sclp_service_interrupt(0);
+ break;
+ case CHR_EVENT_BREAK:
+ case CHR_EVENT_OPENED:
+ case CHR_EVENT_MUX_OUT:
+ case CHR_EVENT_CLOSED:
+ /* ignore */
+ break;
+ }
+}
+
/* functions to be called by event facility */
static bool can_handle_event(uint8_t type)
@@ -105,6 +128,28 @@ static void get_console_data(SCLPEvent *event, uint8_t *buf, size_t *size,
int avail)
{
SCLPConsole *cons = SCLP_CONSOLE(event);
+ uint16_t be_rows, be_cols, rows, cols;
+
+ if (cons->resize) {
+ if (avail < 5) {
+ *size = 0;
+ return;
+ }
+
+ qemu_chr_fe_get_winsize(&cons->chr, &cols, &rows);
+ be_rows = cpu_to_be16(rows);
+ be_cols = cpu_to_be16(cols);
+
+ /* first byte hex 0x08 indicates a new terminal size follows */
+ *buf++ = 0x08;
+ memcpy(buf, &be_rows, sizeof(be_rows));
+ memcpy(buf + 2, &be_cols, sizeof(be_cols));
+ *size = 5;
+
+ cons->resize = false;
+
+ return;
+ }
/* first byte is hex 0 saying an ascii string follows */
*buf++ = '\0';
@@ -233,7 +278,12 @@ static int console_init(SCLPEvent *event)
}
console_available = true;
qemu_chr_fe_set_handlers(&scon->chr, chr_can_read,
- chr_read, NULL, NULL, scon, NULL, true);
+ chr_read, chr_event, NULL, scon, NULL, true);
+
+ /* set the initial terminal size */
+ scon->resize = true;
+ scon->event.event_pending = true;
+ sclp_service_interrupt(0);
return 0;
}
--
2.54.0
next prev parent reply other threads:[~2026-09-21 12:18 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 19:16 [PATCH v7 00/12] virtio-console: notify about the terminal size Filip Hejsek
2026-06-09 19:16 ` [PATCH v7 01/12] chardev: add cols, rows fields Filip Hejsek
2026-06-09 19:16 ` [PATCH v7 02/12] chardev: add CHR_EVENT_RESIZE Filip Hejsek
2026-06-10 13:25 ` Daniel P. Berrangé
2026-06-09 19:16 ` [PATCH v7 03/12] chardev: add qemu_chr_resize() Filip Hejsek
2026-06-09 19:16 ` [PATCH v7 04/12] char-mux: add support for the terminal size Filip Hejsek
2026-06-09 19:16 ` [PATCH v7 05/12] main-loop: change the handling of SIGWINCH Filip Hejsek
2026-06-09 19:16 ` [PATCH v7 06/12] char-stdio: add support for the terminal size Filip Hejsek
2026-06-09 19:16 ` [PATCH v7 07/12] char-win-stdio: add support for " Filip Hejsek
2026-06-09 19:16 ` [PATCH v7 08/12] ui/console-vc: forward text console size to vc chardev Filip Hejsek
2026-06-09 19:16 ` [PATCH v7 09/12] ui/gtk: forward gtk " Filip Hejsek
2026-06-09 19:16 ` [PATCH v7 10/12] qmp: add chardev-window-size-changed command Filip Hejsek
2026-06-09 19:16 ` [PATCH v7 11/12] virtio-serial-bus: add terminal resize messages Filip Hejsek
2026-06-09 21:48 ` marcandre.lureau
2026-06-10 13:31 ` Daniel P. Berrangé
2026-06-09 19:16 ` [PATCH v7 12/12] virtio-console: notify the guest about terminal resizes Filip Hejsek
2026-09-21 12:16 ` Maximilian Immanuel Brandtner [this message]
2026-09-21 12:19 ` [PATCH] s390x/sclpconsole: implement resizing for vt220 consoles Maximilian Immanuel Brandtner
2026-09-25 2:42 ` Matthew Rosato
2026-09-28 8:21 ` Maximilian Immanuel Brandtner
2026-09-28 9:08 ` [PATCH v2] " Maximilian Immanuel Brandtner
2026-09-28 13:32 ` Jason J. Herne
2026-09-28 19:28 ` Maximilian Immanuel Brandtner
2026-09-28 20:33 ` Matthew Rosato
2026-09-29 15:20 ` [PATCH v3 0/2] " Maximilian Immanuel Brandtner
2026-09-29 15:20 ` [PATCH v3 1/2] s390x/sclpconsole: fix indentation for console_reset Maximilian Immanuel Brandtner
2026-09-29 15:46 ` Matthew Rosato
2026-09-29 16:03 ` Eric Farman
2026-09-29 15:20 ` [PATCH v3 2/2] s390x/sclpconsole: implement resizing for vt220 consoles Maximilian Immanuel Brandtner
2026-09-28 9:30 ` [PATCH v7 00/12] virtio-console: notify about the terminal size Maximilian Immanuel Brandtner
2026-09-28 9:50 ` Michael S. Tsirkin
2026-09-28 21:21 ` Matthew Rosato
2026-09-29 8:33 ` Daniel P. Berrangé
2026-09-29 17:55 ` Filip Hejsek
2026-09-29 9:55 ` Michael S. Tsirkin
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=20260921121641.1354712-1-maxbr@linux.ibm.com \
--to=maxbr@linux.ibm.com \
--cc=amit@kernel.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=brueckner@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=farman@linux.ibm.com \
--cc=filip.hejsek@gmail.com \
--cc=jjherne@linux.ibm.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=maximilian.immanuel.brandtner@protonmail.com \
--cc=mjrosato@linux.ibm.com \
--cc=mst@redhat.com \
--cc=noh4hss@gmail.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=philmd@mailo.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=wangyanan55@huawei.com \
--cc=zhao1.liu@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.