Skip to contentSkip to conversation

s390x/pci: set kvm_msi_via_irqfd_allowed

PATCH Superseded Matthew Rosato 5 participants 7 messages Oct 7, 2025 – Oct 8, 2025

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 s390x/pci: set kvm_msi_via_irqfd_allowed

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it. This improves s390x virtio-pci performance when using kvm acceleration by allowing kvm to deliver interrupts instead of QEMU.

---
v2:
- add review tag
- tweak commit message (David)

---
 hw/s390x/s390-pci-bus.c | 1 +
 1 file changed, 1 insertion(+)
hw/s390x/s390-pci-bus.c +1 -0
index e8e41c8a9a..88852acf45 100644
@@ -900,6 +900,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
     s390_pci_init_default_group();
     css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
                              S390_ADAPTER_SUPPRESSIBLE, errp);
+    kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
 }
 
 static void s390_pcihost_unrealize(DeviceState *dev)
Signature · 1 line
2.51.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 26 lines · Matthew Rosato

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it. This improves s390x virtio-pci performance when using kvm acceleration by allowing kvm to deliver interrupts instead of QEMU.

---
v2:
- add review tag
- tweak commit message (David)

---
  hw/s390x/s390-pci-bus.c | 1 +
  1 file changed, 1 insertion(+)
hw/s390x/s390-pci-bus.c +1 -0
index e8e41c8a9a..88852acf45 100644
@@ -900,6 +900,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
      s390_pci_init_default_group();
      css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
                               S390_ADAPTER_SUPPRESSIBLE, errp);
+    kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
  }
 
  static void s390_pcihost_unrealize(DeviceState *dev)
Reviewed-by on v2 1/1
#2 lore raw
In reply to Matthew Rosato
Quoted 7 lines · Matthew Rosato

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it. This improves s390x virtio-pci performance when using kvm acceleration by allowing kvm to deliver interrupts instead of QEMU.

---

Signature · 3 lines
Cheers

David / dhildenb
Reviewed-by on v2 1/1
#3 lore raw
In reply to Matthew Rosato
Quoted 6 lines · On Tue, 7 Oct 2025 16:56:14 -0400 Matthew Rosato <[email protected]>…

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it. This improves s390x virtio-pci performance when using kvm acceleration by allowing kvm to deliver interrupts instead of QEMU.

#4 lore raw
In reply to Matthew Rosato
Quoted 19 lines · Matthew Rosato

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it. This improves s390x virtio-pci performance when using kvm acceleration by allowing kvm to deliver interrupts instead of QEMU.

---
v2:
- add review tag
- tweak commit message (David)

---
  hw/s390x/s390-pci-bus.c | 1 +
  1 file changed, 1 insertion(+)
hw/s390x/s390-pci-bus.c +0 -0
index e8e41c8a9a..88852acf45 100644

hw/s390x/s390-pci-bus.c static void s390_pcihost_realize(DeviceState *dev, Error **errp) · line 904

Quoted 5 lines
hw/s390x/s390-pci-bus.c +1 -0
@@ -900,6 +900,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
      s390_pci_init_default_group();
      css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
                               S390_ADAPTER_SUPPRESSIBLE, errp);
+    kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
  }

Hi Matthew,

this unfortunately fails to compile without KVM (e.g. on x86 hosts):

../../devel/qemu/hw/s390x/s390-pci-bus.c: In function ‘s390_pcihost_realize’:
../../devel/qemu/hw/s390x/s390-pci-bus.c:903:5: error: ‘kvm_msi_via_irqfd_allowed’ undeclared (first use in this function); did you mean ‘kvm_msi_via_irqfd_enabled’?

  903 |     kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
      |     kvm_msi_via_irqfd_enabled

../../devel/qemu/hw/s390x/s390-pci-bus.c:903:5: note: each undeclared identifier is reported only once for each function it appears in

Thomas

