summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-11-24 23:18:52 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2020-11-24 23:18:52 +0000
commit1925586e03bed086b78fda5d8d758912aea7ecc7 (patch)
tree8724060974d53d8848ede2155765b07a3e804c53 /usr.sbin
parent5f9740e3998a8a2bd0466e57cc4cce61abe1343c (diff)
downloadsrc-test-1925586e03bed086b78fda5d8d758912aea7ecc7.tar.gz
src-test-1925586e03bed086b78fda5d8d758912aea7ecc7.zip
Honor the disabled setting for MSI-X interrupts for passthrough devices.
Add a new ioctl to disable all MSI-X interrupts for a PCI passthrough device and invoke it if a write to the MSI-X capability registers disables MSI-X. This avoids leaving MSI-X interrupts enabled on the host if a guest device driver has disabled them (e.g. as part of detaching a guest device driver). This was found by Chelsio QA when testing that a Linux guest could switch from MSI-X to MSI interrupts when using the cxgb4vf driver. While here, explicitly fail requests to enable MSI on a passthrough device if MSI-X is enabled and vice versa. Reported by: Sony Arpita Das @ Chelsio Reviewed by: grehan, markj MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27212
Notes
Notes: svn path=/head/; revision=368003
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bhyve/pci_passthru.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c
index 85c2e52188b3a..3305a4854812c 100644
--- a/usr.sbin/bhyve/pci_passthru.c
+++ b/usr.sbin/bhyve/pci_passthru.c
@@ -869,6 +869,11 @@ passthru_cfgwrite(struct vmctx *ctx, int vcpu, struct pci_devinst *pi,
if (error)
err(1, "vm_setup_pptdev_msix");
}
+ } else {
+ error = vm_disable_pptdev_msix(ctx, sc->psc_sel.pc_bus,
+ sc->psc_sel.pc_dev, sc->psc_sel.pc_func);
+ if (error)
+ err(1, "vm_disable_pptdev_msix");
}
return (0);
}