int num,
const libxl_device_pci *pci)
{
+ if (pci->name) {
+ flexarray_append(back, GCSPRINTF("name-%d", num));
+ flexarray_append(back, GCSPRINTF("%s", pci->name));
+ }
flexarray_append(back, GCSPRINTF("key-%d", num));
flexarray_append(back, GCSPRINTF(PCI_BDF, pci->bdf.domain, pci->bdf.bus, pci->bdf.dev, pci->bdf.func));
flexarray_append(back, GCSPRINTF("dev-%d", num));
retry_transaction2:
t = xs_transaction_start(ctx->xsh);
+ xs_rm(ctx->xsh, t, GCSPRINTF("%s/name-%d", be_path, i));
xs_rm(ctx->xsh, t, GCSPRINTF("%s/state-%d", be_path, i));
xs_rm(ctx->xsh, t, GCSPRINTF("%s/key-%d", be_path, i));
xs_rm(ctx->xsh, t, GCSPRINTF("%s/dev-%d", be_path, i));
xs_write(ctx->xsh, t, GCSPRINTF("%s/vdevfn-%d", be_path, j - 1), tmp, strlen(tmp));
xs_rm(ctx->xsh, t, tmppath);
}
+ tmppath = GCSPRINTF("%s/name-%d", be_path, j);
+ tmp = libxl__xs_read(gc, t, tmppath);
+ if (tmp) {
+ xs_write(ctx->xsh, t, GCSPRINTF("%s/name-%d", be_path, j - 1), tmp, strlen(tmp));
+ xs_rm(ctx->xsh, t, tmppath);
+ }
}
if (!xs_transaction_end(ctx->xsh, t, 0))
if (errno == EAGAIN)
pas->starting = starting;
pas->callback = device_pci_add_stubdom_done;
+ if (pci->name) {
+ libxl_pci_bdf *pcibdf =
+ libxl_pci_bdf_assignable_name2bdf(CTX, pci->name);
+
+ if (!pcibdf) {
+ rc = ERROR_FAIL;
+ goto out;
+ }
+
+ LOGD(DETAIL, domid, "'%s' -> %04x:%02x:%02x.%u", pci->name,
+ pcibdf->domain, pcibdf->bus, pcibdf->dev, pcibdf->func);
+
+ libxl_pci_bdf_copy(CTX, &pci->bdf, pcibdf);
+ libxl_pci_bdf_dispose(pcibdf);
+ free(pcibdf);
+ }
+
if (libxl__domain_type(gc, domid) == LIBXL_DOMAIN_TYPE_HVM) {
rc = xc_test_assign_device(ctx->xch, domid,
pci_encode_bdf(&pci->bdf));
libxl_device_pci *pci = &pas->pci;
if (rc) {
- LOGD(ERROR, domid,
- "libxl__device_pci_add failed for "
- "PCI device %x:%x:%x.%x (rc %d)",
- pci->bdf.domain, pci->bdf.bus, pci->bdf.dev, pci->bdf.func,
- rc);
+ if (pci->name) {
+ LOGD(ERROR, domid,
+ "libxl__device_pci_add failed for "
+ "PCI device '%s' (rc %d)",
+ pci->name,
+ rc);
+ } else {
+ LOGD(ERROR, domid,
+ "libxl__device_pci_add failed for "
+ "PCI device %x:%x:%x.%x (rc %d)",
+ pci->bdf.domain, pci->bdf.bus, pci->bdf.dev, pci->bdf.func,
+ rc);
+ }
pci_info_xs_remove(gc, &pci->bdf, "domid");
}
libxl_device_pci_dispose(pci);
libxl__ev_time_init(&prs->timeout);
libxl__ev_time_init(&prs->retry_timer);
+ if (pci->name) {
+ libxl_pci_bdf *pcibdf =
+ libxl_pci_bdf_assignable_name2bdf(CTX, pci->name);
+
+ if (!pcibdf) {
+ rc = ERROR_FAIL;
+ goto out;
+ }
+
+ LOGD(DETAIL, domid, "'%s' -> %04x:%02x:%02x.%u", pci->name,
+ pcibdf->domain, pcibdf->bus, pcibdf->dev, pcibdf->func);
+
+ libxl_pci_bdf_copy(CTX, &prs->pci.bdf, pcibdf);
+ libxl_pci_bdf_dispose(pcibdf);
+ free(pcibdf);
+ }
+
prs->orig_vdev = pci->vdevfn & ~7U;
if ( pci->vfunc_mask == LIBXL_PCI_FUNC_ALL ) {
} while ((p = strtok_r(NULL, ",=", &saveptr)) != NULL);
}
+ s = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/name-%d", be_path, nr));
+ if (s)
+ pci->name = strdup(s);
+
return 0;
}