diff --git a/0015-libvirt-Add-support-for-phytium-live-migrate-and-s5000c-mode.patch b/0015-libvirt-Add-support-for-phytium-live-migrate-and-s5000c-mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..c992af4307427877dcde48be7983fcd12a93c70e --- /dev/null +++ b/0015-libvirt-Add-support-for-phytium-live-migrate-and-s5000c-mode.patch @@ -0,0 +1,143 @@ +From e5b5147b704498c008497620766631015ffb9255 Mon Sep 17 00:00:00 2001 +From: liyuting +Date: Mon, 30 Jun 2025 15:25:46 +0800 +Subject: [PATCH] [Feature] Add support for phytium host-model and s5000c model + +--- + src/cpu/cpu_arm.c | 1 + + src/cpu_map/arm_Tengyun-S5000C.xml | 6 +++ + src/cpu_map/index.xml | 1 + + src/cpu_map/meson.build | 1 + + src/qemu/qemu_capabilities.c | 60 +++++++++++++++++++++++++++++- + 5 files changed, 68 insertions(+), 1 deletion(-) + create mode 100644 src/cpu_map/arm_Tengyun-S5000C.xml + +diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c +index 324c701..c160552 100644 +--- a/src/cpu/cpu_arm.c ++++ b/src/cpu/cpu_arm.c +@@ -661,6 +661,7 @@ virCPUarmDecode(virCPUDef *cpu, + + if (cpuData->features) { + cpu->nfeatures = g_strv_length(cpuData->features); ++ cpu->nfeatures_max = cpu->nfeatures; + cpu->features = g_new0(virCPUFeatureDef, cpu->nfeatures); + + for (i = 0; i < cpu->nfeatures; i++) { +diff --git a/src/cpu_map/arm_Tengyun-S5000C.xml b/src/cpu_map/arm_Tengyun-S5000C.xml +new file mode 100644 +index 0000000..f8fa593 +--- /dev/null ++++ b/src/cpu_map/arm_Tengyun-S5000C.xml +@@ -0,0 +1,6 @@ ++ ++ ++ ++ ++ ++ +diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml +index 5d18a4a..bca4a3d 100644 +--- a/src/cpu_map/index.xml ++++ b/src/cpu_map/index.xml +@@ -119,5 +119,6 @@ + + + ++ + + +diff --git a/src/cpu_map/meson.build b/src/cpu_map/meson.build +index ca4934d..409f3c0 100644 +--- a/src/cpu_map/meson.build ++++ b/src/cpu_map/meson.build +@@ -11,6 +11,7 @@ cpumap_data = [ + 'arm_Neoverse-N2.xml', + 'arm_Neoverse-V1.xml', + 'arm_Tengyun-S2500.xml', ++ 'arm_Tengyun-S5000C.xml', + 'arm_ThunderX299xx.xml', + 'arm_vendors.xml', + 'index.xml', +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index ae44328..3f92b75 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -3718,7 +3718,62 @@ virQEMUCapsInitCPUModelX86(virQEMUCaps *qemuCaps, + return 0; + } + ++/** ++ * Returns 0 when host CPU model provided by QEMU was filled in qemuCaps, ++ * 1 when the caller should fall back to using virCaps *->host.cpu, ++ * 2 when cpu model info is not supported for this configuration, ++ * -1 on error. ++ */ ++static int ++virQEMUCapsInitCPUModelARM(virQEMUCaps *qemuCaps, ++ virDomainVirtType type, ++ qemuMonitorCPUModelInfo *modelInfo, ++ virCPUDef *cpu, ++ bool migratable) ++{ ++ size_t i; ++ g_autoptr(virCPUDef) hostCPU = NULL; ++ ++ if (!modelInfo) { ++ if (type == VIR_DOMAIN_VIRT_KVM) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("missing host CPU model info from QEMU " ++ "capabilities for binary %s"), ++ qemuCaps->binary); ++ return -1; ++ } ++ return 2; ++ } ++ ++ if (!(hostCPU = virQEMUCapsProbeHostCPU(qemuCaps->arch, NULL))) ++ return -1; ++ ++ cpu->model = g_strdup(hostCPU->model); ++ cpu->features = g_new0(virCPUFeatureDef, modelInfo->nprops); + ++ cpu->nfeatures_max = modelInfo->nprops; ++ cpu->nfeatures = 0; ++ ++ for (i = 0; i < modelInfo->nprops; i++) { ++ virCPUFeatureDef *feature = cpu->features + cpu->nfeatures; ++ qemuMonitorCPUProperty *prop = modelInfo->props + i; ++ const char *name = virQEMUCapsCPUFeatureFromQEMU(qemuCaps->arch, prop->name); ++ ++ if (prop->type != QEMU_MONITOR_CPU_PROPERTY_BOOLEAN) ++ continue; ++ ++ feature->name = g_strdup(name); ++ ++ if (!prop->value.boolean || ++ (migratable && prop->migratable == VIR_TRISTATE_BOOL_NO)) ++ feature->policy = VIR_CPU_FEATURE_DISABLE; ++ else ++ feature->policy = VIR_CPU_FEATURE_REQUIRE; ++ cpu->nfeatures++; ++ } ++ ++ return 0; ++} + /** + * Returns 0 when host CPU model provided by QEMU was filled in qemuCaps, + * 1 when the caller should fall back to other methods, +@@ -3743,7 +3798,10 @@ virQEMUCapsInitCPUModel(virQEMUCaps *qemuCaps, + } else if (ARCH_IS_X86(qemuCaps->arch)) { + ret = virQEMUCapsInitCPUModelX86(qemuCaps, type, modelInfo, + cpu, migratable); +- } else if (ARCH_IS_ARM(qemuCaps->arch) || ARCH_IS_LOONGARCH(qemuCaps->arch)) { ++ } else if (ARCH_IS_ARM(qemuCaps->arch)) { ++ ret = virQEMUCapsInitCPUModelARM(qemuCaps, type, modelInfo, ++ cpu, migratable); ++ } else if (ARCH_IS_LOONGARCH(qemuCaps->arch)) { + ret = 2; + } + +-- +2.25.1 + diff --git a/libvirt.spec b/libvirt.spec index c834f41a8086d0c1c93d35985f1542bc67a18335..152ded6109e7e1d57441b5a9d92ef88e5fef185b 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -113,7 +113,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 9.10.0 -Release: 3%{?dist} +Release: 4%{?dist} License: LGPLv2+ URL: https://libvirt.org/ Source0: https://libvirt.org/sources/libvirt-%{version}.tar.xz @@ -132,6 +132,8 @@ Patch0010: 0010-conf-qemu-Fix-some-code-about-Reuse-ASID-for-Hygon-C.patch # Support provide blobs for secret injection for Hygon Confidential VMs Patch0011: 0011-conf-qemu-support-provide-inject-secret-for-Hygon-CS.patch Patch0012: remote_driver-fix-the-UAF-causing-UnicodeDecodeError.patch +#Add support for phytium host-model and s5000c model +Patch0015: 0015-libvirt-Add-support-for-phytium-live-migrate-and-s5000c-mode.patch Requires: libvirt-daemon = %{version}-%{release} Requires: libvirt-daemon-config-network = %{version}-%{release} @@ -2114,6 +2116,9 @@ exit 0 %changelog +* Tue Jul 15 2025 liyuting - 9.10.0-4 +- phytium: Add support for phytium live migrate and s5000c model + * Sat Jan 4 2025 Xianglai Li - 9.10.0-3 -fix the UAF causing "UnicodeDecodeError: 'utf-8' codec can't decode byte XXX".