Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149545058
D33628.1790429384.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D33628.1790429384.diff
View Options
diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c
--- a/usr.sbin/bhyve/pci_passthru.c
+++ b/usr.sbin/bhyve/pci_passthru.c
@@ -420,7 +420,7 @@
}
static int
-init_msix_table(struct vmctx *ctx, struct passthru_softc *sc, uint64_t base)
+init_msix_table(struct vmctx *ctx, struct passthru_softc *sc)
{
struct pci_devinst *pi = sc->psc_pi;
struct pci_bar_mmap pbm;
@@ -548,13 +548,6 @@
sc->psc_bar[i].lobits = lobits;
pi->pi_bar[i].lobits = lobits;
- /* The MSI-X table needs special handling */
- if (i == pci_msix_table_bar(pi)) {
- error = init_msix_table(ctx, sc, base);
- if (error)
- return (-1);
- }
-
/*
* 64-bit BAR takes up two slots so skip the next one.
*/
@@ -596,7 +589,17 @@
write_config(&sc->psc_sel, PCIR_COMMAND, 2,
pci_get_cfgdata16(pi, PCIR_COMMAND));
- error = 0; /* success */
+ /*
+ * 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;
+ }
+
done:
return (error);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Sep 26, 1:29 PM (1 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29933633
Default Alt Text
D33628.1790429384.diff (1 KB)
Attached To
Mode
D33628: bhyve: passthru: enable BARs before possibly mmap(2)ing them
Attached
Detach File
Event Timeline
Log In to Comment