From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmW8x-00069p-NQ for qemu-devel@nongnu.org; Tue, 02 Mar 2010 12:44:27 -0500 Received: from [199.232.76.173] (port=53806 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmW8x-00069c-9y for qemu-devel@nongnu.org; Tue, 02 Mar 2010 12:44:27 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NmW8v-0000gF-Ox for qemu-devel@nongnu.org; Tue, 02 Mar 2010 12:44:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5372) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NmW8v-0000g9-Br for qemu-devel@nongnu.org; Tue, 02 Mar 2010 12:44:25 -0500 Date: Tue, 2 Mar 2010 19:41:03 +0200 From: "Michael S. Tsirkin" Message-ID: <20100302174103.GA8976@redhat.com> References: <0de4c8d7d8f9a7e6fdfc1f161f7c95b6a2866f3e.1267122331.git.mst@redhat.com> <4B86CD42.205@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B86CD42.205@codemonkey.ws> Subject: [Qemu-devel] Re: [PATCHv2 02/12] kvm: add API to set ioeventfd List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: quintela@redhat.com, mtosatti@redhat.com, qemu-devel@nongnu.org, avi@redhat.com, amit.shah@redhat.com, kraxel@redhat.com On Thu, Feb 25, 2010 at 01:19:30PM -0600, Anthony Liguori wrote: > 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 >> --- >> >> 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 > So I renamed to kvm_set_ioeventfd_pio_word, but I still left assign boolean in place because both implementation and usage take up less code this way. It's just an internal function, so no biggie to change it later ... -- MST