From ea3cae4dc9b6f0e9377dba74b01a3a54b14dc615 Mon Sep 17 00:00:00 2001 From: Xianglai Li Date: Wed, 13 Dec 2023 04:43:51 -0500 Subject: [PATCH] Add some default device support for loongarch Add adaptations for loongarch with the following features: Default video Support UEFI prefer Usb tablet and usb keyboard rng and memballoon sound device Usb controller Signed-off-by: Xianglai Li --- virtinst/devices/video.py | 2 ++ virtinst/guest.py | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/virtinst/devices/video.py b/virtinst/devices/video.py index 70067a72c..97adf7d33 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/guest.py b/virtinst/guest.py index 493576dcc..652efece5 100644 --- a/virtinst/guest.py +++ b/virtinst/guest.py @@ -353,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_loongarch64()): return True if not os_support: @@ -544,6 +545,7 @@ class Guest(XMLBuilder): else: prefer_efi = (self.os.is_arm_machvirt() or self.os.is_riscv_virt() or + self.os.is_loongarch64() or self.conn.is_bhyve()) log.debug("Prefer EFI => %s", prefer_efi) @@ -910,7 +912,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 @@ -992,7 +995,10 @@ class Guest(XMLBuilder): # For pseries, we always assume OS supports usb3 if qemu_usb3: usb3 = True - + elif self.os.is_loongarch64(): + # For loongarch64, we always assume OS supports usb3 + if qemu_usb3: + usb3 = True if usb2: for dev in DeviceController.get_usb2_controllers(self.conn): @@ -1024,7 +1030,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_loongarch64()): return self.add_device(DeviceGraphics(self.conn)) @@ -1037,7 +1044,8 @@ class Guest(XMLBuilder): 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 if (self.conn.is_qemu() and @@ -1083,7 +1091,8 @@ class Guest(XMLBuilder): 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 if self.osinfo.supports_virtioballoon(self._extra_drivers): @@ -1110,6 +1119,8 @@ class Guest(XMLBuilder): return True if self.os.is_riscv_virt(): return True + if self.os.is_loongarch64(): + return True return False def _add_q35_pcie_controllers(self):