From patchwork Tue Jun 15 20:23:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cam Macdonell X-Patchwork-Id: 106331 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5FKOYwN002221 for ; Tue, 15 Jun 2010 20:24:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932251Ab0FOUYF (ORCPT ); Tue, 15 Jun 2010 16:24:05 -0400 Received: from fleet.cs.ualberta.ca ([129.128.22.22]:59343 "EHLO fleet.cs.ualberta.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758275Ab0FOUXx (ORCPT ); Tue, 15 Jun 2010 16:23:53 -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 27A0528049; Tue, 15 Jun 2010 14:23:52 -0600 (MDT) From: Cam Macdonell To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Cam Macdonell Subject: [PATCH v7 2/4] Add function to assign ioeventfd to MMIO. Date: Tue, 15 Jun 2010 14:23:44 -0600 Message-Id: <1276633426-30995-3-git-send-email-cam@cs.ualberta.ca> X-Mailer: git-send-email 1.6.3.2.198.g6096d In-Reply-To: <1276633426-30995-2-git-send-email-cam@cs.ualberta.ca> References: <1276633426-30995-1-git-send-email-cam@cs.ualberta.ca> <1276633426-30995-2-git-send-email-cam@cs.ualberta.ca> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 15 Jun 2010 20:24:35 +0000 (UTC) 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);