1. 08 9月, 2010 3 次提交
    • B
      scsi-disk: respect the page control (PC) field in the MODE SENSE command · 282ab04e
      Bernhard Kohl 提交于
      The page control (PC) field defines the type of mode parameter values
      to be returned in the mode pages:
      
      PC=0 : Current values
      PC=1 : Changeable values
      PC=2 : Default values
      PC=3 : Saved values
      
      The current implementation always returns the same type of parameters.
      This is OK for Current and Default values as we don't support changes
      to be done by the MODE SELECT command.
      
      For Saved values the following applies (implemented by this patch):
      "A PC field value of 3h requests that the target return the saved
      values of the mode parameters. Implementation of saved page parameters
      is optional. Mode parameters not supported by the target shall be set
      to zero. If saved values are not implemented, the command shall be
      terminated with CHECK CONDITION status, the sense key set to
      ILLEGAL REQUEST and the additional sense code set to
      SAVING PARAMETERS NOT SUPPORTED."
      
      For Changeable values the following applies (implemented by this patch):
      "A PC field value of 1h requests that the target return a mask denoting
      those mode parameters that are changeable. In the mask, the fields of
      the mode parameters that are changeable shall be set to all one bits and
      the fields of the mode parameters that are non-changeable (i.e. defined
      by the target) shall be set to all zero bits."
      
      In newer versions of the SCSI-2 spec the following clause was added.
      "If the logical unit does not implement changeable parameters mode pages
      and the device server receives a MODE SENSE command with 01b in the PC
      field, then the command shall be terminated with CHECK CONDITION status,
      with the sense key set to ILLEGAL REQUEST, and the additional sense code
      set to INVALID FIELD IN CDB."
      
      This was not yet included in the SCSI-2 Working Drafts from 1986-1993.
      I assume that the variant to return CHECK CONDITION for PC=1 is not
      widely implemented by real devices. I have a legacy OS which fails,
      if MODE_SENSE returns non GOOD for PC=1. So for highest compatibility I
      implemented the former variant with this patch.
      
      The last Working Draft X3T9.2 Rev. 10L 7-SEP-93 can be found here:
      http://ldkelley.com/SCSI2/SCSI2/SCSI2-08.html#8.2.10
      
      In mode_sense_page() this patch also avoids multiple hard coded
      definitions of the same mode page length. Instead I use the varable
      p[1]. In fact the returned length of the mode pages 4 and 5 were wrong
      (2 bytes less).
      Signed-off-by: NBernhard Kohl <bernhard.kohl@nsn.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      282ab04e
    • B
      scsi-disk: fix the mode data header returned by the MODE SENSE(10) command · ce512ee1
      Bernhard Kohl 提交于
      The header for the  MODE SENSE(10) command is 8 bytes long.
      Signed-off-by: NBernhard Kohl <bernhard.kohl@nsn.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      ce512ee1
    • B
      scsi-disk: fix the mode data length field returned by the MODE SENSE command · 78e70c30
      Bernhard Kohl 提交于
      The MODE DATA LENGTH field indicates the length in bytes of the following
      data that is available to be transferred. The mode data length does not include
      the number of bytes in the MODE DATA LENGTH field.
      Signed-off-by: NBernhard Kohl <bernhard.kohl@nsn.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      78e70c30
  2. 24 8月, 2010 1 次提交
    • B
      Rearrange block headers · 2446333c
      Blue Swirl 提交于
      Changing block.h or blockdev.h resulted in recompiling most objects.
      
      Move DriveInfo typedef and BlockInterfaceType enum definitions
      to qemu-common.h and rearrange blockdev.h use to decrease churn.
      Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
      2446333c
  3. 13 7月, 2010 1 次提交
  4. 06 7月, 2010 1 次提交
    • M
      scsi: Reject unimplemented error actions · 620f862e
      Markus Armbruster 提交于
      drive_init() doesn't permit rerror for if=scsi, but that's worthless:
      we get it via if=none and -device.
      
      Moreover, scsi-generic doesn't support werror.  Since drive_init()
      doesn't catch that, option werror was silently ignored even with
      if=scsi.
      
      Wart: unlike drive_init(), we don't reject the default action when
      it's explicitly specified.  That's because we can't distinguish "no
      rerror option" from "rerror=report", or "no werror" from
      "rerror=enospc".  Left for another day.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      620f862e
  5. 02 7月, 2010 3 次提交
    • M
      block: Fix virtual media change for if=none · 7d0d6950
      Markus Armbruster 提交于
      BlockDriverState member removable controls whether virtual media
      change (monitor commands change, eject) is allowed.  It is set when
      the "type hint" is BDRV_TYPE_CDROM or BDRV_TYPE_FLOPPY.
      
      The type hint is only set by drive_init().  It sets BDRV_TYPE_FLOPPY
      for if=floppy.  It sets BDRV_TYPE_CDROM for media=cdrom and if=ide,
      scsi, xen, or none.
      
      if=ide and if=scsi work, because the type hint makes it a CD-ROM.
      if=xen likewise, I think.
      
      For the same reason, if=none works when it's used by ide-drive or
      scsi-disk.  For other guest devices, there are problems:
      
      * fdc: you can't change virtual media
      
          $ qemu [...] -drive if=none,id=foo,... -global isa-fdc.driveA=foo
          QEMU 0.12.50 monitor - type 'help' for more information
          (qemu) eject foo
          Device 'foo' is not removable
      
        unless you add media=cdrom, but that makes it readonly.
      
      * virtio: if you add media=cdrom, you can change virtual media.  If
        you eject, the guest gets I/O errors.  If you change, the guest sees
        the drive's contents suddenly change.
      
      * scsi-generic: if you add media=cdrom, you can change virtual media.
        I didn't test what that does to the guest or the physical device,
        but it can't be pretty.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      7d0d6950
    • M
      qdev: Decouple qdev_prop_drive from DriveInfo · f8b6cc00
      Markus Armbruster 提交于
      Make the property point to BlockDriverState, cutting out the DriveInfo
      middleman.  This prepares the ground for block devices that don't have
      a DriveInfo.
      
      Currently all user-defined ones have a DriveInfo, because the only way
      to define one is -drive & friends (they go through drive_init()).
      DriveInfo is closely tied to -drive, and like -drive, it mixes
      information about host and guest part of the block device.  I'm
      working towards a new way to define block devices, with clean
      host/guest separation, and I need to get DriveInfo out of the way for
      that.
      
      Fortunately, the device models are perfectly happy with
      BlockDriverState, except for two places: ide_drive_initfn() and
      scsi_disk_initfn() need to check the DriveInfo for a serial number set
      with legacy -drive serial=...  Use drive_get_by_blockdev() there.
      
      Device model code should now use DriveInfo only when explicitly
      dealing with drives defined the old way, i.e. without -device.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f8b6cc00
    • M
      blockdev: Clean up automatic drive deletion · 14bafc54
      Markus Armbruster 提交于
      We automatically delete blockdev host parts on unplug of the guest
      device.  Too much magic, but we can't change that now.
      
      The delete happens early in the guest device teardown, before the
      connection to the host part is severed.  Thus, the guest part's
      pointer to the host part dangles for a brief time.  No actual harm
      comes from this, but we'll catch such dangling pointers a few commits
      down the road.  Clean up the dangling pointers by delaying the
      automatic deletion until the guest part's pointer is gone.
      
      Device usb-storage deliberately makes two qdev properties refer to the
      same drive, because it automatically creates a second device.  Again,
      too much magic we can't change now.  Multiple references worked okay
      before, but now free_drive() dies for the second one.  Zap the extra
      reference.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      14bafc54
  6. 15 6月, 2010 1 次提交
  7. 04 6月, 2010 3 次提交
  8. 11 5月, 2010 2 次提交
  9. 18 3月, 2010 2 次提交
  10. 17 3月, 2010 1 次提交
    • C
      block: add logical_block_size property · 8cfacf07
      Christoph Hellwig 提交于
      Add a logical block size attribute as various guest side tools only
      increase the filesystem sector size based on it, not the advisory
      physical block size.
      
      For scsi we already have support for a different logical block size
      in place for CDROMs that we can built upon.  Only my recent block
      device characteristics VPD page needs some fixups.  Note that we
      leave the logial block size for CDROMs hardcoded as the 2k value
      is expected for it in general.
      
      For virtio-blk we already have a feature flag claiming to support
      a variable logical block size that was added for the s390 kuli
      hypervisor.  Interestingly it does not actually change the units
      in which the protocol works, which is still fixed at 512 bytes,
      but only communicates a different minimum I/O granularity.  So
      all we need to do in virtio is to add a trap for unaligned I/O
      and round down the device size to the next multiple of the logical
      block size.
      
      IDE does not support any other logical block size than 512 bytes.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      8cfacf07
  11. 16 3月, 2010 2 次提交
  12. 09 3月, 2010 2 次提交
  13. 07 3月, 2010 1 次提交
  14. 11 2月, 2010 3 次提交
    • C
      scsi: add topology support · ee3659e3
      Christoph Hellwig 提交于
      Export the physical block size in the READ CAPACITY (16) command,
      and add the new block limits VPD page to export the minimum and
      optiomal I/O sizes.
      
      Note that we also need to bump the scsi revision level to SPC-2
      as that is the minimum requirement by at least the Linux kernel
      to try READ CAPACITY (16) first and look at the block limits VPD
      page.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      ee3659e3
    • C
      block: add topology qdev properties · 428c149b
      Christoph Hellwig 提交于
      Add three new qdev properties to export block topology information to
      the guest.  This is needed to get optimal I/O alignment for RAID arrays
      or SSDs.
      
      The options are:
      
       - physical_block_size to specify the physical block size of the device,
         this is going to increase from 512 bytes to 4096 kilobytes for many
         modern storage devices
       - min_io_size to specify the minimal I/O size without performance impact,
         this is typically set to the RAID chunk size for arrays.
       - opt_io_size to specify the optimal sustained I/O size, this is
         typically the RAID stripe width for arrays.
      
      I decided to not auto-probe these values from blkid which might easily
      be possible as I don't know how to deal with these issues on migration.
      
      Note that we specificly only set the physical_block_size, and not the
      logial one which is the unit all I/O is described in.  The reason for
      that is that IDE does not support increasing the logical block size and
      at last for now I want to stick to one meachnisms in queue and allow
      for easy switching of transports for a given backing image which would
      not be possible if scsi and virtio use real 4k sectors, while ide only
      uses the physical block exponent.
      
      To make this more common for the different block drivers introduce a
      new BlockConf structure holding all common block properties and a
      DEFINE_BLOCK_PROPERTIES macro to add them all together, mirroring
      what is done for network drivers.  Also switch over all block drivers
      to use it, except for the floppy driver which has weird driveA/driveB
      properties and probably won't require any advanced block options ever.
      
      Example usage for a virtio device with 4k physical block size and
      8k optimal I/O size:
      
        -drive file=scratch.img,media=disk,cache=none,id=scratch \
        -device virtio-blk-pci,drive=scratch,physical_block_size=4096,opt_io_size=8192
      
      aliguori: updated patch to take into account BLOCK events
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      428c149b
    • L
      scsi: Generate BLOCK_IO_ERROR QMP event · 380f640f
      Luiz Capitulino 提交于
      Just call bdrv_mon_event() in the right place.
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      380f640f
  15. 27 1月, 2010 1 次提交
  16. 20 1月, 2010 1 次提交
    • G
      scsi: device version property · 383b4d9b
      Gerd Hoffmann 提交于
      This patch adds a new property named 'ver' to scsi-disk which allows to
      specify the version which the virtual disk/cdrom should report to the
      guest.  By default this is the qemu version (i.e. 0.12).  usage:
      
        -drive if=none,id=disk,file=...
        -device lsi
        -device scsi-disk,drive=disk,bus=scsi.0,unit=0,ver=42
      
      You can also switch the version for all scsi drives using:
      
        -global scsi-disk.ver=42
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      383b4d9b
  17. 13 12月, 2009 1 次提交
  18. 05 12月, 2009 1 次提交
  19. 04 12月, 2009 2 次提交
  20. 03 12月, 2009 8 次提交