From: Stefan Schallenberg <nafets227(a)users.noreply.github.com>
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 88774c55ae..b01bcbf949 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 14a3670e5c..8a01b854c0 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -380,6 +380,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 2ca5af3297..4871e89324 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -618,7 +618,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";
@@ -2179,7 +2179,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 */
@@ -4157,6 +4157,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 f59cbf559e..2aa5dab049 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9072,7 +9072,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 e25afdad6b..2a757683c8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3253,6 +3253,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
addPCIRoot = true;
break;
+ case VIR_ARCH_ARMV6L:
case VIR_ARCH_ARMV7L:
case VIR_ARCH_AARCH64:
addDefaultUSB = false;
@@ -3297,7 +3298,6 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
addPCIRoot = true;
break;
- case VIR_ARCH_ARMV6L:
case VIR_ARCH_ARMV7B:
case VIR_ARCH_CRIS:
case VIR_ARCH_ITANIUM:
@@ -5908,7 +5908,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";
@@ -9691,7 +9692,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;
@@ -10497,7 +10499,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 27c9bfb946..64a6595717 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;
@@ -2185,7 +2186,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 332885eb77..1c60aaee03 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.1