1b87cf
From e4e8b74f2cf090c8b29efcd3ceac4e4c4d07b929 Mon Sep 17 00:00:00 2001
1b87cf
Message-Id: <e4e8b74f2cf090c8b29efcd3ceac4e4c4d07b929@dist-git>
1b87cf
From: Michal Privoznik <mprivozn@redhat.com>
1b87cf
Date: Thu, 27 Jan 2022 11:13:53 +0100
1b87cf
Subject: [PATCH] qemu_command: Generate memory only after controllers
1b87cf
1b87cf
Currently, memory device (def->mems) part of cmd line is
1b87cf
generated before any controller. In majority of cases it doesn't
1b87cf
matter because neither of memory devices live on a bus that's
1b87cf
created by an exposed controller (e.g. there's no DIMM
1b87cf
controller, at least not exposed). Except for virtio-mem and
1b87cf
virtio-pmem, which do have a PCI address. And if it so happens
1b87cf
that the device goes onto non-default bus (pci.0) starting such
1b87cf
guest fails, because the controller that creates the desired bus
1b87cf
wasn't processed yet. QEMU processes arguments in order.
1b87cf
1b87cf
For instance, if virtio-mem has address with bus='0x01' QEMU
1b87cf
refuses to start with the following message:
1b87cf
1b87cf
  Bus 'pci.1' not found
1b87cf
1b87cf
Similarly for virtio-pmem. I've successfully tested migration and
1b87cf
changing the order does not affect migration stream.
1b87cf
1b87cf
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2047271
1b87cf
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
1b87cf
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
1b87cf
(cherry picked from commit af23241cfed712f69450e82135d7c7b4899736de)
1b87cf
1b87cf
Conflicts:
1b87cf
tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args:
1b87cf
tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args:
1b87cf
tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args:
1b87cf
tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args:
1b87cf
tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args:
1b87cf
tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args:
1b87cf
tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.args:
1b87cf
tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args:
1b87cf
tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args:
1b87cf
tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args:
1b87cf
  These happened because downstream we don't use JSON for -device,
1b87cf
  but upstream we do (as of 1a691fe1c84090da80a652c4c80ac00a6134a69b).
1b87cf
1b87cf
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2050697
1b87cf
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
1b87cf
---
1b87cf
 src/qemu/qemu_command.c                                   | 6 +++---
1b87cf
 tests/qemuxml2argvdata/hugepages-memaccess.args           | 4 ++--
1b87cf
 tests/qemuxml2argvdata/hugepages-memaccess2.args          | 4 ++--
1b87cf
 tests/qemuxml2argvdata/hugepages-numa-default-dimm.args   | 4 ++--
1b87cf
 .../qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args  | 4 ++--
1b87cf
 .../qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args | 4 ++--
1b87cf
 tests/qemuxml2argvdata/memory-hotplug-dimm-addr.args      | 8 ++++----
1b87cf
 tests/qemuxml2argvdata/memory-hotplug-dimm.args           | 8 ++++----
1b87cf
 .../memory-hotplug-nvdimm-access.x86_64-latest.args       | 4 ++--
1b87cf
 .../memory-hotplug-nvdimm-align.x86_64-5.2.0.args         | 4 ++--
1b87cf
 .../memory-hotplug-nvdimm-align.x86_64-latest.args        | 4 ++--
1b87cf
 .../memory-hotplug-nvdimm-label.x86_64-5.2.0.args         | 4 ++--
1b87cf
 .../memory-hotplug-nvdimm-label.x86_64-latest.args        | 4 ++--
1b87cf
 .../memory-hotplug-nvdimm-pmem.x86_64-5.2.0.args          | 4 ++--
1b87cf
 .../memory-hotplug-nvdimm-pmem.x86_64-latest.args         | 4 ++--
1b87cf
 .../memory-hotplug-nvdimm-ppc64-abi-update.args           | 4 ++--
1b87cf
 tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.args   | 4 ++--
