From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KWWyl-00056R-Bl for qemu-devel@nongnu.org; Fri, 22 Aug 2008 09:47:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KWWyk-00055c-Mb for qemu-devel@nongnu.org; Fri, 22 Aug 2008 09:47:03 -0400 Received: from [199.232.76.173] (port=53752 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWWyk-00055O-H8 for qemu-devel@nongnu.org; Fri, 22 Aug 2008 09:47:02 -0400 Received: from ag-out-0708.google.com ([72.14.246.242]:37992) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KWWyk-0001x6-A8 for qemu-devel@nongnu.org; Fri, 22 Aug 2008 09:47:02 -0400 Received: by ag-out-0708.google.com with SMTP id 31so1394442agc.5 for ; Fri, 22 Aug 2008 06:47:01 -0700 (PDT) Message-ID: <48AEC328.6040502@codemonkey.ws> Date: Fri, 22 Aug 2008 08:46:16 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/2] xenner: add event channel implementation. References: <1219400728-20422-1-git-send-email-kraxel@redhat.com> <1219400728-20422-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1219400728-20422-2-git-send-email-kraxel@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: xen-devel@lists.xensource.com, Gerd Hoffmann Gerd Hoffmann wrote: > This adds a xen event channel implementation to qemu, intented to be > used by xenner (aka xen emulation). > > The patch also adds a XenEvtOps struct with function pointers for the > xc_evtchn_* family, which is used to switch between libxenctrl and the > qemu implementation at runtime. By default libxenctrl is used. > I suppose the QEMU implementation is to eventually eliminate the need for libxc? Do you also plan on doing a XenStore implementation within QEMU? > --- > Makefile.target | 1 + > hw/xen_interfaces.h | 27 +++ > hw/xen_machine_pv.c | 2 + > hw/xenner_libxc_evtchn.c | 396 ++++++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 426 insertions(+), 0 deletions(-) > create mode 100644 hw/xen_interfaces.h > create mode 100644 hw/xenner_libxc_evtchn.c > > diff --git a/Makefile.target b/Makefile.target > index 5c97874..b88fd8f 100644 > --- a/Makefile.target > +++ b/Makefile.target > @@ -521,6 +521,7 @@ endif > # xen backend driver support > XEN_OBJS := xen_machine_pv.o xen_backend.o xen_devconfig.o xen_domainbuild.o > XEN_OBJS += xen_console.o xen_framebuffer.o xen_disk.o xen_nic.o > +XEN_OBJS += xenner_libxc_evtchn.o > Historically, we didn't have directories in QEMU because we used CVS and directories are a nightmare. With the shear number of files being added for Xen, it probably makes sense to stick them all in a directory. > ifeq ($(CONFIG_XEN), yes) > OBJS += $(XEN_OBJS) > LIBS += $(XEN_LIBS) > diff --git a/hw/xen_interfaces.h b/hw/xen_interfaces.h > new file mode 100644 > index 0000000..869b382 > --- /dev/null > +++ b/hw/xen_interfaces.h > @@ -0,0 +1,27 @@ > +#ifndef QEMU_XEN_INTERFACES_H > +#define QEMU_XEN_INTERFACES_H 1 > Minor nit, make sure to have copyrights in all of your files. > +static void bind_port_peer(struct port *p, int domid, int port) > +{ > + struct domain *domain; > + struct port *o; > + char *msg = "ok"; > Should be const char *. > + domain = get_domain(domid); > + o = domain->p+port; > + if (!o->priv) { > + msg = "peer not allocated"; > + } else if (o->peer) { > + msg = "peer already bound"; > + } else if (p->peer) { > + msg = "port already bound"; > + } else { > + o->peer = p; > + p->peer = o; > + } > Watch the whitespace (you've got tabs all over). > + if (debug) > + fprintf(stderr, "xen ev:%3d: bind port %d domain %d <-> port %d domain %d : %s\n", > + p->priv->fd_read, > + p->port, p->priv->domain->domid, > + port, domid, msg); > + put_domain(domain); > +} > + > +static void unbind_port(struct port *p) > +{ > + struct port *o; > + > + o = p->peer; > + if (o) { > + if (debug) > + fprintf(stderr,"xen ev:%3d: unbind port %d domain %d <-> port %d domain %d\n", > + p->priv->fd_read, > + p->port, p->priv->domain->domid, > + o->port, o->priv->domain->domid); > + o->peer = NULL; > + p->peer = NULL; > + } > +} > + > +static void notify_send_peer(struct port *peer) > +{ > + uint32_t evtchn = peer->port; > + write(peer->priv->fd_write, &evtchn, sizeof(evtchn)); > Should be unix_write and should deal with errors. Regards, Anthony Liguori