You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2021/07/15 07:45:30 UTC

[cloudstack] branch 4.15 updated: kvm: pre-add 32 PCI controller for hot-plug issue on ARM64 (#5193)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.15
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.15 by this push:
     new 5228fae  kvm: pre-add 32 PCI controller for hot-plug issue on ARM64 (#5193)
5228fae is described below

commit 5228fae7b80213371cc4206226d15212bff95cf1
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Thu Jul 15 13:15:10 2021 +0530

    kvm: pre-add 32 PCI controller for hot-plug issue on ARM64 (#5193)
    
    On newer libvirt/qemu it seems PCI hot-plugging could be an issue as
    seen in:
    
    https://www.suse.com/support/kb/doc/?id=000019383
    https://bugs.launchpad.net/nova/+bug/1836065
    
    This was found to be true on ARM64/aarch64 platform (tested on
    RaspberryPi4). As per the default machine doc, it advises to
    pre-allocate PCI controllers on the machine and pcie-to-pci-bridge based
    controller for legacy PCI models:
    https://libvirt.org/pci-hotplug.html#x86_64-q35
    
    This patch introduces the concept as a workaround until a proper fix is
    done (ideally in the upstream libvirt/qemu projects). Until then client
    code can add 32 PCI controllers and a pcie-to-pci-bridge controller for
    aarch64 platforms.
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 .../java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java     | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 1927ddd..3ea7a19 100644
--- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -530,6 +530,15 @@ public class LibvirtVMDef {
                     devicesBuilder.append(dev.toString());
                 }
             }
+
+            if (_emulator != null && _emulator.endsWith("aarch64")) {
+                devicesBuilder.append("<controller type='pci' model='pcie-root'/>\n");
+                for (int i = 0; i < 32; i++) {
+                  devicesBuilder.append("<controller type='pci' model='pcie-root-port'/>\n");
+                }
+                devicesBuilder.append("<controller type='pci' model='pcie-to-pci-bridge'/>\n");
+            }
+
             devicesBuilder.append("</devices>\n");
             return devicesBuilder.toString();
         }