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] RESEND: function for assigning ioeventfds.
Date: Wed, 21 Apr 2010 13:15:47 -0600 [thread overview]
Message-ID: <1271877347-24981-1-git-send-email-cam@cs.ualberta.ca> (raw)
In-Reply-To: <1271872163-22722-4-git-send-email-cam@cs.ualberta.ca>
Apologies, I wasn't on the latest KVM HEAD and so missed that Michael had added
an irqfd assignment function (and a more correct one at that). So now this
patch has just one function.
---
kvm-all.c | 26 ++++++++++++++++++++++++++
kvm.h | 7 +++++++
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index c0d27db..df8e398 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1193,6 +1193,32 @@ int kvm_set_signal_mask(CPUState *env, const sigset_t *sigset)
}
#ifdef KVM_IOEVENTFD
+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 65a4ee2..0f25d20 100644
--- a/kvm.h
+++ b/kvm.h
@@ -174,9 +174,16 @@ static inline void cpu_synchronize_post_init(CPUState *env)
}
#if defined(KVM_IOEVENTFD) && defined(CONFIG_KVM)
+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_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
parent reply other threads:[~2010-04-21 19:15 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1271872163-22722-4-git-send-email-cam@cs.ualberta.ca>]
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=1271877347-24981-1-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).