From a7c16c0443b21bb73be9a2552c751e47e847c30e Mon Sep 17 00:00:00 2001 From: jhb Date: Sat, 20 Aug 2016 00:22:39 +0000 Subject: [PATCH] MFC 298950: Fix an off by one error when remapping MSI-X vectors. pci_remap_msix() can be used to alter the mapping of allocated MSI-X vectors to the MSI-X table. The code had an off by one error when adding the IRQ resources after performing a remap. This was fatal for any vectors in the table that used the "last" valid IRQ as those vectors were assigned a garbage IRQ value. git-svn-id: svn://svn.freebsd.org/base/stable/8@304511 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/pci/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 07423f7a8..d95a388f3 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1617,7 +1617,7 @@ pci_remap_msix_method(device_t dev, device_t child, int count, for (i = 0; i < count; i++) { if (vectors[i] == 0) continue; - irq = msix->msix_vectors[vectors[i]].mv_irq; + irq = msix->msix_vectors[vectors[i] - 1].mv_irq; resource_list_add(&dinfo->resources, SYS_RES_IRQ, i + 1, irq, irq, 1); } @@ -1631,7 +1631,7 @@ pci_remap_msix_method(device_t dev, device_t child, int count, printf("---"); else printf("%d", - msix->msix_vectors[vectors[i]].mv_irq); + msix->msix_vectors[vectors[i] - 1].mv_irq); } printf("\n"); } -- 2.42.0