From nobody Sun Feb 8 09:10:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1584878543; cv=none; d=zohomail.com; s=zohoarc; b=S5uHU+cybNfJWIF5Dl0kyhD4CBqOYRKxPjpqRs55QpDm0DeNVJGA2iDeCup9SBsf+EOPws9m5lyhxJBOGB8wZguIsP7zMmtryiEj0CSdGIb4GADPBaW0Rapagj6jt3vHqI7cFturrDYA6Gk9NK7tA2gGE95eNeR8pXvarsXRMLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584878543; h=Content-Type:Content-Transfer-Encoding:Cc: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=sK0jVc8haxalxBM7ktyvYJOD+OfJ+UzgK55ybXDdBx4=; b=CYzrHHk8rdIq/7Bc1T4PMznTH4bQ3fVMfmX657FO3AmL+2tcS+UaIp3rOmLtJYsjgS6LNg/nejVnjJqsZWXSBoA8os4HolivtKcOHVh23s5OZBWuY3ayxtFglQXeY429w91up6pV4CelDMaV4rpyiixw4xKm060shu9ClxeBJ7k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1584878543914619.0089867827134; Sun, 22 Mar 2020 05:02:23 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-392-Q9SrsGH0O0CgRlhK0MHbkA-1; Sun, 22 Mar 2020 08:02:20 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 342EEA0CD2; Sun, 22 Mar 2020 12:02:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7DE8A5C28D; Sun, 22 Mar 2020 12:02:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6FDE6863A7; Sun, 22 Mar 2020 12:02:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02MC207o016553 for ; Sun, 22 Mar 2020 08:02:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3D7992028CD4; Sun, 22 Mar 2020 12:02:00 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38B772028CD2 for ; Sun, 22 Mar 2020 12:02:00 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A2FF8F690B for ; Sun, 22 Mar 2020 12:02:00 +0000 (UTC) Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-390-7-6cXVEvNLGrNB0mAeMtjw-1; Sun, 22 Mar 2020 08:01:57 -0400 Received: by mail-qk1-f180.google.com with SMTP id l25so7350382qki.7 for ; Sun, 22 Mar 2020 05:01:57 -0700 (PDT) Received: from localhost.localdomain ([2804:431:c7c6:a54:94b:6faa:a6b0:6b1b]) by smtp.gmail.com with ESMTPSA id r10sm8607901qkm.23.2020.03.22.05.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Mar 2020 05:01:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584878542; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=sK0jVc8haxalxBM7ktyvYJOD+OfJ+UzgK55ybXDdBx4=; b=MqmFsaExWwXfB1TmEPWF7QbOr0EHgxAxGWnBQVq7Bom3uoIa40trBJhmschH4FzbwG/sOD 8utEpQooWJZolsl/vEY1PWrb7iN4B82NIYecNby94YnNnkDEoSFWEkjJvc7uwy9TCCRbiD yuxBzNfcDMNVUsK0xQuxVD9e4o/XCcI= X-MC-Unique: Q9SrsGH0O0CgRlhK0MHbkA-1 X-MC-Unique: 7-6cXVEvNLGrNB0mAeMtjw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cGuUZePmYb791zuuPHK3AHQGGxoq2wBY7kPQ6vCShR8=; b=tnoJ0bQalR7xeEWakxO/Hzu/vkJlhUphrIPqI+dUaDxPVsmZTBbZ2onN/q/B93R/P2 c6VJv4c2m0ymuH97gE+V1KkDpLeNvUPjB9gG6euwuKdsjm7OjW/VL2nAhOqCMmHRPC6p D1FuGX+VuG4WoSKarFARi6l4SI9jtn7e8b2CpiOT6//Bss6Uo+AWNIEOpbM7BgkOo6Df bSV67bRHgpA0+ek0v8XX1BnphPC9BooAM3Jer5UfI85plh2PeWIOecLqw34EXIoP0+Jd jpura9eqLk2asSKwi8WaoEwQ0cZm8q+ufAesPAenV3Fe+WgIOT1fMf+CvyKY6Mz+2iLQ iW0Q== X-Gm-Message-State: ANhLgQ3SlF4Tu0bktfW69dNBOIO3jdVPI9PrgeCnoesRIRvhuSYm/Fw9 IbPagih6B9W07apFahI2cRKfG/SX X-Google-Smtp-Source: ADFU+vtIs+VaG2f1P5jr7VFv8tloLaSaGqiUNTRM1KSVV1kdvKx/4CCmKdnM8RRwYIiXSVHHvmbNDA== X-Received: by 2002:a37:bc81:: with SMTP id m123mr16127419qkf.319.1584878516835; Sun, 22 Mar 2020 05:01:56 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v3 2/6] conf: Introduce optional 'uuid' element for NVDIMM memory Date: Sun, 22 Mar 2020 09:01:37 -0300 Message-Id: <20200322120141.564642-3-danielhb413@gmail.com> In-Reply-To: <20200322120141.564642-1-danielhb413@gmail.com> References: <20200322120141.564642-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 02MC207o016553 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , shivaprasadbhat@gmail.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" ppc64 NVDIMM support was implemented in QEMU by commit [1]. The support is similar to what x86 already does, aside from an extra 'uuid' element. This patch introduces a new optional 'uuid' element for the NVDIMM memory model. This element behaves like the 'uuid' element of the domain definition - if absent, we'll create a new one, otherwise use the one provided by the XML. The 'uuid' element is exclusive to pseries guests and are unavailable for other architectures. Next patch will use this new element to add NVDIMM support for ppc64. [1] https://github.com/qemu/qemu/commit/ee3a71e36654317b14ede0290e87628f8b7= 9f850 Signed-off-by: Daniel Henrique Barboza --- docs/schemas/domaincommon.rng | 5 ++ src/conf/domain_conf.c | 37 +++++++++++++-- src/conf/domain_conf.h | 3 ++ .../memory-hotplug-nvdimm-ppc64.xml | 47 +++++++++++++++++++ .../memory-hotplug-nvdimm-ppc64.xml | 47 +++++++++++++++++++ tests/qemuxml2xmltest.c | 2 + 6 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.xml create mode 100644 tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 6805420451..d79dee650e 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5754,6 +5754,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e0432fc47d..43643b93a1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16592,6 +16592,7 @@ static virDomainMemoryDefPtr virDomainMemoryDefParseXML(virDomainXMLOptionPtr xmlopt, xmlNodePtr memdevNode, xmlXPathContextPtr ctxt, + const virDomainDef *dom, unsigned int flags) { VIR_XPATH_NODE_AUTORESTORE(ctxt); @@ -16638,6 +16639,25 @@ virDomainMemoryDefParseXML(virDomainXMLOptionPtr x= mlopt, =20 def->discard =3D val; } + VIR_FREE(tmp); + + if (def->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM && + ARCH_IS_PPC64(dom->os.arch)) { + /* Extract nvdimm uuid or generate a new one */ + tmp =3D virXPathString("string(./uuid[1])", ctxt); + + if (!tmp) { + if (virUUIDGenerate(def->uuid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate UUID")); + goto error; + } + } else if (virUUIDParse(tmp, def->uuid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed uuid element")); + goto error; + } + } =20 /* source */ if ((node =3D virXPathNode("./source", ctxt)) && @@ -16935,7 +16955,8 @@ virDomainDeviceDefParse(const char *xmlStr, break; case VIR_DOMAIN_DEVICE_MEMORY: if (!(dev->data.memory =3D virDomainMemoryDefParseXML(xmlopt, node, - ctxt, flags))) + ctxt, def, + flags))) return NULL; break; case VIR_DOMAIN_DEVICE_IOMMU: @@ -21882,6 +21903,7 @@ virDomainDefParseXML(xmlDocPtr xml, virDomainMemoryDefPtr mem =3D virDomainMemoryDefParseXML(xmlopt, nodes[i], ctxt, + def, flags); if (!mem) goto error; @@ -27097,6 +27119,7 @@ virDomainMemoryTargetDefFormat(virBufferPtr buf, static int virDomainMemoryDefFormat(virBufferPtr buf, virDomainMemoryDefPtr def, + const virDomainDef *dom, unsigned int flags) { const char *model =3D virDomainMemoryModelTypeToString(def->model); @@ -27111,6 +27134,14 @@ virDomainMemoryDefFormat(virBufferPtr buf, virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); =20 + if (def->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM && + ARCH_IS_PPC64(dom->os.arch)) { + char uuidstr[VIR_UUID_STRING_BUFLEN]; + + virUUIDFormat(def->uuid, uuidstr); + virBufferAsprintf(buf, "%s\n", uuidstr); + } + if (virDomainMemorySourceDefFormat(buf, def) < 0) return -1; =20 @@ -29440,7 +29471,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, } =20 for (n =3D 0; n < def->nmems; n++) { - if (virDomainMemoryDefFormat(buf, def->mems[n], flags) < 0) + if (virDomainMemoryDefFormat(buf, def->mems[n], def, flags) < 0) goto error; } =20 @@ -30553,7 +30584,7 @@ virDomainDeviceDefCopy(virDomainDeviceDefPtr src, rc =3D virDomainPanicDefFormat(&buf, src->data.panic); break; case VIR_DOMAIN_DEVICE_MEMORY: - rc =3D virDomainMemoryDefFormat(&buf, src->data.memory, flags); + rc =3D virDomainMemoryDefFormat(&buf, src->data.memory, def, flags= ); break; case VIR_DOMAIN_DEVICE_SHMEM: rc =3D virDomainShmemDefFormat(&buf, src->data.shmem, flags); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 73bd097cf8..b7c31eb62f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2189,6 +2189,9 @@ struct _virDomainMemoryDef { unsigned long long labelsize; /* kibibytes; valid only for NVDIMM */ bool readonly; /* valid only for NVDIMM */ =20 + /* required for QEMU NVDIMM ppc64 support */ + unsigned char uuid[VIR_UUID_BUFLEN]; + virDomainDeviceInfo info; }; =20 diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.xml b/tests= /qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.xml new file mode 100644 index 0000000000..59352d3c52 --- /dev/null +++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.xml @@ -0,0 +1,47 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1099511627776 + 1267710 + 1267710 + 2 + + hvm + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + +
+ + + + 49545eb3-75e1-2d0a-acdd-f0294406c99e + + /tmp/nvdimm + + + 523264 + 0 + +
+ + + diff --git a/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml b/tes= ts/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml new file mode 100644 index 0000000000..59352d3c52 --- /dev/null +++ b/tests/qemuxml2xmloutdata/memory-hotplug-nvdimm-ppc64.xml @@ -0,0 +1,47 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1099511627776 + 1267710 + 1267710 + 2 + + hvm + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + +
+ + + + 49545eb3-75e1-2d0a-acdd-f0294406c99e + + /tmp/nvdimm + + + 523264 + 0 + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 9b6a235777..a3c25b4a76 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1246,6 +1246,8 @@ mymain(void) DO_TEST("memory-hotplug-nvdimm-align", QEMU_CAPS_DEVICE_NVDIMM); DO_TEST("memory-hotplug-nvdimm-pmem", QEMU_CAPS_DEVICE_NVDIMM); DO_TEST("memory-hotplug-nvdimm-readonly", QEMU_CAPS_DEVICE_NVDIMM); + DO_TEST("memory-hotplug-nvdimm-ppc64", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST= _BRIDGE, + QEMU_CAPS_DEVICE_NVDIMM); DO_TEST("net-udp", NONE); =20 DO_TEST("video-virtio-gpu-device", QEMU_CAPS_DEVICE_VIRTIO_GPU); --=20 2.25.1