All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: bsd@redhat.com, Jason Wang <jasowang@redhat.com>,
	Gleb Natapov <gleb@kernel.org>
Subject: [FYI PATCH 12/20] kvm: add capability for any-length ioeventfds
Date: Mon, 28 Sep 2015 12:38:57 +0200	[thread overview]
Message-ID: <1443436745-38086-13-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1443436745-38086-1-git-send-email-pbonzini@redhat.com>

From: Jason Wang <jasowang@redhat.com>

Cc: Gleb Natapov <gleb@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Documentation/virtual/kvm/api.txt | 6 +++++-
 include/uapi/linux/kvm.h          | 1 +
 virt/kvm/eventfd.c                | 4 +---
 virt/kvm/kvm_main.c               | 1 +
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index e3e9c41721a2..34cc068e81ea 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -1604,7 +1604,7 @@ provided event instead of triggering an exit.
 struct kvm_ioeventfd {
 	__u64 datamatch;
 	__u64 addr;        /* legal pio/mmio address */
-	__u32 len;         /* 1, 2, 4, or 8 bytes    */
+	__u32 len;         /* 0, 1, 2, 4, or 8 bytes    */
 	__s32 fd;
 	__u32 flags;
 	__u8  pad[36];
@@ -1627,6 +1627,10 @@ to the registered address is equal to datamatch in struct kvm_ioeventfd.
 For virtio-ccw devices, addr contains the subchannel id and datamatch the
 virtqueue index.
 
+With KVM_CAP_IOEVENTFD_ANY_LENGTH, a zero length ioeventfd is allowed, and
+the kernel will ignore the length of guest write and may get a faster vmexit.
+The speedup may only apply to specific architectures, but the ioeventfd will
+work anyway.
 
 4.60 KVM_DIRTY_TLB
 
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 12e3afbf0f47..03f3618612aa 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -830,6 +830,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_GUEST_DEBUG_HW_BPS 119
 #define KVM_CAP_GUEST_DEBUG_HW_WPS 120
 #define KVM_CAP_SPLIT_IRQCHIP 121
+#define KVM_CAP_IOEVENTFD_ANY_LENGTH 122
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 79db45336e3a..ac89299b8699 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -914,9 +914,7 @@ kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
 		return -EINVAL;
 
 	/* ioeventfd with no length can't be combined with DATAMATCH */
-	if (!args->len &&
-	    args->flags & (KVM_IOEVENTFD_FLAG_PIO |
-			   KVM_IOEVENTFD_FLAG_DATAMATCH))
+	if (!args->len && (args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH))
 		return -EINVAL;
 
 	ret = kvm_assign_ioeventfd_idx(kvm, bus_idx, args);
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 23116dcb2129..afd7ae6aec65 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2718,6 +2718,7 @@ static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
 	case KVM_CAP_IRQFD:
 	case KVM_CAP_IRQFD_RESAMPLE:
 #endif
+	case KVM_CAP_IOEVENTFD_ANY_LENGTH:
 	case KVM_CAP_CHECK_EXTENSION_VM:
 		return 1;
 #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
-- 
1.8.3.1



  parent reply	other threads:[~2015-09-28 10:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28 10:38 [FYI PATCH 00/20] kvm/queue will be merged soon to kvm/next Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 01/20] KVM: x86: set TMR when the interrupt is accepted Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 02/20] KVM: x86: store IOAPIC-handled vectors in each VCPU Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 03/20] KVM: x86: replace vm_has_apicv hook with cpu_uses_apicv Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 04/20] KVM: x86: introduce lapic_in_kernel Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 05/20] KVM: x86: unify handling of interrupt window Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 06/20] KVM: x86: Split the APIC from the rest of IRQCHIP Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 07/20] KVM: x86: Add KVM exit for IOAPIC EOIs Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 08/20] KVM: x86: Add EOI exit bitmap inference Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 09/20] KVM: x86: Add support for local interrupt requests from userspace Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 10/20] kvm: use kmalloc() instead of kzalloc() during iodev register/unregister Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 11/20] kvm: add tracepoint for fast mmio Paolo Bonzini
2015-09-28 10:38 ` Paolo Bonzini [this message]
2015-09-28 10:38 ` [FYI PATCH 13/20] kvm/x86: Hyper-V HV_X64_MSR_RESET msr Paolo Bonzini
2015-09-28 10:38 ` [FYI PATCH 14/20] kvm/x86: Hyper-V HV_X64_MSR_VP_INDEX export for QEMU Paolo Bonzini
2015-09-28 10:39 ` [FYI PATCH 15/20] kvm/x86: Hyper-V HV_X64_MSR_VP_RUNTIME support Paolo Bonzini
2015-09-28 10:39 ` [FYI PATCH 16/20] KVM: VMX: adjust interface to allocate/free_vpid Paolo Bonzini
2015-09-28 10:39 ` [FYI PATCH 17/20] KVM: VMX: introduce __vmx_flush_tlb to handle specific vpid Paolo Bonzini
2015-09-28 10:39 ` [FYI PATCH 18/20] KVM: nVMX: emulate the INVVPID instruction Paolo Bonzini
2015-09-28 10:39 ` [FYI PATCH 19/20] KVM: nVMX: nested VPID emulation Paolo Bonzini
2015-09-28 10:39 ` [FYI PATCH 20/20] KVM: vmx: disable posted interrupts if no local APIC Paolo Bonzini

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=1443436745-38086-13-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bsd@redhat.com \
    --cc=gleb@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.