1. 11 9月, 2011 1 次提交
  2. 07 9月, 2011 4 次提交
    • G
      usb: claim port at device initialization time. · 891fb2cd
      Gerd Hoffmann 提交于
      This patch makes qemu assign a port when creating the device, not when
      attaching it.  For most usb devices this isn't a noticable difference
      because they are in attached state all the time.
      
      The change affects usb-host devices which live in detached state while
      the real device is unplugged from the host.  They have a fixed port
      assigned all the time now instead of getting grabbing one on attach and
      releasing it at detach, i.e. they stop floating around at the usb bus.
      
      The change also allows to simplify usb-hub.  It doesn't need the
      handle_attach() callback any more to configure the downstream ports.
      This can be done at device initialitation time now.  The changed
      initialization order (first grab upstream port, then register downstream
      ports) also fixes some icky corner cases.  For example it is not possible
      any more to plug the hub into one of its own downstream ports.
      
      The usb host adapters must care too.  USBPort->dev being non-NULL
      doesn't imply any more the device is in attached state.  The host
      adapters must additionally check the USBPort->dev->attached flag.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      891fb2cd
    • G
      usb-ehci: handle siTDs · 2fe80192
      Gerd Hoffmann 提交于
      This patch adds code to do minimal siTD handling, which is basically
      just following the next pointer.  This is good enougth to handle the
      inactive siTDs used by FreeBSD.  Active siTDs are skipped too as we
      don't have split transfer support in qemu, additionally a warning is
      printed.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      2fe80192
    • G
      usb-host: claim port · 9516bb47
      Gerd Hoffmann 提交于
      When configured to pass through a specific host port (using hostbus and
      hostport properties), try to claim the port if supported by the kernel.
      That will avoid any kernel drivers binding to devices plugged into that
      port.  It will not stop any userspace apps (such as usb_modeswitch)
      access the device via usbfs though.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      9516bb47
    • G
      usb-host: start tracing support · e6a2f500
      Gerd Hoffmann 提交于
      Add a bunch of trace points to usb-linux.c  Drop a bunch of DPRINTK's in
      favor of the trace points.  Also cleanup error reporting a bit while being
      at it.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      e6a2f500
  3. 02 9月, 2011 1 次提交
  4. 01 9月, 2011 2 次提交
  5. 28 8月, 2011 1 次提交
  6. 23 8月, 2011 1 次提交
  7. 22 8月, 2011 1 次提交
  8. 12 8月, 2011 2 次提交
  9. 02 8月, 2011 3 次提交
  10. 01 8月, 2011 1 次提交
    • K
      coroutine: introduce coroutines · 00dccaf1
      Kevin Wolf 提交于
      Asynchronous code is becoming very complex.  At the same time
      synchronous code is growing because it is convenient to write.
      Sometimes duplicate code paths are even added, one synchronous and the
      other asynchronous.  This patch introduces coroutines which allow code
      that looks synchronous but is asynchronous under the covers.
      
      A coroutine has its own stack and is therefore able to preserve state
      across blocking operations, which traditionally require callback
      functions and manual marshalling of parameters.
      
      Creating and starting a coroutine is easy:
      
        coroutine = qemu_coroutine_create(my_coroutine);
        qemu_coroutine_enter(coroutine, my_data);
      
      The coroutine then executes until it returns or yields:
      
        void coroutine_fn my_coroutine(void *opaque) {
            MyData *my_data = opaque;
      
            /* do some work */
      
            qemu_coroutine_yield();
      
            /* do some more work */
        }
      
      Yielding switches control back to the caller of qemu_coroutine_enter().
      This is typically used to switch back to the main thread's event loop
      after issuing an asynchronous I/O request.  The request callback will
      then invoke qemu_coroutine_enter() once more to switch back to the
      coroutine.
      
      Note that if coroutines are used only from threads which hold the global
      mutex they will never execute concurrently.  This makes programming with
      coroutines easier than with threads.  Race conditions cannot occur since
      only one coroutine may be active at any time.  Other coroutines can only
      run across yield.
      
      This coroutines implementation is based on the gtk-vnc implementation
      written by Anthony Liguori <anthony@codemonkey.ws> but it has been
      significantly rewritten by Kevin Wolf <kwolf@redhat.com> to use
      setjmp()/longjmp() instead of the more expensive swapcontext() and by
      Paolo Bonzini <pbonzini@redhat.com> for Windows Fibers support.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      00dccaf1
  11. 22 7月, 2011 1 次提交
  12. 21 7月, 2011 1 次提交
  13. 18 7月, 2011 2 次提交
  14. 17 7月, 2011 1 次提交
  15. 19 6月, 2011 2 次提交
  16. 14 6月, 2011 8 次提交
    • G
      025b168c
    • G
      usb-ehci: itd handling fixes. · e654887f
      Gerd Hoffmann 提交于
      This patch fixes a bunch of issues in the itd descriptor handling.
      Most important fix is to handle transfers which cross page borders
      correctly by looking up the address of the next page.  Luckily the
      linux uses physically contigous memory so the data used to hits the
      correct location even with this bug instead of corrupting guest
      memory.  Also the transfer length updates for outgoing transfers wasn't
      correct.
      
      While being at it DPRINTFs have been replaced by tracepoints.
      
      The isoch_pause logic has been disabled.  Not clear to me which propose
      this serves and I think it is incorrect too as we just skip processing
      itds.  Even when no xfer happens we have to clear the active bit.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      e654887f
    • G
      usb-ehci: multiqueue support · 8ac6d699
      Gerd Hoffmann 提交于
      This patch adds support for keeping multiple queues going at the same
      time.  One slow device will not affect other devices any more.
      
      The patch adds code to manage EHCIQueue structs.  It also does a number
      of changes to the state machine:
      
       * The state machine will never ever stop in EXECUTING any more.
         Instead it will continue with the next queue (aka HORIZONTALQH) when
         the usb device returns USB_RET_ASYNC.
       * The state machine will stop processing when it figures it walks in
         circles (easy to figure now that we have a EHCIQueue struct for each
         QH we've processed).  The bailout logic should not be needed any
         more.  For now it is still in, but will assert() in case it triggers.
       * The state machine will just skip queues with a async USBPacket in
         flight.
       * The state machine will resume processing as soon as the async
         USBPacket is finished.
      
      The patch also takes care to flush the QH struct back to guest memory
      when needed, so we don't get stale data when (re-)loading it from guest
      memory in FETCHQH state.
      
      It also makes the writeback code to not touch the first three dwords of
      the QH struct as the EHCI must not write them.  This actually fixes a
      bug where QH chaining changes (next ptr) by the linux ehci driver where
      overwritten by the emulated EHCI.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      8ac6d699
    • G
      usb-ehci: trace buffer copy · f2c88dc1
      Gerd Hoffmann 提交于
      Add a trace point for buffer copies and drop the DPRINTF's.
      
      No change in behavior.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      f2c88dc1
    • G
      usb-ehci: improve mmio tracing · c4f8e211
      Gerd Hoffmann 提交于
      Add a separate tracepoint to log how register values change in response
      to a mmio write.  Especially useful for registers which have read-only
      or clear-on-write bits in them.
      
      No change in behavior.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      c4f8e211
    • G
      usb-ehci: trace port state · dcbd0b5c
      Gerd Hoffmann 提交于
      Trace usb port operations (attach, detach, reset),
      drop a few obsolete DPRINTF's.
      
      No change in behavior.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      dcbd0b5c
    • G
      usb-ehci: trace state machine changes · 26d53979
      Gerd Hoffmann 提交于
      Add functions to get and set the current state of the state machine,
      add tracepoints there to trace state transitions.  Add support for
      traceing the queue heads and transfer descriptors as we look at them.
      
      Drop a few DPRINTFs and all DPRINTF_ST lines, they are obsolete now.
      
      No change in behavior.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      26d53979
    • G
      usb-ehci: trace mmio and usbsts · 439a97cc
      Gerd Hoffmann 提交于
      This patch starts adding trace support to ehci.  It traces
      updates of the status register (USBSTS), mmio access and
      controller reset.
      
      It also adds functions to set and clear status register bits
      and puts them in use everywhere.
      
      Some DPRINTF's are dropped in favor of the new tracepoints.
      
      No change in behavior.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      439a97cc
  17. 05 6月, 2011 1 次提交
  18. 26 5月, 2011 3 次提交
  19. 18 5月, 2011 1 次提交
    • S
      qed: Periodically flush and clear need check bit · 6f321e93
      Stefan Hajnoczi 提交于
      One strategy to limit the startup delay of consistency check when
      opening image files is to ensure that the file is marked dirty for as
      little time as possible.
      
      QED currently marks the image dirty when the first allocating write
      request is issued and clears the dirty bit again when the image is
      cleanly closed.  In practice that means the image is marked dirty for
      most of a guest's lifetime and prone to being in a dirty state upon
      crash or power failure.
      
      It is safe to clear the dirty bit after all allocating write requests
      have completed and a flush has been performed.  This patch adds a timer
      after the last allocating write request completes.  When the timer fires
      it will flush and then clear the dirty bit.  The timer is set to 5
      seconds and is cancelled upon arrival of a new allocating write request.
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      6f321e93
  20. 08 5月, 2011 2 次提交
  21. 03 5月, 2011 1 次提交