Module Name:    src
Committed By:   jdolecek
Date:           Wed Jun 17 14:04:03 UTC 2020

Modified Files:
        src/sys/dev/pci: vga_pci.c

Log Message:
explicitly disable INTx interrupts to avoid interrupt storm triggered by
unhandled adapter interrupts

fixes PR kern/46596 by Andreas Gustafsson, fix adopted from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/pci/vga_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/vga_pci.c
diff -u src/sys/dev/pci/vga_pci.c:1.55 src/sys/dev/pci/vga_pci.c:1.56
--- src/sys/dev/pci/vga_pci.c:1.55	Thu Jul  7 06:55:41 2016
+++ src/sys/dev/pci/vga_pci.c	Wed Jun 17 14:04:03 2020
@@ -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 <sys/cdefs.h>
-__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 <sys/param.h>
 #include <sys/systm.h>
@@ -230,6 +230,16 @@ vga_pci_attach(device_t parent, device_t
 			    "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,

Reply via email to