From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eric Auger <eric.auger@linaro.org>
Subject: [Qemu-devel] [PULL 03/47] KVM_CAP_IRQFD and KVM_CAP_IRQFD_RESAMPLE checks
Date: Mon, 15 Dec 2014 17:37:47 +0100 [thread overview]
Message-ID: <1418661511-22348-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1418661511-22348-1-git-send-email-pbonzini@redhat.com>
From: Eric Auger <eric.auger@linaro.org>
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 <eric.auger@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/intc/openpic_kvm.c | 1 -
hw/intc/xics_kvm.c | 1 -
include/sysemu/kvm.h | 10 ++++++++++
kvm-all.c | 7 +++++++
target-i386/kvm.c | 1 -
target-s390x/kvm.c | 1 -
6 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c
index 3e2cd18..f7cac58 100644
--- a/hw/intc/openpic_kvm.c
+++ b/hw/intc/openpic_kvm.c
@@ -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;
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index 20b19e9..c15453f 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -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;
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 22e42ef..104cf35 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -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;
@@ -102,6 +103,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:
*
* Returns: true if we can route a PCI MSI (Message Signaled Interrupt)
diff --git a/kvm-all.c b/kvm-all.c
index 937bc9d..c86626f 100644
--- 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;
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index ccf36e8..3a3dfc4 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -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;
}
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 50709ba..1b79c4d 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -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;
}
--
1.8.3.1
next prev parent reply other threads:[~2014-12-15 16:39 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 16:37 [Qemu-devel] [PULL 00/47] Patches for KVM, x86, SCSI, migration fixes (2014-12-15) Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 01/47] Add bootloader name to multiboot implementation Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 02/47] target-i386: simplify AES emulation Paolo Bonzini
2014-12-15 16:37 ` Paolo Bonzini [this message]
2014-12-15 16:37 ` [Qemu-devel] [PULL 04/47] vfio: use kvm_resamplefds_enabled() Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 05/47] valgrind: avoid false positives in KVM_GET_DIRTY_LOG ioctl Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 06/47] valgrind/i386: avoid false positives on KVM_SET_CLOCK ioctl Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 07/47] valgrind/i386: avoid false positives on KVM_SET_PIT ioctl Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 08/47] valgrind/i386: avoid false positives on KVM_SET_XCRS ioctl Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 09/47] valgrind/i386: avoid false positives on KVM_SET_MSRS ioctl Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 10/47] valgrind/i386: avoid false positives on KVM_GET_MSRS ioctl Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 11/47] valgrind/i386: avoid false positives on KVM_SET_VCPU_EVENTS ioctl Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 12/47] valgrind/s390x: avoid false positives on KVM_SET_FPU ioctl Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 13/47] coverity/s390x: avoid false positive in kvm_irqchip_add_adapter_route Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 14/47] target-i386: add feature flags for CPUID[EAX=0xd, ECX=1] Paolo Bonzini
2014-12-15 16:37 ` [Qemu-devel] [PULL 15/47] target-mips: kvm: do not use get_clock() Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 16/47] target-i386: get/set/migrate XSAVES state Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 17/47] x86: Drop superfluous conditionals around g_free() Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 18/47] x86: Fuse g_malloc(); memset() into g_malloc0() Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 19/47] x86: Use g_new() & friends where that makes obvious sense Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 20/47] x86: Drop some superfluous casts from void * Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 21/47] scsi: Drop superfluous conditionals around g_free() Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 22/47] scsi: Fuse g_malloc(); memset() into g_malloc0() Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 23/47] scsi: Use g_new() & friends where that makes obvious sense Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 24/47] scsi-disk: provide maximum transfer length Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 25/47] cpu-exec: fix cpu_exec_nocache Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 26/47] cpu-exec: reset exception_index correctly Paolo Bonzini
2014-12-19 2:19 ` Eduardo Habkost
2014-12-23 6:55 ` Pavel Dovgaluk
[not found] ` <2162.40673694319$1419317788@news.gmane.org>
2014-12-23 8:54 ` Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 27/47] icount: set can_do_io outside TB execution Paolo Bonzini
2014-12-17 8:53 ` Pavel Dovgaluk
2014-12-17 9:19 ` Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 28/47] icount: introduce cpu_get_icount_raw Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 29/47] cpu-exec: invalidate nocache translation if they are interrupted Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 30/47] timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 31/47] cpus: make icount warp behave well with respect to stop/cont Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 32/47] i386: do not cross the pages boundaries in replay mode Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 33/47] pc: add 2.3 machine types Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 34/47] target-i386: add VME to all CPUs Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 35/47] target-i386: add f16c and rdrand to Haswell and Broadwell Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 36/47] target-i386: add Ivy Bridge CPU model Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 37/47] kvm/apic: fix 2.2->2.1 migration Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 38/47] linuxboot: fix loading old kernels Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 39/47] serial: reset thri_pending on IER writes with THRI=0 Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 40/47] serial: clean up THRE/TEMT handling Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 41/47] serial: update LSR on enabling/disabling FIFOs Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 42/47] serial: only resample THR interrupt on rising edge of IER.THRI Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 43/47] sdhci: Set a default frequency clock Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 44/47] sdhci: Remove class "virtual" methods Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 45/47] sdhci: Add "sysbus" to sdhci QOM types and methods Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 46/47] sdhci: Define SDHCI PCI ids Paolo Bonzini
2014-12-15 16:38 ` [Qemu-devel] [PULL 47/47] sdhci: Support SDHCI devices on PCI Paolo Bonzini
2014-12-16 12:33 ` [Qemu-devel] [PULL 00/47] Patches for KVM, x86, SCSI, migration fixes (2014-12-15) Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1418661511-22348-4-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=eric.auger@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).