git: 2edd355e33d2 - main - vt_vga: repost only a vgapci(4) video device
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 04 Nov 2026 17:14:56 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=2edd355e33d28e02f7c7ab3809729f5420c5edaf
commit 2edd355e33d28e02f7c7ab3809729f5420c5edaf
Author: Denis Borovikov <denis.borovikov@gmail.com>
AuthorDate: 2026-11-04 17:13:50 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2026-11-04 17:13:50 +0000
vt_vga: repost only a vgapci(4) video device
When vt(4) falls back to vt_vga, vga_init() passes vd_video_dev to
vga_pci_repost(), which expects a vgapci(4) device. The framebuffer
driver that set it need not provide one: drm-kmod's linux_fb passes the
parent of the DRM parent device, which is vgapci for LinuxKPI PCI
drivers but the PCI bus for virtio-gpu, whose DRM parent is the virtio
PCI transport. On x86, vga_pci_repost() then calls pci_get_class() on
the bus, which fails the accessor's KASSERT under INVARIANTS; without
INVARIANTS the class reads as 0 and the repost is skipped. Repost only
a vgapci device.
Signed-off-by: Denis Borovikov <denis.borovikov@gmail.com>
Reviewed by: wulf
Differential Revision: https://reviews.freebsd.org/D60880
---
sys/dev/vt/hw/vga/vt_vga.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c
index 675c0573bd7e..bf2b7090b29d 100644
--- a/sys/dev/vt/hw/vga/vt_vga.c
+++ b/sys/dev/vt/hw/vga/vt_vga.c
@@ -1301,7 +1301,9 @@ vga_init(struct vt_device *vd)
vd->vd_softc = (void *)&vga_conssoftc;
sc = vd->vd_softc;
- if (vd->vd_flags & VDF_DOWNGRADE && vd->vd_video_dev != NULL)
+ /* vga_pci_repost() takes a vgapci(4) device. */
+ if (vd->vd_flags & VDF_DOWNGRADE && vd->vd_video_dev != NULL &&
+ device_get_devclass(vd->vd_video_dev) == devclass_find("vgapci"))
vga_pci_repost(vd->vd_video_dev);
#if defined(__amd64__) || defined(__i386__)