[PATCH 1/2] Add armv6l Support as guest

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

 



From: Stefan Schallenberg <nafets227@xxxxxxxxxxxxxxxxxxxxxxxx>

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

Signed-off-by: Stefan Schallenberg <infos at nafets.de>
---
 docs/news.xml                                |  9 +++++
 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 | 10 +++++
 tests/testutilsqemu.c                        | 40 +++++++++++++++++++-
 8 files changed, 75 insertions(+), 11 deletions(-)

diff --git a/docs/news.xml b/docs/news.xml
index 4406aeb775..e3ec371876 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -25,6 +25,15 @@
     <section title="New features">
     </section>
     <section title="Improvements">
+      <change>
+        <summary>
+          Add armv6l Support as guest
+        </summary>
+        <description>
+          Support for armv6l qemu guests has been added.
+          Tested with arm1176 CPU on x86.
+        </description>
+      </change>
     </section>
     <section title="Bug fixes">
     </section>
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 71a6db3bb4..9a651a4564 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -407,6 +407,7 @@
       <value>aarch64</value>
       <value>alpha</value>
       <value>armv7l</value>
+      <value>armv6l</value>
       <value>cris</value>
       <value>i686</value>
       <value>ia64</value>
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index fde27010e4..70ecc5bf21 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -624,7 +624,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";
@@ -2199,7 +2199,7 @@ static const char *preferredMachines[] =
 {
     NULL, /* VIR_ARCH_NONE (not a real arch :) */
     "clipper", /* VIR_ARCH_ALPHA */
-    NULL, /* VIR_ARCH_ARMV6L (no QEMU impl) */
+    "versatilepb", /* VIR_ARCH_ARMV6L */
     "integratorcp", /* VIR_ARCH_ARMV7L */
     "integratorcp", /* VIR_ARCH_ARMV7B */
 
@@ -4177,6 +4177,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 23a6661c10..db0ff6da4d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9203,7 +9203,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 2f65bbe34e..acf351f878 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:
@@ -6035,7 +6035,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";
@@ -9818,7 +9819,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;
 
@@ -10624,7 +10626,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..01cebcab16 100644
--- a/tests/capabilityschemadata/caps-qemu-kvm.xml
+++ b/tests/capabilityschemadata/caps-qemu-kvm.xml
@@ -81,6 +81,16 @@
     </features>
   </guest>
 
+<guest>
+    <os_type>hvm</os_type>
+    <arch name='armv7l'>
+      <wordsize>32</wordsize>
+      <emulator>/usr/bin/qemu-system-arm</emulator>
+      <machine>versatilepb</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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux