History | View | Annotate | Download (37.2 kB)
scsi-disk: Remove duplicate cdb parsing
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 driver
The current sense handling in scsi-bus is only used by thescsi-disk driver; the scsi-generic driver is using its own.So we should move the current sense handling into thescsi-disk driver.
Signed-off-by: Hannes Reinecke <hare@suse.de>...
scsi: INQUIRY VPD fixes
We should announce and support the block device characterics pageonly on block devices, not on CDROMs. And the VPD page 0x83 hasan off-by-one error.
Signed-off-by: Hannes Reinecke <hare@suse.de>Acked-by: Christoph Hellwig <hch@lst.de>...
scsi-disk: Move active request asserts
SCSI read/write requests should not be re-issued before the currentfragment of I/O completes. There are asserts in scsi-disk.c that guardthis constraint but they trigger on SPARC Linux 2.4. It turns out thatthe asserts are too early in the code path and don't allow for read...
scsi-disk: Fix immediate failure of bdrv_aio_*
Fix scsi-disk to use the usual completion paths that involve rerror/werrorhandling instead of directly completing the requests in cases wherebdrv_aio_readv/writev returns NULL.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
scsi-disk: Implement rerror option
This implements the rerror option for SCSI disks.
It also includes minor changes to the write path where the same code is usedthat was criticized in the review for the changes to the read path required forrerror support....
scsi-disk: Complete failed requests in scsi_disk_emulate_command
This pulls the request completion for error cases from the caller toscsi_disk_emulate_command. This should not change semantics, but allows toreuse scsi_handle_write_error() for flushes in the next patch....
scsi-disk: Implement werror for flushes
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
use qemu_blockalign consistently
Use qemu_blockalign for all allocations in the block layer. This allowsincreasing the required alignment, which is need to support O_DIRECT ondevices with large block sizes.
Signed-off-by: Christoph Hellwig <hch@lst.de>...
scsi-disk: propagate the required alignment
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
scsi-disk: add some optional scsi commands
I use a legacy OS which depends on some optional SCSI commands.In fact this implementation does nothing special, but provides minimumsupport for the following commands:
REZERO UNITWRITE AND VERIFYWRITE AND VERIFY...
scsi: fix and improve debug prints
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 command
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 targetmay return zero or more block descriptors in the returned MODE SENSE...
scsi-disk: return CHECK CONDITION for unknown page codes in the MODE SENSE 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 pagesfrom a target. If an initiator issues a MODE SENSE command with a...
scsi-disk: fix the block descriptor returned by the MODE SENSE command
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...
scsi-disk: respect the page control (PC) field in the MODE SENSE command
The page control (PC) field defines the type of mode parameter valuesto be returned in the mode pages:
PC=0 : Current valuesPC=1 : Changeable valuesPC=2 : Default valuesPC=3 : Saved values...
scsi-disk: fix the mode data header returned by the MODE SENSE command
The header for the MODE SENSE command is 8 bytes long.
scsi-disk: fix the mode data length field returned by the MODE SENSE command
The MODE DATA LENGTH field indicates the length in bytes of the followingdata that is available to be transferred. The mode data length does not includethe number of bytes in the MODE DATA LENGTH field....
Rearrange block headers
Changing block.h or blockdev.h resulted in recompiling most objects.
Move DriveInfo typedef and BlockInterfaceType enum definitionsto 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 removable
Disks without media make no sense. For SCSI, a Linux guest kernelcomplains during boot. I didn't try other combinations.
scsi-generic doesn't need the additional check, because it already...
scsi: Reject unimplemented error actions
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...
qdev: Decouple qdev_prop_drive from DriveInfo
Make the property point to BlockDriverState, cutting out the DriveInfomiddleman. This prepares the ground for block devices that don't havea DriveInfo.
Currently all user-defined ones have a DriveInfo, because the only way...
block: Fix virtual media change for if=none
BlockDriverState member removable controls whether virtual mediachange (monitor commands change, eject) is allowed. It is set whenthe "type hint" is BDRV_TYPE_CDROM or BDRV_TYPE_FLOPPY.
The type hint is only set by drive_init(). It sets BDRV_TYPE_FLOPPY...
blockdev: Clean up automatic drive deletion
We automatically delete blockdev host parts on unplug of the guestdevice. Too much magic, but we can't change that now.
The delete happens early in the guest device teardown, before theconnection to the host part is severed. Thus, the guest part's...
block: Move error actions from DriveInfo to BlockDriverState
That's where they belong semantically (block device host part), eventhough 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.c
Anything that moves hundreds of lines out of vl.c can't be all bad.
scsi: Fix info qtree for scsi-disk.ver
Show the actual default value instead of <null> when the property hasnot been set.
scsi: Turn drive serial into a qdev property scsi-disk.serial
It needs to be a qdev property, because it belongs to the drive'sguest part.
Bonus: info qtree now shows the serial number.
SCSI: Add disk reset handler
Ensure that pending requests of an SCSI disk are purged on system resetand also restore max_lba. The latter is no only present in the resethandler as that one is called after init as well.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
scsi-disk: Clear aiocb on read completion
Once the I/O completion callback returned, aiocb will be released by thecontroller. So we have to clear the reference not only inscsi_write_complete, but also in scsi_read_complete. Otherwise we riskinconsistencies when a reset hits us before the related request is...
scsi-disk: fix buffer overflow
In case s->version is shorter than 4 bytes we overflow the memcpy srcbuffer. Fix it by clearing the target buffer, then copy only theamount 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 cleanup
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 property
Add a logical block size attribute as various guest side tools onlyincrease the filesystem sector size based on it, not the advisoryphysical block size.
For scsi we already have support for a different logical block size...
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it itfrom its arguments.
This fixes a few error messages lacking a newline:net_handle_fd_param()'s "No file descriptor named %s found", andtap_open()'s "vnet_hdr=1 requested, but no kernel support for...
error: Move qemu_error & friends into their own header
scsi: Make device scsi-disk reject /dev/sg*
You're supposed to use scsi-generic for that. Which rejects anythingbut /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() call
The next commit will move the STOP event into do_vm_stop(), tohave the expected event sequence we need to emit the I/O errorevent before calling vm_stop().
The expected sequence is:
{ "event": "BLOCK_IO_ERROR" [...] }...
scsi: update comment on the standards revision
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
scsi: add topology support
Export the physical block size in the READ CAPACITY (16) command,and add the new block limits VPD page to export the minimum andoptiomal I/O sizes.
Note that we also need to bump the scsi revision level to SPC-2as that is the minimum requirement by at least the Linux kernel...
block: add topology qdev properties
Add three new qdev properties to export block topology information tothe guest. This is needed to get optimal I/O alignment for RAID arraysor SSDs.
The options are:
- physical_block_size to specify the physical block size of the device,...
scsi: Generate BLOCK_IO_ERROR QMP event
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()
Win32 suffers from a very big memory leak when dealing with SCSI devices.Each read/write request allocates memory with qemu_memalign (ieVirtualAlloc) but frees it with qemu_free (ie free).Pair all qemu_memalign() calls with qemu_vfree() to prevent such leaks....
scsi: device version property
This patch adds a new property named 'ver' to scsi-disk which allows tospecify the version which the virtual disk/cdrom should report to theguest. By default this is the qemu version (i.e. 0.12). usage:
-drive if=none,id=disk,file=......
scsi-disk: Inquiry with allocation length of CDB < 36 (v4)
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 toosmall to transfer all of the parameters, the additional length shall...
scsi: fix incorrect ?: use
Fixes OpenBSD build.
SCSI: Fix Standard INQUIRY data
Vendor identification, product identification and product revision levelshould be padded with spaces without a terminating NULL character, seeSCSI-2 standard, 8.2.5.1 Standard INQUIRY data.
Signed-off-by: Laszlo Ast <laszlo.ast@siemens-enterprise.com>...
Rename DriveInfo.onerror to on_write_error
Either rename variables and functions to refer to write errors (which is whatthey 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>
scsi-disk: restruct emulation: GET_CONFIGURATION
Move GET_CONFIGURATION emulation from scsi_send_command() toscsi_disk_emulate_command().
Also add GET_CONFIGURATION to scsi-defs.h and scsi_command_name().
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
scsi-disk: restruct emulation: SERVICE_ACTION_IN
Move SERVICE_ACTION_IN emulation from scsi_send_command() toscsi_disk_emulate_command().
Also add SERVICE_ACTION_IN to scsi-defs.h and scsi_command_name().
scsi-disk: restruct emulation: REPORT_LUNS
Move REPORT_LUNS emulation from scsi_send_command() toscsi_disk_emulate_command().
Also add REPORT_LUNS to scsi-defs.h and scsi_command_name().
scsi-disk: restruct emulation: VERIFY
Move VERIFY emulation from scsi_send_command() toscsi_disk_emulate_command().
scsi: add read/write 16 commands.
Add READ_16 + friends to scsi-defs.h, scsi_command_name() and therequest parsing helper functions.
Use them in scsi-disk.c too.
scsi-disk: restruct emulation: INQUIRY
Move INQUIRY emulation from scsi_send_command() toscsi_disk_emulate_command(). Also split the longish INQUITY emulationcode into the new scsi_disk_emulate_inquiry() function. Serial numberhandling is slightly changed, we don't copy it any more but look it up...
scsi-disk: restruct emulation: RESERVE+RELEASE
Move RESERVE+RELEASE emulation from scsi_send_command() toscsi_disk_emulate_command().
scsi-disk: restruct emulation: MODE_SENSE
Move MODE_SENSE emulation from scsi_send_command() toscsi_disk_emulate_command(). Create two helper functions:mode_sense_page() which writes the actual mode pages andscsi_disk_emulate_mode_sense() which holds the longish MODE_SENSE...
scsi-disk: restruct emulation: START_STOP
Move START_STOP emulation from scsi_send_command() toscsi_disk_emulate_command().
scsi-disk: restruct emulation: ALLOW_MEDIUM_REMOVAL
Move ALLOW_MEDIUM_REMOVAL emulation from scsi_send_command() toscsi_disk_emulate_command().
scsi-disk: restruct emulation: READ_CAPACITY
Move READ_CAPACITY emulation from scsi_send_command() toscsi_disk_emulate_command().
scsi-disk: restruct emulation: SYNCHRONIZE_CACHE
Move SYNCHRONIZE_CACHE emulation from scsi_send_command() toscsi_disk_emulate_command().
scsi-disk: restruct emulation: READ_TOC
Move READ_TOC emulation from scsi_send_command() toscsi_disk_emulate_command(). Add scsi_disk_emulate_read_toc() functionwhich holds the longisch READ_TOC emulation code.
scsi-disk: restruct emulation: core + TEST_UNIT_READY.
Add new scsi_disk_emulate_command() function, which will -- whenfinished -- handle all scsi disk command emulation except actual I/O(READ+WRITE commands) which goes to the block layer. The function...
scsi-disk: restruct emulation: REQUEST_SENSE
Move REQUEST_SENSE emulation from scsi_send_command() toscsi_disk_emulate_command().
scsi: move sense to SCSIDevice, create SCSISense struct.
scsi: move dinfo to SCSIDevice
scsi: move status to SCSIRequest.
Also add and use the scsi_req_complete() helper function for calling thecompletion callback.
scsi: create common SCSIRequest structure.
Rename the SCSIRequest structs in scsi-disk.c and scsi-generic.c toSCSIDiskReq and SCSIGenericReq. Create a SCSIRequest struct and movethe common elements over.
scsi: move request lists to QTAILQ.
Changes: * Move from open-coded lists to QTAILQ macros. * Move the struct elements to the common data structures (SCSIDevice + SCSIRequest). * Drop free request pools. * Fix request cleanup in the destroy callback....
scsi: move SCSIRequest management to common code.
Create generic functions to allocate, find and release SCSIRequeststructs. Make scsi-disk and scsi-generic use them.
scsi: move blocksize from SCSIGenericState to SCSIDevice
scsi: add scsi-defs.h
Largely based on <scsi/scsi.h> from linux. Added into the tree so wecan use the defines everywhere, not just in scsi-generic.c (which islinux-specific).
scsi: move type from SCSIGenericState to SCSIDevice
scsi: use command defines in scsi-disk.c
scsi: move scsi-disk.h -> scsi.h
Pass the drive's readonly attribute to the guest OS
Implemented for virtio-blk and for scsi
scsi disk block descriptor v2
The SCSI-2 documentation suggests, that although the blockdescriptor is optional for an arbitrary SCSI-2 device (chapter 8.2.10,http://ldkelley.com/SCSI2/SCSI2/SCSI2/SCSI2/SCSI2-08.html )it is mandatory for a disk: chapters 9.1.2, 9.3.3...
drive cleanup fixes.
Changes: * drive_uninit() wants a DriveInfo now. * drive_uninit() also calls bdrv_delete(), so callers don't need to do that. * drive_uninit() calls are moved over to the ->exit() callbacks, destroy_bdrvs() is zapped. * setting bdrv->private is not needed any more as the...
Implement scsi device destruction
block: add enable_write_cache flag
Add a enable_write_cache flag in the block driver state, and use it todecide if we claim to have a volatile write cache that needs controlledflushing from the guest. The flag is off if cache=writethrough isdefined because O_DSYNC guarantees that every write goes to stable...
qdev/scsi: add scsi bus support to qdev, convert drivers.
Adding scsi disks via -device works now, i.e. you can do:
-drive id=sda,if=none,......
Fix VM state change handlers running out of order
When a VM state change handler changes VM state, other VM state changehandlers can see the state transitions out of order.
bmdma_map(), scsi_disk_init() and virtio_blk_init() install VM statechange handlers to restart DMA. These handlers can vm_stop() by...
Fix most warnings (errors with -Werror) when debugging is enabled
I used the following command to enable debugging:perl -p -i -e 's/^\/\/#define DEBUG/#define DEBUG/g' * /* *//*
Replace gcc variadic macro extension with C99 version
Fix OpenSolaris gcc4 warnings: iovec type mismatches, missing 'static'
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7103 c046a42c-6fe2-441c-8c8c-71466251a162
remove bdrv_aio_read/bdrv_aio_write (Christoph Hellwig)
Always use the vectored APIs to reduce code churn once we switch the BlockDriverAPI to be vectored.
Signed-off-by: Christoph Hellwig <hch@lst.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
Misc scsi disk/cdrom fixes/improvements 4/4
Implement Test Unit Ready command (return NOT READY as aboveif !bdrv_is_inserted(...))
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6954 c046a42c-6fe2-441c-8c8c-71466251a162
misc scsi disk/cdrom fixes/improvements 3/4
Add asc 0x3a, ascq 0: Medium not present to NOT READY sense(needed to keep some guests from retrying causing long sleeps in thekernel)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6953 c046a42c-6fe2-441c-8c8c-71466251a162
misc scsi disk/cdrom fixes/improvements 2/4
Implement cdrom load/eject functionality (Start Stop Unit command)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6952 c046a42c-6fe2-441c-8c8c-71466251a162
misc scsi disk/cdrom fixes/improvements 1/4
Use correct sector size for cdrom Read TOC command
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6951 c046a42c-6fe2-441c-8c8c-71466251a162
check SCSI read/write requests against max LBA (Rik van Riel)
The bdrv layer uses a signed offset. Furthermore, block-raw-posixonly seeks when that offset is positive. Passing a negative offsetto block-raw-posix can result in data being written at the current...
SCSI divide capacity by s->cluster_size (Rik van Riel)
Paul Brook pointed out that the number of sectors reportedby the SCSI read capacity commands needs to be divided bys->cluster_size, because bdrv_get_geometry reports the numberof 512 byte sectors, while emulated CDROMs report 2048 byte...
support >2TB SCSI disks (Rik van Riel)
Implement SCSI READ, WRITE and SAI READ CAPACITY commands,so SCSI disks larger than 2TB can work with guests that support thesenewer SCSI commands.
The cast to (uint64_t) is needed because otherwise gcc will use a...
fix signed/unsigned overflows in SCSI disk (Rik van Riel)
Sector numbers can overflow on a virtual scsi disk of over 1TBin size. Qemu's bdrv_read expects an int64_t, so fix the overflowby going to that data type.
On large disks, we clip the capacity to 2TB instead of returning...
Stop VM on error in scsi-disk (Gleb Natapov)
Signed-off-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6409 c046a42c-6fe2-441c-8c8c-71466251a162
Make OpenBSD sparc-softmmu compile warning free
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6299 c046a42c-6fe2-441c-8c8c-71466251a162
add "serial" parameter to -drive flag (Gleb Natapov)
Windows calculates HW "uniqueness" based on a hard drive serial numberamong other things. The patch allows to specify drive serial numberfrom a command line.
Signed-off-by: Gleb Natapov <gleb@redhat.com>...
SCSI: Handle inquiry commands of varying length (Justin Chevrier).
Openserver 5.0.5 sends an Inquiry command to the emulated SCSI diskexpecting a response length of 40 bytes. Currently the response to anInquiry command is hardcoded to 36 bytes. When receiving a response of...
Correct SCSI error reporting (Laurent Vivier)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5455 c046a42c-6fe2-441c-8c8c-71466251a162
qemu: improve scsi dma speed by increasing the dma buffer size
taken from Xen 17267:f4a92f0db20f, original patch by Samuel Thibault.
Signed-off-by: Avi Kivity <avi@qumranet.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>...
Add rigid and flexible disk geometry page support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4821 c046a42c-6fe2-441c-8c8c-71466251a162
Spelling fixes, by Stefan Weil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4655 c046a42c-6fe2-441c-8c8c-71466251a162