1b87cf
 .../memory-hotplug-nvdimm-readonly.x86_64-5.2.0.args      | 4 ++--
1b87cf
 .../memory-hotplug-nvdimm-readonly.x86_64-latest.args     | 4 ++--
1b87cf
 .../memory-hotplug-nvdimm.x86_64-latest.args              | 4 ++--
1b87cf
 .../memory-hotplug-ppc64-nonuma-abi-update.args           | 8 ++++----
1b87cf
 tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.args   | 8 ++++----
1b87cf
 .../memory-hotplug-virtio-mem.x86_64-latest.args          | 8 ++++----
1b87cf
 .../memory-hotplug-virtio-pmem.x86_64-5.2.0.args          | 4 ++--
1b87cf
 .../memory-hotplug-virtio-pmem.x86_64-latest.args         | 4 ++--
1b87cf
 tests/qemuxml2argvdata/pages-dimm-discard.args            | 8 ++++----
1b87cf
 26 files changed, 65 insertions(+), 65 deletions(-)
1b87cf
1b87cf
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
1b87cf
index 6b4647a711..2acdcca2ff 100644
1b87cf
--- a/src/qemu/qemu_command.c
1b87cf
+++ b/src/qemu/qemu_command.c
1b87cf
@@ -10565,9 +10565,6 @@ qemuBuildCommandLine(virQEMUDriver *driver,
1b87cf
         qemuBuildNumaCommandLine(cfg, def, cmd, priv) < 0)
1b87cf
         return NULL;
1b87cf
 
1b87cf
-    if (qemuBuildMemoryDeviceCommandLine(cmd, cfg, def, priv) < 0)
1b87cf
-        return NULL;
1b87cf
-
1b87cf
     virUUIDFormat(def->uuid, uuid);
1b87cf
     virCommandAddArgList(cmd, "-uuid", uuid, NULL);
1b87cf
 
