Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/dev/pci Pull up following revision(s) (requested by j...
details: https://anonhg.NetBSD.org/src/rev/37575ed63afe
branches: netbsd-9
changeset: 938917:37575ed63afe
user: martin <martin%NetBSD.org@localhost>
date: Sun Sep 20 10:16:50 2020 +0000
description:
Pull up following revision(s) (requested by jakllsch in ticket #1090):
sys/dev/pci/virtio_pci.c: revision 1.13
Ensure MSI-X is disabled if allocation of MSI-X interrupts fail.
The virtio device config space moves out from under us when MSI-X
remains enabled, and/or INTx interrupts are masked if we don't ensure
this.
This un-breaks virtio devices that run out of MSI-X interrupts.
Particularly a problem on uniproc x86, where there are only 8 or 9
vectors available, allowing for only about 4 virtio devices to use
MSI-X.
diffstat:
sys/dev/pci/virtio_pci.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diffs (46 lines):
diff -r 4ae7f9e955e5 -r 37575ed63afe sys/dev/pci/virtio_pci.c
--- a/sys/dev/pci/virtio_pci.c Sun Sep 20 10:03:11 2020 +0000
+++ b/sys/dev/pci/virtio_pci.c Sun Sep 20 10:16:50 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.7.4.1 2020/09/20 10:03:11 martin Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.7.4.2 2020/09/20 10:16:50 martin Exp $ */
/*
* Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.7.4.1 2020/09/20 10:03:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.7.4.2 2020/09/20 10:16:50 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -662,10 +662,13 @@
struct virtio_pci_softc * const psc = (struct virtio_pci_softc *)sc;
device_t self = sc->sc_dev;
pci_chipset_tag_t pc = psc->sc_pa.pa_pc;
+ pcitag_t tag = psc->sc_pa.pa_tag;
int error;
int nmsix;
+ int off;
int counts[PCI_INTR_TYPE_SIZE];
pci_intr_type_t max_type;
+ pcireg_t ctl;
nmsix = pci_msix_count(psc->sc_pa.pa_pc, psc->sc_pa.pa_tag);
aprint_debug_dev(self, "pci_msix_count=%d\n", nmsix);
@@ -726,6 +729,13 @@
psc->sc_ihs_num = 1;
psc->sc_config_offset = VIRTIO_CONFIG_DEVICE_CONFIG_NOMSI;
+
+ error = pci_get_capability(pc, tag, PCI_CAP_MSIX, &off, NULL);
+ if (error != 0) {
+ ctl = pci_conf_read(pc, tag, off + PCI_MSIX_CTL);
+ ctl &= ~PCI_MSIX_CTL_ENABLE;
+ pci_conf_write(pc, tag, off + PCI_MSIX_CTL, ctl);
+ }
}
return 0;
Home |
Main Index |
Thread Index |
Old Index