From 4090508053bc50116fa7092edfaa25455b2f383b Mon Sep 17 00:00:00 2001 From: dpd Date: Mon, 13 Apr 2026 10:58:26 +0800 Subject: [PATCH] add support for loongarch64 --- ...a-26.2.0-add-support-for-loongarch64.patch | 144 ++++++++++++++++++ openstack-nova.spec | 7 +- 2 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 0001-openstack-nova-26.2.0-add-support-for-loongarch64.patch diff --git a/0001-openstack-nova-26.2.0-add-support-for-loongarch64.patch b/0001-openstack-nova-26.2.0-add-support-for-loongarch64.patch new file mode 100644 index 0000000..32495a1 --- /dev/null +++ b/0001-openstack-nova-26.2.0-add-support-for-loongarch64.patch @@ -0,0 +1,144 @@ +From 3e7be562d39e6b3111d0dc4cf4588d9078741305 Mon Sep 17 00:00:00 2001 +From: doupengda +Date: Mon, 13 Apr 2026 10:52:48 +0800 +Subject: [PATCH] openstack-nova 26.2.0 add support for loongarch64 + +--- + nova/objects/fields.py | 2 ++ + nova/virt/arch.py | 4 +++- + nova/virt/libvirt/driver.py | 20 +++++++++++++++++--- + nova/virt/libvirt/utils.py | 3 +++ + 4 files changed, 25 insertions(+), 4 deletions(-) + +diff --git a/nova/objects/fields.py b/nova/objects/fields.py +index cae1ea4..3cbb4c4 100644 +--- a/nova/objects/fields.py ++++ b/nova/objects/fields.py +@@ -138,6 +138,8 @@ class Architecture(BaseNovaEnum): + IA64 = arch.IA64 + LM32 = arch.LM32 + ++ LOONGARCH64 = arch.LOONGARCH64 ++ + M68K = arch.M68K + MICROBLAZE = arch.MICROBLAZE + MICROBLAZEEL = arch.MICROBLAZEEL +diff --git a/nova/virt/arch.py b/nova/virt/arch.py +index 7518ab9..628739d 100644 +--- a/nova/virt/arch.py ++++ b/nova/virt/arch.py +@@ -24,6 +24,8 @@ I686 = 'i686' + IA64 = 'ia64' + LM32 = 'lm32' + ++LOONGARCH64 = 'loongarch64' ++ + M68K = 'm68k' + MICROBLAZE = 'microblaze' + MICROBLAZEEL = 'microblazeel' +@@ -56,7 +58,7 @@ XTENSAEB = 'xtensaeb' + + ALL = ( + ALPHA, ARMV6, ARMV7, ARMV7B, +- AARCH64, CRIS, I686, IA64, LM32, ++ AARCH64, CRIS, I686, IA64, LM32, LOONGARCH64, + M68K, MICROBLAZE, MICROBLAZEEL, MIPS, MIPSEL, + MIPS64, MIPS64EL, OPENRISC, PARISC, PARISC64, + PPC, PPCLE, PPC64, PPC64LE, PPCEMB, +diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py +index 467cfb8..17e91b2 100644 +--- a/nova/virt/libvirt/driver.py ++++ b/nova/virt/libvirt/driver.py +@@ -5344,6 +5344,8 @@ class LibvirtDriver(driver.ComputeDriver): + 'migration can break unless all compute nodes ' + 'have identical cpus. AArch64 does not support ' + 'other modes.') ++ elif arch == fields.Architecture.LOONGARCH64: ++ model = "la464" + else: + mode = "host-model" + if mode == "none": +@@ -5354,6 +5356,9 @@ class LibvirtDriver(driver.ComputeDriver): + if arch == fields.Architecture.AARCH64: + if not models: + models = ['max'] ++ if arch == fields.Architecture.LOONGARCH64: ++ if not models: ++ models = ["la464"] + + else: + if mode is None or mode == "none": +@@ -6308,6 +6313,8 @@ class LibvirtDriver(driver.ComputeDriver): + return 'virtio' + elif guestarch == fields.Architecture.MIPSEL: + return 'virtio' ++ elif guestarch == fields.Architecture.LOONGARCH64: ++ return 'virtio' + elif CONF.spice.enabled: + return 'qxl' + +@@ -6495,7 +6502,8 @@ class LibvirtDriver(driver.ComputeDriver): + caps = self._host.get_capabilities() + return self._host.supports_uefi and ( + hw_firmware_type == fields.FirmwareType.UEFI or +- caps.host.cpu.arch == fields.Architecture.AARCH64 ++ caps.host.cpu.arch == fields.Architecture.AARCH64 or ++ caps.host.cpu.arch == fields.Architecture.LOONGARCH64 + ) + + def _check_secure_boot_support( +@@ -6572,7 +6580,7 @@ class LibvirtDriver(driver.ComputeDriver): + + hw_firmware_type = image_meta.properties.get('hw_firmware_type') + +- if arch == fields.Architecture.AARCH64: ++ if arch == fields.Architecture.AARCH64 or arch == fields.Architecture.LOONGARCH64: + if not hw_firmware_type: + hw_firmware_type = fields.FirmwareType.UEFI + +@@ -6956,6 +6964,12 @@ class LibvirtDriver(driver.ComputeDriver): + ): + return True + ++ if ( ++ caps.host.cpu.arch == fields.Architecture.LOONGARCH64 and ++ guest.os_mach_type.startswith('virt') ++ ): ++ return True ++ + return False + + def _get_guest_config(self, instance, network_info, image_meta, +@@ -7402,7 +7416,7 @@ class LibvirtDriver(driver.ComputeDriver): + # TODO(stephenfin): We might want to do this for other non-x86 + # architectures + arch = self._check_emulation_arch(image_meta) +- if arch != fields.Architecture.AARCH64: ++ if arch != fields.Architecture.AARCH64 and arch != fields.Architecture.LOONGARCH64: + return None + + bus = 'usb' +diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py +index 0675e4a..ace9456 100644 +--- a/nova/virt/libvirt/utils.py ++++ b/nova/virt/libvirt/utils.py +@@ -527,6 +527,8 @@ def get_cpu_model_from_arch(arch: str) -> str: + # that all the stuff it can currently emulate, both for "TCG" and "KVM" + elif arch == obj_fields.Architecture.AARCH64: + mode = 'max' ++ elif arch == obj_fields.Architecture.LOONGARCH64: ++ mode = 'la464' + return mode + + +@@ -570,6 +572,7 @@ def get_default_machine_type(arch: str) -> ty.Optional[str]: + obj_fields.Architecture.S390X: "s390-ccw-virtio", + obj_fields.Architecture.I686: "pc", + obj_fields.Architecture.X86_64: "pc", ++ obj_fields.Architecture.LOONGARCH64: "virt", + } + return default_mtypes.get(arch) + +-- +2.43.7 + diff --git a/openstack-nova.spec b/openstack-nova.spec index e3f84f7..4756635 100644 --- a/openstack-nova.spec +++ b/openstack-nova.spec @@ -9,7 +9,7 @@ hardware configurations and seven major hypervisors.} Summary: OpenStack Compute (nova) Name: openstack-nova Version: 26.2.0 -Release: 6%{?dist} +Release: 7%{?dist} License: ASL 2.0 URL: http://openstack.org/projects/compute Source0: https://tarballs.openstack.org/nova/nova-%{version}.tar.gz @@ -37,6 +37,7 @@ Source21: nova_migration-rootwrap.conf Source22: nova_migration-rootwrap_cold_migration Patch3000: 0001-downgrade-the-version-of-qemu-from-4.2.0-to-4.1.0.patch +Patch3001: 0001-openstack-nova-26.2.0-add-support-for-loongarch64.patch BuildRequires: intltool python3-devel git-core python3-oslo-cache python3-os-traits python3-setuptools BuildRequires: python3-netaddr python3-pbr python3-six python3-oslo-i18n python3-cryptography python3-oslo-policy @@ -444,6 +445,10 @@ exit 0 %{python3_sitelib}/nova-*.egg-info %changelog +* Mon Apr 13 2026 doupengda - 26.2.0-7 +- [Type] sync +- [DESC] add support for loongarch64 + * Wed Jun 11 2025 bbrucezhang - 26.2.0-6 - Rebuilt for loongarch64 -- Gitee