From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsYDU-00011T-AX for qemu-devel@nongnu.org; Thu, 05 Jun 2014 10:00:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsYDO-0006op-Kk for qemu-devel@nongnu.org; Thu, 05 Jun 2014 10:00:28 -0400 Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]:48556) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsYDO-0006nt-Ef for qemu-devel@nongnu.org; Thu, 05 Jun 2014 10:00:22 -0400 Received: by mail-we0-f181.google.com with SMTP id w61so1137067wes.40 for ; Thu, 05 Jun 2014 07:00:21 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <539077F2.6060508@redhat.com> Date: Thu, 05 Jun 2014 16:00:18 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20140527120050.15172.94908.stgit@3820> <20140527120330.15172.91211.stgit@3820> In-Reply-To: <20140527120330.15172.91211.stgit@3820> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v10 01/18] Add kvm_eventfds_enabled function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: snabb-devel@googlegroups.com, qemu-devel@nongnu.org Cc: a.motakis@virtualopensystems.com, luke@snabb.co, tech@virtualopensystems.com, n.nikolaev@virtualopensystems.com, mst@redhat.com Il 27/05/2014 14:03, Nikolay Nikolaev ha scritto: > Add a function to check if the eventfd capability is present in KVM in > the host kernel. > > Signed-off-by: Antonios Motakis > Signed-off-by: Nikolay Nikolaev > --- > include/sysemu/kvm.h | 11 +++++++++++ > kvm-all.c | 4 ++++ > kvm-stub.c | 1 + > 3 files changed, 16 insertions(+) > > diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h > index e7ad9d1..1c7f5f6 100644 > --- a/include/sysemu/kvm.h > +++ b/include/sysemu/kvm.h > @@ -43,6 +43,7 @@ extern bool kvm_allowed; > extern bool kvm_kernel_irqchip; > 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_msi_via_irqfd_allowed; > extern bool kvm_gsi_routing_allowed; > @@ -83,6 +84,15 @@ extern bool kvm_readonly_mem_allowed; > #define kvm_halt_in_kernel() (kvm_halt_in_kernel_allowed) > > /** > + * kvm_eventfds_enabled: > + * > + * Returns: true if we can use eventfds to receive notifications > + * from a KVM CPU (ie the kernel supports eventds and we are running > + * with a configuration where it is meaningful to use them). > + */ > +#define kvm_eventfds_enabled() (kvm_eventfds_allowed) > + > +/** > * kvm_irqfds_enabled: > * > * Returns: true if we can use irqfds to inject interrupts into > @@ -128,6 +138,7 @@ extern bool kvm_readonly_mem_allowed; > #define kvm_irqchip_in_kernel() (false) > #define kvm_async_interrupts_enabled() (false) > #define kvm_halt_in_kernel() (false) > +#define kvm_eventfds_enabled() (false) > #define kvm_irqfds_enabled() (false) > #define kvm_msi_via_irqfd_enabled() (false) > #define kvm_gsi_routing_allowed() (false) > diff --git a/kvm-all.c b/kvm-all.c > index a343ede..9649cd3 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -112,6 +112,7 @@ KVMState *kvm_state; > bool kvm_kernel_irqchip; > bool kvm_async_interrupts_allowed; > bool kvm_halt_in_kernel_allowed; > +bool kvm_eventfds_allowed; > bool kvm_irqfds_allowed; > bool kvm_msi_via_irqfd_allowed; > bool kvm_gsi_routing_allowed; > @@ -1504,6 +1505,9 @@ int kvm_init(MachineClass *mc) > (kvm_check_extension(s, KVM_CAP_READONLY_MEM) > 0); > #endif > > + kvm_eventfds_allowed = > + (kvm_check_extension(s, KVM_CAP_IOEVENTFD) > 0); > + > ret = kvm_arch_init(s); > if (ret < 0) { > goto err; > diff --git a/kvm-stub.c b/kvm-stub.c > index 8acda86..3fb17f2 100644 > --- a/kvm-stub.c > +++ b/kvm-stub.c > @@ -22,6 +22,7 @@ > KVMState *kvm_state; > bool kvm_kernel_irqchip; > bool kvm_async_interrupts_allowed; > +bool kvm_eventfds_allowed; > bool kvm_irqfds_allowed; > bool kvm_msi_via_irqfd_allowed; > bool kvm_gsi_routing_allowed; > Acked-by: Paolo Bonzini