qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Krasnyansky <maxk@kernel.org>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [Qemu-devel] Re: [PATCH 4/5] uhci: rewrite UHCI emulator, fully async operation with multiple outstanding transactions
Date: Thu, 14 Aug 2008 12:49:56 -0700	[thread overview]
Message-ID: <48A48C64.8050401@kernel.org> (raw)
In-Reply-To: <48A47085.3060101@codemonkey.ws>

Anthony Liguori wrote:
> 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.
The reasons I decided not too is because there is 2K buffer in each UHCIAsync
struct. memset()ing 2K buffer for each transaction did not seem like a good
idea. ie qemu_mallocz() simply does memset(0)

> 
>>  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
This is probably mismerge. Let me check.

>>  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?

I do not :).
I haven't really played with save/restore. I did not mean to intentionally
enable save/restore stuff, this probably came from KVM tree. Now that I'm
thinking about I did save/restore the VM once with KVM and USB worked fine.
That was before async patches. With async we can probably just cancel all
outstanding transactions. I'll try that out a bit later.

Max

  reply	other threads:[~2008-08-14 19:50 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-14  4:22 [Qemu-devel] [PATCH 0/5] Various USB fixes and improvements Max Krasnyansky
2008-08-14  4:22 ` [Qemu-devel] [PATCH 1/5] husb: support for USB host device auto disconnect Max Krasnyansky
2008-08-14 16:28   ` [Qemu-devel] " Anthony Liguori
2008-08-14 19:26     ` Max Krasnyansky
2008-08-14 21:41     ` Max Krasnyansky
2008-08-14  4:22 ` [Qemu-devel] [PATCH 2/5] husb: support for USB host device auto connect Max Krasnyansky
2008-08-14 16:41   ` [Qemu-devel] " Anthony Liguori
2008-08-14 19:38     ` Max Krasnyansky
2008-08-14 20:21       ` Anthony Liguori
2008-08-14 20:34         ` Max Krasnyansky
2008-08-14 20:41           ` Anthony Liguori
2008-08-14 21:14             ` François Revol
2008-08-15  7:46             ` Guido Günther
2008-08-15 18:24               ` Max Krasnyansky
2008-08-15 18:31                 ` Javier Guerra
2008-08-18 18:21                   ` Max Krasnyansky
2008-08-18 18:52                     ` Javier Guerra
2008-08-18 18:56                       ` Jamie Lokier
2008-08-17  7:52                 ` Avi Kivity
2008-08-18 18:46                   ` Max Krasnyansky
2008-08-18 14:11                 ` Anthony Liguori
2008-08-18 18:16                   ` Max Krasnyansky
2008-08-14  4:22 ` [Qemu-devel] [PATCH 3/5] usb: generic packet handler cleanup and documentation Max Krasnyansky
2008-08-14  4:22 ` [Qemu-devel] [PATCH 4/5] uhci: rewrite UHCI emulator, fully async operation with multiple outstanding transactions Max Krasnyansky
2008-08-14 17:51   ` [Qemu-devel] " Anthony Liguori
2008-08-14 19:49     ` Max Krasnyansky [this message]
2008-10-11 23:54   ` [Qemu-devel] " Juergen Lock
2008-10-15 19:54     ` Max Krasnyansky
2008-10-15 22:05       ` andrzej zaborowski
2008-10-16 21:25         ` Juergen Lock
2008-08-14  4:22 ` [Qemu-devel] [PATCH 5/5] husb: rewrite Linux host USB layer, fully async operation Max Krasnyansky
2008-08-15 14:24   ` Paul Brook
2008-08-15 19:04     ` Max Krasnyansky
2008-08-15 19:53       ` Paul Brook
2008-08-18 18:40         ` Max Krasnyansky
2008-08-14 17:55 ` [Qemu-devel] Re: [PATCH 0/5] Various USB fixes and improvements Anthony Liguori
2008-08-14 19:55   ` Max Krasnyansky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48A48C64.8050401@kernel.org \
    --to=maxk@kernel.org \
    --cc=anthony@codemonkey.ws \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).