static int
qemuBuildGlobalControllerCommandLine(virCommandPtr cmd,
- const virDomainDef *def,
- virQEMUCapsPtr qemuCaps)
+ const virDomainDef *def)
{
size_t i;
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
cont->opts.pciopts.pcihole64) {
const char *hoststr = NULL;
- bool cap = false;
- bool machine = false;
switch (cont->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
hoststr = "i440FX-pcihost";
- cap = virQEMUCapsGet(qemuCaps, QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
- machine = qemuDomainIsI440FX(def);
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
hoststr = "q35-pcihost";
- cap = virQEMUCapsGet(qemuCaps, QEMU_CAPS_Q35_PCI_HOLE64_SIZE);
- machine = qemuDomainIsQ35(def);
break;
default:
return -1;
}
- if (!machine) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Setting the 64-bit PCI hole size is not "
- "supported for machine '%s'"), def->os.machine);
- return -1;
- }
- if (!cap) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("64-bit PCI hole size setting is not supported "
- "with this QEMU binary"));
- return -1;
- }
-
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.pci-hole64-size=%luK", hoststr,
cont->opts.pciopts.pcihole64size);
if (qemuBuildIOMMUCommandLine(cmd, def, qemuCaps) < 0)
return NULL;
- if (qemuBuildGlobalControllerCommandLine(cmd, def, qemuCaps) < 0)
+ if (qemuBuildGlobalControllerCommandLine(cmd, def) < 0)
return NULL;
if (qemuBuildControllersCommandLine(cmd, def, qemuCaps) < 0)
/* pcihole64 */
switch ((virDomainControllerModelPCI) cont->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
+ if (pciopts->pcihole64 || pciopts->pcihole64size != 0) {
+ if (!qemuDomainIsI440FX(def)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Setting the 64-bit PCI hole size is not "
+ "supported for machine '%s'"), def->os.machine);
+ return -1;
+ }
+
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_I440FX_PCI_HOLE64_SIZE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("64-bit PCI hole size setting is not supported "
+ "with this QEMU binary"));
+ return -1;
+ }
+ }
+ break;
+
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
- /* The pcihole64 option only applies to x86 guests */
- if ((pciopts->pcihole64 ||
- pciopts->pcihole64size != 0) &&
- !ARCH_IS_X86(def->os.arch)) {
- virReportControllerInvalidOption(cont, model, modelName, "pcihole64");
- return -1;
+ if (pciopts->pcihole64 || pciopts->pcihole64size != 0) {
+ if (!qemuDomainIsQ35(def)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Setting the 64-bit PCI hole size is not "
+ "supported for machine '%s'"), def->os.machine);
+ return -1;
+ }
+
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_Q35_PCI_HOLE64_SIZE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("64-bit PCI hole size setting is not supported "
+ "with this QEMU binary"));
+ return -1;
+ }
}
break;
QEMU_CAPS_KVM, QEMU_CAPS_VIRTIO_SCSI);
DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
- DO_TEST_FAILURE("pcihole64-none", NONE);
+ DO_TEST_PARSE_ERROR("pcihole64-none", NONE);
DO_TEST("pcihole64-q35",
QEMU_CAPS_DEVICE_IOH3420,
QEMU_CAPS_ICH9_AHCI,
DO_TEST("s390-serial-console",
QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
- DO_TEST("pcihole64", NONE);
- DO_TEST("pcihole64-gib", NONE);
- DO_TEST("pcihole64-none", NONE);
+ DO_TEST("pcihole64", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
+ DO_TEST("pcihole64-gib", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
+ DO_TEST("pcihole64-none", QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
DO_TEST("pcihole64-q35",
QEMU_CAPS_DEVICE_IOH3420,
QEMU_CAPS_ICH9_AHCI,