static int ivshmem_load(QEMUFile* f, void *opaque, int version_id) { IVSHMEM_DPRINTF("ivshmem_load\n"); IVShmemState *proxy = opaque; int ret, i; if (version_id > 0) { return -EINVAL; } if (proxy->role_val == IVSHMEM_PEER) { fprintf(stderr, "ivshmem: 'peer' devices are not migratable\n"); return -EINVAL; } ret = pci_device_load(&proxy->dev, f); if (ret) { return ret; } if (ivshmem_has_feature(proxy, IVSHMEM_MSI)) { msix_load(&proxy->dev, f); for (i = 0; i < proxy->vectors; i++) { msix_vector_use(&proxy->dev, i); } } else { proxy->intrstatus = qemu_get_be32(f); proxy->intrmask = qemu_get_be32(f); } return 0; }
static void ivshmem_setup_msi(IVShmemState * s) { int i; /* allocate the MSI-X vectors */ if (!msix_init(&s->dev, s->vectors, 1, 0)) { pci_register_bar(&s->dev, 1, msix_bar_size(&s->dev), PCI_BASE_ADDRESS_SPACE_MEMORY, msix_mmio_map); IVSHMEM_DPRINTF("msix initialized (%d vectors)\n", s->vectors); } else { IVSHMEM_DPRINTF("msix initialization failed\n"); exit(1); } /* 'activate' the vectors */ for (i = 0; i < s->vectors; i++) { msix_vector_use(&s->dev, i); } /* allocate Qemu char devices for receiving interrupts */ s->eventfd_table = qemu_mallocz(s->vectors * sizeof(EventfdEntry)); }
/* Select the MSI-X vectors used by device. * ivshmem maps events to vectors statically, so * we just enable all vectors on init and after reset. */ static void ivshmem_msix_vector_use(IVShmemState *s) { PCIDevice *d = PCI_DEVICE(s); int i; for (i = 0; i < s->vectors; i++) { msix_vector_use(d, i); } }
/* Select the MSI-X vectors used by device. * ivshmem maps events to vectors statically, so * we just enable all vectors on init and after reset. */ static void ivshmem_use_msix(IVShmemState * s) { int i; if (!msix_present(&s->dev)) { return; } for (i = 0; i < s->vectors; i++) { msix_vector_use(&s->dev, i); } }
/* Select the MSI-X vectors used by device. * ivshmem maps events to vectors statically, so * we just enable all vectors on init and after reset. */ static void ivshmem_use_msix(IVShmemState * s) { PCIDevice *d = PCI_DEVICE(s); int i; if (!msix_present(d)) { return; } for (i = 0; i < s->vectors; i++) { msix_vector_use(d, i); } }
static bool e1000e_use_msix_vectors(E1000EState *s, int num_vectors) { int i; for (i = 0; i < num_vectors; i++) { int res = msix_vector_use(PCI_DEVICE(s), i); if (res < 0) { trace_e1000e_msix_use_vector_fail(i, res); e1000e_unuse_msix_vectors(s, i); return false; } } return true; }
/* Select the MSI-X vectors used by device. * ivshmem maps events to vectors statically, so * we just enable all vectors on init and after reset. */ static void ivshmem_use_msix(IVShmemState * s) { PCIDevice *d = PCI_DEVICE(s); int i; IVSHMEM_DPRINTF("%s, msix present: %d\n", __func__, msix_present(d)); if (!msix_present(d)) { return; } for (i = 0; i < s->vectors; i++) { msix_vector_use(d, i); } }
static int gen_rp_interrupts_init(PCIDevice *d, Error **errp) { int rc; rc = msix_init_exclusive_bar(d, GEN_PCIE_ROOT_PORT_MSIX_NR_VECTOR, 0, errp); if (rc < 0) { assert(rc == -ENOTSUP); } else { msix_vector_use(d, 0); } return rc; }
static void ivshmem_setup_msi(IVShmemState * s) { int i; /* allocate the MSI-X vectors */ memory_region_init(&s->msix_bar, "ivshmem-msix", 4096); if (!msix_init(&s->dev, s->vectors, &s->msix_bar, 1, 0)) { pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->msix_bar); IVSHMEM_DPRINTF("msix initialized (%d vectors)\n", s->vectors); } else { IVSHMEM_DPRINTF("msix initialization failed\n"); exit(1); } /* 'activate' the vectors */ for (i = 0; i < s->vectors; i++) { msix_vector_use(&s->dev, i); } /* allocate QEMU char devices for receiving interrupts */ s->eventfd_table = g_malloc0(s->vectors * sizeof(EventfdEntry)); }