1b87cf
@@ -10617,6 +10614,9 @@ qemuBuildCommandLine(virQEMUDriver *driver,
1b87cf
     if (qemuBuildControllersCommandLine(cmd, def, qemuCaps) < 0)
1b87cf
         return NULL;
1b87cf
 
1b87cf
+    if (qemuBuildMemoryDeviceCommandLine(cmd, cfg, def, priv) < 0)
1b87cf
+        return NULL;
1b87cf
+
1b87cf
     if (qemuBuildHubCommandLine(cmd, def, qemuCaps) < 0)
1b87cf
         return NULL;
1b87cf
 
1b87cf
diff --git a/tests/qemuxml2argvdata/hugepages-memaccess.args b/tests/qemuxml2argvdata/hugepages-memaccess.args
1b87cf
index b89f791697..a369c7f6da 100644
1b87cf
--- a/tests/qemuxml2argvdata/hugepages-memaccess.args
1b87cf
+++ b/tests/qemuxml2argvdata/hugepages-memaccess.args
1b87cf
@@ -24,8 +24,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -numa node,nodeid=2,cpus=2,memdev=ram-node2 \
1b87cf
 -object memory-backend-file,id=ram-node3,mem-path=/dev/hugepages1G/libvirt/qemu/-1-QEMUGuest1,share=off,prealloc=on,size=1073741824,host-nodes=3,policy=bind \
1b87cf
 -numa node,nodeid=3,cpus=3,memdev=ram-node3 \
1b87cf
--object memory-backend-file,id=memdimm0,mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=on,prealloc=on,size=536870912,host-nodes=0-3,policy=bind \
1b87cf
--device pc-dimm,node=1,memdev=memdimm0,id=dimm0,slot=0,addr=4294967296 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -37,6 +35,8 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -usb \
1b87cf
+-object memory-backend-file,id=memdimm0,mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=on,prealloc=on,size=536870912,host-nodes=0-3,policy=bind \
1b87cf
+-device pc-dimm,node=1,memdev=memdimm0,id=dimm0,slot=0,addr=4294967296 \
1b87cf
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
1b87cf
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
1b87cf
diff --git a/tests/qemuxml2argvdata/hugepages-memaccess2.args b/tests/qemuxml2argvdata/hugepages-memaccess2.args
1b87cf
index 0c296797e9..434ebdaa62 100644
1b87cf
--- a/tests/qemuxml2argvdata/hugepages-memaccess2.args
1b87cf
+++ b/tests/qemuxml2argvdata/hugepages-memaccess2.args
1b87cf
@@ -24,8 +24,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -numa node,nodeid=2,cpus=2,memdev=ram-node2 \
1b87cf
 -object memory-backend-file,id=ram-node3,mem-path=/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/ram-node3,share=off,size=1073741824,host-nodes=3,policy=bind \
1b87cf
 -numa node,nodeid=3,cpus=3,memdev=ram-node3 \
1b87cf
--object memory-backend-file,id=memdimm0,mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=on,prealloc=on,size=536870912,host-nodes=0-3,policy=bind \
1b87cf
--device pc-dimm,node=1,memdev=memdimm0,id=dimm0,slot=0,addr=4294967296 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -37,6 +35,8 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -usb \
1b87cf
+-object memory-backend-file,id=memdimm0,mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,share=on,prealloc=on,size=536870912,host-nodes=0-3,policy=bind \
1b87cf
+-device pc-dimm,node=1,memdev=memdimm0,id=dimm0,slot=0,addr=4294967296 \
1b87cf
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
1b87cf
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
1b87cf
diff --git a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args
1b87cf
index f560cabf8e..57bb70346d 100644
1b87cf
--- a/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args
1b87cf
+++ b/tests/qemuxml2argvdata/hugepages-numa-default-dimm.args
1b87cf
@@ -19,8 +19,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -mem-prealloc \
1b87cf
 -mem-path /dev/hugepages2M/libvirt/qemu/-1-fedora \
1b87cf
 -numa node,nodeid=0,cpus=0-1,mem=1024 \
1b87cf
--object memory-backend-file,id=memdimm0,mem-path=/dev/hugepages1G/libvirt/qemu/-1-fedora,size=1073741824,host-nodes=1-3,policy=bind \
1b87cf
--device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \
1b87cf
 -uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -32,4 +30,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -usb \
1b87cf
+-object memory-backend-file,id=memdimm0,mem-path=/dev/hugepages1G/libvirt/qemu/-1-fedora,size=1073741824,host-nodes=1-3,policy=bind \
1b87cf
+-device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \
1b87cf
 -msg timestamp=on
1b87cf
diff --git a/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
1b87cf
index 8b5665f86e..7d9dcfb4df 100644
1b87cf
--- a/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
1b87cf
+++ b/tests/qemuxml2argvdata/hugepages-nvdimm.x86_64-latest.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object '{"qom-type":"memory-backend-file","id":"ram-node0","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","share":true,"prealloc":true,"size":1073741824}' \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"size":536870912}' \
1b87cf
--device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"size":536870912}' \
1b87cf
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -audiodev '{"id":"audio1","driver":"none"}' \
1b87cf
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
1b87cf
 -msg timestamp=on
1b87cf
diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
1b87cf
index 8a40e2d79c..04a320d469 100644
1b87cf
--- a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
1b87cf
+++ b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-instance-00000092/.config \
1b87cf
 -smp 8,sockets=1,dies=1,cores=8,threads=1 \
1b87cf
 -object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":true,"hugetlbsize":2097152,"share":true,"prealloc":true,"size":15032385536,"host-nodes":[3],"policy":"preferred"}' \
1b87cf
 -numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
1b87cf
--object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"size":536870912,"host-nodes":[3],"policy":"preferred"}' \
1b87cf
--device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-instance-00000092/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"size":536870912,"host-nodes":[3],"policy":"preferred"}' \
1b87cf
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -audiodev '{"id":"audio1","driver":"none"}' \
1b87cf
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
1b87cf
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.args b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.args
1b87cf
index 907072d55d..b36117f1e8 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-dimm-addr.args
1b87cf
@@ -17,10 +17,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -realtime mlock=off \
1b87cf
 -smp 2,sockets=2,cores=1,threads=1 \
