Received: from eggs.gnu.org ([2001:4830:134:3::10]:54788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqLzp-0007WX-2c for qemu-devel@nongnu.org; Thu, 07 May 2015 09:37:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqLzk-0004CP-VP for qemu-devel@nongnu.org; Thu, 07 May 2015 09:37:49 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:43360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqLzk-00049E-Ln for qemu-devel@nongnu.org; Thu, 07 May 2015 09:37:44 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 7 May 2015 14:37:42 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6BB3E1B0806E for ; Thu, 7 May 2015 14:38:23 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t47DbeMO8520028 for ; Thu, 7 May 2015 13:37:40 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t47DbeGx003723 for ; Thu, 7 May 2015 07:37:40 -0600 Date: Thu, 7 May 2015 15:37:38 +0200 From: Cornelia Huck Message-ID: <20150507153738.3b6bd58a.cornelia.huck@de.ibm.com> In-Reply-To: <015f01d088b3$57350380$059f0a80$@samsung.com> References: <015f01d088b3$57350380$059f0a80$@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/3] virtio-mmio: introduce set_host_notifier() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Fedin Cc: qemu-devel@nongnu.org On Thu, 07 May 2015 13:48:20 +0300 Pavel Fedin wrote: > set_host_notifier() is introduced into virtio-mmio now. Most of codes came > from virtio-pci. > > Signed-off-by: Ying-Shiuan Pan Meta-comment #1: This is almost certainly not the correct email address of the original author :) I'd recommend to check another archive (e.g. marc.info) that does not mangle the email addresses in the patch body. The original author also should go into the author field in git. > Signed-off-by: Pavel Fedin > --- > hw/virtio/virtio-mmio.c | 72 > +++++++++++++++++++++++++++++++++++++++++++++++++ Meta-comment #2: Your patches are word-wrapped, which not only makes them harder to read but impossible to feed to git am. > 1 file changed, 72 insertions(+) > (...) > +static void virtio_mmio_stop_ioeventfd(VirtIOMMIOProxy *proxy) > +{ > + int r; > + int n; > + VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); > + > + if (!proxy->ioeventfd_started) { > + return; > + } > + > + for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { > + if (!virtio_queue_get_num(vdev, n)) { > + continue; > + } > + > + r = virtio_mmio_set_host_notifier_internal(proxy, n, false, false); > + assert(r >= 0); > + } > + proxy->ioeventfd_started = false; > +} > + > static uint64_t virtio_mmio_read(void *opaque, hwaddr offset, unsigned > size) > { > VirtIOMMIOProxy *proxy = (VirtIOMMIOProxy *)opaque; > @@ -342,6 +394,25 @@ static void virtio_mmio_reset(DeviceState *d) > proxy->guest_page_shift = 0; > } > > +static int virtio_mmio_set_host_notifier(DeviceState *opaque, int n, > + bool assign) > +{ > + VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque); > + > + /* Stop using ioeventfd for virtqueue kick if the device starts using > host > + * notifiers. This makes it easy to avoid stepping on each others' > toes. > + */ > + proxy->ioeventfd_disabled = assign; > + if (assign) { > + virtio_mmio_stop_ioeventfd(proxy); > + } > + /* We don't need to start here: it's not needed because backend > + * currently only stops on status change away from ok, > + * reset, vmstop and such. If we do add code to start here, > + * need to check vmstate, device state etc. */ > + return virtio_mmio_set_host_notifier_internal(proxy, n, assign, false); > +} > + Much of this looks basically the same across any transport supporting ioeventfds (pci, ccw and now mmio) - only actually setting up the notifiers is transport-specific. A case for common helper functions?