From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OBQWL-0008Pv-M6 for qemu-devel@nongnu.org; Mon, 10 May 2010 06:47:33 -0400 Received: from [140.186.70.92] (port=41425 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBQTp-00086t-8A for qemu-devel@nongnu.org; Mon, 10 May 2010 06:47:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBQSI-0007hm-C1 for qemu-devel@nongnu.org; Mon, 10 May 2010 06:44:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41299) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBQSI-0007hU-4J for qemu-devel@nongnu.org; Mon, 10 May 2010 06:43:22 -0400 Message-ID: <4BE7E347.9050705@redhat.com> Date: Mon, 10 May 2010 13:43:19 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1271872408-22842-1-git-send-email-cam@cs.ualberta.ca> <1271872408-22842-2-git-send-email-cam@cs.ualberta.ca> <1271872408-22842-3-git-send-email-cam@cs.ualberta.ca> <1271872408-22842-4-git-send-email-cam@cs.ualberta.ca> In-Reply-To: <1271872408-22842-4-git-send-email-cam@cs.ualberta.ca> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v5 3/5] Add functions for assigning ioeventfd and irqfds. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cam Macdonell Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org On 04/21/2010 08:53 PM, Cam Macdonell wrote: > Generic functions to assign irqfds and ioeventfds. > > Signoff. > } > > #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; > Braces, here and elsewhere. > + r = kvm_vm_ioctl(kvm_state, KVM_IRQFD,&call); > + > + if (r< 0) { > + return r; > -errno > + } > + 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; > May be more usable to have separate assign and deassign functions (that can call into a single internal implementation). > + > + ret = kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD,&iofd); > + > + if (ret< 0) { > + return ret; > -errno > + } > + > + return 0; > +} > + > -- error compiling committee.c: too many arguments to function