The branch main has been updated by kfv:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9c8dcc2f2fbc9dcf4132b97de3d223f3e9f000a1

commit 9c8dcc2f2fbc9dcf4132b97de3d223f3e9f000a1
Author:     Faraz Vahedi <[email protected]>
AuthorDate: 2026-10-03 12:38:27 +0000
Commit:     Faraz Vahedi <[email protected]>
CommitDate: 2026-10-03 12:38:27 +0000

    virtio_console: Negotiate VIRTIO_CONSOLE_F_SIZE
    
    The driver reads cols/rows and sets the tty window size but
    never offered the feature, so that code has been dead since
    the very beginning; also read size under the configuration
    generation count.
    
    Reviewed by:    markj
    Approved by:    fuz (mentor)
    Differential Revision:  https://reviews.freebsd.org/D60089
---
 sys/dev/virtio/console/virtio_console.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/sys/dev/virtio/console/virtio_console.c 
b/sys/dev/virtio/console/virtio_console.c
index 66433565ce25..81ffd7058f06 100644
--- a/sys/dev/virtio/console/virtio_console.c
+++ b/sys/dev/virtio/console/virtio_console.c
@@ -137,7 +137,9 @@ struct vtcon_softc {
     KASSERT((_id) >= 0 && (_id) < (_sc)->vtcon_max_ports,      \
         ("%s: port ID %d out of range", __func__, _id))
 
-#define VTCON_FEATURES  VIRTIO_CONSOLE_F_MULTIPORT
+#define VTCON_FEATURES \
+    (VIRTIO_CONSOLE_F_SIZE             | \
+     VIRTIO_CONSOLE_F_MULTIPORT)
 
 static struct virtio_feature_desc vtcon_feature_desc[] = {
        { VIRTIO_CONSOLE_F_SIZE,        "ConsoleSize"   },
@@ -467,14 +469,19 @@ static void
 vtcon_read_config(struct vtcon_softc *sc, struct virtio_console_config *concfg)
 {
        device_t dev;
+       int gen;
 
        dev = sc->vtcon_dev;
 
-       bzero(concfg, sizeof(struct virtio_console_config));
+       do {
+               gen = virtio_config_generation(dev);
+               bzero(concfg, sizeof(struct virtio_console_config));
 
-       VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_SIZE, cols, concfg);
-       VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_SIZE, rows, concfg);
-       VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_MULTIPORT, max_nr_ports, concfg);
+               VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_SIZE, cols, concfg);
+               VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_SIZE, rows, concfg);
+               VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_MULTIPORT, max_nr_ports,
+                   concfg);
+       } while (gen != virtio_config_generation(dev));
 }
 
 #undef VTCON_GET_CONFIG

Reply via email to