Re: [libvirt PATCH V2 4/4] Add test script for loongarch

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

 



On Wed, Jan 10, 2024 at 11:07:49AM +0800, Xianglai Li wrote:
> diff --git a/src/conf/schemas/basictypes.rng b/src/conf/schemas/basictypes.rng
> index 26eb538077..f117f19d33 100644
> --- a/src/conf/schemas/basictypes.rng
> +++ b/src/conf/schemas/basictypes.rng
> @@ -444,6 +444,7 @@
>        <value>i686</value>
>        <value>ia64</value>
>        <value>lm32</value>
> +      <value>loongarch64</value>
>        <value>m68k</value>
>        <value>microblaze</value>
>        <value>microblazeel</value>

This change is unrelated to testing and needs to be moved to the
first patch, the one in which you're introducing the architecture.

> diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
> index c4a4508430..062450e132 100644
> --- a/tests/domaincapstest.c
> +++ b/tests/domaincapstest.c
> @@ -389,6 +389,19 @@ doTestQemu(const char *inputDir G_GNUC_UNUSED,
>                                 VIR_DOMAIN_VIRT_KVM, opaque) < 0)
>              ret = -1;
>
> +        if (doTestQemuInternal(version, "virt", arch, variant,
> +                               VIR_DOMAIN_VIRT_QEMU, opaque) < 0)
> +            ret = -1;
> +    } else if (STRPREFIX(arch, "loongarch64")) {
> +        /* For loongarch64 we test two combinations:
> +         *
> +         *   - KVM with virt machine
> +         *   - TCG with virt machine
> +         */
> +        if (doTestQemuInternal(version, "virt", arch, variant,
> +                               VIR_DOMAIN_VIRT_KVM, opaque) < 0)
> +            ret = -1;
> +

You can fold this check into the existing one for riscv64 and avoid
duplicating the corresponding code.

> diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.replies b/tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.replies
> new file mode 100644
> index 0000000000..4be5364d37
> --- /dev/null
> +++ b/tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.replies
> @@ -0,0 +1,30140 @@
> +{
> +  "execute": "qmp_capabilities",
> +  "id": "libvirt-1"
> +}
> +
> +{
> +  "return": {
> +  },
> +  "id": "libvirt-1"
> +}
> +
> +{
> +  "execute": "query-version",
> +  "id": "libvirt-2"
> +}
> +
> +{
> +  "return": {
> +    "qemu": {
> +      "micro": 0,
> +      "minor": 2,
> +      "major": 8
> +    },
> +    "package": "v8.2.0"
> +  },
> +  "id": "libvirt-2"
> +}
> +
[...]
> +
> +{
> +  "execute": "query-kvm",
> +  "id": "libvirt-5"
> +}
> +
> +{
> +  "return": {
> +    "enabled": true,
> +    "present": true
> +  },
> +  "id": "libvirt-5"
> +}

Oh, so you're running this on actual KVM-capable loongarch64
hardware? That's very neat!

> diff --git a/tests/qemuxml2argvdata/default-video-type-loongarch64.loongarch64-latest.args b/tests/qemuxml2argvdata/default-video-type-loongarch64.loongarch64-latest.args
> new file mode 100644
> index 0000000000..0a76cca6ce
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/default-video-type-loongarch64.loongarch64-latest.args
> @@ -0,0 +1,34 @@
> +LC_ALL=C \
> +PATH=/bin \
> +HOME=/var/lib/libvirt/qemu/domain--1-default-video-type-l \
> +USER=test \
> +LOGNAME=test \
> +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-default-video-type-l/.local/share \
> +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-default-video-type-l/.cache \
> +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-default-video-type-l/.config \
> +/usr/bin/qemu-system-loongarch64 \
> +-name guest=default-video-type-loongarch64-test,debug-threads=on \
> +-S \
> +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-default-video-type-l/master-key.aes"}' \
> +-machine virt,usb=off,dump-guest-core=off,memory-backend=loongarch.ram,acpi=on \
> +-accel tcg \
> +-cpu la464 \
> +-m size=1048576k \
> +-object '{"qom-type":"memory-backend-ram","id":"loongarch.ram","size":1073741824}' \
> +-overcommit mem-lock=off \
> +-smp 1,sockets=1,cores=1,threads=1 \
> +-uuid 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f \
> +-no-user-config \
> +-nodefaults \
> +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
> +-mon chardev=charmonitor,id=monitor,mode=control \
> +-rtc base=utc \
> +-no-shutdown \
> +-boot strict=on \
> +-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x1"}' \
> +-device '{"driver":"pcie-root-port","port":9,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x1.0x1"}' \
> +-audiodev '{"id":"audio1","driver":"spice"}' \
> +-spice port=0,seamless-migration=on \
> +-device '{"driver":"virtio-vga","id":"video0","max_outputs":1,"bus":"pci.1","addr":"0x0"}' \
> +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
> +-msg timestamp=on

