Index: pci_passthru.c =================================================================== --- pci_passthru.c (revision 261702) +++ pci_passthru.c (working copy) @@ -358,7 +358,7 @@ { int b, s, f; int error, idx; - size_t len, remaining, table_size; + size_t len, remaining, table_size, table_offset; vm_paddr_t start; struct pci_devinst *pi = sc->psc_pi; @@ -368,6 +368,7 @@ s = sc->psc_sel.pc_dev; f = sc->psc_sel.pc_func; +#if 0 /* * If the MSI-X table BAR maps memory intended for * other uses, it is at least assured that the table @@ -380,9 +381,13 @@ printf("Unsupported MSI-X configuration: %d/%d/%d\n", b, s, f); return (-1); } +#endif - /* Compute the MSI-X table size */ - table_size = pi->pi_msix.table_count * MSIX_TABLE_ENTRY_SIZE; + /* Compute the MSI-X table size and offset */ + table_offset = rounddown2(pi->pi_msix.table_offset, 4096); + + table_size = pi->pi_msix.table_offset - table_offset; + table_size += pi->pi_msix.table_count * MSIX_TABLE_ENTRY_SIZE; table_size = roundup2(table_size, 4096); idx = pi->pi_msix.table_bar; @@ -390,8 +395,8 @@ remaining = pi->pi_bar[idx].size; /* Map everything before the MSI-X table */ - if (pi->pi_msix.table_offset > 0) { - len = pi->pi_msix.table_offset; + if (table_offset > 0) { + len = table_offset; error = vm_map_pptdev_mmio(ctx, b, s, f, start, len, base); if (error) return (error);