From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Cam Macdonell Date: Fri, 4 Jun 2010 15:45:38 -0600 Message-Id: <1275687942-12312-3-git-send-email-cam@cs.ualberta.ca> 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> Subject: [Qemu-devel] [PATCH v6 2/6] Add function to assign ioeventfd to MMIO. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Cam Macdonell , kvm@vger.kernel.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); -- 1.6.3.2.198.g6096d