Re: [libvirt] [PATCH v3 8/9] tests: Add RISC-V architectures

On Wed, 2018-08-22 at 11:15 +0200, Lubomir Rintel wrote:
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> --- tests/capabilityschemadata/caps-qemu-kvm.xml | 36 + .../caps_3.0.0.riscv32.replies | 14819 ++++++++++++++++ .../caps_3.0.0.riscv32.xml | 118 + .../caps_3.0.0.riscv64.replies | 14819 ++++++++++++++++ .../caps_3.0.0.riscv64.xml | 118 + tests/qemucapabilitiestest.c | 2 + tests/qemuxml2argvdata/riscv64-virt.args | 30 + tests/qemuxml2argvdata/riscv64-virt.xml | 32 + tests/qemuxml2argvtest.c | 3 + .../riscv64-virt.xml | 42 + tests/qemuxml2xmloutdata/riscv64-virt.xml | 36 + tests/qemuxml2xmltest.c | 2 + tests/testutilsqemu.c | 72 + tests/vircapstest.c | 6 + 14 files changed, 30135 insertions(+) create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies create mode 100644 tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml create mode 100644 tests/qemuxml2argvdata/riscv64-virt.args create mode 100644 tests/qemuxml2argvdata/riscv64-virt.xml create mode 100644 tests/qemuxml2startupxmloutdata/riscv64-virt.xml create mode 100644 tests/qemuxml2xmloutdata/riscv64-virt.xml
I think I didn't explain myself clearly enough while reviewing v2: I expected patches 07-09 and 11 to be squashed together, but patch 10 to remain standalone. No big deal, I'll take care of splitting it up again myself. [...]
+++ b/tests/qemuxml2argvdata/riscv64-virt.xml @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>riscv64</name> + <uuid>fd65fc03-8838-4c4d-9d8d-395802488790</uuid> + <memory unit='KiB'>2097152</memory> + <currentMemory unit='KiB'>2097152</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='riscv64' machine='virt'>hvm</type> + <kernel>/var/lib/libvirt/images/bbl</kernel> + <cmdline>console=ttyS0 ro root=/dev/vda</cmdline> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-riscv64</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='/var/lib/libvirt/images/stage4-disk.img'/> + <target dev='vda' bus='virtio'/> + <address type='virtio-mmio'/> + </disk> + <serial type='pty'> + <target port='0'/> + </serial> + <console type='pty'> + <target type='serial' port='0'/> + </console> + </devices> +</domain>
You didn't minimize the input file like I requested during review :( Oh well, I'll take care of it. Reviewed-by: Andrea Bolognani <abologna@redhat.com> [...]
+static int testQemuAddRISCV32Guest(virCapsPtr caps) +{ + static const char *names[] = { "spike_v1.10", + "spike_v1.9.1", + "sifive_e", + "virt", + "sifive_u" }; + static const int nmachines = ARRAY_CARDINALITY(names); + virCapsGuestMachinePtr *machines = NULL; + virCapsGuestPtr guest; + + machines = virCapabilitiesAllocMachines(names, nmachines); + if (!machines) + goto error; + + guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_RISCV32, + QEMUBinList[TEST_UTILS_QEMU_BIN_RISCV32], + NULL, nmachines, machines); + if (!guest) + goto error; + + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) + goto error; + + return 0; + + error: + virCapabilitiesFreeMachines(machines, nmachines); + return -1; +} + +static int testQemuAddRISCV64Guest(virCapsPtr caps) +{ + static const char *names[] = { "spike_v1.10", + "spike_v1.9.1", + "sifive_e", + "virt", + "sifive_u" }; + static const int nmachines = ARRAY_CARDINALITY(names); + virCapsGuestMachinePtr *machines = NULL; + virCapsGuestPtr guest; + + machines = virCapabilitiesAllocMachines(names, nmachines); + if (!machines) + goto error; + + guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, VIR_ARCH_RISCV64, + QEMUBinList[TEST_UTILS_QEMU_BIN_RISCV64], + NULL, nmachines, machines); + if (!guest) + goto error; + + if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL)) + goto error; + + return 0; + + error: + virCapabilitiesFreeMachines(machines, nmachines); + return -1; +} + static int testQemuAddS390Guest(virCapsPtr caps) { static const char *s390_machines[] = { "s390-virtio", @@ -440,6 +506,12 @@ virCapsPtr testQemuCapsInit(void) if (testQemuAddPPCGuest(caps)) goto cleanup;
+ if (testQemuAddRISCV32Guest(caps) < 0) + goto cleanup; + + if (testQemuAddRISCV64Guest(caps) < 0) + goto cleanup; + if (testQemuAddS390Guest(caps)) goto cleanup;
And of course I didn't clean up the surrounding code even though I said I would... This is a good reminder I guess :) -- Andrea Bolognani / Red Hat / Virtualization

On Thu, 2018-08-23 at 19:18 +0200, Andrea Bolognani wrote:
On Wed, 2018-08-22 at 11:15 +0200, Lubomir Rintel wrote: [...]
create mode 100644 tests/qemuxml2startupxmloutdata/riscv64-virt.xml
Oh, and this file is unnecessary (qemuxml2startup is only intended to cover some very specific use cases) so I've dropped it. The series is now pushed :) Thanks for your contribution! I'll post a patch to address the USB situation soon. -- Andrea Bolognani / Red Hat / Virtualization
participants (1)
-
Andrea Bolognani