qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCHv2 02/12] kvm: add API to set ioeventfd


From: Anthony Liguori
Subject: [Qemu-devel] Re: [PATCHv2 02/12] kvm: add API to set ioeventfd
Date: Thu, 25 Feb 2010 13:19:30 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Lightning/1.0pre Thunderbird/3.0

On 02/25/2010 12:28 PM, Michael S. Tsirkin wrote:
Comment on kvm usage: rather than require users to do if (kvm_enabled())
and/or ifdefs, this patch adds an API that, internally, is defined to
stub function on non-kvm build, and checks kvm_enabled for non-kvm
run.

While rest of qemu code still uses if (kvm_enabled()), I think this
approach is cleaner, and we should convert rest of code to it
long term.

I'm not opposed to that.

Signed-off-by: Michael S. Tsirkin<address@hidden>
---

Avi, Marcelo, pls review/ack.

  kvm-all.c |   22 ++++++++++++++++++++++
  kvm.h     |   16 ++++++++++++++++
  2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index 1a02076..9742791 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1138,3 +1138,25 @@ int kvm_set_signal_mask(CPUState *env, const sigset_t 
*sigset)

      return r;
  }
+
+#ifdef KVM_IOEVENTFD
+int kvm_set_ioeventfd(uint16_t addr, uint16_t data, int fd, bool assigned)

I think this API could use some love. You're using a very limited set of things that ioeventfd can do and you're multiplexing creation and destruction in a single call.

I think:

kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t data);
kvm_unset_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t data);

Would be better.  Alternatively, an API that matched ioeventfd exactly:

kvm_set_ioeventfd(int fd, uint64_t addr, int size, uint64_t data, int flags);
kvm_unset_ioeventfd(...);

Could work too.

Regards,

Anthony Liguori





reply via email to

[Prev in Thread] Current Thread [Next in Thread]