From: Jiri Denemark Date: Thu, 31 Oct 2024 13:19:54 +0000 (+0100) Subject: qemu: Fix maximum physical address size in baseline CPU X-Git-Tag: v10.10.0-rc1~215 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e71a510605f13c7701a4f0b4911973d32bb2eb02;p=thirdparty%2Flibvirt.git qemu: Fix maximum physical address size in baseline CPU We should include maximum physical address size in the CPU definition created by virConnectBaselineHypervisorCPU only if we know the value for all input CPUs. Otherwise we would create a CPU definition that is not usable on all hosts from which we gathered the CPU info. https://issues.redhat.com/browse/RHEL-24850 Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 72211da137..72a9542c0b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11914,10 +11914,12 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn, goto cleanup; for (i = 0; i < ncpus; i++) { - if (!cpus[i]->addr || cpus[i]->addr->limit == 0) + if (!cpus[i]->addr || cpus[i]->addr->limit == 0) { + physAddrSize = 0; continue; + } - if (physAddrSize == 0 || cpus[i]->addr->limit < physAddrSize) + if (i == 0 || cpus[i]->addr->limit < physAddrSize) physAddrSize = cpus[i]->addr->limit; }