Update loongarch code

virt-manager updated to 4.1,
loongarch code changed, update loongarch code.

Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
This commit is contained in:
Xianglai Li 2024-02-27 22:14:54 -05:00
parent 7fdf7f5ea4
commit 489c14ad23
5 changed files with 543 additions and 166 deletions

View File

@ -0,0 +1,83 @@
From 2e466df762326045c7d40f179bff6e54d2e0d015 Mon Sep 17 00:00:00 2001
From: Xianglai Li <lixianglai@loongson.cn>
Date: Wed, 28 Feb 2024 02:07:26 -0500
Subject: [PATCH 2/4] Add loongarch support in guest class
Add adaptations for loongarch with the following features in guest class:
virtio Support
input deveice support
default graphic Support
usb redir support
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
---
virtinst/guest.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/virtinst/guest.py b/virtinst/guest.py
index e663602..86f6e14 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -352,7 +352,8 @@ class Guest(XMLBuilder):
if (self.os.is_arm_machvirt() or
self.os.is_riscv_virt() or
self.os.is_s390x() or
- self.os.is_pseries()):
+ self.os.is_pseries() or
+ self.os.is_loongarch64()):
return True
if not os_support:
@@ -541,7 +542,7 @@ class Guest(XMLBuilder):
# and doesn't break QEMU internal snapshots
prefer_efi = self.osinfo.requires_firmware_efi(self.os.arch)
else:
- prefer_efi = self.os.is_arm_machvirt() or self.conn.is_bhyve()
+ prefer_efi = self.os.is_arm_machvirt() or self.conn.is_bhyve() or self.os.is_loongarch64()
log.debug("Prefer EFI => %s", prefer_efi)
return prefer_efi
@@ -902,7 +903,8 @@ class Guest(XMLBuilder):
usb_tablet = True
if (self.os.is_arm_machvirt() or
self.os.is_riscv_virt() or
- self.os.is_pseries()):
+ self.os.is_pseries() or
+ self.os.is_loongarch64()):
usb_tablet = True
usb_keyboard = True
@@ -984,7 +986,11 @@ class Guest(XMLBuilder):
# For pseries, we always assume OS supports usb3
if qemu_usb3:
usb3 = True
-
+ elif self.os.is_loongarch64():
+ # For machvirt, we always assume OS supports usb3
+ if (qemu_usb3 and
+ self.conn.support.conn_machvirt_pci_default()):
+ usb3 = True
if usb2:
for dev in DeviceController.get_usb2_controllers(self.conn):
@@ -1016,7 +1022,7 @@ class Guest(XMLBuilder):
if self.os.is_container() and not self.conn.is_vz():
return
if (not self.os.is_x86() and
- not self.os.is_pseries()):
+ not self.os.is_pseries() and not self.os.is_loongarch64()):
return
self.add_device(DeviceGraphics(self.conn))
@@ -1155,6 +1161,8 @@ class Guest(XMLBuilder):
self.add_device(dev)
def _add_spice_usbredir(self):
+ if (self.os.is_loongarch64()):
+ return
if self.skip_default_usbredir:
return
if self.devices.redirdev:
--
2.27.0

View File

