Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69B4ECA9ED1 for ; Mon, 12 Oct 2026 14:07:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xGGef-0000GB-CS; Mon, 12 Oct 2026 10:05:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xGGeT-0008Vt-8c for qemu-devel@nongnu.org; Mon, 12 Oct 2026 10:05:17 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xGGeQ-00066u-Rh for qemu-devel@nongnu.org; Mon, 12 Oct 2026 10:05:16 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-48bbb06e746so1125227f8f.3 for ; Mon, 12 Oct 2026 07:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791813913; x=1792418713; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3qc+m3TuYOGQD0I78puHWALWD7CmUetuHlHfjJWUiIg=; b=IzJolAdizXpaVfGdY2hqDjtnnSvaY9PQvf5Jf8eiepnOkd+zhOcVgo9oKQaN3gsvW5 kH3JkfzHQr8ozgaRa8dvgZkGlDKSDe6tXhL1Mcr69aW5UGk2kwxY87tnR5Z3/1Mp/BRM tneGjB3lyo9TJWHKFOslYQWBsHBVck4uBlWWrwrLw7NFqv2IKCnAUF3uNxUULmYZqF8d 0JAykt08Yr8zLO+gG4EdbvNqZ8jAw8f/RpGsWUEEMYYRrw2WT6UiFwNvplJ57tQ79K+G 6mzvyyjw/CSGmH4HlCjHHi9pnmXiDEG9XU2tNYn+9raFNuOdAAlBqZ6Zs65DmWq3yitL OC4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791813913; x=1792418713; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3qc+m3TuYOGQD0I78puHWALWD7CmUetuHlHfjJWUiIg=; b=JE3LogIv27kavqK7lwxMYITKQUp18sHPU89e8PmHED/dH3H4Skx742FNA8OPG0TMuD SupRIB3oBI1QvQGilR2He6DjqukZ3GAmc2Zc4oPMCyh+Hpxgfn1BauOHMcAbLSBN/HHd DdB+/RLRCKwAIBX/o5xw93VD+QXeNyRzB6milJFPTNdSoph4TxFSl9IJQ4C9qpKwzNU6 OgVHRA6eXW0zKkbFjPjtLwOoD9pqtVHbyilXNZNMt1jzD2ksqPvnWMQRELeB8sNMrj+e N5GM9fkk1/WJFtJFgE6wXor9jcD5C7ikjNkvDaEc4fQxVElQT7Eh6rCwNEboUIJEQn44 4pkA== X-Gm-Message-State: AFq9FYKwkXZMFkqvxHUeG9RpR/nUwg5/1EAjxnuEkMrzAKJpzMR9ivvu WXq8ArD/tGw1FBq9tYM6BahXpkw37kc/oC+kjnJ5wl7fXX84CY+TomeM X-Gm-Gg: AYBFou2KwsNbLrAUVEYUvyB3NZz3m5OEcDOARt4xvv8GdIHhvBdzuYiw1h5Cg6ew//Y Ej2q1hCoLmDMPcPchxZs9d0bnEF2Va+19zdJL27H7UFprh9IKLpniicqhJjPTL4JTwdVvK4h3JM PVyq2JQqHxXDPTT71oUkqfv0Eu7GF35e4JJhD5v/xp52c7t8J97+vTOlD/WFAo3/kEB5/doSFGH Kqn73YUhfAdpQhcb+G/P8NPCOqvuigdwxFJ2qWz+qdNsO4YX1sHgGFPHh2hu3l8+N6Y3I1dYv6b TycxKl72vSAMj28Wa6PumX5g46PkJsvojeifj7daR2dAyhu2iW111lAo5EmgerqM9pgmHAu3tZY 9uR2iJTzqyXnW+U47qVoxZmxqBUs3Hwgmejxfro6uabfwd25QgVDiLufEQ7pLKwICbVN5lLj0sE CJfh9wKQlFm9QzfjQ/DHRT/UObwLCZUwJkDsJ8LEJUFcRWyg5Cfq/EhgKKTHi1AON/Stjuem/Ii QFWq3XaacCJzHtAUU8JjFEu/f+bESw2JclN X-Received: by 2002:a05:6000:41c8:b0:488:8132:141b with SMTP id ffacd0b85a97d-48dba9bdc8bmr17747359f8f.20.1791813912952; Mon, 12 Oct 2026 07:05:12 -0700 (PDT) Received: from localhost (ip-78-44-39-34.bb.vodafone.cz. [78.44.39.34]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48db9abd574sm20301606f8f.34.2026.10.12.07.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2026 07:05:12 -0700 (PDT) From: Filip Hejsek Date: Mon, 12 Oct 2026 16:05:01 +0200 Subject: [PATCH v10 02/12] chardev: add CHR_EVENT_RESIZE MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20261012-console-resize-v10-2-2c3b10d829b3@gmail.com> References: <20261012-console-resize-v10-0-2c3b10d829b3@gmail.com> In-Reply-To: <20261012-console-resize-v10-0-2c3b10d829b3@gmail.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , "Michael S. Tsirkin" , Laurent Vivier , Amit Shah , Markus Armbruster , Eric Blake , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Zhao Liu , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Maximilian Immanuel Brandtner , Dominique Martinet , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Szymon Lukasz X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1791813907; l=8913; i=filip.hejsek@gmail.com; s=20250912; h=from:subject:message-id; bh=GU1RCEPjAeOZRrN0OqfylK7FcG0ExiEXC1iG5jiUuaE=; b=a4mfaqD3lVx/KT34Esj6gy3AGmgVUOriE9tv0da0hcDPGgIzdvjg1lmcfvCpWM3wT5aCmKQa5 Uxxo5Qqb/I+CTLwsPGCmWEu7w5csX/N4fnKGzxUeH8qTHlLtP7uVxOY X-Developer-Key: i=filip.hejsek@gmail.com; a=ed25519; pk=nakB8gEK3oi+Q/5dBTMCy/LgZL47NP60z1jeDR6O/WU= Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=filip.hejsek@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Szymon Lukasz Add a new chardev event, CHR_EVENT_RESIZE, which a backend should trigger if it detects the size of the connected terminal changed. Signed-off-by: Szymon Lukasz [Filip: add note that only the focused frontend gets the event] Reviewed-by: Daniel P. Berrangé Signed-off-by: Filip Hejsek --- backends/cryptodev-vhost-user.c | 1 + chardev/char.c | 1 + hw/block/vhost-user-blk.c | 1 + hw/char/terminal3270.c | 1 + hw/char/virtio-console.c | 1 + hw/display/vhost-user-media.c | 1 + hw/ipmi/ipmi_bmc_extern.c | 1 + hw/scsi/vhost-user-scsi.c | 1 + hw/usb/ccid-card-passthru.c | 1 + hw/usb/dev-serial.c | 1 + hw/usb/redirect.c | 1 + hw/virtio/vhost-user-base.c | 1 + hw/virtio/vhost-user-scmi.c | 1 + include/chardev/char.h | 6 ++++++ monitor/hmp.c | 1 + monitor/qmp.c | 1 + net/passt.c | 1 + net/vhost-user.c | 1 + 18 files changed, 23 insertions(+) diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c index 3334e280a2..b0e325e47e 100644 --- a/backends/cryptodev-vhost-user.c +++ b/backends/cryptodev-vhost-user.c @@ -173,6 +173,7 @@ static void cryptodev_vhost_user_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/chardev/char.c b/chardev/char.c index 9da0911e50..40d2180ce7 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -75,6 +75,7 @@ void qemu_chr_be_event(Chardev *s, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 3dade143c9..1352a0cf57 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -441,6 +441,7 @@ static void vhost_user_blk_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c index 989b6f6ee1..acd754bcfa 100644 --- a/hw/char/terminal3270.c +++ b/hw/char/terminal3270.c @@ -169,6 +169,7 @@ static void chr_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 4737b9a56e..36ad2ddc3f 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -165,6 +165,7 @@ static void chr_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/display/vhost-user-media.c b/hw/display/vhost-user-media.c index 851af8ddc2..3d76aaba58 100644 --- a/hw/display/vhost-user-media.c +++ b/hw/display/vhost-user-media.c @@ -241,6 +241,7 @@ static void vu_media_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index fa08ed6c21..bd7c61b2d2 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -436,6 +436,7 @@ static void chr_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 5070178dc2..7687f2804f 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -225,6 +225,7 @@ static void vhost_user_scsi_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index 5ab7855272..3f4052ec82 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -323,6 +323,7 @@ static void ccid_card_vscard_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: case CHR_EVENT_CLOSED: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index b238cb7937..98d2abbd56 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -576,6 +576,7 @@ static void usb_serial_event(void *opaque, QEMUChrEvent event) break; case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index dfd9e8bb50..a666b1e8d7 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1390,6 +1390,7 @@ static void usbredir_chardev_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c index 1a377016e7..3cb59fc173 100644 --- a/hw/virtio/vhost-user-base.c +++ b/hw/virtio/vhost-user-base.c @@ -277,6 +277,7 @@ static void vub_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/hw/virtio/vhost-user-scmi.c b/hw/virtio/vhost-user-scmi.c index c4692bd6aa..29d37716b3 100644 --- a/hw/virtio/vhost-user-scmi.c +++ b/hw/virtio/vhost-user-scmi.c @@ -215,6 +215,7 @@ static void vu_scmi_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/include/chardev/char.h b/include/chardev/char.h index 6394ec2ffe..ee9f24038b 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -22,6 +22,12 @@ typedef enum { CHR_EVENT_OPENED, /* new connection established */ CHR_EVENT_MUX_IN, /* mux-focus was set to this terminal */ CHR_EVENT_MUX_OUT, /* mux-focus will move on */ + CHR_EVENT_RESIZE, /* + * the size of the terminal connected to + * the chardev has changed. NOTE: this event is only + * sent to the focused frontend, so you should also + * update the size on receiving CHR_EVENT_MUX_IN. + */ CHR_EVENT_CLOSED /* connection closed. NOTE: currently this event * is only bound to the read port of the chardev. * Normally the read port and write port of a diff --git a/monitor/hmp.c b/monitor/hmp.c index 488ec23937..7b80d84800 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1587,6 +1587,7 @@ static void monitor_event(void *opaque, QEMUChrEvent event) break; case CHR_EVENT_BREAK: + case CHR_EVENT_RESIZE: /* Ignored */ break; } diff --git a/monitor/qmp.c b/monitor/qmp.c index aec0315775..eb44012643 100644 --- a/monitor/qmp.c +++ b/monitor/qmp.c @@ -663,6 +663,7 @@ static void monitor_qmp_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/net/passt.c b/net/passt.c index 45440c399b..e65198960e 100644 --- a/net/passt.c +++ b/net/passt.c @@ -428,6 +428,7 @@ static void passt_vhost_user_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } diff --git a/net/vhost-user.c b/net/vhost-user.c index 2d0fc49b4d..b849de92da 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -363,6 +363,7 @@ static void net_vhost_user_event(void *opaque, QEMUChrEvent event) case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: case CHR_EVENT_MUX_OUT: + case CHR_EVENT_RESIZE: /* Ignore */ break; } -- 2.56.0