[PATCH 6/9] tests/util: add RISC-V capabilities

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

 



Signed-off-by: Lubomir Rintel <lkundrak@xxxxx>
---
 tests/testutilsqemu.c | 72 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index dc7e90b952..c6376262b9 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -28,6 +28,8 @@ typedef enum {
     TEST_UTILS_QEMU_BIN_ARM,
     TEST_UTILS_QEMU_BIN_PPC64,
     TEST_UTILS_QEMU_BIN_PPC,
+    TEST_UTILS_QEMU_BIN_RISCV32,
+    TEST_UTILS_QEMU_BIN_RISCV64,
     TEST_UTILS_QEMU_BIN_S390X
 } QEMUBinType;
 
@@ -38,6 +40,8 @@ static const char *QEMUBinList[] = {
     "/usr/bin/qemu-system-arm",
     "/usr/bin/qemu-system-ppc64",
     "/usr/bin/qemu-system-ppc",
+    "/usr/bin/qemu-system-riscv32",
+    "/usr/bin/qemu-system-riscv64",
     "/usr/bin/qemu-system-s390x"
 };
 
@@ -285,6 +289,68 @@ static int testQemuAddPPCGuest(virCapsPtr caps)
     return -1;
 }
 
+static int testQemuAddRISCV32Guest(virCapsPtr caps)
+{
+    static const char *machine[] = { "spike_v1.10",
+                                     "spike_v1.9.1",
+                                     "sifive_e",
+                                     "virt",
+                                     "sifive_u" };
+    virCapsGuestMachinePtr *machines = NULL;
+    virCapsGuestPtr guest;
+
+    machines = virCapabilitiesAllocMachines(machine, 1);
+    if (!machines)
+        goto error;
+
+    guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_RISCV32,
+                                    QEMUBinList[TEST_UTILS_QEMU_BIN_RISCV32],
+                                    NULL, 1, machines);
+    if (!guest)
+        goto error;
+
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
+        goto error;
+
+    return 0;
+
+ error:
+    /* No way to free a guest? */
+    virCapabilitiesFreeMachines(machines, 1);
+    return -1;
+}
+
+static int testQemuAddRISCV64Guest(virCapsPtr caps)
+{
+    static const char *machine[] = { "spike_v1.10",
+                                     "spike_v1.9.1",
+                                     "sifive_e",
+                                     "virt",
+                                     "sifive_u" };
+    virCapsGuestMachinePtr *machines = NULL;
+    virCapsGuestPtr guest;
+
+    machines = virCapabilitiesAllocMachines(machine, 1);
+    if (!machines)
+        goto error;
+
+    guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_RISCV64,
+                                    QEMUBinList[TEST_UTILS_QEMU_BIN_RISCV64],
+                                    NULL, 1, machines);
+    if (!guest)
+        goto error;
+
+    if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL))
+        goto error;
+
+    return 0;
+
+ error:
+    /* No way to free a guest? */
+    virCapabilitiesFreeMachines(machines, 1);
+    return -1;
+}
+
 static int testQemuAddS390Guest(virCapsPtr caps)
 {
     static const char *s390_machines[] = { "s390-virtio",
@@ -422,6 +488,12 @@ virCapsPtr testQemuCapsInit(void)
     if (testQemuAddPPCGuest(caps))
         goto cleanup;
 
+    if (testQemuAddRISCV32Guest(caps))
+        goto cleanup;
+
+    if (testQemuAddRISCV64Guest(caps))
+        goto cleanup;
+
     if (testQemuAddS390Guest(caps))
         goto cleanup;
 
-- 
2.17.0

--
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