File libvirt-enable-atomic-completion.diff of Package libvirt

diff -uNrp libvirt-12.0.0.orig/src/conf/domain_conf.c libvirt-12.0.0/src/conf/domain_conf.c
--- libvirt-12.0.0.orig/src/conf/domain_conf.c	2026-02-23 10:32:59.719240309 +0000
+++ libvirt-12.0.0/src/conf/domain_conf.c	2026-02-27 09:19:07.941838058 +0000
@@ -9024,6 +9024,11 @@ virDomainControllerDefParseXML(virDomain
                                          &def->opts.pciopts.hotplug) < 0)
                 return NULL;
 
+            if (virXMLPropTristateSwitch(targetNodes[0], "x-atomic-completion",
+                                         VIR_XML_PROP_NONE,
+                                         &def->opts.pciopts.atomicCompletion) < 0)
+                return NULL;
+
             if (virXMLPropInt(targetNodes[0], "index", 0, VIR_XML_PROP_NONNEGATIVE,
                               &def->opts.pciopts.targetIndex,
                               def->opts.pciopts.targetIndex) < 0)
@@ -24326,6 +24331,11 @@ virDomainControllerDefFormatPCI(virBuffe
                           def->opts.pciopts.memReserve);
     }
 
+    if (def->opts.pciopts.atomicCompletion != VIR_TRISTATE_SWITCH_ABSENT) {
+        virBufferAsprintf(&targetAttrBuf, " x-atomic-completion='%s'",
+                          virTristateSwitchTypeToString(def->opts.pciopts.atomicCompletion));
+    }
+
     if (def->opts.pciopts.numaNode != -1)
         virBufferAsprintf(&targetChildBuf, "<node>%d</node>\n", def->opts.pciopts.numaNode);
 
