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 <lixianglai@loongson.cn>
This commit is contained in:
Xianglai Li 2023-12-13 04:43:51 -05:00 committed by Pavel Hrdina
parent d2cf01b3eb
commit ea3cae4dc9
2 changed files with 19 additions and 6 deletions

View File

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

View File

@ -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):