libvirt/libvirt-qemu_command-Use-qemuBuildVirtioDevProps-to-build-cmd-line-for-virtio-mem-and-virtio-pmem.patch
Jiri Denemark ef809b76a6 libvirt-10.10.0-10.el9
- esxConnectListAllDomains: Don't propagate failure to lookup a single domain (RHEL-80606)
- conf: parse interface/source/@dev for all interface types (with backend type='passt') (RHEL-82539)
- libvirt-host: Clarify/fix description of the CPU frequency field (RHEL-86197)
- virNodeGetInfo: Improve description of the case when fake data is reported (RHEL-86197)
- manpages: virsh: Use disclaimer from 'virNodeGetInfo()' for 'virsh nodeinfo' (RHEL-86197)
- esx: Accept empty "path" URI component same way as "/" (RHEL-86459)
- qemu: Rename outgoingMigration parameter in various TPM functions (RHEL-86800)
- qemu: Properly propagate migration state to TPM cleanup code (RHEL-86800)
- qemuDomainBlockCopyCommon: Don't revoke access to file twice on failure (RHEL-7357)
- qemuxmlconftest: Drop s390-default-cpu-...ccw-virtio-2.7 test cases (RHEL-72976)
- tests: add capabilities for QEMU 10.0.0 on s390x (RHEL-72976)
- qemu: Do NOT autoadd NUMA node for s390 (RHEL-72976)
- qemu_command: Use qemuBuildVirtioDevProps() to build cmd line for virtio-mem and virtio-pmem (RHEL-72976)
- qemuxmlconftest: Introduce memory-hotplug-virtio-mem-pci-s390x.xml (RHEL-72976)
- qemu_caps: Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW (RHEL-72976)
- qemu: Validate virtio-mem-ccw (RHEL-72976)
- qemu: Allow virtio-mem on CCW (RHEL-72976)
- qemuxmlconftest: Introduce memory-hotplug-virtio-mem-ccw-s390x.xml (RHEL-72976)
- qemu_domain_address: fix CCW virtio-mem hotplug (RHEL-72976)

Resolves: RHEL-72976, RHEL-7357, RHEL-80606, RHEL-82539, RHEL-86197
Resolves: RHEL-86459, RHEL-86800
2025-04-17 09:56:28 +02:00

96 lines
3.9 KiB
Diff

From 782c337fb48b56a50ed85cbfe1dc3a8a1342ac08 Mon Sep 17 00:00:00 2001
Message-ID: <782c337fb48b56a50ed85cbfe1dc3a8a1342ac08.1744876588.git.jdenemar@redhat.com>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 13 Jan 2025 15:48:03 +0100
Subject: [PATCH] qemu_command: Use qemuBuildVirtioDevProps() to build cmd line
for virtio-mem and virtio-pmem
Both, virtio-mem and virtio-pmem devices follow traditional QEMU
naming convention: their suffix determines what bus they live on.
For instance, virtio-mem-pci, virtio-mem-ccw, virtio-pmem-pci.
We already have a function that constructs device name following
this convention: qemuBuildVirtioDevGetConfigDev().
While there's no virtio-pmem-ccw device yet, the function can
still be used.
Another advantage of using the function is - it'll be easier in
future when we want to configure various virtio aspects of memory
devices (like ats, iommu_platform, etc.).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
(cherry picked from commit 89d56c41ac16452eb5f6f27eb87658277b270f83)
Resolves: https://issues.redhat.com/browse/RHEL-72976
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b7d61edd19..fb70c79a94 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -967,6 +967,23 @@ qemuBuildVirtioDevGetConfigDev(const virDomainDeviceDef *device,
break;
}
+ case VIR_DOMAIN_DEVICE_MEMORY:
+ switch (device->data.memory->model) {
+ case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
+ *baseName = "virtio-pmem";
+ break;
+ case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM:
+ *baseName = "virtio-mem";
+ break;
+ case VIR_DOMAIN_MEMORY_MODEL_DIMM:
+ case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
+ case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
+ case VIR_DOMAIN_MEMORY_MODEL_NONE:
+ case VIR_DOMAIN_MEMORY_MODEL_LAST:
+ break;
+ }
+ break;
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_WATCHDOG:
case VIR_DOMAIN_DEVICE_GRAPHICS:
@@ -979,7 +996,6 @@ qemuBuildVirtioDevGetConfigDev(const virDomainDeviceDef *device,
case VIR_DOMAIN_DEVICE_SHMEM:
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
- case VIR_DOMAIN_DEVICE_MEMORY:
case VIR_DOMAIN_DEVICE_IOMMU:
case VIR_DOMAIN_DEVICE_AUDIO:
case VIR_DOMAIN_DEVICE_PSTORE:
@@ -3487,12 +3503,16 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
break;
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
- device = "virtio-pmem-pci";
+ /* Deliberately not setting @device. */
+ if (!(props = qemuBuildVirtioDevProps(VIR_DOMAIN_DEVICE_MEMORY, mem, priv->qemuCaps)))
+ return NULL;
address = mem->target.virtio_pmem.address;
break;
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM:
- device = "virtio-mem-pci";
+ /* Deliberately not setting @device. */
+ if (!(props = qemuBuildVirtioDevProps(VIR_DOMAIN_DEVICE_MEMORY, mem, priv->qemuCaps)))
+ return NULL;
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC) &&
qemuBuildMemoryGetPagesize(cfg, def, mem, NULL, NULL, NULL, &prealloc) < 0)
@@ -3514,7 +3534,7 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg,
}
if (virJSONValueObjectAdd(&props,
- "s:driver", device,
+ "S:driver", device,
"k:node", mem->targetNode,
"P:label-size", labelsize * 1024,
"P:block-size", blocksize * 1024,
--
2.49.0