]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Validate PCI controller options (pcihole64)
authorAndrea Bolognani <abologna@redhat.com>
Tue, 20 Feb 2018 14:07:15 +0000 (15:07 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 9 Mar 2018 15:57:26 +0000 (16:57 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1483816

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
src/qemu/qemu_domain.c

index a48e6f139a1537b8fea8a27dff230ea06ec635da..614f86df2150f7cfafb186a7d21cdd61c4e6b523 100644 (file)
@@ -4671,6 +4671,40 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont,
         return -1;
     }
 
+    /* pcihole64 */
+    switch ((virDomainControllerModelPCI) cont->model) {
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
+    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;
+        }
+        break;
+
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
+    case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS:
+        if (pciopts->pcihole64 ||
+            pciopts->pcihole64size != 0) {
+            virReportControllerInvalidOption(cont, model, modelName, "pcihole64");
+            return -1;
+        }
+        break;
+
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT:
+    case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
+    default:
+        virReportEnumRangeError(virDomainControllerModelPCI, cont->model);
+        return -1;
+    }
+
     return qemuDomainDeviceDefValidateControllerPCIOld(cont, def, qemuCaps);
 }