1. 20 6月, 2016 1 次提交
  2. 17 6月, 2016 1 次提交
  3. 14 6月, 2016 1 次提交
  4. 13 6月, 2016 2 次提交
    • P
      hw/usb/dev-network.c: Use ldl_le_p() and stl_le_p() · ec9125bc
      Peter Maydell 提交于
      Use stl_le_p() and ldl_le_p() to read and write data from
      buffers, rather than using pointer casts and cpu_to_le32()
      for writes and le32_to_cpup() for reads. This:
       * avoids lots of casts
       * works even if the buffer isn't as aligned as the host would like
       * avoids using the *_to_cpup() functions which we want to get rid of
      
      Note that there may still be some places where a pointer from the
      guest is cast to a pointer to a host structure; these would also
      have to be changed for the device to work on a host CPU which
      enforces alignment restrictions.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 1465573077-29221-1-git-send-email-peter.maydell@linaro.org
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      ec9125bc
    • G
      usb-host: add special case for bus+addr · e058fa2d
      Gerd Hoffmann 提交于
      This patch changes usb-host behavior in case we hostbus= and hostaddr=
      properties are used to identify the usb device in question.  Instead of
      adding the device to the hotplug watchlist we try to open directly using
      the given bus number and device address.
      
      Putting a device specified by hostaddr to the hotplug watchlist isn't
      a great idea as the address isn't a fixed property.  It changes every
      time the device is plugged in.  So considering this case as "use the
      device at bus:addr _now_" is more sane.  Also usb-host will throw errors
      in case it can't initialize the host device.
      
      Note: For devices on the hotplug watchlist (hostport or vendorid or
      productid specified) qemu continues to ignore errors and keeps
      monitoring the usb bus to see if the device eventually shows up.
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 1464945175-28939-1-git-send-email-kraxel@redhat.com
      e058fa2d
  5. 07 6月, 2016 3 次提交
  6. 23 5月, 2016 2 次提交
  7. 11 5月, 2016 3 次提交
    • S
      usb: Support compilation without poll.h · a277c3e0
      Stefan Weil 提交于
      This is a hack to support compilation with Mingw-w64 which provides
      a libusb-1.0 package, but no poll.h.
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      Message-id: 1458630800-10088-1-git-send-email-sw@weilnetz.de
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      a277c3e0
    • I
      usb-mtp: fix usb_mtp_get_device_info so that libmtp on the guest doesn't complain · 1f66fe57
      Isaac Lozano 提交于
      If an application uses libmtp on the guest system,
      it will complain with the warning message:
      LIBMTP WARNING: VendorExtensionID: ffffffff
      LIBMTP WARNING: VendorExtensionDesc: (null)
      LIBMTP WARNING: this typically means the device is PTP (i.e. a camera) but
      not a MTP device at all. Trying to continue anyway.
      
      This is because libmtp expects a MTP Vendor Extension ID of 0x00000006 and a
      MTP Version of 0x0064. These numbers are taken from Microsoft's MTP Vendor
      Extension Identification Message page and are what most physical devices
      show.
      Signed-off-by: NIsaac Lozano <109lozanoi@gmail.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1460892593-5908-1-git-send-email-109lozanoi@gmail.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      1f66fe57
    • R
      usb:xhci: no DMA on HC reset · 491d68d9
      Roman Kagan 提交于
      This patch is a rough fix to a memory corruption we are observing when
      running VMs with xhci USB controller and OVMF firmware.
      
      Specifically, on the following call chain
      
      xhci_reset
        xhci_disable_slot
          xhci_disable_ep
            xhci_set_ep_state
      
      QEMU overwrites guest memory using stale guest addresses.
      
      This doesn't happen when the guest (firmware) driver sets up xhci for
      the first time as there are no slots configured yet.  However when the
      firmware hands over the control to the OS some slots and endpoints are
      already set up with their context in the guest RAM.  Now the OS' driver
      resets the controller again and xhci_set_ep_state then reads and writes
      that memory which is now owned by the OS.
      
      As a quick fix, skip calling xhci_set_ep_state in xhci_disable_ep if the
      device context base address array pointer is zero (indicating we're in
      the HC reset and no DMA is possible).
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NRoman Kagan <rkagan@virtuozzo.com>
      Message-id: 1462384435-1034-1-git-send-email-rkagan@virtuozzo.com
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      491d68d9
  8. 25 4月, 2016 1 次提交
    • G
      usb/uhci: move pid check · f419a626
      Gerd Hoffmann 提交于
      commit "5f77e06b usb: add pid check at the first of uhci_handle_td()"
      moved the pid verification to the start of the uhci_handle_td function,
      to simplify the error handling (we don't have to free stuff which we
      didn't allocate in the first place ...).
      
      Problem is now the check fires too often, it raises error IRQs even for
      TDs which we are not going to process because they are not set active.
      
      So, lets move down the check a bit, so it is done only for active TDs,
      but still before we are going to allocate stuff to process the requested
      transfer.
      Reported-by: NJoe Clifford <joe@thunderbug.co.uk>
      Tested-by: NJoe Clifford <joe@thunderbug.co.uk>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Message-id: 1461321893-15811-1-git-send-email-kraxel@redhat.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      f419a626
  9. 22 4月, 2016 1 次提交
  10. 19 4月, 2016 2 次提交
  11. 23 3月, 2016 3 次提交
    • V
      util: move declarations out of qemu-common.h · f348b6d1
      Veronia Bahaa 提交于
      Move declarations out of qemu-common.h for functions declared in
      utils/ files: e.g. include/qemu/path.h for utils/path.c.
      Move inline functions out of qemu-common.h and into new files (e.g.
      include/qemu/bcd.h)
      Signed-off-by: NVeronia Bahaa <veroniabahaa@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f348b6d1
    • R
      Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND · 73bcb24d
      Rutuja Shah 提交于
      This patch replaces get_ticks_per_sec() calls with the macro
      NANOSECONDS_PER_SECOND. Also, as there are no callers, get_ticks_per_sec()
      is then removed.  This replacement improves the readability and
      understandability of code.
      
      For example,
      
          timer_mod(fdctrl->result_timer,
      	      qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 50));
      
      NANOSECONDS_PER_SECOND makes it obvious that qemu_clock_get_ns
      matches the unit of the expression on the right side of the plus.
      Signed-off-by: NRutuja Shah <rutu.shah.26@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      73bcb24d
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  12. 18 3月, 2016 6 次提交
  13. 29 2月, 2016 1 次提交
  14. 23 2月, 2016 7 次提交
  15. 11 2月, 2016 2 次提交
  16. 09 2月, 2016 2 次提交
    • E
      qom: Swap 'name' next to visitor in ObjectPropertyAccessor · d7bce999
      Eric Blake 提交于
      Similar to the previous patch, it's nice to have all functions
      in the tree that involve a visitor and a name for conversion to
      or from QAPI to consistently stick the 'name' parameter next
      to the Visitor parameter.
      
      Done by manually changing include/qom/object.h and qom/object.c,
      then running this Coccinelle script and touching up the fallout
      (Coccinelle insisted on adding some trailing whitespace).
      
          @ rule1 @
          identifier fn;
          typedef Object, Visitor, Error;
          identifier obj, v, opaque, name, errp;
          @@
           void fn
          - (Object *obj, Visitor *v, void *opaque, const char *name,
          + (Object *obj, Visitor *v, const char *name, void *opaque,
             Error **errp) { ... }
      
          @@
          identifier rule1.fn;
          expression obj, v, opaque, name, errp;
          @@
           fn(obj, v,
          -   opaque, name,
          +   name, opaque,
              errp)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-20-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      d7bce999
    • E
      qapi: Swap visit_* arguments for consistent 'name' placement · 51e72bc1
      Eric Blake 提交于
      JSON uses "name":value, but many of our visitor interfaces were
      called with visit_type_FOO(v, &value, name, errp).  This can be
      a bit confusing to have to mentally swap the parameter order to
      match JSON order.  It's particularly bad for visit_start_struct(),
      where the 'name' parameter is smack in the middle of the
      otherwise-related group of 'obj, kind, size' parameters! It's
      time to do a global swap of the parameter ordering, so that the
      'name' parameter is always immediately after the Visitor argument.
      
      Additional reason in favor of the swap: the existing include/qjson.h
      prefers listing 'name' first in json_prop_*(), and I have plans to
      unify that file with the qapi visitors; listing 'name' first in
      qapi will minimize churn to the (admittedly few) qjson.h clients.
      
      Later patches will then fix docs, object.h, visitor-impl.h, and
      those clients to match.
      
      Done by first patching scripts/qapi*.py by hand to make generated
      files do what I want, then by running the following Coccinelle
      script to affect the rest of the code base:
       $ spatch --sp-file script `git grep -l '\bvisit_' -- '**/*.[ch]'`
      I then had to apply some touchups (Coccinelle insisted on TAB
      indentation in visitor.h, and botched the signature of
      visit_type_enum() by rewriting 'const char *const strings[]' to
      the syntactically invalid 'const char*const[] strings').  The
      movement of parameters is sufficient to provoke compiler errors
      if any callers were missed.
      
          // Part 1: Swap declaration order
          @@
          type TV, TErr, TObj, T1, T2;
          identifier OBJ, ARG1, ARG2;
          @@
           void visit_start_struct
          -(TV v, TObj OBJ, T1 ARG1, const char *name, T2 ARG2, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
           { ... }
      
          @@
          type bool, TV, T1;
          identifier ARG1;
          @@
           bool visit_optional
          -(TV v, T1 ARG1, const char *name)
          +(TV v, const char *name, T1 ARG1)
           { ... }
      
          @@
          type TV, TErr, TObj, T1;
          identifier OBJ, ARG1;
          @@
           void visit_get_next_type
          -(TV v, TObj OBJ, T1 ARG1, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, TErr errp)
           { ... }
      
          @@
          type TV, TErr, TObj, T1, T2;
          identifier OBJ, ARG1, ARG2;
          @@
           void visit_type_enum
          -(TV v, TObj OBJ, T1 ARG1, T2 ARG2, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
           { ... }
      
          @@
          type TV, TErr, TObj;
          identifier OBJ;
          identifier VISIT_TYPE =~ "^visit_type_";
          @@
           void VISIT_TYPE
          -(TV v, TObj OBJ, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, TErr errp)
           { ... }
      
          // Part 2: swap caller order
          @@
          expression V, NAME, OBJ, ARG1, ARG2, ERR;
          identifier VISIT_TYPE =~ "^visit_type_";
          @@
          (
          -visit_start_struct(V, OBJ, ARG1, NAME, ARG2, ERR)
          +visit_start_struct(V, NAME, OBJ, ARG1, ARG2, ERR)
          |
          -visit_optional(V, ARG1, NAME)
          +visit_optional(V, NAME, ARG1)
          |
          -visit_get_next_type(V, OBJ, ARG1, NAME, ERR)
          +visit_get_next_type(V, NAME, OBJ, ARG1, ERR)
          |
          -visit_type_enum(V, OBJ, ARG1, ARG2, NAME, ERR)
          +visit_type_enum(V, NAME, OBJ, ARG1, ARG2, ERR)
          |
          -VISIT_TYPE(V, OBJ, NAME, ERR)
          +VISIT_TYPE(V, NAME, OBJ, ERR)
          )
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-19-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      51e72bc1
  17. 02 2月, 2016 2 次提交