From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: registering ioeventfd in qemu/kvm Date: Mon, 27 Aug 2012 10:51:10 +0200 Message-ID: <503B34FE.5060608@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Shesha Sreenivasamurthy Return-path: Received: from mail-ee0-f46.google.com ([74.125.83.46]:40422 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753347Ab2H0IvO (ORCPT ); Mon, 27 Aug 2012 04:51:14 -0400 Received: by eekc1 with SMTP id c1so825848eek.19 for ; Mon, 27 Aug 2012 01:51:13 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Il 23/08/2012 05:35, Shesha Sreenivasamurthy ha scritto: > Hi, > I am trying to generate eventfd upon a IO write from the guest, say it > is at offset IO_NOTIFY_REG (0x10). When the guest writes to this > register, I get control to QEMU's to the write function associated in > mypci_iomem_ops. However, instead of this I would like to register an > eventfd. > > To achieve that, first I tried: > memory_region_add_eventfd(&mypci->bar_iomem, IO_NOTIFY_REG, 4, > true, 1, fd); This is the right way. You can look (in the git tree of QEMU) at hw/ivshmem.c, which is the simplest user of the eventfd API. Note that recently the API was changed to accept an EventNotifier rather than the raw eventfd. Paolo