I see that virtio-vga is used here. It seems to work fine, but
regular VGA doesn't, at least from a quick test. I'm just wondering
if that's likely to be just an issue with the specific guest OS I'm
using... aarch64 has some problems with (virtio) VGA that force it to
use virtio-gpu instead, but I guess that's not the case for
loongarch64? Just making sure.

> diff --git a/tests/qemuxml2argvdata/loongarch64-virt-pci.xml b/tests/qemuxml2argvdata/loongarch64-virt-pci.xml
> new file mode 100644
> index 0000000000..689f2a37bd
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/loongarch64-virt-pci.xml
> @@ -0,0 +1,27 @@
> +<domain type='qemu'>
> +  <name>loongarch64</name>
> +  <uuid>fd65fc03-8838-4c4d-9d8d-395802488790</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <vcpu placement='static'>1</vcpu>
> +  <os>
> +    <type arch='loongarch64' machine='virt'>hvm</type>
> +    <kernel>/var/lib/libvirt/images/loongarch64.bbl</kernel>
> +    <cmdline>root=/dev/vda</cmdline>
> +  </os>
> +  <features>
> +    <acpi/>
> +  </features>
> +  <devices>
> +    <emulator>/usr/bin/qemu-system-loongarch64</emulator>
> +    <disk type='file'>
> +      <driver name='qemu' type='qcow2'/>
> +      <source file='/var/lib/libvirt/images/loongarch64.qcow2'/>
> +      <target dev='vda' bus='virtio'/>
> +      <!-- We need to manually pick an address on pcie.0 because otherwise
> +           libvirt would try to add pcie-root-ports, and QEMU doesn't support
> +           PCIe controllers for RISC-V guests yet -->
> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
> +    </disk>
> +    <memballoon model='none'/>
> +  </devices>
> +</domain>

This test case is relevant for riscv64, where we had to use
virtio-mmio initially and only got PCI later. It doesn't apply to
loongarch64, and in fact it might make sense to drop it for riscv64
too at this point.

> diff --git a/tests/qemuxml2argvdata/loongarch64-virt.xml b/tests/qemuxml2argvdata/loongarch64-virt.xml
> new file mode 100644
> index 0000000000..3b2111bfc2
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/loongarch64-virt.xml
> @@ -0,0 +1,22 @@
> +<domain type='qemu'>
> +  <name>loongarch64</name>
> +  <uuid>fd65fc03-8838-4c4d-9d8d-395802488790</uuid>
> +  <memory unit='KiB'>2097152</memory>
> +  <vcpu placement='static'>1</vcpu>
> +  <os>
> +    <type arch='loongarch64' machine='virt'>hvm</type>
> +    <kernel>/var/lib/libvirt/images/bbl</kernel>
> +    <cmdline>console=ttyS0 ro root=/dev/vda</cmdline>
> +  </os>
> +  <features>
> +    <acpi/>
> +  </features>
> +  <devices>
> +    <emulator>/usr/bin/qemu-system-loongarch64</emulator>
> +    <disk type='file'>
> +      <source file='/var/lib/libvirt/images/stage4-disk.img'/>
> +      <target dev='vda' bus='virtio'/>
> +    </disk>
> +    <serial type='pty'/>
> +  </devices>
> +</domain>

This one's also not particularly useful, since all the features that
it exercises are already covered by one of the other tests. Please
drop it.

-- 
Andrea Bolognani / Red Hat / Virtualization
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[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