#5 lore raw
Quoted 28 lines · Thomas Huth
Quoted 19 lines · Matthew Rosato

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it.  This improves s390x virtio-pci performance when using kvm acceleration by allowing kvm to deliver interrupts instead of QEMU.

---
v2:
  - add review tag
  - tweak commit message (David)
---
  hw/s390x/s390-pci-bus.c | 1 +

  1 file changed, 1 insertion(+)
hw/s390x/s390-pci-bus.c +0 -0
index e8e41c8a9a..88852acf45 100644

hw/s390x/s390-pci-bus.c static void s390_pcihost_realize(DeviceState *dev, Error **errp) · line 904

Quoted 5 lines
hw/s390x/s390-pci-bus.c +1 -0
@@ -900,6 +900,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
       s390_pci_init_default_group();
       css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
                                S390_ADAPTER_SUPPRESSIBLE, errp);
+    kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
   }

 Hi Matthew,

Quoted 9 lines

this unfortunately fails to compile without KVM (e.g. on x86 hosts):

../../devel/qemu/hw/s390x/s390-pci-bus.c: In function ‘s390_pcihost_realize’:
../../devel/qemu/hw/s390x/s390-pci-bus.c:903:5: error: ‘kvm_msi_via_irqfd_allowed’ undeclared (first use in this function); did you mean ‘kvm_msi_via_irqfd_enabled’? 903 |     kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
      |     kvm_msi_via_irqfd_enabled
../../devel/qemu/hw/s390x/s390-pci-bus.c:903:5: note: each undeclared identifier is reported only once for each function it appears in

Argh, thanks for pointing this out. Of course this value only exists when CONFIG_KVM...

What do you think about using a routine in hw/s390x/s390-pci-kvm.c to set the value (and is a NOP stub when !CONFIG_KVM)?

Thanks,
Matt

#6 lore raw
Quoted 39 lines · Matthew Rosato
Quoted 28 lines · Thomas Huth
Quoted 19 lines · Matthew Rosato

Allow irqfd to be used for virtio-pci on s390x if the kernel supports it.  This improves s390x virtio-pci performance when using kvm acceleration by allowing kvm to deliver interrupts instead of QEMU.

---
v2:
  - add review tag
  - tweak commit message (David)

---
   hw/s390x/s390-pci-bus.c | 1 +
   1 file changed, 1 insertion(+)
hw/s390x/s390-pci-bus.c +0 -0
index e8e41c8a9a..88852acf45 100644

hw/s390x/s390-pci-bus.c static void s390_pcihost_realize(DeviceState *dev, Error **errp) · line 904

Quoted 5 lines
hw/s390x/s390-pci-bus.c +1 -0
@@ -900,6 +900,7 @@ static void s390_pcihost_realize(DeviceState *dev, Error **errp)
       s390_pci_init_default_group();
       css_register_io_adapters(CSS_IO_ADAPTER_PCI, true, false,
                                S390_ADAPTER_SUPPRESSIBLE, errp);
+    kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
   }

 Hi Matthew,

Quoted 9 lines

this unfortunately fails to compile without KVM (e.g. on x86 hosts):

../../devel/qemu/hw/s390x/s390-pci-bus.c: In function ‘s390_pcihost_realize’:
../../devel/qemu/hw/s390x/s390-pci-bus.c:903:5: error: ‘kvm_msi_via_irqfd_allowed’ undeclared (first use in this function); did you mean ‘kvm_msi_via_irqfd_enabled’?
  903 |     kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
      |     kvm_msi_via_irqfd_enabled
../../devel/qemu/hw/s390x/s390-pci-bus.c:903:5: note: each undeclared identifier is reported only once for each function it appears in

Quoted 3 lines

Argh, thanks for pointing this out. Of course this value only exists when CONFIG_KVM...

What do you think about using a routine in hw/s390x/s390-pci-kvm.c to set the value (and is a NOP stub when !CONFIG_KVM)?

Yes, since we're doing this for some other KVM-related functions there already, that sounds like the right way to go here.

Thomas