diff options
author | Corvin Köhne <C.Koehne@beckhoff.com> | 2022-01-03 14:48:10 +0000 |
---|---|---|
committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2022-01-03 14:55:10 +0000 |
commit | 338a1be836308f6d807f8bfe9b335463d537abc4 (patch) | |
tree | 1451205678c0d66b4e70e3804ca4c1288bf7064d | |
parent | b94ed3bc5a54976f27de671df2da38168c8bf52d (diff) | |
download | src-338a1be836308f6d807f8bfe9b335463d537abc4.tar.gz src-338a1be836308f6d807f8bfe9b335463d537abc4.zip |
bhyve: only init MSI-X table if passthru device supports it
Some passthru devices only support MSI instead of MSI-X. For those
devices the initialization of MSI-X table will fail. Re-add the
check erroneously removed in f1442847c9404d4bc5f5524a0c3362dd39cb14f9.
MFC after: 3 days
X-MFC with: f1442847c9404d4bc5f5524a0c3362dd39cb14f9
PR: 260148
Reviewed by: manu, bz
Differential Revision: https://reviews.freebsd.org/D33728
-rw-r--r-- | usr.sbin/bhyve/pci_passthru.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c index 240571f209e3..ea8a3a71c8b8 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -593,13 +593,17 @@ cfginit(struct vmctx *ctx, struct pci_devinst *pi, int bus, int slot, int func) * We need to do this after PCIR_COMMAND got possibly updated, e.g., * a BAR was enabled, as otherwise the PCIOCBARMMAP might fail on us. */ - error = init_msix_table(ctx, sc); - if (error != 0) { - warnx("failed to initialize MSI-X table for PCI %d/%d/%d: %d", - bus, slot, func, error); - goto done; + if (pci_msix_table_bar(pi) >= 0) { + error = init_msix_table(ctx, sc); + if (error != 0) { + warnx( + "failed to initialize MSI-X table for PCI %d/%d/%d: %d", + bus, slot, func, error); + goto done; + } } + error = 0; /* success */ done: return (error); } |