File qemu-pcie-atomic-completion.diff of Package qemu

diff -uNrp qemu-10.2.0.orig/hw/pci/pcie.c qemu-10.2.0/hw/pci/pcie.c
--- qemu-10.2.0.orig/hw/pci/pcie.c	2026-02-21 18:37:01.022437969 +0000
+++ qemu-10.2.0/hw/pci/pcie.c	2026-02-21 22:19:01.988820007 +0000
@@ -928,9 +928,15 @@ void pcie_cap_slot_push_attention_button
 /* root control/capabilities/status. PME isn't emulated for now */
 void pcie_cap_root_init(PCIDevice *dev)
 {
+    PCIESlot *s = PCIE_SLOT(dev);
+
     pci_set_word(dev->wmask + dev->exp.exp_cap + PCI_EXP_RTCTL,
                  PCI_EXP_RTCTL_SECEE | PCI_EXP_RTCTL_SENFEE |
                  PCI_EXP_RTCTL_SEFEE);
+    if (s->atomic_completion) {
+        pci_long_test_and_set_mask(dev->config + dev->exp.exp_cap + PCI_EXP_DEVCAP2,
+                                   PCI_EXP_DEVCAP2_ATOMIC_COMP32 | PCI_EXP_DEVCAP2_ATOMIC_COMP64);
+    }
 }
 
 void pcie_cap_root_reset(PCIDevice *dev)
diff -uNrp qemu-10.2.0.orig/hw/pci-bridge/gen_pcie_root_port.c qemu-10.2.0/hw/pci-bridge/gen_pcie_root_port.c
--- qemu-10.2.0.orig/hw/pci-bridge/gen_pcie_root_port.c	2026-02-21 18:37:00.986178287 +0000
+++ qemu-10.2.0/hw/pci-bridge/gen_pcie_root_port.c	2026-02-21 22:21:52.728589580 +0000
@@ -145,6 +145,8 @@ static const Property gen_rp_props[] = {
                                 speed, PCIE_LINK_SPEED_16),
     DEFINE_PROP_PCIE_LINK_WIDTH("x-width", PCIESlot,
                                 width, PCIE_LINK_WIDTH_32),
+    DEFINE_PROP_BOOL("x-atomic-completion", PCIESlot,
+                     atomic_completion, false),
 };
 
 static void gen_rp_dev_class_init(ObjectClass *klass, const void *data)
diff -uNrp qemu-10.2.0.orig/include/hw/pci/pcie_port.h qemu-10.2.0/include/hw/pci/pcie_port.h
--- qemu-10.2.0.orig/include/hw/pci/pcie_port.h	2026-02-21 18:37:01.742614295 +0000
+++ qemu-10.2.0/include/hw/pci/pcie_port.h	2026-02-21 22:19:01.988820007 +0000
@@ -68,6 +68,9 @@ struct PCIESlot {
     /* broken ACPI hotplug compat knob to preserve 6.1 ABI intact */
     bool        hide_native_hotplug_cap;
 
+    /* x-atomic-completion: advertise 32 and 64 bit AtomicOp completer capabilities */
+    bool        atomic_completion;
+
     QLIST_ENTRY(PCIESlot) next;
 };
 
openSUSE Build Service is sponsored by