1b87cf
 -numa node,nodeid=0,cpus=0-1,mem=214 \
1b87cf
--object memory-backend-file,id=memdimm0,mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,prealloc=on,size=536870912,host-nodes=1-3,policy=bind \
1b87cf
--device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0,addr=4294967296 \
1b87cf
--object memory-backend-ram,id=memdimm2,size=536870912 \
1b87cf
--device pc-dimm,node=0,memdev=memdimm2,id=dimm2,slot=2 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -32,6 +28,10 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -usb \
1b87cf
+-object memory-backend-file,id=memdimm0,mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,prealloc=on,size=536870912,host-nodes=1-3,policy=bind \
1b87cf
+-device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0,addr=4294967296 \
1b87cf
+-object memory-backend-ram,id=memdimm2,size=536870912 \
1b87cf
+-device pc-dimm,node=0,memdev=memdimm2,id=dimm2,slot=2 \
1b87cf
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
1b87cf
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-dimm.args b/tests/qemuxml2argvdata/memory-hotplug-dimm.args
1b87cf
index 5d87f4a3ef..72c2803c5e 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-dimm.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-dimm.args
1b87cf
@@ -17,10 +17,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -realtime mlock=off \
1b87cf
 -smp 2,sockets=2,cores=1,threads=1 \
1b87cf
 -numa node,nodeid=0,cpus=0-1,mem=214 \
1b87cf
--object memory-backend-ram,id=memdimm0,size=536870912 \
1b87cf
--device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \
1b87cf
--object memory-backend-file,id=memdimm1,mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,prealloc=on,size=536870912,host-nodes=1-3,policy=bind \
1b87cf
--device pc-dimm,node=0,memdev=memdimm1,id=dimm1,slot=1 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -32,6 +28,10 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -usb \
1b87cf
+-object memory-backend-ram,id=memdimm0,size=536870912 \
1b87cf
+-device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \
1b87cf
+-object memory-backend-file,id=memdimm1,mem-path=/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1,prealloc=on,size=536870912,host-nodes=1-3,policy=bind \
1b87cf
+-device pc-dimm,node=0,memdev=memdimm1,id=dimm1,slot=1 \
1b87cf
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
1b87cf
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args
1b87cf
index 3664150c51..94aeadabce 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-access.x86_64-latest.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":false,"prealloc":true,"size":536870912}' \
1b87cf
--device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":false,"prealloc":true,"size":536870912}' \
1b87cf
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-5.2.0.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-5.2.0.args
1b87cf
index 6c28c86004..0b29a6fded 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-5.2.0.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-5.2.0.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object memory-backend-ram,id=ram-node0,size=224395264 \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,share=off,prealloc=on,size=536870912,align=2097152 \
1b87cf
--device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,share=off,prealloc=on,size=536870912,align=2097152 \
1b87cf
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args
1b87cf
index aa77849079..5045cc8318 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-align.x86_64-latest.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":false,"prealloc":true,"size":536870912,"align":2097152}' \
1b87cf
--device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":false,"prealloc":true,"size":536870912,"align":2097152}' \
1b87cf
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-5.2.0.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-5.2.0.args
1b87cf
index c45b401af5..7c67161b78 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-5.2.0.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-5.2.0.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object memory-backend-ram,id=ram-node0,size=224395264 \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,share=off,prealloc=on,size=536870912 \
1b87cf
--device nvdimm,node=0,label-size=131072,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,share=off,prealloc=on,size=536870912 \
1b87cf
+-device nvdimm,node=0,label-size=131072,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args
1b87cf
index 07863ba87c..9466877699 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-label.x86_64-latest.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":false,"prealloc":true,"size":536870912}' \
1b87cf
--device nvdimm,node=0,label-size=131072,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":false,"prealloc":true,"size":536870912}' \
1b87cf
+-device nvdimm,node=0,label-size=131072,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-5.2.0.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-5.2.0.args
1b87cf
index 3f35d4dca2..c4dae0cfd1 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-5.2.0.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-5.2.0.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object memory-backend-ram,id=ram-node0,size=224395264 \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,share=off,size=536870912,pmem=on \
1b87cf
--device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,share=off,size=536870912,pmem=on \
1b87cf
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args
1b87cf
index 4ed86feb01..9324535ac3 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-pmem.x86_64-latest.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":false,"size":536870912,"pmem":true}' \
1b87cf
--device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":false,"size":536870912,"pmem":true}' \
1b87cf
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.args
1b87cf
index ebdb0429d0..55b16c9dc2 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64-abi-update.args
1b87cf
@@ -17,8 +17,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -realtime mlock=off \
1b87cf
 -smp 2,sockets=2,cores=1,threads=1 \
