From nobody Sun Feb 8 12:19:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686903264; cv=none; d=zohomail.com; s=zohoarc; b=Yl9tazWWzeGzkd7vZKR+/0+9jA24HORIiNRFR4CDCZ4UMRHChxABY5o6sAIbS3yHpnInv/x50643Jq8LWfRxwFhXkFGiE+7bwA79Ab6DfremHU4mNnyopF23cDH9jhDtroeaoIBXaUZ4cXsfJh08OfLNGPA3e5juRLo4m7DXCHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686903264; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cHgS/X85XSefL16UoB8mSaVPTEnt699am6d9sUfoLY0=; b=AFl4i6K22UEFkUIzuLHUrDgjyoEboDBSwMRJ8VSHG1RihF2WAvi+1K5QNW6LozTOWBtfvXT5TGyDDyAcJW8Db3pA0PskdATCSBdnrLj7iBuFgABXaXxLycofjagInBoDIl9jRWfllUycx7Ubr9OVdIBbmbfKz7o3b1imZE9gZuo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1686903264701830.3510080436356; Fri, 16 Jun 2023 01:14:24 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-225-viCTt4t-NFi9-dyDbJBjCQ-1; Fri, 16 Jun 2023 04:14:19 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D92B85A5A6; Fri, 16 Jun 2023 08:14:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 783AA492B06; Fri, 16 Jun 2023 08:14:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5091C1946594; Fri, 16 Jun 2023 08:14:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 554681946A43 for ; Fri, 16 Jun 2023 08:14:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 362EE422E2; Fri, 16 Jun 2023 08:14:16 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.45.224.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA5B063F4A for ; Fri, 16 Jun 2023 08:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686903263; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=cHgS/X85XSefL16UoB8mSaVPTEnt699am6d9sUfoLY0=; b=X7FinSF0d/ALz7RRdb6/l1f1kZQi/VGJ7upkYBJ+23/ZBFmqJxppJK3YZujP6Be3+Dxavd n6d9Qn5cAB9igbuack9PRGwxu/I9GrEQVaLit33RW8mvXAH7vwSiy+sj7VjESQqi/pDFIq 19koEzqohX5dXJFy0ZSQmAIEhg/a+IU= X-MC-Unique: viCTt4t-NFi9-dyDbJBjCQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 2/3] qemu: Include maximum physical address size in baseline CPU Date: Fri, 16 Jun 2023 10:14:09 +0200 Message-ID: <502e07ee4772fcfdf5cd398e40eb41195ec08584.1686903214.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686903265479100001 Content-Type: text/plain; charset="utf-8" The current implementation of virConnectBaselineHypervisorCPU in QEMU driver can provide a CPU definition that will not work on all hosts in case they have different maximum physical address size. So when we get the info from domain capabilities, we need to choose the smallest physical address size for the computed baseline CPU definition. https://bugzilla.redhat.com/show_bug.cgi?id=3D2171860 Signed-off-by: Jiri Denemark --- src/qemu/qemu_driver.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 857fbfb799..c4bd766531 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11778,6 +11778,8 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn, virCPUDef *cpu =3D NULL; char *cpustr =3D NULL; g_auto(GStrv) features =3D NULL; + unsigned int physAddrSize =3D 0; + size_t i; =20 virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); @@ -11845,6 +11847,21 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr con= n, virCPUExpandFeatures(arch, cpu) < 0) goto cleanup; =20 + for (i =3D 0; i < ncpus; i++) { + if (!cpus[i]->addr || cpus[i]->addr->limit =3D=3D 0) + continue; + + if (physAddrSize =3D=3D 0 || cpus[i]->addr->limit < physAddrSize) + physAddrSize =3D cpus[i]->addr->limit; + } + + if (physAddrSize > 0) { + cpu->addr =3D g_new0(virCPUMaxPhysAddrDef, 1); + cpu->addr->mode =3D VIR_CPU_MAX_PHYS_ADDR_MODE_PASSTHROUGH; + cpu->addr->limit =3D physAddrSize; + cpu->addr->bits =3D -1; + } + cpustr =3D virCPUDefFormat(cpu, NULL); =20 cleanup: --=20 2.41.0