@ -1,21 +1,19 @@
From 49874e7491b10b7cf47f842e2967dc843fb862a0 Mon Sep 17 00:00:00 2001
From: zhaotianrui <zhaotianrui@loongson.cn>
Date: Mon, 12 Dec 2022 16:51:20 +0800
Subject: [PATCH] Add loongarch support
From d10f3f9bc65b7832db98ef00973bf22f38dd86a6 Mon Sep 17 00:00:00 2001
From: Xianglai Li <lixianglai@loongson.cn>
Date: Wed, 28 Feb 2024 02:03:21 -0500
Subject: [PATCH 1/4] Add loongarch support
Signed-off-by: zhaotianrui <zhaotianrui@loongson.cn>
Set loongarch installable,And Define the judgment function of
loongarch architecture.
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
---
virtManager/createvm.py | 5 ++++-
virtinst/devices/disk.py | 2 ++
virtinst/devices/video.py | 2 ++
virtinst/domain/cpu.py | 5 +++++
virtinst/domain/os.py | 3 +++
virtinst/domcapabilities.py | 6 +++++-
virtinst/guest.py | 16 ++++++++++++----
7 files changed, 33 insertions(+), 6 deletions(-)
virtManager/createvm.py | 6 +++++-
virtinst/domain/os.py | 2 ++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/virtManager/createvm.py b/virtManager/createvm.py
index 7e5ded6..7930b37 100644
index 7e5ded6..f5d678d 100644
--- a/virtManager/createvm.py
+++ b/virtManager/createvm.py
@@ -476,7 +476,8 @@ class vmmCreateVM(vmmGObjectUI):
@ -24,167 +22,33 @@ index 7e5ded6..7930b37 100644
guest.os.is_ppc64() or
- guest.os.is_s390x())
+ guest.os.is_s390x() or
+ guest.os.is_loongarch())
+ guest.os.is_loongarch64())
default_efi = (
self.config.get_default_firmware_setting() == "uefi" and
@@ -857,6 +858,8 @@ class vmmCreateVM(vmmGObjectUI):
machines.sort()
@@ -864,6 +865,9 @@ class vmmCreateVM(vmmGObjectUI):
defmachine = recommended_machine
prios = [defmachine]
defmachine = None
+ if self._capsinfo.arch in ["loongarch64"]:
+ defmachine = "loongson7a"
prios = []
recommended_machine = virtinst.Guest.get_recommended_machine(
self._capsinfo)
diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py
index dc59fd1..261b82b 100644
--- a/virtinst/devices/disk.py
+++ b/virtinst/devices/disk.py
@@ -974,6 +974,8 @@ class DeviceDisk(Device):
return "sd"
if guest.os.is_q35():
return "sata"
+ if self.is_cdrom() and guest.os.is_loongarch():
+ return "scsi"
if self.conn.is_bhyve():
# IDE bus is not supported by bhyve
return "sata"
diff --git a/virtinst/devices/video.py b/virtinst/devices/video.py
index 70067a7..d10fd7a 100644
--- a/virtinst/devices/video.py
+++ b/virtinst/devices/video.py
@@ -27,6 +27,8 @@ class DeviceVideo(Device):
@staticmethod
def default_model(guest):
+ if guest.os.is_loongarch():
+ return "virtio"
if not guest.os.is_hvm():
return None
if guest.os.is_pseries():
diff --git a/virtinst/domain/cpu.py b/virtinst/domain/cpu.py
index 5de42b4..82b68ac 100644
--- a/virtinst/domain/cpu.py
+++ b/virtinst/domain/cpu.py
@@ -449,5 +449,10 @@ class DomainCpu(XMLBuilder):
# -M virt defaults to a 32bit CPU, even if using aarch64
self.set_model(guest, "cortex-a57")
+ elif guest.os.is_loongarch() and guest.type == "kvm":
+ if guest.os.arch != self.conn.caps.host.cpu.arch:
+ return
+ self.set_special_mode(guest, guest.loongarch_cpu_default)
+ defmachine = "virt"
+
elif guest.os.is_x86() and guest.type == "kvm":
self._set_cpu_x86_kvm_default(guest)
for p in prios[:]:
if p not in machines:
prios.remove(p) # pragma: no cover
diff --git a/virtinst/domain/os.py b/virtinst/domain/os.py
index e2cea75..bd0deac 100644
index e2cea75..e783c85 100644
--- a/virtinst/domain/os.py
+++ b/virtinst/domain/os.py
@@ -70,6 +70,9 @@ class DomainOs(XMLBuilder):
def is_pseries(self):
return self.is_ppc64() and str(self.machine).startswith("pseries")
+ def is_loongarch(self):
@@ -77,6 +77,8 @@ class DomainOs(XMLBuilder):
return self.arch == "riscv64" or self.arch == "riscv32"
def is_riscv_virt(self):
return self.is_riscv() and str(self.machine).startswith("virt")
+ def is_loongarch64(self):
+ return self.arch == "loongarch64"
+
def is_s390x(self):
return self.arch == "s390x"
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index d22ce6a..50ce12c 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -289,6 +289,10 @@ class DomainCapabilities(XMLBuilder):
r".*arm/QEMU_EFI.*", # fedora, gerd's firmware repo
r".*edk2-arm-code\.fd" # upstream qemu
],
+ "loongarch64": [
+ ".*loongarch_bios.bin", # loongarch
+ ".*loongarch_vars.bin", # gerd's firmware repo
+ ],
}
def find_uefi_path_for_arch(self):
@@ -444,7 +448,7 @@ class DomainCapabilities(XMLBuilder):
# support. Use our pre-existing logic
if not self.conn.is_qemu() and not self.conn.is_test():
return False
- return self.conn.caps.host.cpu.arch in ["i686", "x86_64"]
+ return self.conn.caps.host.cpu.arch in ["i686", "x86_64", "loongarch64"]
return self.devices.graphics.get_enum("type").has_value("spice")
diff --git a/virtinst/guest.py b/virtinst/guest.py
index e663602..f0f2d67 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -212,6 +212,7 @@ class Guest(XMLBuilder):
self.skip_default_rng = False
self.skip_default_tpm = False
self.x86_cpu_default = self.cpu.SPECIAL_MODE_APP_DEFAULT
+ self.loongarch_cpu_default = self.cpu.SPECIAL_MODE_HOST_MODEL_ONLY
# qemu 6.1, fairly new when we added this option, has an unfortunate
# bug with >= 15 root ports, so we choose 14 instead of our original 16
@@ -352,7 +353,8 @@ class Guest(XMLBuilder):
if (self.os.is_arm_machvirt() or
self.os.is_riscv_virt() or
self.os.is_s390x() or
- self.os.is_pseries()):
+ self.os.is_pseries() or
+ self.os.is_loongarch()):
return True
if not os_support:
@@ -541,7 +543,7 @@ class Guest(XMLBuilder):
# and doesn't break QEMU internal snapshots
prefer_efi = self.osinfo.requires_firmware_efi(self.os.arch)
else:
- prefer_efi = self.os.is_arm_machvirt() or self.conn.is_bhyve()
+ prefer_efi = self.os.is_arm_machvirt() or self.conn.is_bhyve() or self.os.is_loongarch()
log.debug("Prefer EFI => %s", prefer_efi)
return prefer_efi
@@ -558,6 +560,8 @@ class Guest(XMLBuilder):
"""
self.os.loader_ro = True
self.os.loader_type = "pflash"
+ if (self.os.is_loongarch()):
+ self.os.loader_type = "rom"
self.os.loader = path
# If the firmware name contains "secboot" it is probably build
@@ -902,7 +906,8 @@ class Guest(XMLBuilder):
usb_tablet = True
if (self.os.is_arm_machvirt() or
self.os.is_riscv_virt() or
- self.os.is_pseries()):
+ self.os.is_pseries() or
+ self.os.is_loongarch()):
usb_tablet = True
usb_keyboard = True
@@ -1016,7 +1021,8 @@ class Guest(XMLBuilder):
if self.os.is_container() and not self.conn.is_vz():
return
if (not self.os.is_x86() and
- not self.os.is_pseries()):
+ not self.os.is_pseries() and
+ not self.os.is_loongarch()):
return
self.add_device(DeviceGraphics(self.conn))
@@ -1155,6 +1161,8 @@ class Guest(XMLBuilder):
self.add_device(dev)
def _add_spice_usbredir(self):
+ if (self.os.is_loongarch()):
+ return
if self.skip_default_usbredir:
return
if self.devices.redirdev:
##################
# XML properties #
--
2.33.0
2.27.0

View File

@ -0,0 +1,59 @@
From 568965c0c852d882028d0777c1fa311da62ef6cb Mon Sep 17 00:00:00 2001
From: Xianglai Li <lixianglai@loongson.cn>
Date: Wed, 28 Feb 2024 02:11:16 -0500
Subject: [PATCH 3/4] Add some default device support for loongarch
Add adaptations for loongarch with the following features:
scsi support
default video Support
cpu modeul support
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
---
virtinst/devices/disk.py | 2 ++
virtinst/devices/video.py | 2 ++
virtinst/domain/cpu.py | 3 +++
3 files changed, 7 insertions(+)
diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py
index dc59fd1..cfb1387 100644
--- a/virtinst/devices/disk.py
+++ b/virtinst/devices/disk.py
@@ -974,6 +974,8 @@ class DeviceDisk(Device):
return "sd"
if guest.os.is_q35():
return "sata"
+ if self.is_cdrom() and guest.os.is_loongarch64():
+ return "scsi"
if self.conn.is_bhyve():
# IDE bus is not supported by bhyve
return "sata"
diff --git a/virtinst/devices/video.py b/virtinst/devices/video.py
index 70067a7..97adf7d 100644
--- a/virtinst/devices/video.py
+++ b/virtinst/devices/video.py
@@ -31,6 +31,8 @@ class DeviceVideo(Device):
return None
if guest.os.is_pseries():
return "vga"
+ if guest.os.is_loongarch64():
+ return "virtio"
if guest.os.is_arm_machvirt():
# For all cases here the hv and guest are new enough for virtio
return "virtio"
diff --git a/virtinst/domain/cpu.py b/virtinst/domain/cpu.py
index 5de42b4..c93a43b 100644
--- a/virtinst/domain/cpu.py
+++ b/virtinst/domain/cpu.py
@@ -449,5 +449,8 @@ class DomainCpu(XMLBuilder):
# -M virt defaults to a 32bit CPU, even if using aarch64
self.set_model(guest, "cortex-a57")
+ elif guest.os.is_loongarch64():
+ self.set_model(guest, "la464")
+
elif guest.os.is_x86() and guest.type == "kvm":
self._set_cpu_x86_kvm_default(guest)
--
2.27.0

View File

@ -0,0 +1,365 @@
From 26d63f7864341a6ce254449209bd7b8069b4ee45 Mon Sep 17 00:00:00 2001
From: Xianglai Li <lixianglai@loongson.cn>
Date: Wed, 28 Feb 2024 02:16:23 -0500
Subject: [PATCH 4/4] Add test cases for loongarch
Add some basic test cases for loongarch.
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
---
.../capabilities/kvm-loongarch64-domcaps.xml | 167 ++++++++++++++++++
tests/data/capabilities/kvm-loongarch64.xml | 28 +++
.../virt-install-kvm-loongarch64-basic.xml | 99 +++++++++++
tests/test_cli.py | 8 +
tests/utils.py | 1 +
5 files changed, 303 insertions(+)
create mode 100644 tests/data/capabilities/kvm-loongarch64-domcaps.xml
create mode 100644 tests/data/capabilities/kvm-loongarch64.xml
create mode 100644 tests/data/cli/compare/virt-install-kvm-loongarch64-basic.xml
diff --git a/tests/data/capabilities/kvm-loongarch64-domcaps.xml b/tests/data/capabilities/kvm-loongarch64-domcaps.xml
new file mode 100644
index 0000000..2013da3
--- /dev/null
+++ b/tests/data/capabilities/kvm-loongarch64-domcaps.xml
@@ -0,0 +1,167 @@
+<domainCapabilities>
+ <path>/usr/bin/qemu-system-loongarch64</path>
+ <domain>kvm</domain>
+ <machine>virt</machine>
+ <arch>loongarch64</arch>
+ <vcpu max='256'/>
+ <iothreads supported='yes'/>
+ <os supported='yes'>
+ <enum name='firmware'/>
+ <loader supported='yes'>
+ <value>/obviously/fake/firmware1.fd</value>
+ <value>/obviously/fake/firmware2.fd</value>
+ <enum name='type'>
+ <value>rom</value>
+ <value>pflash</value>
+ </enum>
+ <enum name='readonly'>
+ <value>yes</value>
+ <value>no</value>
+ </enum>
+ <enum name='secure'>
+ <value>no</value>
+ </enum>
+ </loader>
+ </os>
+ <cpu>
+ <mode name='host-passthrough' supported='yes'>
+ <enum name='hostPassthroughMigratable'>
+ <value>off</value>
+ </enum>
+ </mode>
+ <mode name='maximum' supported='yes'>
+ <enum name='maximumMigratable'>
+ <value>on</value>
+ <value>off</value>
+ </enum>
+ </mode>
+ <mode name='host-model' supported='no'/>
+ <mode name='custom' supported='yes'>
+ <model usable='unknown' vendor='unknown'>la132</model>
+ <model usable='unknown' vendor='unknown'>la464</model>
+ <model usable='unknown' vendor='unknown'>max</model>
+ </mode>
+ </cpu>
+ <memoryBacking supported='yes'>
+ <enum name='sourceType'>
+ <value>file</value>
+ <value>anonymous</value>
+ <value>memfd</value>
+ </enum>
+ </memoryBacking>
+ <devices>
+ <disk supported='yes'>
+ <enum name='diskDevice'>
+ <value>disk</value>
+ <value>cdrom</value>
+ <value>floppy</value>
+ <value>lun</value>
+ </enum>
+ <enum name='bus'>
+ <value>fdc</value>
+ <value>scsi</value>
+ <value>virtio</value>
+ <value>usb</value>
+ <value>sata</value>
+ </enum>
+ <enum name='model'>
+ <value>virtio</value>
+ <value>virtio-transitional</value>
+ <value>virtio-non-transitional</value>
+ </enum>
+ </disk>
+ <graphics supported='yes'>
+ <enum name='type'>
+ <value>sdl</value>
+ <value>vnc</value>
+ <value>spice</value>
+ <value>dbus</value>
+ </enum>
+ </graphics>
+ <video supported='yes'>
+ <enum name='modelType'>
+ <value>vga</value>
+ <value>cirrus</value>
+ <value>virtio</value>
+ <value>none</value>
+ <value>bochs</value>
+ <value>ramfb</value>
+ </enum>
+ </video>
+ <hostdev supported='yes'>
+ <enum name='mode'>
+ <value>subsystem</value>
+ </enum>
+ <enum name='startupPolicy'>
+ <value>default</value>
+ <value>mandatory</value>
+ <value>requisite</value>
+ <value>optional</value>
+ </enum>
+ <enum name='subsysType'>
+ <value>usb</value>
+ <value>pci</value>
+ <value>scsi</value>
+ </enum>
+ <enum name='capsType'/>
+ <enum name='pciBackend'>
+ <value>default</value>
+ <value>vfio</value>
+ </enum>
+ </hostdev>
+ <rng supported='yes'>
+ <enum name='model'>
+ <value>virtio</value>
+ <value>virtio-transitional</value>
+ <value>virtio-non-transitional</value>
+ </enum>
+ <enum name='backendModel'>
+ <value>random</value>
+ <value>egd</value>
+ <value>builtin</value>
+ </enum>
+ </rng>
+ <filesystem supported='yes'>
+ <enum name='driverType'>
+ <value>path</value>
+ <value>handle</value>
+ <value>virtiofs</value>
+ </enum>
+ </filesystem>
+ <tpm supported='no'/>
+ <redirdev supported='yes'>
+ <enum name='bus'>
+ <value>usb</value>
+ </enum>
+ </redirdev>
+ <channel supported='yes'>
+ <enum name='type'>
+ <value>pty</value>
+ <value>unix</value>
+ <value>spicevmc</value>
+ </enum>
+ </channel>
+ <crypto supported='yes'>
+ <enum name='model'>
+ <value>virtio</value>
+ </enum>
+ <enum name='type'>
+ <value>qemu</value>
+ </enum>
+ <enum name='backendModel'>
+ <value>builtin</value>
+ <value>lkcf</value>
+ </enum>
+ </crypto>
+ </devices>
+ <features>
+ <gic supported='no'/>
+ <vmcoreinfo supported='yes'/>
+ <genid supported='no'/>
+ <backingStoreInput supported='yes'/>
+ <backup supported='yes'/>
+ <async-teardown supported='yes'/>
+ <sev supported='no'/>
+ <sgx supported='no'/>
+ </features>
+</domainCapabilities>
diff --git a/tests/data/capabilities/kvm-loongarch64.xml b/tests/data/capabilities/kvm-loongarch64.xml
new file mode 100644
index 0000000..c15d4d9
--- /dev/null
+++ b/tests/data/capabilities/kvm-loongarch64.xml
@@ -0,0 +1,28 @@
+<capabilities>
+
+ <host>
+ <cpu>
+ <arch>loongarch64</arch>
+ </cpu>
+ <power_management/>
+ <iommu support='no'/>
+ </host>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name='loongarch64'>
+ <wordsize>64</wordsize>
+ <emulator>/usr/bin/qemu-system-loongarch64</emulator>
+ <domain type='qemu'/>
+ <domain type='kvm'/>
+ </arch>
+ <features>
+ <acpi default='on' toggle='yes'/>
+ <cpuselection/>
+ <deviceboot/>
+ <disksnapshot default='on' toggle='no'/>
+ <externalSnapshot/>
+ </features>
+ </guest>
+
+</capabilities>
diff --git a/tests/data/cli/compare/virt-install-kvm-loongarch64-basic.xml b/tests/data/cli/compare/virt-install-kvm-loongarch64-basic.xml
new file mode 100644
index 0000000..83444ba
--- /dev/null
+++ b/tests/data/cli/compare/virt-install-kvm-loongarch64-basic.xml
@@ -0,0 +1,99 @@
+<domain type="kvm">
+ <name>fedora19</name>
+ <uuid>00000000-1111-2222-3333-444444444444</uuid>
+ <metadata>
+ <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
+ <libosinfo:os id="http://fedoraproject.org/fedora/19"/>
+ </libosinfo:libosinfo>
+ </metadata>
+ <memory>65536</memory>
+ <currentMemory>65536</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type arch="loongarch64">hvm</type>
+ <boot dev="network"/>
+ </os>
+ <features>
+ <acpi/>
+ </features>
+ <cpu mode="custom" match="exact">
+ <model>la464</model>
+ </cpu>
+ <clock offset="utc"/>
+ <devices>
+ <emulator>/usr/bin/qemu-system-loongarch64</emulator>
+ <controller type="usb" model="qemu-xhci" ports="15"/>
+ <interface type="bridge">
+ <source bridge="testsuitebr0"/>
+ <mac address="00:11:22:33:44:55"/>
+ <model type="virtio"/>
+ </interface>
+ <console type="pty"/>
+ <channel type="unix">
+ <source mode="bind"/>
+ <target type="virtio" name="org.qemu.guest_agent.0"/>
+ </channel>
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+ <input type="tablet" bus="usb"/>
+ <input type="keyboard" bus="usb"/>
+ <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+ <image compression="off"/>
+ </graphics>
+ <sound model="ich6"/>
+ <video>
+ <model type="virtio"/>
+ </video>
+ </devices>
+ <on_reboot>destroy</on_reboot>
+</domain>
+<domain type="kvm">
+ <name>fedora19</name>
+ <uuid>00000000-1111-2222-3333-444444444444</uuid>
+ <metadata>
+ <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
+ <libosinfo:os id="http://fedoraproject.org/fedora/19"/>
+ </libosinfo:libosinfo>
+ </metadata>
+ <memory>65536</memory>
+ <currentMemory>65536</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type arch="loongarch64">hvm</type>
+ <boot dev="network"/>
+ </os>
+ <features>
+ <acpi/>
+ </features>
+ <cpu mode="custom" match="exact">
+ <model>la464</model>
+ </cpu>
+ <clock offset="utc"/>
+ <devices>
+ <emulator>/usr/bin/qemu-system-loongarch64</emulator>
+ <controller type="usb" model="qemu-xhci" ports="15"/>
+ <interface type="bridge">
+ <source bridge="testsuitebr0"/>
+ <mac address="00:11:22:33:44:55"/>
+ <model type="virtio"/>
+ </interface>
+ <console type="pty"/>
+ <channel type="unix">
+ <source mode="bind"/>
+ <target type="virtio" name="org.qemu.guest_agent.0"/>
+ </channel>
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+ <input type="tablet" bus="usb"/>
+ <input type="keyboard" bus="usb"/>
+ <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+ <image compression="off"/>
+ </graphics>
+ <sound model="ich6"/>
+ <video>
+ <model type="virtio"/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 774db09..65123f5 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1179,6 +1179,14 @@ c.add_compare("--connect %(URI-KVM-AARCH64)s --osinfo fedora30 --arch aarch64 --
+#####################
+# loongarch64 tests #
+#####################
+
+c.add_compare("--osinfo fedora19 --nodisks --pxe --connect " + utils.URIs.kvm_loongarch64, "kvm-loongarch64-basic")
+
+
+
#################
# AMD sev tests #
#################
diff --git a/tests/utils.py b/tests/utils.py
index 5c813f6..6d91a14 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -105,6 +105,7 @@ class _URIs(object):
self.kvm_ppc64le = _uri_qemu + _caps("kvm-ppc64le.xml") + _domcaps("kvm-ppc64le-domcaps.xml")
self.kvm_s390x = _uri_qemu + _caps("kvm-s390x.xml") + _domcaps("kvm-s390x-domcaps.xml")
self.qemu_riscv64 = _uri_qemu + _caps("qemu-riscv64.xml") + _domcaps("qemu-riscv64-domcaps.xml")
+ self.kvm_loongarch64 = _uri_qemu + _caps("kvm-loongarch64.xml") + _domcaps("kvm-loongarch64-domcaps.xml")
--
2.27.0

View File

@ -2,7 +2,7 @@
Name: virt-manager
Version: 4.1.0
Release: 3
Release: 4
Summary: The manage virtual machines tool which via libvirt.
License: GPLv2+
BuildArch: noarch
@ -10,6 +10,9 @@ URL: https://virt-manager.org/
Source0: https://virt-manager.org/download/sources/virt-manager/virt-manager-%{version}.tar.gz
Patch1: Add-loongarch-support.patch
Patch2: Add-loongarch-support-in-guest-class.patch
Patch3: Add-some-default-device-support-for-loongarch.patch
Patch4: Add-test-cases-for-loongarch.patch
Requires: virt-manager-common = %{version}-%{release} python3-gobject gtk3 libvirt-glib >= 0.0.9
Requires: gtk-vnc2 dconf vte291 gtksourceview4
@ -87,6 +90,9 @@ done
%{_mandir}/man1/{virt-install.1*,virt-clone.1*,virt-xml.1*}
%changelog
* Thu Feb 29 2024 lixianglai <lixianglai@loongson.cn> - 4.1.0-4
- Update loongarch code
* Wed Feb 28 2024 lijunwei <lijunwei@kylinos.cn> - 4.1.0-3
* fix bug that virt-manager can not support features dies