From nobody Sun Feb 8 03:58:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1583434277; cv=none; d=zohomail.com; s=zohoarc; b=iOPb/QJpkTRCPkrTpjGNSla1n+ANplBwGvD3AQCG3VzdmE0BtUazgadYCnCexlWi1zS3NWp9LQ5bEd7+0VRjqRz+nZx7WnetzY3IyBBjOF7Sud26VsExTk46ELW/RC6ocaRFeMjYmPEYjfUaefplmcqMM9xJdH5RJG1xCbSQfCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583434277; 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=dIfZ88GPcmxgeXSW9wMPLdtegiubsiYXZsgwsWUYldg=; b=k08f69JE/LdDPRXMIEQ7WQsJ6Y/3r36Dn2qCoZi9kSG4O3a+tMXt9xrV5PDGlbHLUasUrvv4CS5nZpYbJrE1+EgpY0ZcJMzPLyx3sS3LQw/VbUVLzWDmqpRSo0yYdKAEo9bnifxEGp9ZR3RAomKC0hrriAun1+cNoCalAxMDkZE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1583434277359222.79673117218533; Thu, 5 Mar 2020 10:51:17 -0800 (PST) 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-257-M-blcquOPVaHQbleqo-afw-1; Thu, 05 Mar 2020 13:51:13 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42974800D4E; Thu, 5 Mar 2020 18:51:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B1DC991D74; Thu, 5 Mar 2020 18:51:07 +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 0B24F1803C33; Thu, 5 Mar 2020 18:51:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 025Ip4Qw000932 for ; Thu, 5 Mar 2020 13:51:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id 742FD101B556; Thu, 5 Mar 2020 18:51:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FDDC101F0A1 for ; Thu, 5 Mar 2020 18:51:04 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 50C668007A4 for ; Thu, 5 Mar 2020 18:51:04 +0000 (UTC) Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-73-zr3UGMxFMA-Ay5Xjgz38Gg-1; Thu, 05 Mar 2020 13:51:01 -0500 Received: by mail-qt1-f169.google.com with SMTP id r6so4940733qtt.9 for ; Thu, 05 Mar 2020 10:51:01 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:77f1:bfee:4b65:7d38:7648]) by smtp.gmail.com with ESMTPSA id i26sm16182868qkl.66.2020.03.05.10.50.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 10:50:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583434275; 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=dIfZ88GPcmxgeXSW9wMPLdtegiubsiYXZsgwsWUYldg=; b=iKiY0kVhO2MTDbezWr3Oqz4+epcc0imMSuBgmlLit47OP6GlB09ucWDKLvl3sby11+DQ4Q Xu2zO0liIXHve0TVI4tj7/B49PpgFcVt99HMZ95WLvIjpzkesQh4bmhioq6wd+JkBcblcd 4D25Z8sbC8Umf95anvRqy3HDqzbpj1o= X-MC-Unique: M-blcquOPVaHQbleqo-afw-1 X-MC-Unique: zr3UGMxFMA-Ay5Xjgz38Gg-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=johp3lOJyp8hGfyR045VQYG+/ccvpFeSSiKXwFv7e7E=; b=kWsinqKNdMe7thC5OYwAQ/hDX+8Q4Mw9BrsHe7JvHxw1RkNX4iRGdv1QWoG1qecYs1 cZcjAFObRBwVtalggUMwHQPDLBaYiGlp5XT43VnnC1hNA7uj6KMGF/VgaVx0fZqSiP0w AjR4yk/8C+I9LFcRgIdrGwkR3zOtZIaxDa714DdiaXM/xIZKqFz8hcPsKu57xgTpT3pJ fnHQFoL96C58RkHo5BS5XHPYFBY+kX1LPFiPK5pV1F2z+iaJpx11JDvKeud1QG81JumC tQwy3a40r+cihKO+/IgnLpwvvqEcDdDqO7o7YrBmel7T0P1EvHd+C3ahNuj6LCGczWCL hWCg== X-Gm-Message-State: ANhLgQ0HStNOUMS79NIsZJ3xdbdT8BjdCLeyxLhifPfzE9DIQ6BJUW/B DRaQAuyey+kn7UW/xs5u2LEuFHe9FIw= X-Google-Smtp-Source: ADFU+vuYrGGmsSgPiFqoLS8pSG7vDTH+LO3prRingM15W66U9gS92ogP8XdcYMwAfC4GxsBbM+tV+A== X-Received: by 2002:ac8:44a3:: with SMTP id a3mr56761qto.303.1583434258058; Thu, 05 Mar 2020 10:50:58 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 1/4] conf: Introduce optional 'uuid' element for NVDIMM memory Date: Thu, 5 Mar 2020 15:50:44 -0300 Message-Id: <20200305185047.1097648-2-danielhb413@gmail.com> In-Reply-To: <20200305185047.1097648-1-danielhb413@gmail.com> References: <20200305185047.1097648-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 025Ip4Qw000932 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.13 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 529a98fc05..119ebc9401 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5660,6 +5660,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d8471acd2d..cce4d322f9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16500,6 +16500,7 @@ static virDomainMemoryDefPtr virDomainMemoryDefParseXML(virDomainXMLOptionPtr xmlopt, xmlNodePtr memdevNode, xmlXPathContextPtr ctxt, + const virDomainDef *dom, unsigned int flags) { VIR_XPATH_NODE_AUTORESTORE(ctxt); @@ -16546,6 +16547,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)) && @@ -16843,7 +16863,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: @@ -21790,6 +21811,7 @@ virDomainDefParseXML(xmlDocPtr xml, virDomainMemoryDefPtr mem =3D virDomainMemoryDefParseXML(xmlopt, nodes[i], ctxt, + def, flags); if (!mem) goto error; @@ -26976,6 +26998,7 @@ virDomainMemoryTargetDefFormat(virBufferPtr buf, static int virDomainMemoryDefFormat(virBufferPtr buf, virDomainMemoryDefPtr def, + const virDomainDef *dom, unsigned int flags) { const char *model =3D virDomainMemoryModelTypeToString(def->model); @@ -26990,6 +27013,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 @@ -29319,7 +29350,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 @@ -30432,7 +30463,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 91b776c28a..f2f2635957 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.24.1