From e1d78452d411c039a84eb32243a6f5ce45e4feae Mon Sep 17 00:00:00 2001 From: jdolecek Date: Wed, 17 Jun 2020 14:04:03 +0000 Subject: [PATCH] explicitly disable INTx interrupts to avoid interrupt storm triggered by unhandled adapter interrupts fixes PR kern/46596 by Andreas Gustafsson, fix adopted from FreeBSD --- sys/dev/pci/vga_pci.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index a726270238c6..93e84b8fa72d 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: vga_pci.c,v 1.55 2016/07/07 06:55:41 msaitoh Exp $ */ +/* $NetBSD: vga_pci.c,v 1.56 2020/06/17 14:04:03 jdolecek Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 1.55 2016/07/07 06:55:41 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vga_pci.c,v 1.56 2020/06/17 14:04:03 jdolecek Exp $"); #include #include @@ -230,6 +230,16 @@ vga_pci_attach(device_t parent, device_t self, void *aux) "WARNING: strange BAR @ 0x%02x\n", reg); } + /* + * Disable INTx interrupts, there is no specific chipset driver for + * this PCI device. Else unhandled display adapter interrupts + * might freeze the CPU. + */ + pcireg_t cmd = pci_conf_read(pa->pa_pc, pa->pa_tag, + PCI_COMMAND_STATUS_REG); + pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, + cmd | PCI_COMMAND_INTERRUPT_DISABLE); + /* XXX Expansion ROM? */ vga_common_attach(sc, pa->pa_iot, pa->pa_memt, WSDISPLAY_TYPE_PCIVGA,