From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KTgzL-0003Qb-75 for qemu-devel@nongnu.org; Thu, 14 Aug 2008 13:51:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KTgzI-0003QK-QD for qemu-devel@nongnu.org; Thu, 14 Aug 2008 13:51:53 -0400 Received: from [199.232.76.173] (port=43453 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTgzI-0003QH-LC for qemu-devel@nongnu.org; Thu, 14 Aug 2008 13:51:52 -0400 Received: from wr-out-0506.google.com ([64.233.184.238]:13133) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KTgzI-0002Kr-E1 for qemu-devel@nongnu.org; Thu, 14 Aug 2008 13:51:52 -0400 Received: by wr-out-0506.google.com with SMTP id c46so729279wra.18 for ; Thu, 14 Aug 2008 10:51:51 -0700 (PDT) Message-ID: <48A47085.3060101@codemonkey.ws> Date: Thu, 14 Aug 2008 12:51:01 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1a8fc205ecb1a6dea2d6a2cc4019f359c90f39fb.1218685608.git.maxk@kernel.org> In-Reply-To: <1a8fc205ecb1a6dea2d6a2cc4019f359c90f39fb.1218685608.git.maxk@kernel.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 4/5] uhci: rewrite UHCI emulator, fully async operation with multiple outstanding transactions Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Krasnyansky Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Max Krasnyansky wrote: > > +static UHCIAsync *uhci_async_alloc(UHCIState *s) > +{ > + UHCIAsync *async = qemu_malloc(sizeof(UHCIAsync)); > + if (async) { > + memset(&async->packet, 0, sizeof(async->packet)); > You can use qemu_mallocz() here. > static void uhci_attach(USBPort *port1, USBDevice *dev); > > static void uhci_update_irq(UHCIState *s) > @@ -143,15 +320,18 @@ static void uhci_reset(UHCIState *s) > s->intr = 0; > s->fl_base_addr = 0; > s->sof_timing = 64; > + > for(i = 0; i < NB_PORTS; i++) { > port = &s->ports[i]; > port->ctrl = 0x0080; > if (port->port.dev) > uhci_attach(&port->port, port->port.dev); > } > + > + uhci_async_cancel_all(s); > } > > -#if 0 > +#if 1 > Just drop the #if > static void uhci_save(QEMUFile *f, void *opaque) > { > UHCIState *s = opaque; > @@ -239,9 +419,8 @@ static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val) > UHCIState *s = opaque; > > addr &= 0x1f; > -#ifdef DEBUG > - printf("uhci writew port=0x%04x val=0x%04x\n", addr, val); > -#endif > + dprintf("uhci: writew port=0x%04x val=0x%04x\n", addr, val); > + > switch(addr) { > case 0x00: > if ((val & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) { > @@ -350,9 +529,9 @@ static uint32_t uhci_ioport_readw(void *opaque, uint32_t addr) > val = 0xff7f; /* disabled port */ > break; > } > -#ifdef DEBUG > - printf("uhci readw port=0x%04x val=0x%04x\n", addr, val); > -#endif > + > + dprintf("uhci: readw port=0x%04x val=0x%04x\n", addr, val); > + > return val; > } How do you handle the outstanding asynchronous requests in save/restore? Regards, Anthony Liguori