From nobody Sat Feb 7 04:27:35 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=1680004703; cv=none; d=zohomail.com; s=zohoarc; b=Jt9pbBwAS4jqBkXR3lpo8+evnRsmHXrI3o2eBOwq7LaHgONmynBO4+KtsxqZ+lyGkLmOMx7SQ9b/XoaUBr9fipMM37TU7mBErSpVpB579ekDKsED6UuVcYoltex/5gAIwD68xNE8kQHLMAdPGHS/bcYaGS65ltIf1UmP4GY2Bec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680004703; 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=jL2VKgCQlShIvEY+WEWPiA/EE3+xsIzY0i5RRnZEh3k=; b=lWsBq/DxgA3InHbNS5xBxvt6wkZOB5xIj00L9z+HeauuvHOFGZJViaP64s3YAwOEnvf5/BtiRNCqUBB+TxeKlOHQnSpTvFuojHVMgZhkHfmYXlq4HJ0n4EKYOA3eUJrPHEAif2xJiFLquf7pZYMNeQa98Fb+cN7E3tq7w9SgFd4= 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 1680004703070740.8198181429126; Tue, 28 Mar 2023 04:58:23 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-338-E180GBY7PIef9TnsIxxqZA-1; Tue, 28 Mar 2023 07:58:17 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25ED6280D595; Tue, 28 Mar 2023 11:58:14 +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 DFA4D14171BB; Tue, 28 Mar 2023 11:58:11 +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 92715194658D; Tue, 28 Mar 2023 11:58:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EA4CC194658C for ; Tue, 28 Mar 2023 11:58:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C78261121333; Tue, 28 Mar 2023 11:58:05 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F06D1121330 for ; Tue, 28 Mar 2023 11:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680004702; 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=jL2VKgCQlShIvEY+WEWPiA/EE3+xsIzY0i5RRnZEh3k=; b=cesy40RoWSWFEVRQsSxYG84GY2E0g0/VuqewDIRaMrM0HHp4AIuFVdAdg1ilE/aqt1n7ix uLHCmTty7NPC6Rxea5QVZplgeICJ+C+kQ2jP56rp05xb8sTF8NiwEJrAwQT0zS5bUXjedb ZFN/cIQUCD85w6RgY6SaPuJAVsxJDNo= X-MC-Unique: E180GBY7PIef9TnsIxxqZA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 1/3] conf: Introduce
for virtio-mem and virtio-pmem Date: Tue, 28 Mar 2023 13:58:01 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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.7 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: 1680004704667100002 Content-Type: text/plain; charset="utf-8"; x-default="true" Both virtio-mem and virtio-pmem devices have '.memaddr' attribute which controls the address where they are mapped in the guest memory. Ideally, users do not need to specify this as QEMU does the right thing and computes addresses automatically on startup. But soon, we will need to record this address as it is part of guest ABI. And also, there might be some users that want to control this value. Now, we are in a bit of a pickle, because both these device types already have a PCI address, therefore we can't just use
blindly. But what we can do, is introduce
under the element. This is also more conceptual, as knobs under control guest visible config of memory device (and .memaddr surely falls into that category). NB, SgxEPCDeviceInfo struct in QMP definition also has .memaddr attribute, but because of the way we build cmd line there's no (easy) way to set the attribute. So ignore that for now. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- docs/formatdomain.rst | 7 ++++++ src/conf/domain_conf.c | 24 ++++++++++++++++++- src/conf/domain_conf.h | 2 ++ src/conf/domain_validate.c | 6 +++++ src/conf/schemas/domaincommon.rng | 7 ++++++ .../memory-hotplug-virtio-mem.xml | 1 + .../memory-hotplug-virtio-pmem.xml | 1 + 7 files changed, 47 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 27f83e254d..092d2296d5 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -8100,6 +8100,7 @@ Example: usage of the memory devices 524288 +
@@ -8113,6 +8114,7 @@ Example: usage of the memory devices 2048 1048576 524288 +
@@ -8256,6 +8258,11 @@ Example: usage of the memory devices element is formatted into live XML and never parsed, i.e. it is output-only element. =20 + ``address`` + For ``virtio-mem`` and ``virtio-pmem`` only. + The physical address in memory, where device is mapped. :since:`Since + 9.3.0` + =20 IOMMU devices ~~~~~~~~~~~~~ diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9f49c6e62d..bed6acac3a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13377,6 +13377,7 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node, virDomainMemoryDef *def) { VIR_XPATH_NODE_AUTORESTORE(ctxt) + xmlNodePtr addrNode =3D NULL; int rv; =20 ctxt->node =3D node; @@ -13422,16 +13423,27 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node, if (virDomainParseMemory("./requested", "./requested/@unit", ctxt, &def->requestedsize, false, false) < 0) return -1; + + addrNode =3D virXPathNode("./address", ctxt); + break; + + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: + addrNode =3D virXPathNode("./address", ctxt); break; =20 case VIR_DOMAIN_MEMORY_MODEL_NONE: case VIR_DOMAIN_MEMORY_MODEL_DIMM: - case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: case VIR_DOMAIN_MEMORY_MODEL_LAST: break; } =20 + if (addrNode && + virXMLPropULongLong(addrNode, "base", 16, + VIR_XML_PROP_NONE, &def->address) < 0) { + return -1; + } + return 0; } =20 @@ -20996,6 +21008,13 @@ virDomainMemoryDefCheckABIStability(virDomainMemor= yDef *src, return false; } =20 + if (src->address !=3D dst->address) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target memory device address '0x%llx' doesn't ma= tch source memory device address '0x%llx'"), + dst->address, src->address); + return false; + } + if (src->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM) { if (src->labelsize !=3D dst->labelsize) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -25184,6 +25203,9 @@ virDomainMemoryTargetDefFormat(virBuffer *buf, } } =20 + if (def->address) + virBufferAsprintf(&childBuf, "
\n", def->= address); + virXMLFormatElement(buf, "target", NULL, &childBuf); } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 5a2c70f012..0a8e877a63 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2646,6 +2646,8 @@ struct _virDomainMemoryDef { unsigned long long currentsize; /* kibibytes, valid for VIRTIO_MEM and active domain only, only to report = never parse */ + unsigned long long address; /* address where memory is mapped, valid f= or + VIRTIO_PMEM and VIRTIO_MEM only. */ bool readonly; /* valid only for NVDIMM */ =20 /* required for QEMU NVDIMM ppc64 support */ diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index f208c0c531..ad76a21ca2 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2358,6 +2358,12 @@ virDomainMemoryDefValidate(const virDomainMemoryDef = *mem, _("requested size must be an integer multiple o= f block size")); return -1; } + + if (mem->address % mem->blocksize !=3D 0) { + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("memory device address must be aligned to blo= cksize")); + return -1; + } break; =20 case VIR_DOMAIN_MEMORY_MODEL_DIMM: diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 6158ed79ac..9af47f9688 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -7153,6 +7153,13 @@ + + + + + + + diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml b/tests/q= emuxml2argvdata/memory-hotplug-virtio-mem.xml index 73036d8602..f5cc4a35ed 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.xml @@ -65,6 +65,7 @@ 0 2048 1048576 +
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml b/tests/= qemuxml2argvdata/memory-hotplug-virtio-pmem.xml index 4cebd294ec..21b90e4d8a 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.xml @@ -47,6 +47,7 @@ 524288 +
--=20 2.39.2 From nobody Sat Feb 7 04:27:35 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=1680004708; cv=none; d=zohomail.com; s=zohoarc; b=D+KbepsGv+0maRN1BlsG7en6XbLB+68P9npJiVNUL6FwB65YDVCSmRdYCrWw9HwiZigH5CQ/L0HttQ77ytJ10CjYB2t+AIS7AA8Ucs/KGTKhxCug9fyxJzUsqzRUETfdGiqhn4mRLzkxb+LPJymhSrVs1zicFCqAuSjN8/DtjRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680004708; 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=j/OCRywQCzAEkiCEFvlZ83YAIXnPhG3SzdKHeNor3xk=; b=QaR1bwZCzX5QtS9ZqrlzbC7ina7UbCOcEGdzLkeVTgF2yo/f3KmpeZdhbYq5Qa7pckU3LcleuteIaTeBBWAvbK/P1g9rJXw/6TGDbNd/xZXu6utfYKT4Cd95zQEHKHRRV8lgKTQAVHh8obPna9zpvNwIOCGgDdxk+gXbfc+hq0k= 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 1680004708501717.4161251297584; Tue, 28 Mar 2023 04:58:28 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-452-Pk9YCFZgOryXf0KyeNRk4A-1; Tue, 28 Mar 2023 07:58:21 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 13D51385F372; Tue, 28 Mar 2023 11:58:19 +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 01757492C13; Tue, 28 Mar 2023 11:58:19 +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 106CC19465A4; Tue, 28 Mar 2023 11:58:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 92A881946A78 for ; Tue, 28 Mar 2023 11:58:11 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 670F31121333; Tue, 28 Mar 2023 11:58:06 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B8291121330 for ; Tue, 28 Mar 2023 11:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680004707; 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=j/OCRywQCzAEkiCEFvlZ83YAIXnPhG3SzdKHeNor3xk=; b=epGf1HyIM83o/FRE/h6m7qmJ/rxMKBOK3inlvjbH66iz3OlYKhPDnIvZaz7aNenL8b0vAa iCQ27Tvl7GYirpIeJiFJSNM8YeF9RvEpaL9f4TFzcYTikd9GNB5wlyipWzbcaRoYEKx81t tilhs4uDpXq8QJFIbb0IvA7ZTRDhDK4= X-MC-Unique: Pk9YCFZgOryXf0KyeNRk4A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 2/3] qemu: Fill virtio-mem/virtio-pmem .memaddr at runtime Date: Tue, 28 Mar 2023 13:58:02 +0200 Message-Id: <071f73fc67399e42f42e93377053e6842000a103.1680004662.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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.9 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: 1680004710668100001 Content-Type: text/plain; charset="utf-8"; x-default="true" After a QEMU domain is started, among other thing we query memory device information. And while memory address is returned by QEMU for all models, we store it only for DIMMs and NVDIMMs. Do store it for VIRTIO_MEM and VIRTIO_PMEM too. This effectively reports the address the virtio-mem/virtio-pmem is mapped to in live XML. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_domain.c | 7 +++++-- src/qemu/qemu_monitor_json.c | 12 ++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 6c29c8f09f..c10e939e0c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8538,7 +8538,11 @@ qemuDomainUpdateMemoryDeviceInfo(virDomainObj *vm, =20 switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: - mem->currentsize =3D VIR_DIV_UP(dimm->size, 1024); + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: + if (mem->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM) { + mem->currentsize =3D VIR_DIV_UP(dimm->size, 1024); + } + mem->address =3D dimm->address; break; =20 case VIR_DOMAIN_MEMORY_MODEL_DIMM: @@ -8548,7 +8552,6 @@ qemuDomainUpdateMemoryDeviceInfo(virDomainObj *vm, mem->info.addr.dimm.base =3D dimm->address; break; =20 - case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: case VIR_DOMAIN_MEMORY_MODEL_NONE: case VIR_DOMAIN_MEMORY_MODEL_LAST: diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index f4416c929f..3b2caf05e2 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7265,6 +7265,7 @@ qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitor *mon, case VIR_DOMAIN_MEMORY_MODEL_DIMM: case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: /* While 'id' attribute is marked as optional in QEMU's QAPI * specification, Libvirt always sets it. Thus we can fail if = not * present. */ @@ -7305,13 +7306,21 @@ qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitor *mon, return -1; =20 } - } else if (model =3D=3D VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM) { + } else if (model =3D=3D VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM || + model =3D=3D VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM) { if (virJSONValueObjectGetNumberUlong(dimminfo, "size", &meminfo->size) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed/missing size in virtio mem= ory info")); return -1; } + + if (virJSONValueObjectGetNumberUlong(dimminfo, "memaddr", + &meminfo->address) < = 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed/missing memaddr in virtio = memory info")); + return -1; + } } break; =20 @@ -7336,7 +7345,6 @@ qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitor *mon, } break; =20 - case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: case VIR_DOMAIN_MEMORY_MODEL_NONE: case VIR_DOMAIN_MEMORY_MODEL_LAST: /* type not handled yet */ --=20 2.39.2 From nobody Sat Feb 7 04:27:35 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=1680004704; cv=none; d=zohomail.com; s=zohoarc; b=YuDjYjf3BSplLqvA2L3OCPulM4qwRtziWXHCCYwxhL97vCXXsb0TlimU7U9K8X4Mfc2RUtfyLcxLfYZbalQQupcJPjfQfjGm9QTeH2eVsOoTN9f+J6PU+HgNuS6xmLBtmyZ1gKHkOH9Vnc2Br215w8w56rHrgo1OLNIhSrZMEPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680004704; 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=fZr/6gBRD6t8Y0R9yy8zgffcpL2odb6LYBu0KYIWoa0=; b=DPHI1sLYkOoK0jNUIKzHBFnHNjfcaIT9wlzmuhTSCMb/CYPkAptqaQTEHriSRhLPewIR79WeGAbeeqIVxJd6qs6ujYxKlludE4G7gzeIIY9LFByy8wzDE23lMPGjmNaRcR1sjp4v4Yv9adsTEoAtvBU+2b2D0ViIQ2698pjxABM= 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 1680004703997376.3339054987591; Tue, 28 Mar 2023 04:58:23 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-550-tXLH1faSNmuT05h8BzwB2g-1; Tue, 28 Mar 2023 07:58:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BC3B0280D590; Tue, 28 Mar 2023 11:58:18 +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 A7D2D4020C82; Tue, 28 Mar 2023 11:58:18 +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 C9BF91946A42; Tue, 28 Mar 2023 11:58:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 166A71946A41 for ; Tue, 28 Mar 2023 11:58:07 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 076A91121330; Tue, 28 Mar 2023 11:58:07 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A04091121339 for ; Tue, 28 Mar 2023 11:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680004703; 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=fZr/6gBRD6t8Y0R9yy8zgffcpL2odb6LYBu0KYIWoa0=; b=WTSrIK6blgQG4xpZU86qks5sOwQeIzBqZztGHzaAh5XR/7+rAoKSglxZaq/SUjMkAOy96q +501naLca8l/YshrGEl0Fu0XoQB6w9bxQhGAGM/HWpGCueCQnqnqbKcOTjmqxQKdp7nql7 tky5QvedFRt4ecCCpBUtS7ywP2Aw6W4= X-MC-Unique: tXLH1faSNmuT05h8BzwB2g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 3/3] qemu_command: Generate .memaddr for virtio-mem and virtio-pmem Date: Tue, 28 Mar 2023 13:58:03 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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.2 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: 1680004704653100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This is fairly trivial. Just set .memaddr attribute if a value was set in the XML. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2180679 Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_command.c | 1 + .../memory-hotplug-virtio-mem.x86_64-latest.args | 2 +- .../memory-hotplug-virtio-pmem.x86_64-5.2.0.args | 2 +- .../memory-hotplug-virtio-pmem.x86_64-latest.args | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7e75354902..717dadd492 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3628,6 +3628,7 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, "T:unarmed", unarmed, "s:memdev", memdev, "B:prealloc", prealloc, + "P:memaddr", mem->address, "s:id", mem->info.alias, NULL) < 0) return NULL; diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest= .args b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args index ba1dd872ba..592578fb59 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args @@ -32,7 +32,7 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGue= st1/.config \ -object '{"qom-type":"memory-backend-ram","id":"memvirtiomem0","reserve":f= alse,"size":1073741824}' \ -device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"request= ed-size":536870912,"memdev":"memvirtiomem0","id":"virtiomem0","bus":"pci.0"= ,"addr":"0x2"}' \ -object '{"qom-type":"memory-backend-file","id":"memvirtiomem1","mem-path"= :"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","reserve":false,"size":21474= 83648,"host-nodes":[1,2,3],"policy":"bind"}' \ --device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"request= ed-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"id":"virtiome= m1","bus":"pci.1","addr":"0x1"}' \ +-device '{"driver":"virtio-mem-pci","node":0,"block-size":2097152,"request= ed-size":1073741824,"memdev":"memvirtiomem1","prealloc":true,"memaddr":5637= 144576,"id":"virtiomem1","bus":"pci.1","addr":"0x1"}' \ -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-form= at","id":"ide0-0-0","bootindex":1}' \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-5.2.0= .args b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-5.2.0.args index 4972285a3e..e28dd339e9 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-5.2.0.args +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-5.2.0.args @@ -30,7 +30,7 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGue= st1/.config \ -boot strict=3Don \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -object memory-backend-file,id=3Dmemvirtiopmem0,mem-path=3D/tmp/virtio_pme= m,share=3Don,size=3D536870912 \ --device virtio-pmem-pci,memdev=3Dmemvirtiopmem0,id=3Dvirtiopmem0,bus=3Dpci= .0,addr=3D0x5 \ +-device virtio-pmem-pci,memdev=3Dmemvirtiopmem0,memaddr=3D5368709120,id=3D= virtiopmem0,bus=3Dpci.0,addr=3D0x5 \ -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Dlibvirt-1-format,id=3Dide0-0-0= ,bootindex=3D1 \ diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-lates= t.args b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.ar= gs index 560be76730..bd8343c15e 100644 --- a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args +++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGue= st1/.config \ -boot strict=3Don \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ -object '{"qom-type":"memory-backend-file","id":"memvirtiopmem0","mem-path= ":"/tmp/virtio_pmem","share":true,"size":536870912}' \ --device '{"driver":"virtio-pmem-pci","memdev":"memvirtiopmem0","id":"virti= opmem0","bus":"pci.0","addr":"0x5"}' \ +-device '{"driver":"virtio-pmem-pci","memdev":"memvirtiopmem0","memaddr":5= 368709120,"id":"virtiopmem0","bus":"pci.0","addr":"0x5"}' \ -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-form= at","id":"ide0-0-0","bootindex":1}' \ --=20 2.39.2