diff -uNrp libvirt-12.0.0.orig/src/conf/domain_conf.h libvirt-12.0.0/src/conf/domain_conf.h
--- libvirt-12.0.0.orig/src/conf/domain_conf.h	2026-02-23 10:32:59.721304643 +0000
+++ libvirt-12.0.0/src/conf/domain_conf.h	2026-02-27 09:20:22.213729446 +0000
@@ -761,6 +761,7 @@ struct _virDomainPCIControllerOpts {
      */
     int numaNode;
     virTristateSwitch hotplug; /* 'off' to prevent hotplug/unplug, default 'on' */
+    virTristateSwitch atomicCompletion; /* x-atomic-completion for pcie-root-port */
 
     unsigned long long memReserve; /* used by pci-bridge and pcie-root-port,
                                       0 == undef, KiB */
diff -uNrp libvirt-12.0.0.orig/src/conf/schemas/domaincommon.rng libvirt-12.0.0/src/conf/schemas/domaincommon.rng
--- libvirt-12.0.0.orig/src/conf/schemas/domaincommon.rng	2026-02-23 10:32:59.761276956 +0000
+++ libvirt-12.0.0/src/conf/schemas/domaincommon.rng	2026-02-27 09:19:07.961838036 +0000
@@ -3023,6 +3023,11 @@
                     </attribute>
                   </optional>
                   <optional>
+                    <attribute name="x-atomic-completion">
+                      <ref name="virOnOff"/>
+                    </attribute>
+                  </optional>
+                  <optional>
                     <element name="node">
                       <ref name="unsignedInt"/>
                     </element>
diff -uNrp libvirt-12.0.0.orig/src/qemu/qemu_capabilities.c libvirt-12.0.0/src/qemu/qemu_capabilities.c
--- libvirt-12.0.0.orig/src/qemu/qemu_capabilities.c	2026-02-23 10:33:00.118636986 +0000
+++ libvirt-12.0.0/src/qemu/qemu_capabilities.c	2026-02-27 09:19:07.989838006 +0000
@@ -579,6 +579,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
               "fsdev.multidevs", /* QEMU_CAPS_FSDEV_MULTIDEVS */
               "virtio.packed", /* X_QEMU_CAPS_VIRTIO_PACKED_QUEUES */
               "pcie-root-port.hotplug", /* QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG */
+              "pcie-root-port.x-atomic-completion", /* QEMU_CAPS_PCIE_ROOT_PORT_ATOMIC_COMPLETION */
               "aio.io_uring", /* QEMU_CAPS_AIO_IO_URING */
               "machine.pseries.cap-cfpc", /* X_QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC */
 
@@ -1510,6 +1511,7 @@ static struct virQEMUCapsDevicePropsFlag
 
 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsPCIeRootPort[] = {
     { "hotplug", QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG, NULL },
+    { "x-atomic-completion", QEMU_CAPS_PCIE_ROOT_PORT_ATOMIC_COMPLETION, NULL },
 };
 
 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsUSBHost[] = {
diff -uNrp libvirt-12.0.0.orig/src/qemu/qemu_capabilities.h libvirt-12.0.0/src/qemu/qemu_capabilities.h
--- libvirt-12.0.0.orig/src/qemu/qemu_capabilities.h	2026-02-23 10:33:00.119253856 +0000
+++ libvirt-12.0.0/src/qemu/qemu_capabilities.h	2026-02-27 09:19:07.965769366 +0000
@@ -554,6 +554,7 @@ typedef enum { /* virQEMUCapsFlags group
     QEMU_CAPS_FSDEV_MULTIDEVS, /* fsdev.multidevs */
     X_QEMU_CAPS_VIRTIO_PACKED_QUEUES, /* virtio.packed */
     QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG, /* pcie-root-port.hotplug */
+    QEMU_CAPS_PCIE_ROOT_PORT_ATOMIC_COMPLETION, /* pcie-root-port.x-atomic-completion */
     QEMU_CAPS_AIO_IO_URING, /* -blockdev {...,"aio":"io_uring",...} */
     X_QEMU_CAPS_MACHINE_PSERIES_CAP_CFPC, /* -machine pseries.cap-cfpc */
 
diff -uNrp libvirt-12.0.0.orig/src/qemu/qemu_command.c libvirt-12.0.0/src/qemu/qemu_command.c
--- libvirt-12.0.0.orig/src/qemu/qemu_command.c	2026-02-23 10:33:00.125562863 +0000
+++ libvirt-12.0.0/src/qemu/qemu_command.c	2026-02-27 09:21:16.465648540 +0000
@@ -2797,6 +2797,7 @@ qemuBuildControllerPCIDevProps(virDomain
                                   "i:chassis", pciopts->chassis,
                                   "s:id", def->info.alias,
                                   "T:hotplug", pciopts->hotplug,
+                                  "T:x-atomic-completion", pciopts->atomicCompletion,
                                   "P:mem-reserve", pciopts->memReserve * 1024,
                                   NULL) < 0)
             return -1;
diff -uNrp libvirt-12.0.0.orig/src/qemu/qemu_validate.c libvirt-12.0.0/src/qemu/qemu_validate.c
--- libvirt-12.0.0.orig/src/qemu/qemu_validate.c	2026-02-23 10:33:00.188028449 +0000
+++ libvirt-12.0.0/src/qemu/qemu_validate.c	2026-02-27 09:46:42.009745551 +0000
@@ -4618,6 +4618,13 @@ qemuValidateDomainDeviceDefControllerPCI
                                "hotplug", modelName);
                 return -1;
             }
+            if (pciopts->atomicCompletion != VIR_TRISTATE_SWITCH_ABSENT &&
+                !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCIE_ROOT_PORT_ATOMIC_COMPLETION)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("setting the '%1$s' property on a '%2$s' device is not supported by this QEMU binary"),
+                               "x-atomic-completion", modelName);
+                return -1;
+            }
             break;
 
         case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
openSUSE Build Service is sponsored by