[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/3] Add armv6l Support as guest



From: Stefan Schallenberg <nafets227 users noreply github com>

Support for armv6l qemu guests has been added.
Tested with arm1176 CPU on x86.

Signed-off-by: Stefan Schallenberg <infos nafets de>
---
 docs/schemas/basictypes.rng                  |  1 +
 src/qemu/qemu_capabilities.c                 |  5 +-
 src/qemu/qemu_command.c                      |  4 +-
 src/qemu/qemu_domain.c                       | 11 ++--
 src/qemu/qemu_domain_address.c               |  6 +-
 tests/capabilityschemadata/caps-qemu-kvm.xml | 66 ++++++++++++++++++++
 tests/testutilsqemu.c                        | 40 +++++++++++-
 7 files changed, 122 insertions(+), 11 deletions(-)

diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 71a6db3bb4..9a63720ff7 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -406,6 +406,7 @@
     <choice>
       <value>aarch64</value>
       <value>alpha</value>
+      <value>armv6l</value>
       <value>armv7l</value>
       <value>cris</value>
       <value>i686</value>
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 20a1a0c201..8cb50073b4 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -625,7 +625,7 @@ static const char *virQEMUCapsArchToString(virArch arch)
 {
     if (arch == VIR_ARCH_I686)
         return "i386";
-    else if (arch == VIR_ARCH_ARMV7L)
+    else if (arch == VIR_ARCH_ARMV6L || arch == VIR_ARCH_ARMV7L)
         return "arm";
     else if (arch == VIR_ARCH_OR32)
         return "or32";
@@ -2201,7 +2201,7 @@ static const char *preferredMachines[] =
 {
     NULL, /* VIR_ARCH_NONE (not a real arch :) */
     "clipper", /* VIR_ARCH_ALPHA */
-    NULL, /* VIR_ARCH_ARMV6L (no QEMU impl) */
+    "integratorcp", /* VIR_ARCH_ARMV6L */
     "integratorcp", /* VIR_ARCH_ARMV7L */
     "integratorcp", /* VIR_ARCH_ARMV7B */
 
@@ -4179,6 +4179,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
 
     /* GIC capabilities, eg. available GIC versions */
     if ((qemuCaps->arch == VIR_ARCH_AARCH64 ||
+         qemuCaps->arch == VIR_ARCH_ARMV6L ||
          qemuCaps->arch == VIR_ARCH_ARMV7L) &&
         virQEMUCapsProbeQMPGICCapabilities(qemuCaps, mon) < 0)
         goto cleanup;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 315419c71b..c36f8d44e3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9223,7 +9223,9 @@ static bool
 qemuChrIsPlatformDevice(const virDomainDef *def,
                         virDomainChrDefPtr chr)
 {
-    if (def->os.arch == VIR_ARCH_ARMV7L || def->os.arch == VIR_ARCH_AARCH64) {
+    if (def->os.arch == VIR_ARCH_ARMV6L ||
+        def->os.arch == VIR_ARCH_ARMV7L ||
+        def->os.arch == VIR_ARCH_AARCH64) {
 
         /* pl011 (used on mach-virt) is a platform device */
         if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ee61caa823..efe6202101 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3260,6 +3260,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
             addPCIRoot = true;
         break;
 
+    case VIR_ARCH_ARMV6L:
     case VIR_ARCH_ARMV7L:
     case VIR_ARCH_AARCH64:
         addDefaultUSB = false;
@@ -3305,7 +3306,6 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
         addPCIRoot = true;
         break;
 
-    case VIR_ARCH_ARMV6L:
     case VIR_ARCH_ARMV7B:
     case VIR_ARCH_CRIS:
     case VIR_ARCH_ITANIUM:
@@ -6024,7 +6024,8 @@ qemuDomainDefaultNetModel(const virDomainDef *def,
     if (ARCH_IS_S390(def->os.arch))
         return "virtio";
 
-    if (def->os.arch == VIR_ARCH_ARMV7L ||
+    if (def->os.arch == VIR_ARCH_ARMV6L ||
+        def->os.arch == VIR_ARCH_ARMV7L ||
         def->os.arch == VIR_ARCH_AARCH64) {
         if (STREQ(def->os.machine, "versatilepb"))
             return "smc91c111";
@@ -9807,7 +9808,8 @@ bool
 qemuDomainMachineIsARMVirt(const char *machine,
                            const virArch arch)
 {
-    if (arch != VIR_ARCH_ARMV7L &&
+    if (arch != VIR_ARCH_ARMV6L &&
+        arch != VIR_ARCH_ARMV7L &&
         arch != VIR_ARCH_AARCH64)
         return false;
 
@@ -10613,7 +10615,8 @@ qemuDomainSupportsNicdev(virDomainDefPtr def,
                          virDomainNetDefPtr net)
 {
     /* non-virtio ARM nics require legacy -net nic */
-    if (((def->os.arch == VIR_ARCH_ARMV7L) ||
+    if (((def->os.arch == VIR_ARCH_ARMV6L) ||
+        (def->os.arch == VIR_ARCH_ARMV7L) ||
         (def->os.arch == VIR_ARCH_AARCH64)) &&
         net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO &&
         net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 73ed9cc68c..4cee6633ac 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -468,7 +468,8 @@ static void
 qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
                                        virQEMUCapsPtr qemuCaps)
 {
-    if (def->os.arch != VIR_ARCH_ARMV7L &&
+    if (def->os.arch != VIR_ARCH_ARMV6L &&
+        def->os.arch != VIR_ARCH_ARMV7L &&
         def->os.arch != VIR_ARCH_AARCH64)
         return;
 
@@ -2367,7 +2368,8 @@ static bool
 qemuDomainSupportsPCI(virDomainDefPtr def,
                       virQEMUCapsPtr qemuCaps)
 {
-    if ((def->os.arch != VIR_ARCH_ARMV7L) &&
+    if ((def->os.arch != VIR_ARCH_ARMV6L) &&
+        (def->os.arch != VIR_ARCH_ARMV7L) &&
         (def->os.arch != VIR_ARCH_AARCH64) &&
         !ARCH_IS_RISCV(def->os.arch))
         return true;
diff --git a/tests/capabilityschemadata/caps-qemu-kvm.xml b/tests/capabilityschemadata/caps-qemu-kvm.xml
index 1aa98d140f..4b3895dbd1 100644
--- a/tests/capabilityschemadata/caps-qemu-kvm.xml
+++ b/tests/capabilityschemadata/caps-qemu-kvm.xml
@@ -81,6 +81,72 @@
     </features>
   </guest>
 
+  <guest>
+    <os_type>hvm</os_type>
+    <arch name='armv6l'>
+      <wordsize>32</wordsize>
+      <emulator>/usr/bin/qemu-system-arm</emulator>
+      <machine maxCpus='1'>integratorcp</machine>
+      <machine maxCpus='2'>nuri</machine>
+      <machine maxCpus='1'>mps2-an511</machine>
+      <machine maxCpus='1'>verdex</machine>
+      <machine maxCpus='1'>mps2-an505</machine>
+      <machine maxCpus='512'>virt-3.0</machine>
+      <machine canonical='virt-3.0' maxCpus='512'>virt</machine>
+      <machine maxCpus='1'>ast2500-evb</machine>
+      <machine maxCpus='2'>smdkc210</machine>
+      <machine maxCpus='1'>collie</machine>
+      <machine maxCpus='1'>imx25-pdk</machine>
+      <machine maxCpus='1'>spitz</machine>
+      <machine maxCpus='4'>realview-pbx-a9</machine>
+      <machine maxCpus='1'>realview-eb</machine>
+      <machine maxCpus='1'>realview-pb-a8</machine>
+      <machine maxCpus='1'>versatilepb</machine>
+      <machine maxCpus='1'>emcraft-sf2</machine>
+      <machine maxCpus='255'>virt-2.9</machine>
+      <machine maxCpus='1'>musicpal</machine>
+      <machine maxCpus='1'>z2</machine>
+      <machine maxCpus='1'>akita</machine>
+      <machine maxCpus='255'>virt-2.7</machine>
+      <machine maxCpus='1'>kzm</machine>
+      <machine maxCpus='255'>virt-2.8</machine>
+      <machine maxCpus='4'>realview-eb-mpcore</machine>
+      <machine maxCpus='2'>mcimx7d-sabre</machine>
+      <machine maxCpus='1'>sx1</machine>
+      <machine maxCpus='1'>sx1-v1</machine>
+      <machine maxCpus='255'>virt-2.6</machine>
+      <machine maxCpus='1'>cubieboard</machine>
+      <machine maxCpus='4'>highbank</machine>
+      <machine maxCpus='4'>raspi2</machine>
+      <machine maxCpus='1'>netduino2</machine>
+      <machine maxCpus='1'>terrier</machine>
+      <machine maxCpus='1'>n810</machine>
+      <machine maxCpus='1'>mainstone</machine>
+      <machine maxCpus='1'>palmetto-bmc</machine>
+      <machine maxCpus='4'>sabrelite</machine>
+      <machine maxCpus='4'>midway</machine>
+      <machine maxCpus='1'>romulus-bmc</machine>
+      <machine maxCpus='1'>cheetah</machine>
+      <machine maxCpus='1'>tosa</machine>
+      <machine maxCpus='1'>borzoi</machine>
+      <machine maxCpus='1'>versatileab</machine>
+      <machine maxCpus='1'>lm3s6965evb</machine>
+      <machine maxCpus='1'>n800</machine>
+      <machine maxCpus='255'>virt-2.10</machine>
+      <machine maxCpus='255'>virt-2.11</machine>
+      <machine maxCpus='1'>connex</machine>
+      <machine maxCpus='255'>virt-2.12</machine>
+      <machine maxCpus='1'>witherspoon-bmc</machine>
+      <machine maxCpus='1'>xilinx-zynq-a9</machine>
+      <machine maxCpus='1'>mps2-an385</machine>
+      <machine maxCpus='4'>vexpress-a9</machine>
+      <machine maxCpus='4'>vexpress-a15</machine>
+      <machine maxCpus='1'>canon-a1100</machine>
+      <machine maxCpus='1'>lm3s811evb</machine>
+      <domain type='qemu'/>
+    </arch>
+  </guest>
+
   <guest>
     <os_type>hvm</os_type>
     <arch name='armv7l'>
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 0d3e9fc7e6..3f7d3b107d 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -392,7 +392,39 @@ static int testQemuAddS390Guest(virCapsPtr caps)
     return -1;
 }
 
-static int testQemuAddArmGuest(virCapsPtr caps)
+static int testQemuAddArm6Guest(virCapsPtr caps)
+{
+    static const char *machines[] = { "versatilepb" };
+    virCapsGuestMachinePtr *capsmachines = NULL;
+    virCapsGuestPtr guest;
+
+    capsmachines = virCapabilitiesAllocMachines(machines,
+                                                ARRAY_CARDINALITY(machines));
+    if (!capsmachines)
+        goto error;
+
+    guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_ARMV6L,
+                                    QEMUBinList[TEST_UTILS_QEMU_BIN_ARM],
+                                    NULL,
+                                    ARRAY_CARDINALITY(machines),
+                                    capsmachines);
+    if (!guest)
+        goto error;
+
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
+        goto error;
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM,
+                                       NULL, NULL, 0, NULL))
+        goto error;
+
+    return 0;
+
+ error:
+    virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines));
+    return -1;
+}
+
+static int testQemuAddArm7Guest(virCapsPtr caps)
 {
     static const char *machines[] = { "vexpress-a9",
                                       "vexpress-a15",
@@ -426,6 +458,7 @@ static int testQemuAddArmGuest(virCapsPtr caps)
     return -1;
 }
 
+
 static int testQemuAddAARCH64Guest(virCapsPtr caps)
 {
     static const char *machines[] = { "virt"};
@@ -514,7 +547,10 @@ virCapsPtr testQemuCapsInit(void)
     if (testQemuAddS390Guest(caps))
         goto cleanup;
 
-    if (testQemuAddArmGuest(caps))
+    if (testQemuAddArm6Guest(caps))
+        goto cleanup;
+
+    if (testQemuAddArm7Guest(caps))
         goto cleanup;
 
     if (testQemuAddAARCH64Guest(caps))
-- 
2.19.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]