1b87cf
 -numa node,nodeid=0,cpus=0-1,mem=1024 \
1b87cf
--object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,prealloc=on,size=537001984 \
1b87cf
--device nvdimm,node=0,label-size=131072,uuid=49545eb3-75e1-2d0a-acdd-f0294406c99e,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -28,4 +26,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -rtc base=utc \
1b87cf
 -no-shutdown \
1b87cf
 -boot strict=on \
1b87cf
+-object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,prealloc=on,size=537001984 \
1b87cf
+-device nvdimm,node=0,label-size=131072,uuid=49545eb3-75e1-2d0a-acdd-f0294406c99e,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -msg timestamp=on
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.args
1b87cf
index ebdb0429d0..55b16c9dc2 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-ppc64.args
1b87cf
@@ -17,8 +17,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -realtime mlock=off \
1b87cf
 -smp 2,sockets=2,cores=1,threads=1 \
1b87cf
 -numa node,nodeid=0,cpus=0-1,mem=1024 \
1b87cf
--object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,prealloc=on,size=537001984 \
1b87cf
--device nvdimm,node=0,label-size=131072,uuid=49545eb3-75e1-2d0a-acdd-f0294406c99e,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -28,4 +26,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -rtc base=utc \
1b87cf
 -no-shutdown \
1b87cf
 -boot strict=on \
1b87cf
+-object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,prealloc=on,size=537001984 \
1b87cf
+-device nvdimm,node=0,label-size=131072,uuid=49545eb3-75e1-2d0a-acdd-f0294406c99e,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -msg timestamp=on
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-5.2.0.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-5.2.0.args
1b87cf
index bca2f286ba..b1873c100f 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-5.2.0.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-5.2.0.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object memory-backend-ram,id=ram-node0,size=224395264 \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,share=off,prealloc=on,size=536870912 \
1b87cf
--device nvdimm,node=0,unarmed=on,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object memory-backend-file,id=memnvdimm0,mem-path=/tmp/nvdimm,share=off,prealloc=on,size=536870912 \
1b87cf
+-device nvdimm,node=0,unarmed=on,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.args
1b87cf
index 8be7f35cec..4f11d22e00 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm-readonly.x86_64-latest.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":224395264}' \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":false,"prealloc":true,"size":536870912}' \
1b87cf
--device nvdimm,node=0,unarmed=on,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":false,"prealloc":true,"size":536870912}' \
1b87cf
+-device nvdimm,node=0,unarmed=on,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args
1b87cf
index 307698749e..434a0f91cf 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-nvdimm.x86_64-latest.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":1073741824}' \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","prealloc":true,"size":536870912}' \
1b87cf
--device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","prealloc":true,"size":536870912}' \
1b87cf
+-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args b/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args
1b87cf
index 5380c9e805..e8a6451841 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma-abi-update.args
1b87cf
@@ -16,10 +16,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -m size=1048576k,slots=16,maxmem=4194304k \
1b87cf
 -realtime mlock=off \
1b87cf
 -smp 1,sockets=1,cores=1,threads=1 \
