1. 08 8月, 2011 1 次提交
  2. 04 8月, 2011 2 次提交
    • G
      usb-hid: split hid code to hw/hid.[ch] · dcfda673
      Gerd Hoffmann 提交于
      Almost pure code motion.  Unstatic hid interface functions and add
      them to the header file.  Some renames.  Some code style cleanups.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      dcfda673
    • G
      usb: use iovecs in USBPacket · 4f4321c1
      Gerd Hoffmann 提交于
      Zap data pointer from USBPacket, add a QEMUIOVector instead.
      Add a bunch of helper functions to manage USBPacket data.
      Switch over users to the new interface.
      
      Note that USBPacket->len was used for two purposes:  First to
      pass in the buffer size and second to return the number of
      transfered bytes or the status code on async transfers.  There
      is a new result variable for the latter.  A new status code
      was added to catch uninitialized result.
      
      Nobody creates iovecs with more than one element (yet).
      Some users are (temporarely) limited to iovecs with a single
      element to keep the patch size as small as possible.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      4f4321c1
  3. 03 8月, 2011 1 次提交
  4. 02 8月, 2011 2 次提交
  5. 01 8月, 2011 2 次提交
    • A
      coroutine: implement coroutines using gthread · d0e2fce5
      Aneesh Kumar K.V 提交于
      On platforms that don't support makecontext(3) use gthread based
      coroutine implementation.
      
      Darwin has makecontext(3) but getcontext(3) is stubbed out to return
      ENOTSUP.  Andreas Färber <andreas.faerber@web.de> debugged this and
      contributed the ./configure test which solves the issue for Darwin/ppc64
      (and ppc) v10.5.
      
      [Original patch by Aneesh, made consistent with coroutine-ucontext.c and
      switched to GStaticPrivate by Stefan.  Tested on Linux and OpenBSD.]
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      d0e2fce5
    • 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
  6. 22 7月, 2011 8 次提交
  7. 21 7月, 2011 1 次提交
  8. 17 7月, 2011 1 次提交
  9. 14 6月, 2011 2 次提交
    • A
      libcacard: add libcacard.la target · 44dc0ca3
      Alon Levy 提交于
      No flag to configure is required. Instead, added a libcacard.la target that
      is not built by default, only when requested explicitly via:
      
      mkdir build
      cd build
      ../configure
      make libcacard.la
      make install-libcacard
      
      Uses libtool to do actual linking of object files and shared library, and
      installing. Tested only under linux, but supposed to work on other systems as
      well.
      
      If libtool isn't found you get a message complaining about that, only at build
      time (since it is not a default target I did not add a message at configure
      time).
      
      New build artifacts:
       .libs subdirectories (at <buildroot> and <buildroot>/libcacard)
       *.lo files (at same locations as the respective o files)
      
      Added %.lo : %.c rule that uses libtool.
      Updated clean rule to clean up those artifacts.
      Added specific rule to call dtrace with libtool wrapper (note that because of
      a current upstream dtrace bug fixed by systemtap b1568fd85 commit the -fPIC flag
      isn't actually passed on. still current dtrace+libtool produced object links fine).
      If libtool is missing any of the following targets will complain and exit 1:
       any subdir: *.lo
       root and libcacard: libcacard.la, libcacard-instsall
      
      Tested to link and load with all tracing backends.
      44dc0ca3
    • A
      cocoa: Revert dependency on VNC · e949467b
      Andreas Färber 提交于
      In 821601ea (Make VNC support optional)
      cocoa.o was moved from ui-obj-$(CONFIG_COCOA) to vnc-obj-$(CONFIG_COCOA),
      adding a dependency on $(CONFIG_VNC). That must've been unintentional.
      
      Cc: Jes Sorensen <Jes.Sorensen@redhat.com>
      Cc: Anthony Liguori <aliguori@us.ibm.com>
      Signed-off-by: NAndreas Färber <andreas.faerber@web.de>
      e949467b
  10. 08 6月, 2011 3 次提交
  11. 02 6月, 2011 4 次提交
  12. 01 6月, 2011 1 次提交
    • A
      libcacard: add libcacard.la target · b7b8c618
      Alon Levy 提交于
      No flag to configure is required. Instead, added a libcacard.la target that
      is not built by default, only when requested explicitly via:
      
      mkdir build
      cd build
      ../configure
      make libcacard.la
      make install-libcacard
      
      Uses libtool to do actual linking of object files and shared library, and
      installing. Tested only under linux, but supposed to work on other systems as
      well.
      
      If libtool isn't found you get a message complaining about that, only at build
      time (since it is not a default target I did not add a message at configure
      time).
      
      New build artifacts:
       .libs subdirectories (at <buildroot> and <buildroot>/libcacard)
       *.lo files (at same locations as the respective o files)
      
      Added %.lo : %.c rule that uses libtool.
      Updated clean rule to clean up those artifacts.
      Added specific rule to call dtrace with libtool wrapper (note that because of
      a current upstream dtrace bug fixed by systemtap b1568fd85 commit the -fPIC flag
      isn't actually passed on. still current dtrace+libtool produced object links fine).
      If libtool is missing any of the following targets will complain and exit 1:
       any subdir: *.lo
       root and libcacard: libcacard.la, libcacard-instsall
      
      Tested to link and load with all tracing backends.
      b7b8c618
  13. 26 5月, 2011 1 次提交
    • G
      usb: add ehci adapter · 94527ead
      Gerd Hoffmann 提交于
      This patch finally merges the EHCI host adapter aka USB 2.0 support.
      
      Based on the ehci bits collected @ git://git.kiszka.org/qemu.git ehci
      
      EHCI has a long out-of-tree history.  Project was started by Mark
      Burkley, with contributions by Niels de Vos.  David S. Ahern continued
      working on it.  Kevin Wolf, Jan Kiszka and Vincent Palatin contributed
      bugfixes.
      
      /me (Gerd Hoffmann) picked it up where it left off, prepared the code
      for merge, fixed a few bugs and added basic user docs.
      
      Cc: David S. Ahern <daahern@cisco.com>
      Cc: Jan Kiszka <jan.kiszka@web.de>
      Cc: Kevin Wolf <mail@kevin-wolf.de>
      Cc: Vincent Palatin <vincent.palatin_qemu@m4x.org>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      94527ead
  14. 08 5月, 2011 2 次提交
  15. 29 4月, 2011 1 次提交
  16. 27 4月, 2011 2 次提交
  17. 07 4月, 2011 2 次提交
  18. 02 4月, 2011 4 次提交
    • A
      ccid: add ccid-card-emulated device · 585738a6
      Alon Levy 提交于
      This devices uses libcacard (internal) to emulate a smartcard conforming
      to the CAC standard. It attaches to the usb-ccid bus. Usage instructions
      (example command lines) are in the following patch in docs/ccid.txt. It
      uses libcacard which uses nss, so it can work with both hw cards and
      certificates (files).
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      
      ---
      
      changes from v20->v21: (Jes Sorenson review)
       * cosmetics
       * use qemu-thread and qemu_malloc/qemu_free
      
      changes from v19->v20:
       * checkpatch.pl
      
      changes from v18->v19:
       * add qdev.desc
       * backend: drop the enumeration property, back to using a string one.
      
      changes from v16->v17:
       * use PROP_TYPE_ENUM for backend
      
      changes from v15->v16:
       * fix error reporting in initfn
       * bump copyright year
       * update copyright license
      
      changes from v1:
       * remove stale comments, use only c-style comments
       * bugfix, forgot to set recv_len
       * change reader name to 'Virtual Reader'
      585738a6
    • R
      libcacard: initial commit · 111a38b0
      Robert Relyea 提交于
      libcacard emulates a Common Access Card (CAC) which is a standard
      for smartcards. It is used by the emulated ccid card introduced in
      a following patch. Docs are available in docs/libcacard.txt
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      
      ---
      
      changes from v24->v25:
       * Fix out of tree builds.
       * Fix build with linux-user targets.
      
      changes from v23->v24: (Jes Sorensen review 2)
       * Makefile.target: use obj-$(CONFIG_*) +=
       * remove unrequired includes, include qemu-common before qemu-thread
        * required adding #define NO_NSPR_10_SUPPORT (harmless)
      
      changes from v22->v23:
       * configure fixes: (reported by Stefan Hajnoczi)
        * test a = b, not a == b (second isn't portable)
        * quote $source_path in case it contains spaces
         - this doesn't really help since there are many other places
           that need similar fixes, not introduced by this patch.
      
      changes from v21->v22:
       * fix configure to not link libcacard if nss not found
          (reported by Stefan Hajnoczi)
       * fix vscclient linkage with simpletrace backend
          (reported by Stefan Hajnoczi)
       * card_7816.c: add missing break in ERROR_DATA_NOT_FOUND
          (reported by William van de Velde)
      
      changes from v20->v21: (Jes Sorensen review)
       * use qemu infrastructure: qemu-thread, qemu-common (qemu_malloc
        and qemu_free), error_report
       * assert instead of ASSERT
       * cosmetic fixes
       * use strpbrk and isspace
       * add --disable-nss --enable-nss here, instead of in the final patch.
       * split vscclient, passthru and docs to following patches.
      
      changes from v19->v20:
       * checkpatch.pl
      
      changes from v15->v16:
      
      Build:
       * don't erase self with distclean
       * fix make clean after make distclean
       * Makefile: make vscclient link quiet
      
      Behavioral:
       * vcard_emul_nss: load coolkey in more situations
       * vscclient:
        * use hton,ntoh
        * send init on connect, only start vevent thread on response
        * read payload after header check, before type switch
        * remove Reconnect
        * update for vscard_common changes, empty Flush implementation
      
      Style/Whitespace:
       * fix wrong variable usage
       * remove unused variable
       * use only C style comments
        * add copyright header
        * fix tabulation
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      
      libcacard: fix out of tree builds
      111a38b0
    • A
      ccid: add passthru card device · edbb2136
      Alon Levy 提交于
      The passthru ccid card is a device sitting on the usb-ccid bus and
      using a chardevice to communicate with a remote device using the
      VSCard protocol defined in libcacard/vscard_common.h
      
      Usage docs available in following patch in docs/ccid.txt
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      
      ---
      
      Changes from v23->v24:
       * fixed double license line in header.
      
      Changes from v20->v21: (Jes Sorensen review)
       * add reference to COPYING in header
       * long comment reformatting
      
      Changes from v19->v20:
       * checkpatch.pl
      
      Changes from v18->v19:
       * add qdev.desc
       * remove .qdev.unplug (no hot unplug support for ccid bus)
      
      Changes from v16->v17:
       * fix wrong cast when receiving VSC_Error
       * ccid-card-passthru: force chardev user wakeup by sending Init
         see lengthy comment below.
      
      Changes from v15->v16:
      
      Behavioral changes:
       * return correct size
       * return error instead of assert if client sent too large ATR
       * don't assert if client sent too large a size, but add asserts for indices to buffer
       * reset vscard_in indices on chardev disconnect
       * handle init from client
       * error if no chardev supplied
       * use ntoh, hton
       * eradicate reader_id_t
       * remove Reconnect usage (removed from VSCARD protocol)
       * send VSC_SUCCESS on card insert/remove and reader add/remove
      
      Style fixes:
       * width of line fix
       * update copyright
       * remove old TODO's
       * update file header comment
       * use macros for debug levels
       * c++ style comment replacement
       * update copyright license
       * fix ATR size comment
       * fix whitespace in struct def
       * fix DPRINTF prefix
       * line width fix
      
      ccid-card-passthru: force chardev user wakeup by sending Init
      
      The problem: how to wakeup the user of the smartcard when the smartcard
      device is initialized?
      
      Long term solution: have a callback interface. This was done via
      the deprecated so called chardev ioctl interface.
      
      Short term solution: do a write. Specifically we write an Init message.
      And we change the client to send it's own Init message regardless of
      receiving this one. Additional Init messages will be regarded as
      acceptable, the first one received after connection establishment is
      the determining one wrt capabilities.
      edbb2136
    • A
      usb-ccid: add CCID bus · 36707144
      Alon Levy 提交于
      A CCID device is a smart card reader. It is a USB device, defined at [1].
      This patch introduces the usb-ccid device that is a ccid bus. Next patches will
      introduce two card types to use it, a passthru card and an emulated card.
      
       [1] http://www.usb.org/developers/devclass_docs/DWG_Smart-Card_CCID_Rev110.
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      
      ---
      
      changes from v20->v21: (Jes Sorenson review)
       * cosmetic changes - fix multi line comments.
       * reorder fields in USBCCIDState
       * add reference to COPYING
       * add --enable-smartcard and --disable-smartcard here (moved
       from last patch)
      
      changes from v19->v20:
       * checkpatch.pl
      
      changes from v18->v19:
       * merged: ccid.h: add copyright, fix define and remove non C89 comments
       * add qdev.desc
      
      changes from v15->v16:
      
      Behavioral changes:
       * fix abort on client answer after card remove
       * enable migration
       * remove side affect code from asserts
       * return consistent self-powered state
       * mask out reserved bits in ccid_set_parameters
       * add missing abRFU in SetParameters (no affect on linux guest)
      
      whitefixes / comments / consts defines:
       * remove stale comment
       * remove ccid_print_pending_answers if no DEBUG_CCID
       * replace printf's with DPRINTF, remove DEBUG_CCID, add verbosity defines
       * use error_report
       * update copyright (most of the code is not original)
       * reword known bug comment
       * add missing closing quote in comment
       * add missing whitespace on one line
       * s/CCID_SetParameter/CCID_SetParameters/
       * add comments
       * use define for max packet size
      
      Comment for "return consistent self-powered state":
      
      the Configuration Descriptor bmAttributes claims we are self powered,
      but we were returning not self powered to USB_REQ_GET_STATUS control message.
      
      In practice, this message is not sent by a linux 2.6.35.10-74.fc14.x86_64
      guest (not tested on other guests), unless you issue lsusb -v as root (for
      example).
      36707144