[libvirt PATCH 0/3] Support for restarting passt backend
by Laine Stump
If the passt process that implements the backend of a QEMU emulated
network device terminates, QEMU itself is incapable of restarting a
new process so that the networking can begin... working again.
However, what QEMU can and does do is:
1) send the NETDEV_STREAM_DISCONNECTED event to libvirt when it sees
that the socket has been closed (this event has been in QEMU for as
long as support for "-netdev stream", which is used for connecting
to passt)
2) as of QEMU 8.0.0, the qemu commandline for -netdev stream accepts
the "reconnect" option, which tells QEMU to attempt reconnecting to
the same socket it previously used, repeating the attempt every "n"
seconds (the only argument to reconnect) until it is successful.
If libvirt adds the reconnect option to the qemu commandline, and then
responds to a NETDEV_STREAM_DISCONNECTED event by re-running the same
passt command that it ran when the device was originally connected,
then a guest will be able to recover in the (very unlikely, according
to Stefano!) event that the original passt process unexpectedly exits,
or is killed by some external entity.
Patch 2/3 handles (2) above, while patch 3/3 handles (1). (patch 1/3
is a short guest appearance by pkrempa. Thanks pkrempa!).
This resolves https://bugzilla.redhat.com/2172098
Along with Stefano's series fixing up selinux issues related to
running the passt process, they make the passt backend very usable.
Laine Stump (2):
qemu: add reconnect=5 to passt qemu commandline options when available
qemu: respond to NETDEV_STREAM_DISCONNECTED event
Peter Krempa (1):
qemu: capabilities: Introduce QEMU_CAPS_NETDEV_STREAM_RECONNECT
src/qemu/qemu_capabilities.c | 4 +
src/qemu/qemu_capabilities.h | 3 +
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_driver.c | 82 +++++++++++++++++++
src/qemu/qemu_monitor.c | 11 +++
src/qemu/qemu_monitor.h | 6 ++
src/qemu/qemu_monitor_json.c | 16 ++++
src/qemu/qemu_passt.c | 11 +++
src/qemu/qemu_process.c | 18 ++++
.../caps_8.0.0.x86_64.xml | 1 +
.../net-user-passt.x86_64-7.2.0.args | 37 +++++++++
.../net-user-passt.x86_64-latest.args | 2 +-
tests/qemuxml2argvtest.c | 1 +
14 files changed, 193 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/net-user-passt.x86_64-7.2.0.args
--
2.39.2
1 year, 8 months
[libvirt PATCH 0/2] A couple simple cleanups
by Laine Stump
Noticed these while doing other work.
Laine Stump (2):
qemu: add check for QEMU_CAPS_NETDEV_STREAM during validation
qemu: remove extraneous error log when qemuPasstStart() fails during
hotplug
src/qemu/qemu_hotplug.c | 5 +-
src/qemu/qemu_validate.c | 6 ++
.../net-user-passt.x86_64-latest.xml | 61 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 +-
4 files changed, 69 insertions(+), 5 deletions(-)
create mode 100644 tests/qemuxml2xmloutdata/net-user-passt.x86_64-latest.xml
--
2.39.2
1 year, 8 months
[libvirt PATCH v2] qemu: implement QEMU NBD source reconnect delay attribute
by Christian Nautze
Currently it's only possible to set this parameter during domain
creation via QEMU commandline passthrough feature.
With the new delay attribute it's also possible to set this
parameter if you want to attach a new NBD disk
using "virsh attach-device domain device.xml" e.g.:
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
<source protocol='nbd' name='foo'>
<host name='example.org' port='6000'/>
<reconnect delay='10'/>
</source>
<target dev='vdb' bus='virtio'/>
</disk>
Signed-off-by: Christian Nautze <christian.nautze(a)exoscale.ch>
---
Change: reconnect element: drop mandatory 'enabled' attribute when using 'delay'
---
docs/formatdomain.rst | 11 +++++++--
src/conf/domain_conf.c | 12 ++++++++++
src/conf/schemas/domaincommon.rng | 3 +++
src/conf/schemas/storagecommon.rng | 13 ++++++++---
src/conf/storage_source_conf.c | 1 +
src/conf/storage_source_conf.h | 4 ++++
src/qemu/qemu_block.c | 4 +++-
src/qemu/qemu_domain.c | 9 ++++++++
.../disk-network-nbd.x86_64-latest.args | 23 +++++++++++--------
tests/qemuxml2argvdata/disk-network-nbd.xml | 8 +++++++
tests/qemuxml2xmloutdata/disk-network-nbd.xml | 9 ++++++++
11 files changed, 81 insertions(+), 16 deletions(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 36c6d87907..ee30c51cea 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -2946,13 +2946,20 @@ paravirtualized driver is specified via the ``disk`` element.
are intended to be default, then the entire element may be omitted.
``reconnect``
For disk type ``vhostuser`` configures reconnect timeout if the connection
- is lost. It has two mandatory attributes:
+ is lost. This is set with the two mandatory attributes ``enabled`` and
+ ``timeout``.
+ For disk type ``network`` and protocol ``nbd`` the QEMU NBD reconnect delay
+ can be set via attribute ``delay``:
``enabled``
If the reconnect feature is enabled, accepts ``yes`` and ``no``
``timeout``
The amount of seconds after which hypervisor tries to reconnect.
-
+ ``delay``
+ Only for NBD hosts. The amount of seconds during which all requests are
+ paused and will be rerun after a successful reconnect. After that time, any
+ delayed requests and all future requests before a successful reconnect
+ will immediately fail. If not set the default QEMU value is 0.
For a "file" or "volume" disk type which represents a cdrom or floppy (the
``device`` attribute), it is possible to define policy what to do with the
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a5578324b9..3f2ba2aab8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7146,6 +7146,15 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
src->tlsFromConfig = !!value;
}
+ if (src->protocol == VIR_STORAGE_NET_PROTOCOL_NBD) {
+ xmlNodePtr cur;
+ if ((cur = virXPathNode("./reconnect", ctxt))) {
+ if (virXMLPropUInt(cur, "delay", 10, VIR_XML_PROP_NONE,
+ &src->reconnectDelay) < 0)
+ return -1;
+ }
+ }
+
/* for historical reasons we store the volume and image name in one XML
* element although it complicates thing when attempting to access them. */
if (src->path &&
@@ -22073,6 +22082,9 @@ virDomainDiskSourceFormatNetwork(virBuffer *attrBuf,
virBufferAddLit(childBuf, "/>\n");
}
+ if (src->reconnectDelay) {
+ virBufferAsprintf(childBuf, "<reconnect delay='%u'/>\n", src->reconnectDelay);
+ }
virBufferEscapeString(childBuf, "<snapshot name='%s'/>\n", src->snapshot);
virBufferEscapeString(childBuf, "<config file='%s'/>\n", src->configFile);
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index a57dd212ab..dd5fbeac09 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -2199,6 +2199,9 @@
</optional>
<ref name="diskSourceCommon"/>
<ref name="diskSourceNetworkHost"/>
+ <optional>
+ <ref name="reconnect"/>
+ </optional>
<optional>
<ref name="encryption"/>
</optional>
diff --git a/src/conf/schemas/storagecommon.rng b/src/conf/schemas/storagecommon.rng
index 4d6e646c9a..582375358c 100644
--- a/src/conf/schemas/storagecommon.rng
+++ b/src/conf/schemas/storagecommon.rng
@@ -55,14 +55,21 @@
<define name="reconnect">
<element name="reconnect">
- <attribute name="enabled">
- <ref name="virYesNo"/>
- </attribute>
+ <optional>
+ <attribute name="enabled">
+ <ref name="virYesNo"/>
+ </attribute>
+ </optional>
<optional>
<attribute name="timeout">
<ref name="unsignedInt"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="delay">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
</element>
</define>
diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c
index cecd7e811e..58009fd06e 100644
--- a/src/conf/storage_source_conf.c
+++ b/src/conf/storage_source_conf.c
@@ -811,6 +811,7 @@ virStorageSourceCopy(const virStorageSource *src,
def->sslverify = src->sslverify;
def->readahead = src->readahead;
def->timeout = src->timeout;
+ def->reconnectDelay = src->reconnectDelay;
def->metadataCacheMaxSize = src->metadataCacheMaxSize;
/* storage driver metadata are not copied */
diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h
index 14a6825d54..c6187dda59 100644
--- a/src/conf/storage_source_conf.h
+++ b/src/conf/storage_source_conf.h
@@ -312,6 +312,10 @@ struct _virStorageSource {
unsigned long long readahead; /* size of the readahead buffer in bytes */
unsigned long long timeout; /* connection timeout in seconds */
+ /* NBD QEMU reconnect-delay option,
+ * 0 as default value */
+ unsigned int reconnectDelay;
+
virStorageSourceNVMeDef *nvme; /* type == VIR_STORAGE_TYPE_NVME */
virDomainChrSourceDef *vhostuser; /* type == VIR_STORAGE_TYPE_VHOST_USER */
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 5e700eff99..8fcebd8992 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -529,6 +529,7 @@ qemuBlockStorageSourceGetNBDProps(virStorageSource *src,
"S:export", src->path,
"S:tls-creds", tlsAlias,
"S:tls-hostname", tlsHostname,
+ "p:reconnect-delay", src->reconnectDelay,
NULL) < 0)
return NULL;
@@ -1848,7 +1849,8 @@ qemuBlockGetBackingStoreString(virStorageSource *src,
src->ncookies == 0 &&
src->sslverify == VIR_TRISTATE_BOOL_ABSENT &&
src->timeout == 0 &&
- src->readahead == 0) {
+ src->readahead == 0 &&
+ src->reconnectDelay == 0) {
switch ((virStorageNetProtocol) src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_NBD:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e9bc0f375d..02ae3823fb 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5020,6 +5020,15 @@ qemuDomainValidateStorageSource(virStorageSource *src,
}
}
+ if (src->reconnectDelay > 0) {
+ if (actualType != VIR_STORAGE_TYPE_NETWORK ||
+ src->protocol != VIR_STORAGE_NET_PROTOCOL_NBD) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("reconnect delay is supported only with NBD protocol"));
+ return -1;
+ }
+ }
+
if (src->query &&
(actualType != VIR_STORAGE_TYPE_NETWORK ||
(src->protocol != VIR_STORAGE_NET_PROTOCOL_HTTPS &&
diff --git a/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args b/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args
index 21e619af3e..e8d13b0bd4 100644
--- a/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args
@@ -28,21 +28,24 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-no-acpi \
-boot strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
--blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"node-name":"libvirt-6-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-6-format","read-only":false,"driver":"raw","file":"libvirt-6-storage"}' \
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-6-format","id":"virtio-disk0","bootindex":1}' \
+-blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"export":"bar","node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-5-format","read-only":false,"driver":"raw","file":"libvirt-5-storage"}' \
--device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-5-format","id":"virtio-disk0","bootindex":1}' \
--blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"export":"bar","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-5-format","id":"virtio-disk1"}' \
+-blockdev '{"driver":"nbd","server":{"type":"inet","host":"::1","port":"6000"},"node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-4-format","read-only":false,"driver":"raw","file":"libvirt-4-storage"}' \
--device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-4-format","id":"virtio-disk1"}' \
--blockdev '{"driver":"nbd","server":{"type":"inet","host":"::1","port":"6000"},"node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x4","drive":"libvirt-4-format","id":"virtio-disk2"}' \
+-blockdev '{"driver":"nbd","server":{"type":"inet","host":"::1","port":"6000"},"export":"bar","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"raw","file":"libvirt-3-storage"}' \
--device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x4","drive":"libvirt-3-format","id":"virtio-disk2"}' \
--blockdev '{"driver":"nbd","server":{"type":"inet","host":"::1","port":"6000"},"export":"bar","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x5","drive":"libvirt-3-format","id":"virtio-disk3"}' \
+-blockdev '{"driver":"nbd","server":{"type":"unix","path":"/var/run/nbdsock"},"export":"bar","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"raw","file":"libvirt-2-storage"}' \
--device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x5","drive":"libvirt-2-format","id":"virtio-disk3"}' \
--blockdev '{"driver":"nbd","server":{"type":"unix","path":"/var/run/nbdsock"},"export":"bar","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"libvirt-2-format","id":"virtio-disk4"}' \
+-blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"export":"foo","reconnect-delay":10,"node-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":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"libvirt-1-format","id":"virtio-disk4"}' \
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"libvirt-1-format","id":"virtio-disk5"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-network-nbd.xml b/tests/qemuxml2argvdata/disk-network-nbd.xml
index 8ac6cc3b7b..4e8b1e5b03 100644
--- a/tests/qemuxml2argvdata/disk-network-nbd.xml
+++ b/tests/qemuxml2argvdata/disk-network-nbd.xml
@@ -49,6 +49,14 @@
</source>
<target dev='vde' bus='virtio'/>
</disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='nbd' name='foo'>
+ <host name='example.org' port='6000'/>
+ <reconnect delay='10'/>
+ </source>
+ <target dev='vdf' bus='virtio'/>
+ </disk>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
diff --git a/tests/qemuxml2xmloutdata/disk-network-nbd.xml b/tests/qemuxml2xmloutdata/disk-network-nbd.xml
index f8dcca4bab..38d1f290c8 100644
--- a/tests/qemuxml2xmloutdata/disk-network-nbd.xml
+++ b/tests/qemuxml2xmloutdata/disk-network-nbd.xml
@@ -54,6 +54,15 @@
<target dev='vde' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='nbd' name='foo'>
+ <host name='example.org' port='6000'/>
+ <reconnect delay='10'/>
+ </source>
+ <target dev='vdf' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+ </disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
--
2.34.1
1 year, 8 months
[PATCH] qemu: forbid updating any attributes of an interface <backend> with update-device
by Laine Stump
Changing any of the attributes of an <interface>'s <backend> would
require removing and re-adding the interface for the new setting to
take effect, so fail any update-device that changes anything in
<backend>
Resolves: https://bugzilla.redhat.com/2169245
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/conf/domain_conf.c | 14 ++++++++++++++
src/conf/domain_conf.h | 2 ++
src/libvirt_private.syms | 1 +
src/qemu/qemu_hotplug.c | 9 +++++++++
4 files changed, 26 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3dfc5c87af..aa7bed7dc3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19853,6 +19853,20 @@ virDomainFsDefCheckABIStability(virDomainFSDef *src,
}
+bool
+virDomainNetBackendIsEqual(virDomainNetBackend *src,
+ virDomainNetBackend *dst)
+{
+ if (src->type != dst->type ||
+ STRNEQ_NULLABLE(src->tap, dst->tap) ||
+ STRNEQ_NULLABLE(src->vhost, dst->vhost) ||
+ STRNEQ_NULLABLE(src->logFile, dst->logFile)) {
+ return false;
+ }
+ return true;
+}
+
+
static bool
virDomainNetDefCheckABIStability(virDomainNetDef *src,
virDomainNetDef *dst)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7d58efb011..bd8ce562d9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3862,6 +3862,8 @@ virDomainNetDef *virDomainNetFindByName(virDomainDef *def, const char *ifname);
bool virDomainHasNet(virDomainDef *def, virDomainNetDef *net);
int virDomainNetInsert(virDomainDef *def, virDomainNetDef *net);
int virDomainNetUpdate(virDomainDef *def, size_t netidx, virDomainNetDef *newnet);
+bool virDomainNetBackendIsEqual(virDomainNetBackend *src,
+ virDomainNetBackend *dst);
int virDomainNetDHCPInterfaces(virDomainDef *def, virDomainInterfacePtr **ifaces);
int virDomainNetARPInterfaces(virDomainDef *def, virDomainInterfacePtr **ifaces);
virDomainNetDef *virDomainNetRemove(virDomainDef *def, size_t i);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 97c3d86217..c6c47dbfac 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -528,6 +528,7 @@ virDomainMouseModeTypeToString;
virDomainNetAllocateActualDevice;
virDomainNetAppendIPAddress;
virDomainNetARPInterfaces;
+virDomainNetBackendIsEqual;
virDomainNetBandwidthUpdate;
virDomainNetDefActualFromNetworkPort;
virDomainNetDefActualToNetworkPort;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index c490e2b97a..b4cddef9f5 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3675,6 +3675,15 @@ qemuDomainChangeNet(virQEMUDriver *driver,
goto cleanup;
}
+ /* nothing in <backend> can be modified in an existing interface -
+ * the entire device will need to be removed and re-added.
+ */
+ if (!virDomainNetBackendIsEqual(&olddev->backend, &newdev->backend)) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot modify network device backend settings"));
+ goto cleanup;
+ }
+
/* allocate new actual device to compare to old - we will need to
* free it if we fail for any reason
*/
--
2.39.1
1 year, 8 months
Re: [PATCH v3 2/2] hw/cxl: Multi-Region CXL Type-3 Devices (Volatile and Persistent)
by Philippe Mathieu-Daudé
On 21/2/23 15:00, Jonathan Cameron wrote:
> From: Gregory Price <gourry.memverge(a)gmail.com>
>
> This commit enables each CXL Type-3 device to contain one volatile
> memory region and one persistent region.
>
> Two new properties have been added to cxl-type3 device initialization:
> [volatile-memdev] and [persistent-memdev]
>
> The existing [memdev] property has been deprecated and will default the
> memory region to a persistent memory region (although a user may assign
> the region to a ram or file backed region). It cannot be used in
> combination with the new [persistent-memdev] property.
>
> Partitioning volatile memory from persistent memory is not yet supported.
>
> Volatile memory is mapped at DPA(0x0), while Persistent memory is mapped
> at DPA(vmem->size), per CXL Spec 8.2.9.8.2.0 - Get Partition Info.
>
> Signed-off-by: Gregory Price <gregory.price(a)memverge.com>
> Reviewed-by: Davidlohr Bueso <dave(a)stgolabs.net>
> Reviewed-by: Fan Ni <fan.ni(a)samsung.com>
> Tested-by: Fan Ni <fan.ni(a)samsung.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron(a)huawei.com>
>
> ---
> v3:
> - Don't set the DVSEC range register base address
> v2:
> - Fixed an off by one in address space selection.
> - Gather tags.
> ---
> docs/system/devices/cxl.rst | 49 ++++--
> hw/cxl/cxl-mailbox-utils.c | 26 +--
> hw/mem/cxl_type3.c | 294 +++++++++++++++++++++++++--------
> include/hw/cxl/cxl_device.h | 11 +-
> tests/qtest/bios-tables-test.c | 8 +-
> tests/qtest/cxl-test.c | 76 +++++++--
> 6 files changed, 353 insertions(+), 111 deletions(-)
>
> diff --git a/docs/system/devices/cxl.rst b/docs/system/devices/cxl.rst
> index f25783a4ec..89a41cff73 100644
> --- a/docs/system/devices/cxl.rst
> +++ b/docs/system/devices/cxl.rst
> @@ -300,7 +300,7 @@ Example topology involving a switch::
>
> Example command lines
> ---------------------
> -A very simple setup with just one directly attached CXL Type 3 device::
> +A very simple setup with just one directly attached CXL Type 3 Persistent Memory device::
>
> qemu-system-aarch64 -M virt,gic-version=3,cxl=on -m 4g,maxmem=8G,slots=8 -cpu max \
> ...
> @@ -308,7 +308,28 @@ A very simple setup with just one directly attached CXL Type 3 device::
> -object memory-backend-file,id=cxl-lsa1,share=on,mem-path=/tmp/lsa.raw,size=256M \
> -device pxb-cxl,bus_nr=12,bus=pcie.0,id=cxl.1 \
> -device cxl-rp,port=0,bus=cxl.1,id=root_port13,chassis=0,slot=2 \
> - -device cxl-type3,bus=root_port13,memdev=cxl-mem1,lsa=cxl-lsa1,id=cxl-pmem0 \
> + -device cxl-type3,bus=root_port13,persistent-memdev=cxl-mem1,lsa=cxl-lsa1,id=cxl-pmem0 \
> + -M cxl-fmw.0.targets.0=cxl.1,cxl-fmw.0.size=4G
> +
> +A very simple setup with just one directly attached CXL Type 3 Volatile Memory device::
> +
> + qemu-system-aarch64 -M virt,gic-version=3,cxl=on -m 4g,maxmem=8G,slots=8 -cpu max \
> + ...
> + -object memory-backend-ram,id=vmem0,share=on,size=256M \
> + -device pxb-cxl,bus_nr=12,bus=pcie.0,id=cxl.1 \
> + -device cxl-rp,port=0,bus=cxl.1,id=root_port13,chassis=0,slot=2 \
> + -device cxl-type3,bus=root_port13,volatile-memdev=vmem0,id=cxl-vmem0 \
> + -M cxl-fmw.0.targets.0=cxl.1,cxl-fmw.0.size=4G
> +
> +The same volatile setup may optionally include an LSA region::
> +
> + qemu-system-aarch64 -M virt,gic-version=3,cxl=on -m 4g,maxmem=8G,slots=8 -cpu max \
> + ...
> + -object memory-backend-ram,id=vmem0,share=on,size=256M \
> + -object memory-backend-file,id=cxl-lsa0,share=on,mem-path=/tmp/lsa.raw,size=256M \
> + -device pxb-cxl,bus_nr=12,bus=pcie.0,id=cxl.1 \
> + -device cxl-rp,port=0,bus=cxl.1,id=root_port13,chassis=0,slot=2 \
> + -device cxl-type3,bus=root_port13,volatile-memdev=vmem0,lsa=cxl-lsa0,id=cxl-vmem0 \
> -M cxl-fmw.0.targets.0=cxl.1,cxl-fmw.0.size=4G
>
> A setup suitable for 4 way interleave. Only one fixed window provided, to enable 2 way
> @@ -328,13 +349,13 @@ the CXL Type3 device directly attached (no switches).::
> -device pxb-cxl,bus_nr=12,bus=pcie.0,id=cxl.1 \
> -device pxb-cxl,bus_nr=222,bus=pcie.0,id=cxl.2 \
> -device cxl-rp,port=0,bus=cxl.1,id=root_port13,chassis=0,slot=2 \
> - -device cxl-type3,bus=root_port13,memdev=cxl-mem1,lsa=cxl-lsa1,id=cxl-pmem0 \
> + -device cxl-type3,bus=root_port13,persistent-memdev=cxl-mem1,lsa=cxl-lsa1,id=cxl-pmem0 \
> -device cxl-rp,port=1,bus=cxl.1,id=root_port14,chassis=0,slot=3 \
> - -device cxl-type3,bus=root_port14,memdev=cxl-mem2,lsa=cxl-lsa2,id=cxl-pmem1 \
> + -device cxl-type3,bus=root_port14,persistent-memdev=cxl-mem2,lsa=cxl-lsa2,id=cxl-pmem1 \
> -device cxl-rp,port=0,bus=cxl.2,id=root_port15,chassis=0,slot=5 \
> - -device cxl-type3,bus=root_port15,memdev=cxl-mem3,lsa=cxl-lsa3,id=cxl-pmem2 \
> + -device cxl-type3,bus=root_port15,persistent-memdev=cxl-mem3,lsa=cxl-lsa3,id=cxl-pmem2 \
> -device cxl-rp,port=1,bus=cxl.2,id=root_port16,chassis=0,slot=6 \
> - -device cxl-type3,bus=root_port16,memdev=cxl-mem4,lsa=cxl-lsa4,id=cxl-pmem3 \
> + -device cxl-type3,bus=root_port16,persistent-memdev=cxl-mem4,lsa=cxl-lsa4,id=cxl-pmem3 \
> -M cxl-fmw.0.targets.0=cxl.1,cxl-fmw.0.targets.1=cxl.2,cxl-fmw.0.size=4G,cxl-fmw.0.interleave-granularity=8k
>
> An example of 4 devices below a switch suitable for 1, 2 or 4 way interleave::
> @@ -354,15 +375,23 @@ An example of 4 devices below a switch suitable for 1, 2 or 4 way interleave::
> -device cxl-rp,port=1,bus=cxl.1,id=root_port1,chassis=0,slot=1 \
> -device cxl-upstream,bus=root_port0,id=us0 \
> -device cxl-downstream,port=0,bus=us0,id=swport0,chassis=0,slot=4 \
> - -device cxl-type3,bus=swport0,memdev=cxl-mem0,lsa=cxl-lsa0,id=cxl-pmem0,size=256M \
> + -device cxl-type3,bus=swport0,persistent-memdev=cxl-mem0,lsa=cxl-lsa0,id=cxl-pmem0,size=256M \
> -device cxl-downstream,port=1,bus=us0,id=swport1,chassis=0,slot=5 \
> - -device cxl-type3,bus=swport1,memdev=cxl-mem1,lsa=cxl-lsa1,id=cxl-pmem1,size=256M \
> + -device cxl-type3,bus=swport1,persistent-memdev=cxl-mem1,lsa=cxl-lsa1,id=cxl-pmem1,size=256M \
> -device cxl-downstream,port=2,bus=us0,id=swport2,chassis=0,slot=6 \
> - -device cxl-type3,bus=swport2,memdev=cxl-mem2,lsa=cxl-lsa2,id=cxl-pmem2,size=256M \
> + -device cxl-type3,bus=swport2,persistent-memdev=cxl-mem2,lsa=cxl-lsa2,id=cxl-pmem2,size=256M \
> -device cxl-downstream,port=3,bus=us0,id=swport3,chassis=0,slot=7 \
> - -device cxl-type3,bus=swport3,memdev=cxl-mem3,lsa=cxl-lsa3,id=cxl-pmem3,size=256M \
> + -device cxl-type3,bus=swport3,persistent-memdev=cxl-mem3,lsa=cxl-lsa3,id=cxl-pmem3,size=256M \
> -M cxl-fmw.0.targets.0=cxl.1,cxl-fmw.0.size=4G,cxl-fmw.0.interleave-granularity=4k
>
> +Deprecations
> +------------
> +
> +The Type 3 device [memdev] attribute has been deprecated in favor of the
> +[persistent-memdev] attributes. [memdev] will default to a persistent memory
> +device for backward compatibility and is incapable of being used in combination
> +with [persistent-memdev].
> +
Probably worth mentioning & referring this in docs/about/deprecated.rst.
1 year, 8 months
[PATCH] NEWS: Document new pvpanic-pci device
by Kristina Hanicova
Signed-off-by: Kristina Hanicova <khanicov(a)redhat.com>
---
NEWS.rst | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/NEWS.rst b/NEWS.rst
index 4625a838f8..0302b4f0e1 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -33,6 +33,11 @@ v9.1.0 (unreleased)
Support crypto device(virtio crypto only), also add support for QEMU with
backend ``builtin`` and ``lkcf``.
+ * qemu: added support for pvpanic-pci device
+
+ A pvpanic device can be now defined as a PCI device (the original is an ISA
+ device) with ``<panic model='pvpanic'/>``.
+
* **Improvements**
* RPM packaging changes
--
2.39.1
1 year, 8 months
[PATCH] qemu: fix reconnect of unix socket is wrong
by Zhenguo Yao
'reconnect' parameter doesn't pass to qemu properly when
hotplug vhost-user device to vm. Fix this by making
'reconnect' to get correct value.
Signed-off-by: Zhenguo Yao <yaozhenguo1(a)gmail.com>
---
src/qemu/qemu_monitor_json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index d05ca2932f..ba6276ec8e 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6450,7 +6450,7 @@ qemuMonitorJSONAttachCharDevGetProps(const char *chrID,
return NULL;
if (chr->data.nix.reconnect.enabled == VIR_TRISTATE_BOOL_YES)
- reconnect = chr->data.tcp.reconnect.timeout;
+ reconnect = chr->data.nix.reconnect.timeout;
else if (chr->data.nix.reconnect.enabled == VIR_TRISTATE_BOOL_NO)
reconnect = 0;
}
--
2.32.0
1 year, 8 months
[libvirt PATCH 0/3] external snapshot deletion fixes
by Pavel Hrdina
Pavel Hrdina (3):
qemu_snapshot: remove memory snapshot when deleting external snapshot
qemu_snapshot: refactor qemuSnapshotDeleteExternalPrepare
NEWS: document external memory snapshot bug fixes
NEWS.rst | 7 +++++++
src/qemu/qemu_snapshot.c | 42 ++++++++++++++++++++++++++--------------
2 files changed, 34 insertions(+), 15 deletions(-)
--
2.39.1
1 year, 8 months
[PATCH v2 0/6] add support for pvpanic-pci device
by Kristina Hanicova
v1 here:
https://listman.redhat.com/archives/libvir-list/2023-February/237622.html
diff to v1:
* reduced test files (thanks Andrea)
* removed redundant check for address type (noticed by Peter)
* plugging the device directly into pcie.0 if its address was not
specified
Kristina Hanicova (6):
qemu: introduce QEMU_CAPS_DEVICE_PANIC_PCI
conf: add panic model 'pvpanic'
tests: add test cases for device pvpanic-pci
qemu: assign PCI address to device pvpanic-pci
tests: add case for pvpanic-pci without address
docs: document panic device 'pvpanic-pci'
docs/formatdomain.rst | 1 +
src/conf/domain_conf.c | 1 +
src/conf/domain_conf.h | 1 +
src/conf/schemas/domaincommon.rng | 1 +
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 17 +++++++++
src/qemu/qemu_domain_address.c | 34 +++++++++++++++++-
src/qemu/qemu_validate.c | 14 ++++++++
.../caps_6.0.0.aarch64.xml | 1 +
.../caps_6.0.0.x86_64.xml | 1 +
.../caps_6.1.0.x86_64.xml | 1 +
.../caps_6.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 +
.../caps_6.2.0.x86_64.xml | 1 +
.../caps_7.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 +
.../caps_7.0.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_7.1.0.ppc64.xml | 1 +
.../caps_7.1.0.x86_64.xml | 1 +
.../caps_7.2.0.x86_64.xml | 1 +
.../caps_8.0.0.riscv64.xml | 1 +
.../caps_8.0.0.x86_64.xml | 1 +
.../pvpanic-pci-aarch64.aarch64-latest.args | 36 +++++++++++++++++++
.../qemuxml2argvdata/pvpanic-pci-aarch64.xml | 20 +++++++++++
...invalid-address-aarch64.aarch64-latest.err | 1 +
.../pvpanic-pci-invalid-address-aarch64.xml | 20 +++++++++++
...pci-no-address-aarch64.aarch64-latest.args | 36 +++++++++++++++++++
.../pvpanic-pci-no-address-aarch64.xml | 18 ++++++++++
.../pvpanic-pci-x86_64.x86_64-latest.args | 34 ++++++++++++++++++
tests/qemuxml2argvdata/pvpanic-pci-x86_64.xml | 24 +++++++++++++
tests/qemuxml2argvtest.c | 5 +++
.../pvpanic-pci-aarch64.aarch64-latest.xml | 32 +++++++++++++++++
...-pci-no-address-aarch64.aarch64-latest.xml | 32 +++++++++++++++++
.../pvpanic-pci-x86_64.x86_64-latest.xml | 32 +++++++++++++++++
tests/qemuxml2xmltest.c | 4 +++
36 files changed, 379 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/pvpanic-pci-aarch64.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/pvpanic-pci-aarch64.xml
create mode 100644 tests/qemuxml2argvdata/pvpanic-pci-invalid-address-aarch64.aarch64-latest.err
create mode 100644 tests/qemuxml2argvdata/pvpanic-pci-invalid-address-aarch64.xml
create mode 100644 tests/qemuxml2argvdata/pvpanic-pci-no-address-aarch64.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/pvpanic-pci-no-address-aarch64.xml
create mode 100644 tests/qemuxml2argvdata/pvpanic-pci-x86_64.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/pvpanic-pci-x86_64.xml
create mode 100644 tests/qemuxml2xmloutdata/pvpanic-pci-aarch64.aarch64-latest.xml
create mode 100644 tests/qemuxml2xmloutdata/pvpanic-pci-no-address-aarch64.aarch64-latest.xml
create mode 100644 tests/qemuxml2xmloutdata/pvpanic-pci-x86_64.x86_64-latest.xml
--
2.39.1
1 year, 8 months