From patchwork Fri Jun 4 21:45:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cam Macdonell X-Patchwork-Id: 54718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C3BBCB7D8D for ; Sat, 5 Jun 2010 07:47:24 +1000 (EST) Received: from localhost ([127.0.0.1]:47261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKejX-0003vc-9y for incoming@patchwork.ozlabs.org; Fri, 04 Jun 2010 17:47:19 -0400 Received: from [140.186.70.92] (port=49348 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKeiT-0003vI-Ro for qemu-devel@nongnu.org; Fri, 04 Jun 2010 17:46:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKeiS-0000So-Qn for qemu-devel@nongnu.org; Fri, 04 Jun 2010 17:46:13 -0400 Received: from fleet.cs.ualberta.ca ([129.128.22.22]:52438) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKeiS-0000Ni-ME for qemu-devel@nongnu.org; Fri, 04 Jun 2010 17:46:12 -0400 Received: from localhost.localdomain (st-brides.cs.ualberta.ca [129.128.23.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.cs.ualberta.ca (Postfix) with ESMTP id 5EFA02803E; Fri, 4 Jun 2010 15:46:00 -0600 (MDT) From: Cam Macdonell To: qemu-devel@nongnu.org Date: Fri, 4 Jun 2010 15:45:38 -0600 Message-Id: <1275687942-12312-3-git-send-email-cam@cs.ualberta.ca> X-Mailer: git-send-email 1.6.3.2.198.g6096d In-Reply-To: <1275687942-12312-2-git-send-email-cam@cs.ualberta.ca> References: <1275687942-12312-1-git-send-email-cam@cs.ualberta.ca> <1275687942-12312-2-git-send-email-cam@cs.ualberta.ca> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Cam Macdonell , kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH v6 2/6] Add function to assign ioeventfd to MMIO. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org --- kvm-all.c | 32 ++++++++++++++++++++++++++++++++ kvm.h | 1 + 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 47f58a6..2982631 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1257,6 +1257,38 @@ int kvm_set_signal_mask(CPUState *env, const sigset_t *sigset) return r; } +int kvm_set_ioeventfd_mmio_long(int fd, uint32_t addr, uint32_t val, bool assign) +{ +#ifdef KVM_IOEVENTFD + int ret; + struct kvm_ioeventfd iofd; + + iofd.datamatch = val; + iofd.addr = addr; + iofd.len = 4; + iofd.flags = KVM_IOEVENTFD_FLAG_DATAMATCH; + iofd.fd = fd; + + if (!kvm_enabled()) { + return -ENOSYS; + } + + if (!assign) { + iofd.flags |= KVM_IOEVENTFD_FLAG_DEASSIGN; + } + + ret = kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD, &iofd); + + if (ret < 0) { + return -errno; + } + + return 0; +#else + return -ENOSYS; +#endif +} + int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign) { #ifdef KVM_IOEVENTFD diff --git a/kvm.h b/kvm.h index aab5118..52e3a7f 100644 --- a/kvm.h +++ b/kvm.h @@ -181,6 +181,7 @@ static inline void cpu_synchronize_post_init(CPUState *env) } #endif +int kvm_set_ioeventfd_mmio_long(int fd, uint32_t adr, uint32_t val, bool assign); #if defined(KVM_IRQFD) && defined(CONFIG_KVM) int kvm_set_irqfd(int gsi, int fd, bool assigned);