1b87cf
--object memory-backend-ram,id=memdimm0,size=536870912 \
1b87cf
--device pc-dimm,memdev=memdimm0,id=dimm0,slot=0 \
1b87cf
--object memory-backend-ram,id=memdimm1,size=536870912 \
1b87cf
--device pc-dimm,memdev=memdimm1,id=dimm1,slot=1 \
1b87cf
 -uuid 49545eb3-75e1-2d0a-acdd-f0294406c99e \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -29,4 +25,8 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -rtc base=utc \
1b87cf
 -no-shutdown \
1b87cf
 -boot strict=on \
1b87cf
+-object memory-backend-ram,id=memdimm0,size=536870912 \
1b87cf
+-device pc-dimm,memdev=memdimm0,id=dimm0,slot=0 \
1b87cf
+-object memory-backend-ram,id=memdimm1,size=536870912 \
1b87cf
+-device pc-dimm,memdev=memdimm1,id=dimm1,slot=1 \
1b87cf
 -msg timestamp=on
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.args b/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.args
1b87cf
index acff36eb78..181409cde0 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-ppc64-nonuma.args
1b87cf
@@ -16,10 +16,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -m size=1310720k,slots=16,maxmem=4194304k \
1b87cf
 -realtime mlock=off \
1b87cf
 -smp 1,sockets=1,cores=1,threads=1 \
1b87cf
--object memory-backend-ram,id=memdimm0,size=536870912 \
1b87cf
--device pc-dimm,memdev=memdimm0,id=dimm0,slot=0 \
1b87cf
--object memory-backend-ram,id=memdimm1,size=536870912 \
1b87cf
--device pc-dimm,memdev=memdimm1,id=dimm1,slot=1 \
1b87cf
 -uuid 49545eb3-75e1-2d0a-acdd-f0294406c99e \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -29,4 +25,8 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -rtc base=utc \
1b87cf
 -no-shutdown \
1b87cf
 -boot strict=on \
1b87cf
+-object memory-backend-ram,id=memdimm0,size=536870912 \
1b87cf
+-device pc-dimm,memdev=memdimm0,id=dimm0,slot=0 \
1b87cf
+-object memory-backend-ram,id=memdimm1,size=536870912 \
1b87cf
+-device pc-dimm,memdev=memdimm1,id=dimm1,slot=1 \
1b87cf
 -msg timestamp=on
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
1b87cf
index 8747b249da..30b635d365 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem.x86_64-latest.args
1b87cf
@@ -18,10 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":2145386496}' \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object '{"qom-type":"memory-backend-ram","id":"memvirtiomem0","reserve":false,"size":1073741824}' \
1b87cf
--device virtio-mem-pci,node=0,block-size=2097152,requested-size=536870912,memdev=memvirtiomem0,id=virtiomem0,bus=pci.0,addr=0x2 \
1b87cf
--object '{"qom-type":"memory-backend-file","id":"memvirtiomem1","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","reserve":false,"size":2147483648,"host-nodes":[1,2,3],"policy":"bind"}' \
1b87cf
--device virtio-mem-pci,node=0,block-size=2097152,requested-size=1073741824,memdev=memvirtiomem1,id=virtiomem1,bus=pci.0,addr=0x3 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -33,6 +29,10 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-ram","id":"memvirtiomem0","reserve":false,"size":1073741824}' \
1b87cf
+-device virtio-mem-pci,node=0,block-size=2097152,requested-size=536870912,memdev=memvirtiomem0,id=virtiomem0,bus=pci.0,addr=0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-file","id":"memvirtiomem1","mem-path":"/dev/hugepages2M/libvirt/qemu/-1-QEMUGuest1","reserve":false,"size":2147483648,"host-nodes":[1,2,3],"policy":"bind"}' \
1b87cf
+-device virtio-mem-pci,node=0,block-size=2097152,requested-size=1073741824,memdev=memvirtiomem1,id=virtiomem1,bus=pci.0,addr=0x3 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
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
1b87cf
index 17fd98fb88..8fa678c209 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-5.2.0.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-5.2.0.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object memory-backend-ram,id=ram-node0,size=2145386496 \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object memory-backend-file,id=memvirtiopmem0,mem-path=/tmp/virtio_pmem,share=on,size=536870912 \
1b87cf
--device virtio-pmem-pci,memdev=memvirtiopmem0,id=virtiopmem0,bus=pci.0,addr=0x5 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object memory-backend-file,id=memvirtiopmem0,mem-path=/tmp/virtio_pmem,share=on,size=536870912 \
1b87cf
+-device virtio-pmem-pci,memdev=memvirtiopmem0,id=virtiopmem0,bus=pci.0,addr=0x5 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args
1b87cf
index e5a91b6d33..95ff490cef 100644
1b87cf
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args
1b87cf
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-pmem.x86_64-latest.args
1b87cf
@@ -18,8 +18,6 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -smp 2,sockets=2,dies=1,cores=1,threads=1 \
1b87cf
 -object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":2145386496}' \
1b87cf
 -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
