1. 25 9月, 2018 3 次提交
  2. 24 8月, 2018 4 次提交
  3. 23 8月, 2018 2 次提交
    • M
      megasas: fix sglist leak · 48285ba2
      Marc-André Lureau 提交于
      tests/cdrom-test -p /x86_64/cdrom/boot/megasas
      
      Produces the following ASAN leak.
      
      ==25700==ERROR: LeakSanitizer: detected memory leaks
      
      Direct leak of 16 byte(s) in 1 object(s) allocated from:
          #0 0x7f06f8faac48 in malloc (/lib64/libasan.so.5+0xeec48)
          #1 0x7f06f87a73c5 in g_malloc (/lib64/libglib-2.0.so.0+0x523c5)
          #2 0x55a729f17738 in pci_dma_sglist_init /home/elmarco/src/qq/include/hw/pci/pci.h:818
          #3 0x55a729f2a706 in megasas_map_dcmd /home/elmarco/src/qq/hw/scsi/megasas.c:698
          #4 0x55a729f39421 in megasas_handle_dcmd /home/elmarco/src/qq/hw/scsi/megasas.c:1574
          #5 0x55a729f3f70d in megasas_handle_frame /home/elmarco/src/qq/hw/scsi/megasas.c:1955
          #6 0x55a729f40939 in megasas_mmio_write /home/elmarco/src/qq/hw/scsi/megasas.c:2119
          #7 0x55a729f41102 in megasas_port_write /home/elmarco/src/qq/hw/scsi/megasas.c:2170
          #8 0x55a729220e60 in memory_region_write_accessor /home/elmarco/src/qq/memory.c:527
          #9 0x55a7292212b3 in access_with_adjusted_size /home/elmarco/src/qq/memory.c:594
          #10 0x55a72922cf70 in memory_region_dispatch_write /home/elmarco/src/qq/memory.c:1473
          #11 0x55a7290f5907 in flatview_write_continue /home/elmarco/src/qq/exec.c:3255
          #12 0x55a7290f5ceb in flatview_write /home/elmarco/src/qq/exec.c:3294
          #13 0x55a7290f6457 in address_space_write /home/elmarco/src/qq/exec.c:3384
          #14 0x55a7290f64a8 in address_space_rw /home/elmarco/src/qq/exec.c:3395
          #15 0x55a72929ecb0 in kvm_handle_io /home/elmarco/src/qq/accel/kvm/kvm-all.c:1729
          #16 0x55a7292a0db5 in kvm_cpu_exec /home/elmarco/src/qq/accel/kvm/kvm-all.c:1969
          #17 0x55a7291c4212 in qemu_kvm_cpu_thread_fn /home/elmarco/src/qq/cpus.c:1215
          #18 0x55a72a966a6c in qemu_thread_start /home/elmarco/src/qq/util/qemu-thread-posix.c:504
          #19 0x7f06ed486593 in start_thread (/lib64/libpthread.so.0+0x7593)
      
      Move the qemu_sglist_destroy() from megasas_complete_command() to
      megasas_unmap_frame(), so map/unmap are balanced.
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20180814141247.32336-1-marcandre.lureau@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      48285ba2
    • G
      scsi: mptsas: Mark as storage device · a736d719
      Guenter Roeck 提交于
      mptsas1068 is currently listed as uncategorized device.
      Mark it as storage device.
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Message-Id: <1533076133-22745-1-git-send-email-linux@roeck-us.net>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      a736d719
  4. 15 8月, 2018 1 次提交
  5. 16 7月, 2018 1 次提交
    • S
      virtio-scsi: fix hotplug ->reset() vs event race · 8449bcf9
      Stefan Hajnoczi 提交于
      There is a race condition during hotplug when iothread is used.  It
      occurs because virtio-scsi may be processing command queues in the
      iothread while the monitor performs SCSI device hotplug.
      
      When a SCSI device is hotplugged the HotplugHandler->plug() callback is
      invoked and virtio-scsi emits a rescan event to the guest.
      
      If the guest submits a SCSI command at this point then it may be
      cancelled before hotplug completes.  This happens because ->reset() is
      called by hw/core/qdev.c:device_set_realized() after
      HotplugHandler->plug() has been called and
      hw/scsi/scsi-disk.c:scsi_disk_reset() purges all requests.
      
      This patch uses the new HotplugHandler->post_plug() callback to emit the
      rescan event after ->reset().  This eliminates the race conditions where
      requests could be cancelled.
      Reported-by: Nl00284672 <lizhengui@huawei.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Fam Zheng <famz@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-Id: <20180716083732.3347-3-stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      8449bcf9
  6. 13 7月, 2018 1 次提交
    • D
      scsi-disk: Block Device Characteristics emulation fix · 740842c9
      Daniel Henrique Barboza 提交于
      The current BDC VPD page (page 0xb1) is too short. This can be
      seen running sg_utils:
      
      $ sg_vpd --page=bdc /dev/sda
      Block device characteristics VPD page (SBC):
      Block device characteristics VPD page length too short=8
      
      By the SCSI spec, the expected size of the SBC page is 0x40.
      There is no telling how the guest will behave with a shorter
      message - it can ignore it, or worse, make (wrong)
      assumptions.
      
      This patch fixes the emulation by setting the size to 0x40.
      This is the output of the previous sg_vpd command after
      applying it:
      
      $ sg_vpd --page=bdc /dev/sda -v
          inquiry cdb: 12 01 b1 00 fc 00
      Block device characteristics VPD page (SBC):
         [PQual=0  Peripheral device type: disk]
        Medium rotation rate is not reported
        Product type: Not specified
        WABEREQ=0
        WACEREQ=0
        Nominal form factor not reported
        FUAB=0
        VBULS=0
      
      To improve readability, this patch also adds the VBULS value
      explictly and add comments on the existing fields we're
      setting.
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      740842c9
  7. 10 7月, 2018 1 次提交
  8. 02 7月, 2018 1 次提交
  9. 29 6月, 2018 6 次提交
    • K
      usb-storage: Add rerror/werror properties · b8efb36b
      Kevin Wolf 提交于
      The error handling policy was traditionally set with -drive, but with
      -blockdev it is no longer possible to set frontend options. scsi-disk
      (and other block devices) have long supported qdev properties to
      configure the error handling policy, so let's add these options to
      usb-storage as well and just forward them to the internal scsi-disk
      instance.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      b8efb36b
    • D
      hw/scsi: add VPD Block Limits emulation · a71c775b
      Daniel Henrique Barboza 提交于
      The VPD Block Limits Inquiry page is optional, allowing SCSI devices
      to not implement it. This is the case for devices like the MegaRAID
      SAS 9361-8i and Microsemi PM8069.
      
      In case of SCSI passthrough, the response of this request is used by
      the QEMU SCSI layer to set the max_io_sectors that the guest
      device will support, based on the value of the max_sectors_kb that
      the device has set in the host at that time. Without this response,
      the guest kernel is free to assume any value of max_io_sectors
      for the SCSI device. If this value is greater than the value from
      the host, SCSI Sense errors will occur because the guest will send
      read/write requests that are larger than the underlying host device
      is configured to support. An example of this behavior can be seen
      in [1].
      
      A workaround is to set the max_sectors_kb host value back in the guest
      kernel (a process that can be automated using rc.local startup scripts
      and the like), but this has several drawbacks:
      
      - it can be troublesome if the guest has many passthrough devices that
      needs this tuning;
      
      - if a change in max_sectors_kb is made in the host side, manual change
      in the guests will also be required;
      
      - during an OS install it is difficult, and sometimes not possible, to
      go to a terminal and change the max_sectors_kb prior to the installation.
      This means that the disk can't be used during the install process. The
      easiest alternative here is to roll back to scsi-hd, install the guest
      and then go back to SCSI passthrough when the installation is done and
      max_sectors_kb can be set.
      
      An easier way would be to QEMU handle the absence of the Block Limits
      VPD device response, setting max_io_sectors accordingly and allowing
      the guest to use the device without the hassle.
      
      This patch adds emulation of the Block Limits VPD response for
      SCSI passthrough devices of type TYPE_DISK that doesn't support
      it. The following changes were made:
      
      - scsi_handle_inquiry_reply will now check the available VPD
      pages from the Inquiry EVPD reply. In case the device does not
      
      - a new function called scsi_generic_set_vpd_bl_emulation,
      that is called during device realize,  was created to set a
      new flag 'needs_vpd_bl_emulation' of the device. This function
      retrieves the Inquiry EVPD response of the device to check for
      VPD BL support.
      
      - scsi_handle_inquiry_reply will now check the available VPD
      pages from the Inquiry EVPD reply in case the device needs
      VPD BL emulation, adding the Block Limits page (0xb0) to
      the list. This will make the guest kernel aware of the
      support that we're now providing by emulation.
      
      - a new function scsi_emulate_block_limits creates the
      emulated Block Limits response. This function is called
      inside scsi_read_complete in case the device requires
      Block Limits VPD emulation and we detected a SCSI Sense
      error in the VPD Block Limits reply that was issued
      from the guest kernel to the device. This error is
      expected: we're reporting support from our side, but
      the device isn't aware of it.
      
      With this patch, the guest now queries the Block Limits
      page during the device configuration because it is being
      advertised in the Supported Pages response. It will either
      receive the Block Limits page from the hardware, if it supports
      it, or will receive an emulated response from QEMU. At any rate,
      the guest now has the information to set the max_sectors_kb
      parameter accordingly, sparing the user of SCSI sense errors
      that would happen without the emulated response and in the
      absence of Block Limits support from the hardware.
      
      [1] https://bugzilla.redhat.com/show_bug.cgi?id=1566195
      
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1566195Reported-by: NDac Nguyen <dacng@us.ibm.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Message-Id: <20180627172432.11120-4-danielhb413@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      a71c775b
    • D
      hw/scsi: centralize SG_IO calls into single function · a0c7e35b
      Daniel Henrique Barboza 提交于
      For the VPD Block Limits emulation with SCSI passthrough,
      we'll issue an Inquiry request with EVPD set to retrieve
      the available VPD pages of the device. This would be done in
      a way similar of what scsi_generic_read_device_identification
      does: create a SCSI command and a reply buffer, fill in the
      sg_io_hdr_t structure, call blk_ioctl, check if an error
      occurred, process the response.
      
      This same process is done in other 2 functions, get_device_type
      and get_stream_blocksize. They differ in the command/reply
      buffer and post-processing, everything else is almost a
      copy/paste.
      
      Instead of adding a forth copy/pasted-ish code when adding
      the passthrough VPD BL emulation, this patch extirpates
      this repetition of those 3 functions and put it into
      a new one called scsi_SG_IO_FROM_DEV. Any future code that
      wants to execute an SG_DXFER_FROM_DEV to the device can
      use it, avoiding filling sg_io_hdr_t again and et cetera.
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Message-Id: <20180627172432.11120-3-danielhb413@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      a0c7e35b
    • D
      hw/scsi: cleanups before VPD BL emulation · 0a96ca24
      Daniel Henrique Barboza 提交于
      To add support for the emulation of Block Limits VPD page
      for passthrough devices, a few adjustments in the current code
      base is required to avoid repetition and improve clarity.
      
      In scsi-generic.c, detach the Inquiry handling from
      scsi_read_complete and put it into a new function called
      scsi_handle_inquiry_reply. This change aims to avoid
      cluttering of scsi_read_complete when we more logic in the
      Inquiry response handling is added in the next patches,
      centralizing the changes in the new function.
      
      In scsi-disk.c, take the build of all emulated VPD pages
      from scsi_disk_emulate_inquiry and make it available to
      other files into a non-static function called
      scsi_disk_emulate_vpd_page. Making it public will allow
      the future VPD BL emulation code for passthrough devices
      to use it from scsi-generic.c, avoiding copy/pasting this
      code solely for that purpose. It also has the advantage of
      providing emulation of all VPD pages in case we need to
      emulate other pages in other scenarios. As a bonus,
      scsi_disk_emulate_inquiry got tidier.
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Message-Id: <20180627172432.11120-2-danielhb413@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0a96ca24
    • M
      esp: remove legacy esp_init() function · e7d99825
      Mark Cave-Ayland 提交于
      Remove the legacy esp_init() function now that there are no more remaining
      users.
      Signed-off-by: NMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Message-Id: <20180613094727.11326-3-mark.cave-ayland@ilande.co.uk>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Tested-by: NHervé Poussineau <hpoussin@reactos.org>
      e7d99825
    • T
      Replace '-enable-kvm' with '-accel kvm' in docs and help texts · a1d30f28
      Thomas Huth 提交于
      The preferred way to select the KVM accelerator is to use "-accel kvm"
      these days, so let's be consistent in our documentation and help texts.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <1528866321-23886-3-git-send-email-thuth@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      a1d30f28
  10. 15 6月, 2018 1 次提交
  11. 02 6月, 2018 1 次提交
  12. 01 6月, 2018 3 次提交
  13. 31 5月, 2018 1 次提交
  14. 25 5月, 2018 1 次提交
  15. 09 4月, 2018 3 次提交
    • D
      hw/scsi: support SCSI-2 passthrough without PI · 29e560f0
      Daniel Henrique Barboza 提交于
      QEMU SCSI code makes assumptions about how the PROTECT and BYTCHK
      works in the protocol, denying support for PI (Protection
      Information) in case the guest OS requests it. However, in SCSI versions 2
      and older, there is no PI concept in the protocol.
      
      This means that when dealing with such devices:
      
      - there is no PROTECT bit in byte 5 of the standard INQUIRY response. The
      whole byte is marked as "Reserved";
      
      - there is no RDPROTECT in byte 2 of READ. We have 'Logical Unit Number'
      in this field instead;
      
      - there is no VRPROTECT in byte 2 of VERIFY. We have 'Logical Unit Number'
      in this field instead. This also means that the BYTCHK bit in this case
      is not related to PI.
      
      Since QEMU does not consider these changes, a SCSI passthrough using
      a SCSI-2 device will not work. It will mistake these fields with
      PI information and return Illegal Request SCSI SENSE thinking
      that the driver is asking for PI support.
      
      This patch fixes it by adding a new attribute called 'scsi_version'
      that is read from the standard INQUIRY response of passthrough
      devices. This allows for a version verification before applying
      conditions related to PI that doesn't apply for older versions.
      Reported-by: NDac Nguyen <dacng@us.ibm.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Message-Id: <20180327211451.14647-1-danielhb@linux.vnet.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      29e560f0
    • P
      scsi-disk: allow customizing the SCSI version · 2343be0d
      Paolo Bonzini 提交于
      We would like to have different behavior for passthrough devices
      depending on the SCSI version they expose.  To prepare for that,
      allow the user of emulated devices to specify the desired SCSI
      level, and adjust the emulation according to the property value.
      The next patch will set the level for scsi-block and scsi-generic
      devices.
      
      Based on a patch by Daniel Henrique Barboza
      <danielhb@linux.vnet.ibm.com>.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      2343be0d
    • F
      scsi-disk: Don't enlarge min_io_size to max_io_size · 37c51741
      Fam Zheng 提交于
      Some backends report big max_io_sectors. Making min_io_size the same
      value in this case will make it impossible for guest to align memory,
      therefore the disk may not be usable at all.
      
      Do not enlarge them when they are zero.
      Reported-by: NDavid Gibson <dgibson@redhat.com>
      Signed-off-by: NFam Zheng <famz@redhat.com>
      
      Message-Id: <20180327164141.19075-1-famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      37c51741
  16. 26 3月, 2018 1 次提交
  17. 18 3月, 2018 1 次提交
  18. 12 3月, 2018 4 次提交
    • T
      hw/mips/jazz: Fix implicit creation of "-drive if=scsi" devices · 148b2ba1
      Thomas Huth 提交于
      The global hack for creating SCSI devices has recently been removed,
      but this apparently broke SCSI devices on some boards that were not
      ready for this change yet. For the pica61 machine you now get:
      
      $ mips64-softmmu/qemu-system-mips64 -M pica61 -cdrom x.iso
      qemu-system-mips64: -cdrom x.iso: machine type does not support if=scsi,bus=0,unit=2
      
      Fix it by calling scsi_bus_legacy_handle_cmdline() after creating the
      corresponding SCSI controller.
      
      Fixes: 14545097Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <1520414644-11535-1-git-send-email-thuth@redhat.com>
      Reviewed-by: NHervé Poussineau <hpoussin@reactos.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      148b2ba1
    • P
      scsi: support NDOB (no data-out buffer) for WRITE SAME commands · 4397a018
      Paolo Bonzini 提交于
      A NDOB bit set to one specifies that the disk shall not transfer data
      from the data-out buffer and shall process the command as if the data-out
      buffer contained user data set to all zeroes.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      4397a018
    • T
      hw: Do not include "sysemu/block-backend.h" if it is not necessary · 7eceff5b
      Thomas Huth 提交于
      After reviewing a patch from Philippe that removes block-backend.h
      from hw/lm32/milkymist.c, I noticed that this header is included
      unnecessarily in a lot of other files, too. Remove those unneeded
      includes to speed up the compilation process a little bit.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <1518684912-31637-1-git-send-email-thuth@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7eceff5b
    • D
      scsi-disk.c: consider bl->max_transfer in INQUIRY emulation · d082d16a
      Daniel Henrique Barboza 提交于
      The calculation of the max_transfer atribute of BlockDriverState
      makes considerations such as max_segments and transfer_length via
      the BLKSECTGET ioctl (if available).
      
      However, bl->max_transfer isn't considered when emulating the INQUIRY
      'Block Limit' response to the scsi-hd devices. This leads to situations
      where the declared max_sectors from the INQUIRY response is inconsistent
      with the block limits, which isn't ideal. It can also be misleading to the
      user that sets /sys/block/<dev>/queue/max_sectors_kb to a certain
      value, then finds a different value in the guest OS for the same disk.
      
      Following the same logic scsi_read_complete from scsi-generic.c does
      when patching the response of the Block Limits VPD back to the guest,
      change the max_io_sectors value of the emulated Block Limits VPD
      response by considering the blk_get_max_transfer of the related
      BlockDriverState. Use MIN_NOT_ZERO to be sure that the minimal
      value is chosen.
      
      Given that we're changing max_io_sectors, consider that min_io_sectors
      and opt_io_sectors can't be greater than the new calculated value.
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Message-Id: <20180306154411.18462-1-danielhb@linux.vnet.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d082d16a
  19. 09 3月, 2018 1 次提交
  20. 06 3月, 2018 1 次提交
  21. 09 2月, 2018 2 次提交