qemu: Format additional PHBs on the command line

Additional PHBs (pci-root controllers) will be created for
the guest using the spapr-pci-host-bridge QEMU device, if
available; the implicit default PHB, while present in the
guest configuration, will be skipped.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1431193Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
Reviewed-by: NLaine Stump <laine@laine.org>
上级 32f23b8d
无相关合并请求
......@@ -3005,6 +3005,40 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
def->opts.pciopts.numaNode);
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
if (def->opts.pciopts.modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE ||
def->opts.pciopts.targetIndex == -1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("autogenerated pci-root options not set"));
goto error;
}
/* Skip the implicit one */
if (def->opts.pciopts.targetIndex == 0)
goto done;
modelName = virDomainControllerPCIModelNameTypeToString(def->opts.pciopts.modelName);
if (!modelName) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown pci-root model name value %d"),
def->opts.pciopts.modelName);
goto error;
}
if (def->opts.pciopts.modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("PCI controller model name '%s' is not valid for a pci-root"),
modelName);
goto error;
}
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("the spapr-pci-host-bridge controller "
"is not supported in this QEMU binary"));
goto error;
}
virBufferAsprintf(&buf, "%s,index=%d,id=%s",
modelName, def->opts.pciopts.targetIndex,
def->info.alias);
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
......@@ -3054,6 +3088,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
if (virBufferCheckError(&buf) < 0)
goto error;
done:
*devstr = virBufferContentAndReset(&buf);
return 0;
......@@ -3111,11 +3146,19 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd,
continue;
}
/* skip pci-root/pcie-root */
/* skip pcie-root */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
(cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT))
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) {
continue;
}
/* Skip pci-root, except for pSeries guests (which actually
* support more than one PCI Host Bridge per guest) */
if (!qemuDomainIsPSeries(def) &&
cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) {
continue;
}
/* first SATA controller on Q35 machines is implicit */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部