]> Git Repo - qemu.git/commitdiff
KVM_CAP_IRQFD and KVM_CAP_IRQFD_RESAMPLE checks
authorEric Auger <[email protected]>
Fri, 31 Oct 2014 13:38:18 +0000 (13:38 +0000)
committerPaolo Bonzini <[email protected]>
Mon, 15 Dec 2014 11:21:01 +0000 (12:21 +0100)
Compute kvm_irqfds_allowed by checking the KVM_CAP_IRQFD extension.
Remove direct settings in architecture specific files.

Add a new kvm_resamplefds_allowed variable, initialized by
checking the KVM_CAP_IRQFD_RESAMPLE extension. Add a corresponding
kvm_resamplefds_enabled() function.

A special notice for s390 where KVM_CAP_IRQFD was not immediatly
advirtised when irqfd capability was introduced in the kernel.
KVM_CAP_IRQ_ROUTING was advertised instead.

This was fixed in "KVM: s390: announce irqfd capability",
ebc3226202d5956a5963185222982d435378b899 whereas irqfd support
was brought in 84223598778ba08041f4297fda485df83414d57e,
"KVM: s390: irq routing for adapter interrupts".  Both commits
first appear in 3.15 so there should not be any kernel
version impacted by this QEMU modification.

Signed-off-by: Eric Auger <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
hw/intc/openpic_kvm.c
hw/intc/xics_kvm.c
include/sysemu/kvm.h
kvm-all.c
target-i386/kvm.c
target-s390x/kvm.c

index 3e2cd189fffb8a4476b5f06077d29a74b3de420a..f7cac585a9ea59353cbfbc34d9431df82a1165df 100644 (file)
@@ -248,7 +248,6 @@ static void kvm_openpic_realize(DeviceState *dev, Error **errp)
         kvm_irqchip_add_irq_route(kvm_state, i, 0, i);
     }
 
-    kvm_irqfds_allowed = true;
     kvm_msi_via_irqfd_allowed = true;
     kvm_gsi_routing_allowed = true;
 
index 20b19e9d4f2c387181b6d0ea66723851d95f6353..c15453f26f7d385a318bcaebda5e920a7b0ca4c4 100644 (file)
@@ -448,7 +448,6 @@ static void xics_kvm_realize(DeviceState *dev, Error **errp)
     }
 
     kvm_kernel_irqchip = true;
-    kvm_irqfds_allowed = true;
     kvm_msi_via_irqfd_allowed = true;
     kvm_gsi_direct_mapping = true;
 
index 22e42ef236f06c00b02e71d97db268fa26efbfca..104cf3535efbb19d0527b2f48e489e1ad0e6984b 100644 (file)
@@ -45,6 +45,7 @@ extern bool kvm_async_interrupts_allowed;
 extern bool kvm_halt_in_kernel_allowed;
 extern bool kvm_eventfds_allowed;
 extern bool kvm_irqfds_allowed;
+extern bool kvm_resamplefds_allowed;
 extern bool kvm_msi_via_irqfd_allowed;
 extern bool kvm_gsi_routing_allowed;
 extern bool kvm_gsi_direct_mapping;
@@ -101,6 +102,15 @@ extern bool kvm_readonly_mem_allowed;
  */
 #define kvm_irqfds_enabled() (kvm_irqfds_allowed)
 
+/**
+ * kvm_resamplefds_enabled:
+ *
+ * Returns: true if we can use resamplefds to inject interrupts into
+ * a KVM CPU (ie the kernel supports resamplefds and we are running
+ * with a configuration where it is meaningful to use them).
+ */
+#define kvm_resamplefds_enabled() (kvm_resamplefds_allowed)
+
 /**
  * kvm_msi_via_irqfd_enabled:
  *
index 937bc9d9035a420a58351f87fa44ce98a3723d4b..c86626f9ff46456be12adabb9f4ac2a381de71c3 100644 (file)
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -120,6 +120,7 @@ bool kvm_async_interrupts_allowed;
 bool kvm_halt_in_kernel_allowed;
 bool kvm_eventfds_allowed;
 bool kvm_irqfds_allowed;
+bool kvm_resamplefds_allowed;
 bool kvm_msi_via_irqfd_allowed;
 bool kvm_gsi_routing_allowed;
 bool kvm_gsi_direct_mapping;
@@ -1584,6 +1585,12 @@ static int kvm_init(MachineState *ms)
     kvm_eventfds_allowed =
         (kvm_check_extension(s, KVM_CAP_IOEVENTFD) > 0);
 
+    kvm_irqfds_allowed =
+        (kvm_check_extension(s, KVM_CAP_IRQFD) > 0);
+
+    kvm_resamplefds_allowed =
+        (kvm_check_extension(s, KVM_CAP_IRQFD_RESAMPLE) > 0);
+
     ret = kvm_arch_init(s);
     if (ret < 0) {
         goto err;
index ccf36e8719de7cd868b1a4d4008d65aad89def59..3a3dfc4795fcbbc2709a3014f0b3ec154be96dc5 100644 (file)
@@ -2563,7 +2563,6 @@ void kvm_arch_init_irq_routing(KVMState *s)
      * irqchip, so we can use irqfds, and on x86 we know
      * we can use msi via irqfd and GSI routing.
      */
-    kvm_irqfds_allowed = true;
     kvm_msi_via_irqfd_allowed = true;
     kvm_gsi_routing_allowed = true;
 }
index 50709ba6b5052162fb5230697e9c21c540a827cc..1b79c4de7568682effd8784fa1f0805b8c334cd3 100644 (file)
@@ -1294,7 +1294,6 @@ void kvm_arch_init_irq_routing(KVMState *s)
      * have to override the common code kvm_halt_in_kernel_allowed setting.
      */
     if (kvm_check_extension(s, KVM_CAP_IRQ_ROUTING)) {
-        kvm_irqfds_allowed = true;
         kvm_gsi_routing_allowed = true;
         kvm_halt_in_kernel_allowed = false;
     }
This page took 0.043554 seconds and 4 git commands to generate.