git: 338a1be83630 - main - bhyve: only init MSI-X table if passthru device supports it
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Jan 2022 15:03:47 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=338a1be836308f6d807f8bfe9b335463d537abc4 commit 338a1be836308f6d807f8bfe9b335463d537abc4 Author: Corvin Köhne <C.Koehne@beckhoff.com> AuthorDate: 2022-01-03 14:48:10 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2022-01-03 14:55:10 +0000 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 --- usr.sbin/bhyve/pci_passthru.c | 14 +++++++++----- 1 file 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); }