From nobody Sun Feb 8 09:37:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1682343622; cv=none; d=zohomail.com; s=zohoarc; b=LoJbUxqw7TcoF3+kTZvXyVzT/VSzmjX9asqDGrnDjEoUCQvRr1+2TX1GxVUQvnVnA5vRRApascCsXuf21ibK94v9alUlJDa4qqLSxcDoCI3xPnJiL3AcAJXhVd+g4emSO5k06sdgaJ9VmwwsGFXYHp70Ads5xPA585oeOECDQuc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682343622; 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=dXukHNp29ft18lmiUF1Vfv+BZuS6BD8VR2e8abea/lw=; b=GPQcC5W7gvpDuZe45CiPXbo1rK8mUpmZ6DuxPfu4aSmhH08L7F8qgAj3JJlrOnLJbt00yo19WcYHx/HMUIFuiLRWZD1QwNMpxjyG/5blQ0vnBOlZaLvgrfYJyDA2li8xR+0ol2sWQmnck45nsm2jmShpcYwlQloIQpE2w5yeBOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1682343621997338.94749123621693; Mon, 24 Apr 2023 06:40:21 -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-154-wkH8dHPhP2qKH9o_NxV0Dg-1; Mon, 24 Apr 2023 09:40:17 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 93E11886463; Mon, 24 Apr 2023 13:40:13 +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 80E241121318; Mon, 24 Apr 2023 13:40:13 +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 6A252194658D; Mon, 24 Apr 2023 13:40:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D3E2E1946588 for ; Mon, 24 Apr 2023 13:40:09 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BA3312166B2B; Mon, 24 Apr 2023 13:40:09 +0000 (UTC) Received: from fedora.. (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6170E2166B29 for ; Mon, 24 Apr 2023 13:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682343621; 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=dXukHNp29ft18lmiUF1Vfv+BZuS6BD8VR2e8abea/lw=; b=JEI0ACkPsuSCLvJN9vzyRFRpm4qEGs5s27XUeqhetpBMJiYyW6jvDqCkIVONmp3SqaXJs0 Ic+b1Mg6MUZJxGrTTAq/Uvsepj8VGNSWltUiRlrHc+XosMIx9glesQpmmorhK+NGv8AZTR DSunPsi2wxxBvT5vx+p9IhUGdV3KbT0= X-MC-Unique: wkH8dHPhP2qKH9o_NxV0Dg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCHv2 2/3] qemu: add support for setting host-phys-bits-limit Date: Mon, 24 Apr 2023 15:40:03 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682343623216100001 Translate to: host-phys-bits-limit=3D39 https://gitlab.com/libvirt/libvirt/-/issues/450 https://bugzilla.redhat.com/show_bug.cgi?id=3D2171860 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/qemu/qemu_command.c | 3 ++ ...-phys-bits-emulate-bare.x86_64-latest.args | 34 +++++++++++++++++++ .../cpu-phys-bits-limit.x86_64-latest.args | 33 ++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 71 insertions(+) create mode 100644 tests/qemuxml2argvdata/cpu-phys-bits-emulate-bare.x86_6= 4-latest.args create mode 100644 tests/qemuxml2argvdata/cpu-phys-bits-limit.x86_64-lates= t.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4ca93bf3dc..1d99f8a46a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6524,6 +6524,9 @@ qemuBuildCpuCommandLine(virCommand *cmd, switch (addr->mode) { case VIR_CPU_MAX_PHYS_ADDR_MODE_PASSTHROUGH: virBufferAddLit(&buf, ",host-phys-bits=3Don"); + + if (addr->limit > 0) + virBufferAsprintf(&buf, ",host-phys-bits-limit=3D%d", addr= ->limit); break; =20 case VIR_CPU_MAX_PHYS_ADDR_MODE_EMULATE: diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-emulate-bare.x86_64-lates= t.args b/tests/qemuxml2argvdata/cpu-phys-bits-emulate-bare.x86_64-latest.ar= gs new file mode 100644 index 0000000000..3fa8384ace --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-emulate-bare.x86_64-latest.args @@ -0,0 +1,34 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-foo \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-foo/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-foo/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-foo/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dfoo,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-foo/master-key.aes"}' \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram \ +-accel kvm \ +-cpu host,migratable=3Don,host-phys-bits=3Doff \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x2"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/cpu-phys-bits-limit.x86_64-latest.args = b/tests/qemuxml2argvdata/cpu-phys-bits-limit.x86_64-latest.args new file mode 100644 index 0000000000..1c20243050 --- /dev/null +++ b/tests/qemuxml2argvdata/cpu-phys-bits-limit.x86_64-latest.args @@ -0,0 +1,33 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-foo \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-foo/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-foo/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-foo/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dfoo,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-foo/master-key.aes"}' \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,acpi= =3Doff \ +-accel kvm \ +-cpu host,migratable=3Don,host-phys-bits=3Don,host-phys-bits-limit=3D39 \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x2"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 23e0c4054c..48ddc102f7 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2722,6 +2722,7 @@ mymain(void) DO_TEST("cpu-phys-bits-emulate2", QEMU_CAPS_KVM); DO_TEST_PARSE_ERROR("cpu-phys-bits-emulate3", QEMU_CAPS_KVM); DO_TEST_PARSE_ERROR("cpu-phys-bits-passthrough2", QEMU_CAPS_KVM); + DO_TEST_CAPS_LATEST("cpu-phys-bits-limit"); =20 DO_TEST_CAPS_VER("sgx-epc", "7.0.0"); =20 --=20 2.39.2