1. 17 3月, 2015 3 次提交
    • M
      usb/dev-storage: Avoid qerror_report_err() outside QMP handlers · c326529b
      Markus Armbruster 提交于
      qerror_report_err() is a transitional interface to help with
      converting existing monitor commands to QMP.  It should not be used
      elsewhere.
      
      usb_msd_password_cb() is only called from within an HMP command
      handler.  Replace by error_report_err().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      c326529b
    • M
      usb/dev-storage: Fix QMP device_add missing encryption key failure · 7afcc1f9
      Markus Armbruster 提交于
      When the image is encrypted, QMP device_add creates the device, defers
      actually attaching it to when the key becomes available, then returns
      an error.  This is wrong.  device_add must either create the device
      and succeed, or do nothing and fail.
      
      The bug is in usb_msd_realize_storage().  It posts an error with
      qerror_report_err(), and returns success.  Device realization relies
      on the return value, and completes.  The QMP monitor, however, relies
      on the posted error, and sends it in an error reply.
      
      Reproducer:
      
          $ qemu-system-x86_64 -nodefaults -display none -usb -qmp stdio -drive if=none,id=foo,file=geheim.qcow2
          {"QMP": {"version": {"qemu": {"micro": 50, "minor": 2, "major": 2}, "package": ""}, "capabilities": []}}
          { "execute": "qmp_capabilities" }
          {"return": {}}
          { "execute": "device_add", "arguments": { "driver": "usb-storage", "id": "bar", "drive": "foo" } }
          {"error": {"class": "DeviceEncrypted", "desc": "'foo' (geheim.qcow2) is encrypted"}}
      
      Even though we got an error back, the device got created just fine.
      To demonstrate, let's unplug it again:
      
          {"execute":"device_del","arguments": { "id": "bar" } }
          {"timestamp": {"seconds": 1426003440, "microseconds": 237181}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/bar/bar.0/legacy[0]"}}
          {"timestamp": {"seconds": 1426003440, "microseconds": 238231}, "event": "DEVICE_DELETED", "data": {"device": "bar", "path": "/machine/peripheral/bar"}}
          {"return": {}}
      
      Fix by making usb_msd_realize_storage() fail properly.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      7afcc1f9
    • M
      monitor usb: Inline monitor_read_bdrv_key_start()'s first part · 9b14e0ef
      Markus Armbruster 提交于
      monitor_read_bdrv_key_start() does several things:
      
      1. If no key is needed, call completion_cb() and succeed
      
      2. If we're in QMP context, call qerror_report_err() and fail
      
      3. Start reading the key in the monitor.
      
      This is two things too many.  Inline 1. and 2. into its callers
      monitor_read_block_device_key() and usb_msd_realize_storage().
      
      Since monitor_read_block_device_key() only ever runs in HMP context,
      drop 2. there.
      
      The next commit will clean up the result in usb_msd_realize_storage().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      9b14e0ef
  2. 10 3月, 2015 2 次提交
    • E
      BlockConf: Call backend functions to detect geometry and blocksizes · 0eb28a42
      Ekaterina Tumanova 提交于
      geometry: hd_geometry_guess function autodetects the drive geometry.
      This patch adds a block backend call, that probes the backing device
      geometry. If the inner driver method is implemented and succeeds
      (currently only for DASDs), the blkconf_geometry will pass-through
      the backing device geometry. Otherwise will fallback to old logic.
      
      blocksize: This patch initializes blocksize properties to 0.
      In order to set the property a blkconf_blocksizes was introduced.
      If user didn't set physical or logical blocksize, it will
      retrieve its value from a driver (only succeeds for DASD), otherwise
      it will set default 512 value.
      
      The blkconf_blocksizes call was added to all users of BlkConf.
      Signed-off-by: NEkaterina Tumanova <tumanova@linux.vnet.ibm.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1424087278-49393-6-git-send-email-tumanova@linux.vnet.ibm.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      0eb28a42
    • M
      hw: Propagate errors through qdev_prop_set_drive() · 9b3d111a
      Markus Armbruster 提交于
      Three kinds of callers:
      
      1. On failure, report the error and abort
      
         Passing &error_abort does the job.  No functional change.
      
      2. On failure, report the error and exit()
      
         This is qdev_prop_set_drive_nofail().  Error reporting moves from
         qdev_prop_set_drive() to its caller.  Because hiding away the error
         in the monitor right before exit() isn't helpful, replace
         qerror_report_err() by error_report_err().  Shouldn't make a
         difference, because qdev_prop_set_drive_nofail() should never be
         used in QMP context.
      
      3. On failure, report the error and recover
      
         This is usb_msd_init() and scsi_bus_legacy_add_drive().  Error
         reporting and freeing the error object moves from
         qdev_prop_set_drive() to its callers.
      
         Because usb_msd_init() can't run in QMP context, replace
         qerror_report_err() by error_report_err() there.
      
         No functional change.
      
         scsi_bus_legacy_add_drive() calling qerror_report_err() is of
         course inappropriate, but this commit merely makes it more obvious.
         The next one will clean it up.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      Message-Id: <1425925048-15482-3-git-send-email-armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9b3d111a
  3. 26 2月, 2015 1 次提交
  4. 18 2月, 2015 2 次提交
  5. 20 10月, 2014 2 次提交
  6. 15 10月, 2014 4 次提交
  7. 23 9月, 2014 4 次提交
  8. 22 9月, 2014 1 次提交
    • M
      usb-storage: Fix how legacy init handles option ID clash · 31376776
      Markus Armbruster 提交于
      usb_msd_init() calls qemu_opts_create() with a made-up ID and false
      fail_if_exists.  If the ID already exists, it happily messes up those
      options, then fails drive_new(), because the BlockDriverState with
      that ID already exists, too.
      
      Reproducer: -drive if=none,id=usb0,format=raw -usbdevice disk:tmp.qcow2
      
      Pass true fail_if_exists to qemu_opts_create(), and if it fails, try
      the next made-up ID.
      
      The reproducer now succeeds, and creates an usb-storage device with ID
      usb1.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      31376776
  9. 16 6月, 2014 1 次提交
  10. 14 5月, 2014 1 次提交
  11. 18 2月, 2014 1 次提交
  12. 06 11月, 2013 1 次提交
  13. 31 8月, 2013 1 次提交
  14. 29 7月, 2013 1 次提交
  15. 23 7月, 2013 1 次提交
  16. 24 6月, 2013 1 次提交
  17. 04 5月, 2013 1 次提交
  18. 09 4月, 2013 1 次提交
    • P
      hw: move headers to include/ · 0d09e41a
      Paolo Bonzini 提交于
      Many of these should be cleaned up with proper qdev-/QOM-ification.
      Right now there are many catch-all headers in include/hw/ARCH depending
      on cpu.h, and this makes it necessary to compile these files per-target.
      However, fixing this does not belong in these patches.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0d09e41a
  19. 06 4月, 2013 1 次提交
  20. 19 2月, 2013 1 次提交
  21. 22 1月, 2013 2 次提交
  22. 17 1月, 2013 1 次提交
  23. 11 1月, 2013 1 次提交
    • A
      Make all static TypeInfos const · 8c43a6f0
      Andreas Färber 提交于
      Since 39bffca2 (qdev: register all
      types natively through QEMU Object Model), TypeInfo as used in
      the common, non-iterative pattern is no longer amended with information
      and should therefore be const.
      
      Fix the documented QOM examples:
      
       sed -i 's/static TypeInfo/static const TypeInfo/g' include/qom/object.h
      
      Since frequently the wrong examples are being copied by contributors of
      new devices, fix all types in the tree:
      
       sed -i 's/^static TypeInfo/static const TypeInfo/g' */*.c
       sed -i 's/^static TypeInfo/static const TypeInfo/g' */*/*.c
      
      This also avoids to piggy-back these changes onto real functional
      changes or other refactorings.
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      8c43a6f0
  24. 19 12月, 2012 4 次提交
  25. 09 11月, 2012 1 次提交
    • H
      usb: split packet result into actual_length + status · 9a77a0f5
      Hans de Goede 提交于
      Since with the ehci and xhci controllers a single packet can be larger
      then maxpacketsize, it is possible for the result of a single packet
      to be both having transferred some data as well as the transfer to have
      an error.
      
      An example would be an input transfer from a bulk endpoint successfully
      receiving 1 or more maxpacketsize packets from the device, followed
      by a packet signalling halt.
      
      While already touching all the devices and controllers handle_packet /
      handle_data / handle_control code, also change the return type of
      these functions to void, solely storing the status in the packet. To
      make the code paths for regular versus async packet handling more
      uniform.
      
      This patch unfortunately is somewhat invasive, since makeing the qemu
      usb core deal with this requires changes everywhere. This patch only
      prepares the usb core for this, all the hcd / device changes are done
      in such a way that there are no functional changes.
      
      This patch has been tested with uhci and ehci hcds, together with usb-audio,
      usb-hid and usb-storage devices, as well as with usb-redir redirection
      with a wide variety of real devices.
      
      Note that there is usually no need to directly set packet->actual_length
      form devices handle_data callback, as that is done by usb_packet_copy()
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      9a77a0f5