diff options
| author | Faraz Vahedi <kfv@FreeBSD.org> | 2026-10-03 12:38:27 +0000 |
|---|---|---|
| committer | Faraz Vahedi <kfv@FreeBSD.org> | 2026-10-03 12:38:27 +0000 |
| commit | 9c8dcc2f2fbc9dcf4132b97de3d223f3e9f000a1 (patch) | |
| tree | 83a1e66cf423a4ea85fb87108816a609c2f0e71c | |
| parent | fe9c7137871ee0b5c48d4c38b87d80f72e73379e (diff) | |
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
| -rw-r--r-- | sys/dev/virtio/console/virtio_console.c | 17 |
1 files 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 |
