summaryrefslogtreecommitdiffstats
path: root/hw/scsi-disk.c
Commit message (Collapse)AuthorAgeFilesLines
* scsi-disk: support WRITE SAME (16) with unmap bitChristoph Hellwig2010-12-171-2/+51
| | | | | | | | | | Support discards via the WRITE SAME command with the unmap bit set, and tell the initiator about the support for it via the block limit and the new thin provisioning EVPD pages. Also fix the comment which incorrectly describedthe block limits EVPD page. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Add bootindex parameter to net/block/fd deviceGleb Natapov2010-12-111-0/+1
| | | | | | | | | If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Introduce fw_name field to DeviceInfo structure.Gleb Natapov2010-12-111-0/+1
| | | | | | | | | Add "fw_name" to DeviceInfo to use in device path building. In contrast to "name" "fw_name" should refer to functionality device provides instead of particular device model like "name" does. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* scsi-disk: Remove duplicate cdb parsingHannes Reinecke2010-11-251-53/+21
| | | | | | | | We parse the CDB twice, which is completely unnecessary. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: Move sense handling into the driverHannes Reinecke2010-11-251-8/+25
| | | | | | | | | | | The current sense handling in scsi-bus is only used by the scsi-disk driver; the scsi-generic driver is using its own. So we should move the current sense handling into the scsi-disk driver. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: INQUIRY VPD fixesHannes Reinecke2010-11-251-4/+14
| | | | | | | | | | We should announce and support the block device characterics page only on block devices, not on CDROMs. And the VPD page 0x83 has an off-by-one error. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: Move active request assertsStefan Hajnoczi2010-11-241-6/+6
| | | | | | | | | | | | | | | SCSI read/write requests should not be re-issued before the current fragment of I/O completes. There are asserts in scsi-disk.c that guard this constraint but they trigger on SPARC Linux 2.4. It turns out that the asserts are too early in the code path and don't allow for read requests to terminate. Only the read assert needs to be moved but move the write assert too for consistency. Reported-by: Nigel Horne <njh@bandsman.co.uk> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: Fix immediate failure of bdrv_aio_*Kevin Wolf2010-11-041-5/+6
| | | | | | | | Fix scsi-disk to use the usual completion paths that involve rerror/werror handling instead of directly completing the requests in cases where bdrv_aio_readv/writev returns NULL. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: Implement werror for flushesKevin Wolf2010-11-041-1/+16
| | | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* scsi-disk: Complete failed requests in scsi_disk_emulate_commandKevin Wolf2010-11-041-11/+10
| | | | | | | | | This pulls the request completion for error cases from the caller to scsi_disk_emulate_command. This should not change semantics, but allows to reuse scsi_handle_write_error() for flushes in the next patch. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* scsi-disk: Implement rerror optionKevin Wolf2010-11-041-34/+66
| | | | | | | | | | | This implements the rerror option for SCSI disks. It also includes minor changes to the write path where the same code is used that was criticized in the review for the changes to the read path required for rerror support. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* scsi-disk: propagate the required alignmentChristoph Hellwig2010-09-211-0/+1
| | | | | Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* use qemu_blockalign consistentlyChristoph Hellwig2010-09-211-4/+5
| | | | | | | | | Use qemu_blockalign for all allocations in the block layer. This allows increasing the required alignment, which is need to support O_DIRECT on devices with large block sizes. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: add some optional scsi commandsBernhard Kohl2010-09-081-1/+35
| | | | | | | | | | | | | | | | | | I use a legacy OS which depends on some optional SCSI commands. In fact this implementation does nothing special, but provides minimum support for the following commands: REZERO UNIT WRITE AND VERIFY(10) WRITE AND VERIFY(12) WRITE AND VERIFY(16) MODE SELECT(6) MODE SELECT(10) SEEK(6) SEEK(10) Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: fix and improve debug printsBernhard Kohl2010-09-081-4/+4
| | | | | | | Some of them are not compile clean. Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: fix the check of the DBD bit in the MODE SENSE commandBernhard Kohl2010-09-081-1/+1
| | | | | | | | | | | | | | | The DBD bit does not work as expected. SCSI-Spec: http://ldkelley.com/SCSI2/SCSI2/SCSI2-08.html#8.2.10 "A disable block descriptors (DBD) bit of zero indicates that the target may return zero or more block descriptors in the returned MODE SENSE data (see 8.3.3), at the target's discretion. A DBD bit of one specifies that the target shall not return any block descriptors in the returned MODE SENSE data." Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: return CHECK CONDITION for unknown page codes in the MODE SENSE ↵Bernhard Kohl2010-09-081-0/+2
| | | | | | | | | | | | | | | command SCSI-Spec: http://ldkelley.com/SCSI2/SCSI2/SCSI2-08.html#8.2.10 "An initiator may request any one or all of the supported mode pages from a target. If an initiator issues a MODE SENSE command with a page code value not implemented by the target, the target shall return CHECK CONDITION status and shall set the sense key to ILLEGAL REQUEST and the additional sense code to INVALID FIELD IN CDB." Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: fix the block descriptor returned by the MODE SENSE commandBernhard Kohl2010-09-081-2/+1
| | | | | | | | | | | | | | | The block descriptor contains the number of blocks, not the highest LBA. Real hard disks return 0 if the number of blocks exceed the maximum 0xFFFFFF. SCSI-Spec: http://ldkelley.com/SCSI2/SCSI2/SCSI2-08.html#8.3.3 "The number of blocks field specifies the number of logical blocks on the medium to which the density code and block length fields apply. A value of zero indicates that all of the remaining logical blocks of the logical unit shall have the medium characteristics specified." Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: respect the page control (PC) field in the MODE SENSE commandBernhard Kohl2010-09-081-10/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: fix the mode data header returned by the MODE SENSE(10) commandBernhard Kohl2010-09-081-6/+32
| | | | | | | The header for the MODE SENSE(10) command is 8 bytes long. Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: fix the mode data length field returned by the MODE SENSE commandBernhard Kohl2010-09-081-1/+1
| | | | | | | | | 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: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Rearrange block headersBlue Swirl2010-08-241-0/+1
| | | | | | | | | 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: Blue Swirl <blauwirbel@gmail.com>
* ide scsi virtio-blk: Reject empty drives unless media is removableMarkus Armbruster2010-07-131-0/+5
| | | | | | | | | | | Disks without media make no sense. For SCSI, a Linux guest kernel complains during boot. I didn't try other combinations. scsi-generic doesn't need the additional check, because it already requires bdrv_is_sg(), which fails without media. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: Reject unimplemented error actionsMarkus Armbruster2010-07-061-0/+5
| | | | | | | | | | | | | | | | | 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: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Fix virtual media change for if=noneMarkus Armbruster2010-07-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qdev: Decouple qdev_prop_drive from DriveInfoMarkus Armbruster2010-07-021-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: Markus Armbruster <armbru@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* blockdev: Clean up automatic drive deletionMarkus Armbruster2010-07-021-1/+1
| | | | | | | | | | | | | | | | | | | | | 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: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Move error actions from DriveInfo to BlockDriverStateMarkus Armbruster2010-06-151-1/+1
| | | | | | | | That's where they belong semantically (block device host part), even though the actions are actually executed by guest device code. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* blockdev: Collect block device code in new blockdev.cMarkus Armbruster2010-06-041-1/+1
| | | | | | | Anything that moves hundreds of lines out of vl.c can't be all bad. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: Fix info qtree for scsi-disk.verMarkus Armbruster2010-06-041-2/+5
| | | | | | | | Show the actual default value instead of <null> when the property has not been set. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi: Turn drive serial into a qdev property scsi-disk.serialMarkus Armbruster2010-06-041-4/+13
| | | | | | | | | | It needs to be a qdev property, because it belongs to the drive's guest part. Bonus: info qtree now shows the serial number. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* scsi-disk: Clear aiocb on read completionJan Kiszka2010-05-101-0/+2
| | | | | | | | | | | Once the I/O completion callback returned, aiocb will be released by the controller. So we have to clear the reference not only in scsi_write_complete, but also in scsi_read_complete. Otherwise we risk inconsistencies when a reset hits us before the related request is released. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* SCSI: Add disk reset handlerJan Kiszka2010-05-101-8/+27
| | | | | | | | | Ensure that pending requests of an SCSI disk are purged on system reset and also restore max_lba. The latter is no only present in the reset handler as that one is called after init as well. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi-disk: fix buffer overflowGerd Hoffmann2010-03-171-1/+3
| | | | | | | | | In case s->version is shorter than 4 bytes we overflow the memcpy src buffer. Fix it by clearing the target buffer, then copy only the amount of bytes we actually have. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* read-only: Another minor cleanupNaphtali Sprei2010-03-171-2/+1
| | | | | | | Don't rely on CDROM hint for read_only attribute Signed-off-by: Naphtali Sprei <nsprei@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* block: add logical_block_size propertyChristoph Hellwig2010-03-171-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* error: Replace qemu_error() by error_report()Markus Armbruster2010-03-161-2/+2
| | | | | | | | | | | | | error_report() terminates the message with a newline. Strip it it from its arguments. This fixes a few error messages lacking a newline: net_handle_fd_param()'s "No file descriptor named %s found", and tap_open()'s "vnet_hdr=1 requested, but no kernel support for IFF_VNET_HDR available" (all three versions). There's one place that passes arguments without newlines intentionally: load_vmstate(). Fix it up.
* error: Move qemu_error & friends into their own headerMarkus Armbruster2010-03-161-2/+1
|
* scsi: Make device scsi-disk reject /dev/sg*Markus Armbruster2010-03-091-0/+5
| | | | | | | | You're supposed to use scsi-generic for that. Which rejects anything but /dev/sg*. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* block: Emit BLOCK_IO_ERROR before vm_stop() callLuiz Capitulino2010-03-081-1/+1
| | | | | | | | | | | | | | The next commit will move the STOP event into do_vm_stop(), to have the expected event sequence we need to emit the I/O error event before calling vm_stop(). The expected sequence is: { "event": "BLOCK_IO_ERROR" [...] } { "event": "STOP" } Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: update comment on the standards revisionChristoph Hellwig2010-03-061-2/+6
| | | | | Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* scsi: add topology supportChristoph Hellwig2010-02-101-2/+26
| | | | | | | | | | | | | | 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: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* block: add topology qdev propertiesChristoph Hellwig2010-02-101-36/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: Generate BLOCK_IO_ERROR QMP eventLuiz Capitulino2010-02-101-1/+5
| | | | | | | Just call bdrv_mon_event() in the right place. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* win32: pair qemu_memalign() with qemu_vfree()Herve Poussineau2010-01-261-1/+1
| | | | | | | | | | Win32 suffers from a very big memory leak when dealing with SCSI devices. Each read/write request allocates memory with qemu_memalign (ie VirtualAlloc) but frees it with qemu_free (ie free). Pair all qemu_memalign() calls with qemu_vfree() to prevent such leaks. Signed-off-by: Herve Poussineau <hpoussin@reactos.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi: device version propertyGerd Hoffmann2010-01-191-1/+4
| | | | | | | | | | | | | | | | | 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: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* scsi-disk: Inquiry with allocation length of CDB < 36 (v4)Artyom Tarasenko2009-12-131-6/+15
| | | | | | | | | | | | | According to the SCSI-2 specification, http://ldkelley.com/SCSI2/SCSI2/SCSI2/SCSI2-08.html#8.2.5 , "if the allocation length of the command descriptor block (CDB) is too small to transfer all of the parameters, the additional length shall not be adjusted to reflect the truncation." The 36 mandatory bytes of response are written to outbuf, and then only the length requested in CDB is transferred. Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* scsi: fix incorrect ?: useBlue Swirl2009-12-041-1/+2
| | | | | | Fixes OpenBSD build. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* SCSI: Fix Standard INQUIRY dataLaszlo Ast2009-12-031-3/+3
| | | | | | | | | | Vendor identification, product identification and product revision level should be padded with spaces without a terminating NULL character, see SCSI-2 standard, 8.2.5.1 Standard INQUIRY data. Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Rename DriveInfo.onerror to on_write_errorKevin Wolf2009-12-031-1/+2
| | | | | | | | Either rename variables and functions to refer to write errors (which is what they actually do) or introduce a parameter to distinguish reads and writes. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud