qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cam Macdonell <cam@cs.ualberta.ca>
To: kvm@vger.kernel.org
Cc: Cam Macdonell <cam@cs.ualberta.ca>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v5 3/5] Add functions for assigning ioeventfd and irqfds.
Date: Wed, 21 Apr 2010 11:53:27 -0600	[thread overview]
Message-ID: <1271872408-22842-4-git-send-email-cam@cs.ualberta.ca> (raw)
In-Reply-To: <1271872408-22842-3-git-send-email-cam@cs.ualberta.ca>

Generic functions to assign irqfds and ioeventfds.

---
 kvm-all.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
 kvm.h     |   14 ++++++++++++++
 2 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index fb8d4b8..d5c7775 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1193,6 +1193,50 @@ int kvm_set_signal_mask(CPUState *env, const sigset_t *sigset)
 }
 
 #ifdef KVM_IOEVENTFD
+int kvm_set_irqfd(int fd, uint16_t vector, uint32_t gsi)
+{
+    struct kvm_irqfd call = { };
+    int r;
+
+    call.fd = fd;
+    call.gsi = gsi;
+
+    if (!kvm_enabled())
+        return -ENOSYS;
+    r = kvm_vm_ioctl(kvm_state, KVM_IRQFD, &call);
+
+    if (r < 0) {
+        return r;
+    }
+    return 0;
+}
+
+int kvm_set_ioeventfd_mmio_long(int fd, uint32_t addr, uint32_t val, bool assign)
+{
+
+    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 ret;
+    }
+
+    return 0;
+}
+
 int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign)
 {
     struct kvm_ioeventfd kick = {
diff --git a/kvm.h b/kvm.h
index c63e314..831d68f 100644
--- a/kvm.h
+++ b/kvm.h
@@ -174,9 +174,23 @@ static inline void cpu_synchronize_post_init(CPUState *env)
 }
 
 #if defined(KVM_IOEVENTFD) && defined(CONFIG_KVM)
+int kvm_set_irqfd(int fd, uint16_t vector, uint32_t gsi);
+int kvm_set_ioeventfd_mmio_long(int fd, uint32_t adr, uint32_t val, bool assign);
 int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign);
 #else
 static inline
+int kvm_set_irqfd(PCIDevice* pdev, uint16_t vector, int fd)
+{
+    return -ENOSYS;
+}
+
+static inline
+int kvm_set_ioeventfd_mmio_long(int fd, uint16_t adr, uint16_t val, bool assign)
+{
+    return -ENOSYS;
+}
+
+static inline
 int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign)
 {
     return -ENOSYS;
-- 
1.6.2.5

  reply	other threads:[~2010-04-21 17:54 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 17:53 [Qemu-devel] [PATCH v5 0/5] PCI Shared Memory device Cam Macdonell
2010-04-21 17:53 ` [Qemu-devel] [PATCH v5 1/5] Device specification for shared memory PCI device Cam Macdonell
2010-04-21 17:53   ` [Qemu-devel] [PATCH v5 2/5] Support adding a file to qemu's ram allocation Cam Macdonell
2010-04-21 17:53     ` Cam Macdonell [this message]
2010-04-21 17:53       ` [Qemu-devel] [PATCH v5 4/5] Inter-VM shared memory PCI device Cam Macdonell
2010-04-21 18:00         ` [Qemu-devel] [PATCH v5 5/5] shared memory server for inter-VM shared memory Cam Macdonell
2010-05-05 16:57         ` [Qemu-devel] [PATCH v5 4/5] RESEND: Inter-VM shared memory PCI device Cam Macdonell
2010-05-06 17:32         ` [Qemu-devel] Re: [PATCH v5 4/5] " Anthony Liguori
2010-05-06 17:59           ` Cam Macdonell
2010-05-10 11:59         ` Avi Kivity
2010-05-10 15:22           ` Cam Macdonell
2010-05-10 15:28             ` Avi Kivity
2010-05-10 15:38               ` Anthony Liguori
2010-05-10 16:20                 ` Cam Macdonell
2010-05-10 16:52                   ` Anthony Liguori
2010-05-18 16:58                     ` Cam Macdonell
2010-05-18 17:27                       ` Avi Kivity
2010-05-10 16:59                 ` Avi Kivity
2010-05-10 17:25                   ` Anthony Liguori
2010-05-10 17:43                     ` Cam Macdonell
2010-05-10 17:52                       ` Anthony Liguori
2010-05-10 18:01                         ` Cam Macdonell
2010-05-11  7:59                         ` Avi Kivity
2010-05-11 13:10                           ` Anthony Liguori
2010-05-11 14:03                             ` Avi Kivity
2010-05-11 14:17                               ` Cam Macdonell
2010-05-11 14:53                                 ` Avi Kivity
2010-05-11 15:51                                   ` Anthony Liguori
2010-05-11 16:39                                     ` Cam Macdonell
2010-05-11 17:05                                       ` Anthony Liguori
2010-05-11 17:50                                         ` Cam Macdonell
2010-05-11 18:13                                         ` Avi Kivity
2010-05-12 15:32                                           ` Cam Macdonell
2010-05-12 15:48                                             ` Avi Kivity
2010-05-11 18:09                                     ` Avi Kivity
2010-05-11  7:55                     ` Avi Kivity
2010-05-10 15:41               ` Cam Macdonell
2010-05-10 16:40                 ` Avi Kivity
2010-05-10 16:48                   ` Cam Macdonell
2010-05-12 15:49                     ` Avi Kivity
2010-05-12 16:14                       ` Cam Macdonell
2010-05-12 16:45                         ` Avi Kivity
2010-05-10 23:17           ` Cam Macdonell
2010-05-11  8:03             ` Avi Kivity
2010-05-13 21:10           ` Cam Macdonell
2010-05-15  6:05             ` Avi Kivity
2010-05-10 10:43       ` [Qemu-devel] Re: [PATCH v5 3/5] Add functions for assigning ioeventfd and irqfds Avi Kivity
2010-05-10 15:13         ` Cam Macdonell
2010-05-10 15:17           ` Avi Kivity
2010-05-10 10:39     ` [Qemu-devel] Re: [PATCH v5 2/5] Support adding a file to qemu's ram allocation Avi Kivity
2010-05-10 15:32       ` Cam Macdonell

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=1271872408-22842-4-git-send-email-cam@cs.ualberta.ca \
    --to=cam@cs.ualberta.ca \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).