1. 02 7月, 2010 6 次提交
    • M
      pc: Fix CMOS info for drives defined with -device · c0897e0c
      Markus Armbruster 提交于
      Drives defined with -drive if=ide get get created along with the IDE
      controller, inside machine->init().  That's before cmos_init().
      Drives defined with -device get created during generic device init.
      That's after cmos_init().  Because of that, CMOS has no information on
      them (type, geometry, translation).  Older versions of Windows such as
      XP reportedly choke on that.
      
      Split off the part of CMOS initialization that needs to know about
      -device devices, and turn it into a reset handler, so it runs after
      device creation.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c0897e0c
    • M
    • 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
      block: Catch attempt to attach multiple devices to a blockdev · 18846dee
      Markus Armbruster 提交于
      For instance, -device scsi-disk,drive=foo -device scsi-disk,drive=foo
      happily creates two SCSI disks connected to the same block device.
      It's all downhill from there.
      
      Device usb-storage deliberately attaches twice to the same blockdev,
      which fails with the fix in place.  Detach before the second attach
      there.
      
      Also catch attempt to delete while a guest device model is attached.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      18846dee
    • 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
      ide: Make it explicit that ide_create_drive() can't fail · fa12fbbe
      Markus Armbruster 提交于
      All callers of ide_create_drive() ignore its value.  Currently
      harmless, because it fails only when qdev_init() fails, which fails
      only when ide_drive_initfn() fails, which never fails.
      
      Brittle.  Change it to die instead of silently ignoring failure.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      fa12fbbe
  2. 30 6月, 2010 1 次提交
  3. 15 6月, 2010 1 次提交
  4. 04 6月, 2010 8 次提交
  5. 17 5月, 2010 1 次提交
    • K
      ide: Fix ide_dma_cancel · 38d8dfa1
      Kevin Wolf 提交于
      When cancelling a request, bdrv_aio_cancel may decide that it waits for
      completion of a request rather than for cancellation. IDE therefore can't
      abandon its DMA status before calling bdrv_aio_cancel; otherwise the callback
      of a completed request would use invalid data.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      38d8dfa1
  6. 15 5月, 2010 1 次提交
  7. 02 5月, 2010 2 次提交
  8. 30 3月, 2010 1 次提交
  9. 27 3月, 2010 2 次提交
  10. 09 3月, 2010 1 次提交
  11. 20 2月, 2010 2 次提交
  12. 11 2月, 2010 3 次提交
    • C
      ide: add topology support · 0009baf1
      Christoph Hellwig 提交于
      Export the physical block size in the ATA IDENTIFY command.  The
      other topology values are not supported in ATA so skip them.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      0009baf1
    • 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
      ide: Generate BLOCK_IO_ERROR QMP event · 7ad7e3c3
      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>
      7ad7e3c3
  13. 27 1月, 2010 1 次提交
    • M
      ide save/restore current transfer fields · 42ee76fe
      Marcelo Tosatti 提交于
      If migration takes place between write of the bmdma address register and
      write of the command register (to initiate DMA), the destination will
      not properly start the DMA op, hanging the guest:
      
      ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
      ata1.00: cmd c8/00:16:41:00:00/00:00:00:00:00/e0 tag 0 dma 11264 in
               res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
      ata1.00: status: { DRDY }
      
      Fix by sending current transfer information in the migration data.
      
      We need to update ide version to 4 for this to work.  As we don't
      have subsectios, we need to chain the update increase until
      vmstate_ide_pci (quintela)
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NJuan Quintela <quintela@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      42ee76fe
  14. 20 1月, 2010 1 次提交
    • G
      ide: device version property · 47c06340
      Gerd Hoffmann 提交于
      This patch adds a new property named 'ver' to ide-drive 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 ide-drive,bus=ide.0,unit=0,drive=disk,ver=42
      
      You can also switch the version for all ide drives using:
      
        -global ide-drive.ver=42
      Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      47c06340
  15. 23 12月, 2009 2 次提交
  16. 14 12月, 2009 1 次提交
    • I
      workaround for cmd646 bmdma register access while no dma is active · 90228ee3
      Igor V. Kovalenko 提交于
      This is a workaround only, and is a partial revert
      of a few changes to BMDMAState which removed pci_dev
      field on the way.
      
      - cmd646 pci_from_bm() expects bm->unit value to
      correspond with bm data being passed to callback
      as opaque pointer. This breaks when write to dma
      control register of second channel happens when no
      dma operation is in progress, so bm->unit is zero
      for second channel, and pci_from_bm() returns garbage
      pointer. Crash happens shortly after that while
      dereferencing that pointer.
      
      v0->v1: cleaned up dead code from pci_from_bm.
      Signed-off-by: NIgor V. Kovalenko <igor.v.kovalenko@gmail.com>
      Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
      90228ee3
  17. 12 12月, 2009 1 次提交
  18. 05 12月, 2009 1 次提交
  19. 04 12月, 2009 4 次提交