Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_passthru.c
Show First 20 Lines • Show All 438 Lines • ▼ Show 20 Lines | init_msix_table(struct vmctx *ctx, struct passthru_softc *sc) | ||||
* 1. The PBA may reside in the first or last page containing the MSI-X | * 1. The PBA may reside in the first or last page containing the MSI-X | ||||
* table. | * table. | ||||
* 2. While PCI devices are not supposed to use the page(s) containing | * 2. While PCI devices are not supposed to use the page(s) containing | ||||
* the MSI-X table for other purposes, some do in practice. | * the MSI-X table for other purposes, some do in practice. | ||||
*/ | */ | ||||
memset(&pbm, 0, sizeof(pbm)); | memset(&pbm, 0, sizeof(pbm)); | ||||
pbm.pbm_sel = sc->psc_sel; | pbm.pbm_sel = sc->psc_sel; | ||||
pbm.pbm_flags = PCIIO_BAR_MMAP_RW; | pbm.pbm_flags = PCIIO_BAR_MMAP_RW; | ||||
pbm.pbm_reg = PCIR_BAR(pi->pi_msix.pba_bar); | pbm.pbm_reg = PCIR_BAR(pi->pi_msix.table_bar); | ||||
pbm.pbm_memattr = VM_MEMATTR_DEVICE; | pbm.pbm_memattr = VM_MEMATTR_DEVICE; | ||||
if (ioctl(pcifd, PCIOCBARMMAP, &pbm) != 0) { | if (ioctl(pcifd, PCIOCBARMMAP, &pbm) != 0) { | ||||
warn("Failed to map MSI-X table BAR on %d/%d/%d", b, s, f); | warn("Failed to map MSI-X table BAR on %d/%d/%d", b, s, f); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
assert(pbm.pbm_bar_off == 0); | assert(pbm.pbm_bar_off == 0); | ||||
pi->pi_msix.mapped_addr = (uint8_t *)(uintptr_t)pbm.pbm_map_base; | pi->pi_msix.mapped_addr = (uint8_t *)(uintptr_t)pbm.pbm_map_base; | ||||
▲ Show 20 Lines • Show All 570 Lines • Show Last 20 Lines |