1b87cf
--object '{"qom-type":"memory-backend-file","id":"memvirtiopmem0","mem-path":"/tmp/virtio_pmem","share":true,"size":536870912}' \
1b87cf
--device virtio-pmem-pci,memdev=memvirtiopmem0,id=virtiopmem0,bus=pci.0,addr=0x5 \
1b87cf
 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -31,6 +29,8 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
1b87cf
+-object '{"qom-type":"memory-backend-file","id":"memvirtiopmem0","mem-path":"/tmp/virtio_pmem","share":true,"size":536870912}' \
1b87cf
+-device virtio-pmem-pci,memdev=memvirtiopmem0,id=virtiopmem0,bus=pci.0,addr=0x5 \
1b87cf
 -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
1b87cf
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
1b87cf
 -device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,bootindex=1 \
1b87cf
diff --git a/tests/qemuxml2argvdata/pages-dimm-discard.args b/tests/qemuxml2argvdata/pages-dimm-discard.args
1b87cf
index 2ebe9c1350..e63c908549 100644
1b87cf
--- a/tests/qemuxml2argvdata/pages-dimm-discard.args
1b87cf
+++ b/tests/qemuxml2argvdata/pages-dimm-discard.args
1b87cf
@@ -17,10 +17,6 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -realtime mlock=off \
1b87cf
 -smp 2,sockets=2,cores=1,threads=1 \
1b87cf
 -numa node,nodeid=0,cpus=0-1,mem=1024 \
1b87cf
--object memory-backend-file,id=memdimm0,mem-path=/dev/hugepages1G/libvirt/qemu/-1-fedora,prealloc=on,size=1073741824,host-nodes=1-3,policy=bind \
1b87cf
--device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \
1b87cf
--object memory-backend-file,id=memdimm1,mem-path=/var/lib/libvirt/qemu/ram/-1-fedora/dimm1,discard-data=on,share=off,size=536870912 \
1b87cf
--device pc-dimm,node=0,memdev=memdimm1,id=dimm1,slot=1 \
1b87cf
 -uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
1b87cf
 -display none \
1b87cf
 -no-user-config \
1b87cf
@@ -32,4 +28,8 @@ QEMU_AUDIO_DRV=none \
1b87cf
 -no-acpi \
1b87cf
 -boot strict=on \
1b87cf
 -usb \
1b87cf
+-object memory-backend-file,id=memdimm0,mem-path=/dev/hugepages1G/libvirt/qemu/-1-fedora,prealloc=on,size=1073741824,host-nodes=1-3,policy=bind \
1b87cf
+-device pc-dimm,node=0,memdev=memdimm0,id=dimm0,slot=0 \
1b87cf
+-object memory-backend-file,id=memdimm1,mem-path=/var/lib/libvirt/qemu/ram/-1-fedora/dimm1,discard-data=on,share=off,size=536870912 \
1b87cf
+-device pc-dimm,node=0,memdev=memdimm1,id=dimm1,slot=1 \
1b87cf
 -msg timestamp=on
1b87cf
-- 
1b87cf
2.35.1
1b87cf