]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Add command line support for PCI high memory MMIO size
authorMatthew R. Ochs <mochs@nvidia.com>
Thu, 15 May 2025 14:48:47 +0000 (07:48 -0700)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 16 May 2025 11:47:32 +0000 (12:47 +0100)
Add support for generating QEMU command line with PCI high memory MMIO size:
    - Add highmem-mmio-size to machine command line generation using
      size conveyed through pcihole64
    - Add validation for aarch64/virt machine type requirement
    - Add capability check for QEMU support

This enables configuring the PCI high memory MMIO window size
for aarch64 virt machine types using the existing pcihole64
element.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
src/qemu/qemu_command.c
src/qemu/qemu_validate.c

index bf03561fde9a3247a21dcfdebb5be138b6711a0d..2f687779cd772dd8350cb1145470229873c756bf 100644 (file)
@@ -6197,7 +6197,8 @@ qemuBuildGlobalControllerCommandLine(virCommand *cmd,
     for (i = 0; i < def->ncontrollers; i++) {
         virDomainControllerDef *cont = def->controllers[i];
         if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
-            cont->opts.pciopts.pcihole64) {
+            cont->opts.pciopts.pcihole64 &&
+            (qemuDomainIsQ35(def) || qemuDomainIsI440FX(def))) {
             const char *hoststr = NULL;
 
             switch (cont->model) {
@@ -7114,6 +7115,17 @@ qemuBuildMachineCommandLine(virCommand *cmd,
 
     qemuBuildMachineACPI(&buf, def, qemuCaps);
 
+    if (qemuDomainIsARMVirt(def)) {
+        for (i = 0; i < def->ncontrollers; i++) {
+            virDomainControllerDef *cont = def->controllers[i];
+            if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
+                cont->opts.pciopts.pcihole64) {
+                virBufferAsprintf(&buf, ",highmem-mmio-size=%lluK", cont->opts.pciopts.pcihole64size);
+                break;
+            }
+        }
+    }
+
     virCommandAddArgBuffer(cmd, &buf);
 
     return 0;
index b2c3c9e2f63170b2baf2e52d66539cfec001b1e1..87588024ced4412e819fc7ce2cd321d583d95948 100644 (file)
@@ -4085,7 +4085,9 @@ qemuValidateDomainDeviceDefControllerPCI(const virDomainControllerDef *cont,
 
     case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
         if (pciopts->pcihole64 || pciopts->pcihole64size != 0) {
-            if (!qemuDomainIsQ35(def)) {
+            if (!qemuDomainIsQ35(def) &&
+                !(qemuDomainIsARMVirt(def) && virQEMUCapsGet(qemuCaps,
+                                                             QEMU_CAPS_MACHINE_VIRT_HIGHMEM_MMIO_SIZE))) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("Setting the 64-bit PCI hole size is not supported for machine '%1$s'"),
                                def->os.machine);