Disable MSI-X before writing the MSI-X table.

That fixes MSI-X interrupt lost on VMware ESXi 6.7 PCI passthrough devices.

ok knakahara@
This commit is contained in:
hikaru 2019-11-13 02:54:59 +00:00
parent a8d6848953
commit 8c80fd2599
1 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: msipic.c,v 1.18 2019/10/03 18:53:08 tnn Exp $ */
/* $NetBSD: msipic.c,v 1.19 2019/11/13 02:54:59 hikaru Exp $ */
/*
* Copyright (c) 2015 Internet Initiative Japan Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.18 2019/10/03 18:53:08 tnn Exp $");
__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.19 2019/11/13 02:54:59 hikaru Exp $");
#include "opt_intrdebug.h"
@ -548,6 +548,11 @@ msix_addroute(struct pic *pic, struct cpu_info *ci,
err = pci_get_capability(pc, tag, PCI_CAP_MSIX, &off, NULL);
KASSERT(err != 0);
/* Disable MSI-X before writing MSI-X table */
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);
entry_base = PCI_MSIX_TABLE_ENTRY_SIZE * msix_vec;
/*