Statistics
| Branch: | Revision:

root / hw / scsi-disk.c @ 74382217

History | View | Annotate | Download (40.1 kB)

# Date Author Comment
a1f0cce2 05/26/2011 01:14 pm Hannes Reinecke

scsi: Update sense code handling

The SCSI spec has a quite detailed list of sense codes available.
It even mandates the use of specific ones for some failure cases.
The current implementation just has one type of generic error
which is actually a violation of the spec in certain cases....

fc4f0754 05/26/2011 01:14 pm Paolo Bonzini

scsi: do not call send_command directly

Move the common part of scsi-disk.c and scsi-generic.c to the SCSI layer.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Christoph Hellwig <>

74382217 05/26/2011 01:14 pm Hannes Reinecke

scsi: Implement 'get_sense' callback

The get_sense callback copies existing sense information into
the provided buffer. This is required if sense information
should be transferred together with the command response.

Signed-off-by: Hannes Reinecke <>...

ad2d30f7 05/26/2011 01:14 pm Paolo Bonzini

scsi: reference-count requests

With the next patch, a device may hold SCSIRequest for an indefinite
time. Split a rather big patch, and protect against access errors,
by reference counting them.

There is some ugliness in scsi_send_command implementation due to...

5c6c0e51 05/26/2011 01:14 pm Hannes Reinecke

scsi: Use 'SCSIRequest' directly

Currently the SCSIRequest structure is abstracted away and cannot accessed
directly from the driver. This requires the handler to do a lookup on
an abstract 'tag' which identifies the SCSIRequest structure.

With this patch the SCSIRequest structure is exposed to the driver. This...

c557e889 05/26/2011 01:14 pm Paolo Bonzini

scsi: commonize purging requests

The code for canceling requests upon reset is already the same. Clean
it up and move it to scsi-bus.c.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Christoph Hellwig <>

94d3f98a 05/26/2011 01:14 pm Paolo Bonzini

scsi: introduce scsi_req_cancel

This is for when the request must be dropped in the void,
but still memory should be freed. To this end, the devices
register a second callback in SCSIBusOps.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Christoph Hellwig <>

ab9adc88 05/26/2011 01:14 pm Paolo Bonzini

scsi: introduce scsi_req_data

This abstracts calling the command_complete callback, reducing churn
in the following patches.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Christoph Hellwig <>

95b5edcd 05/19/2011 11:26 am Markus Armbruster

blockdev: Store -drive option media in DriveInfo

DriveInfo is closely tied to -drive, and like -drive, it mixes
information about host and guest part of the block device. Unlike
DriveInfo, BlockDriverState should be about the host part only.

One of the remaining guest bits there is the "type hint". -drive...

b443ae67 05/19/2011 11:26 am Markus Armbruster

scsi: Split qdev "scsi-disk" into "scsi-hd" and "scsi-cd"

A "scsi-disk" is either a hard disk or a CD-ROM, depending on the
associated BlockDriverState's type hint. Unclean; disk vs. CD belongs
to the guest part, not the host part.

Have separate qdevs "scsi-hd" and "scsi-cd" to model disk vs. CD in...

e07bbac5 02/14/2011 04:39 pm Jan Kiszka

Improve vm_stop reason declarations

Define and use dedicated constants for vm_stop reasons, they actually
have nothing to do with the EXCP_* defines used so far. At this chance,
specify more detailed reasons so that VM state change handlers can
evaluate them....

419e691f 01/24/2011 10:39 pm Stefan Hajnoczi

scsi-disk: Allow overriding SCSI INQUIRY removable bit

Provide the "removable" qdev property bit to override the SCSI INQUIRY
removable (RMB) bit for non-CDROM devices. This will be used by USB
Mass Storage Devices, which sometimes have this guest-visible bit set...

ea3bd56f 12/17/2010 05:11 pm Christoph Hellwig

scsi-disk: support WRITE SAME (16) with unmap bit

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...

1ca4d09a 12/11/2010 11:32 pm Gleb Natapov

Add bootindex parameter to net/block/fd device

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 <>...

779206de 12/11/2010 11:27 pm Gleb Natapov

Introduce fw_name field to DeviceInfo structure.

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 <>...

2dd791b6 11/25/2010 01:51 pm Hannes Reinecke

scsi-disk: Remove duplicate cdb parsing

We parse the CDB twice, which is completely unnecessary.

Signed-off-by: Hannes Reinecke <>
Acked-by: Christoph Hellwig <>
Signed-off-by: Kevin Wolf <>

a6d96eb7 11/25/2010 01:19 pm Hannes Reinecke

scsi: Move sense handling into the driver

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 <>...

39d98982 11/25/2010 01:15 pm Hannes Reinecke

scsi: INQUIRY VPD fixes

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 <>
Acked-by: Christoph Hellwig <>...

6fa2c95f 11/24/2010 06:30 pm Stefan Hajnoczi

scsi-disk: Move active request asserts

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...

d33ea50a 11/04/2010 02:54 pm Kevin Wolf

scsi-disk: Fix immediate failure of bdrv_aio_*

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 <>

5dba48a8 11/04/2010 01:52 pm Kevin Wolf

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 used
that was criticized in the review for the changes to the read path required for
rerror support....

8af7a3ab 11/04/2010 01:52 pm Kevin Wolf

scsi-disk: Complete failed requests in scsi_disk_emulate_command

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....

78ced65e 11/04/2010 01:52 pm Kevin Wolf

scsi-disk: Implement werror for flushes

Signed-off-by: Kevin Wolf <>
Reviewed-by: Stefan Hajnoczi <>

72aef731 09/21/2010 04:39 pm Christoph Hellwig

use qemu_blockalign consistently

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 <>...

73fdb1e1 09/21/2010 04:39 pm Christoph Hellwig

scsi-disk: propagate the required alignment

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Kevin Wolf <>

ebef0bbb 09/08/2010 01:39 pm Bernhard Kohl

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 minimum
support for the following commands:

REZERO UNIT
WRITE AND VERIFY
WRITE AND VERIFY...

aa2b1e89 09/08/2010 01:39 pm Bernhard Kohl

scsi: fix and improve debug prints

Some of them are not compile clean.

Signed-off-by: Bernhard Kohl <>
Signed-off-by: Kevin Wolf <>

333d50fe 09/08/2010 01:39 pm Bernhard Kohl

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 target
may return zero or more block descriptors in the returned MODE SENSE...

a9c17b2b 09/08/2010 01:39 pm Bernhard Kohl

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 pages
from a target. If an initiator issues a MODE SENSE command with a...

2488b740 09/08/2010 01:39 pm Bernhard Kohl

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...

282ab04e 09/08/2010 01:39 pm Bernhard Kohl

scsi-disk: respect the page control (PC) field in the MODE SENSE command

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...

ce512ee1 09/08/2010 01:39 pm Bernhard Kohl

scsi-disk: fix the mode data header returned by the MODE SENSE command

The header for the MODE SENSE command is 8 bytes long.

Signed-off-by: Bernhard Kohl <>
Signed-off-by: Kevin Wolf <>

78e70c30 09/08/2010 01:39 pm Bernhard Kohl

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 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....

2446333c 08/24/2010 06:22 pm Blue Swirl

Rearrange block headers

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 <>

98f28ad7 07/13/2010 06:48 pm Markus Armbruster

ide scsi virtio-blk: Reject empty drives unless media is removable

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...

620f862e 07/06/2010 06:05 pm Markus Armbruster

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...

f8b6cc00 07/02/2010 02:18 pm Markus Armbruster

qdev: Decouple qdev_prop_drive from DriveInfo

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...

7d0d6950 07/02/2010 02:18 pm Markus Armbruster

block: Fix virtual media change for if=none

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...

14bafc54 07/02/2010 02:18 pm Markus Armbruster

blockdev: Clean up automatic drive deletion

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...

abd7f68d 06/15/2010 10:41 am Markus Armbruster

block: Move error actions from DriveInfo to BlockDriverState

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 <>
Signed-off-by: Kevin Wolf <>

666daa68 06/04/2010 04:20 pm Markus Armbruster

blockdev: Collect block device code in new blockdev.c

Anything that moves hundreds of lines out of vl.c can't be all bad.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

552fee93 06/04/2010 12:43 pm Markus Armbruster

scsi: Fix info qtree for scsi-disk.ver

Show the actual default value instead of <null> when the property has
not been set.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

a0fef654 06/04/2010 12:43 pm Markus Armbruster

scsi: Turn drive serial into a qdev property scsi-disk.serial

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 <>
Signed-off-by: Kevin Wolf <>

e9447f35 05/10/2010 07:36 pm Jan Kiszka

SCSI: Add disk reset handler

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 <>...

3e94cb02 05/10/2010 07:36 pm Jan Kiszka

scsi-disk: Clear aiocb on read completion

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...

314b1811 03/17/2010 06:17 pm Gerd Hoffmann

scsi-disk: fix buffer overflow

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 <>
Signed-off-by: Anthony Liguori <>

0056dcc1 03/17/2010 06:16 pm Naphtali Sprei

read-only: Another minor cleanup

Don't rely on CDROM hint for read_only attribute

Signed-off-by: Naphtali Sprei <>
Signed-off-by: Anthony Liguori <>

8cfacf07 03/17/2010 05:42 pm Christoph Hellwig

block: add logical_block_size property

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...

1ecda02b 03/16/2010 05:58 pm Markus Armbruster

error: Replace qemu_error() by error_report()

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...

2f792016 03/16/2010 05:55 pm Markus Armbruster

error: Move qemu_error & friends into their own header

32bb404a 03/09/2010 04:47 pm Markus Armbruster

scsi: Make device scsi-disk reject /dev/sg*

You're supposed to use scsi-generic for that. Which rejects anything
but /dev/sg*.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

554a310b 03/08/2010 07:30 pm Luiz Capitulino

block: Emit BLOCK_IO_ERROR before vm_stop() call

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" [...] }...

99aba0c4 03/07/2010 12:05 am Christoph Hellwig

scsi: update comment on the standards revision

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Aurelien Jarno <>

ee3659e3 02/11/2010 12:53 am Christoph Hellwig

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 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...

428c149b 02/11/2010 12:53 am Christoph Hellwig

block: add topology qdev properties

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,...
380f640f 02/10/2010 07:57 pm Luiz Capitulino

scsi: Generate BLOCK_IO_ERROR QMP event

Just call bdrv_mon_event() in the right place.

Signed-off-by: Luiz Capitulino <>
Signed-off-by: Anthony Liguori <>

f8a83245 01/27/2010 12:41 am Herve Poussineau

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 (ie
VirtualAlloc) but frees it with qemu_free (ie free).
Pair all qemu_memalign() calls with qemu_vfree() to prevent such leaks....

383b4d9b 01/20/2010 12:31 am Gerd Hoffmann

scsi: device version property

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=......
ad3cea42 12/13/2009 12:55 pm Artyom Tarasenko

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 too
small to transfer all of the parameters, the additional length shall...

407f879a 12/04/2009 08:08 pm Blue Swirl

scsi: fix incorrect ?: use

Fixes OpenBSD build.

Signed-off-by: Blue Swirl <>

550fe6c6 12/03/2009 11:25 pm Laszlo Ast

SCSI: Fix Standard INQUIRY data

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 <>...

f7850099 12/03/2009 07:45 pm Kevin Wolf

Rename DriveInfo.onerror to on_write_error

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 <>
Signed-off-by: Anthony Liguori <>

38215553 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: GET_CONFIGURATION

Move GET_CONFIGURATION emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add GET_CONFIGURATION to scsi-defs.h and scsi_command_name().

Signed-off-by: Gerd Hoffmann <>...

5dd90e2a 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: SERVICE_ACTION_IN

Move SERVICE_ACTION_IN emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add SERVICE_ACTION_IN to scsi-defs.h and scsi_command_name().

Signed-off-by: Gerd Hoffmann <>...

39ec9a50 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: REPORT_LUNS

Move REPORT_LUNS emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add REPORT_LUNS to scsi-defs.h and scsi_command_name().

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

88f8a5ed 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: VERIFY

Move VERIFY emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

bd536cf3 12/03/2009 05:41 pm Gerd Hoffmann

scsi: add read/write 16 commands.

Add READ_16 + friends to scsi-defs.h, scsi_command_name() and the
request parsing helper functions.

Use them in scsi-disk.c too.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

0b06c059 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: INQUIRY

Move INQUIRY emulation from scsi_send_command() to
scsi_disk_emulate_command(). Also split the longish INQUITY emulation
code into the new scsi_disk_emulate_inquiry() function. Serial number
handling is slightly changed, we don't copy it any more but look it up...

3d53ba18 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: RESERVE+RELEASE

Move RESERVE+RELEASE emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

ebddfcbe 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: MODE_SENSE

Move MODE_SENSE emulation from scsi_send_command() to
scsi_disk_emulate_command(). Create two helper functions:
mode_sense_page() which writes the actual mode pages and
scsi_disk_emulate_mode_sense() which holds the longish MODE_SENSE...

8d3628ff 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: START_STOP

Move START_STOP emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

c68b9f34 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: ALLOW_MEDIUM_REMOVAL

Move ALLOW_MEDIUM_REMOVAL emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

e7e25e32 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: READ_CAPACITY

Move READ_CAPACITY emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

fc903943 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: SYNCHRONIZE_CACHE

Move SYNCHRONIZE_CACHE emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

02880f43 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: READ_TOC

Move READ_TOC emulation from scsi_send_command() to
scsi_disk_emulate_command(). Add scsi_disk_emulate_read_toc() function
which holds the longisch READ_TOC emulation code.

Signed-off-by: Gerd Hoffmann <>...

aa5dbdc1 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: core + TEST_UNIT_READY.

Add new scsi_disk_emulate_command() function, which will -- when
finished -- handle all scsi disk command emulation except actual I/O
(READ+WRITE commands) which goes to the block layer. The function...

51ad87c9 12/03/2009 05:41 pm Gerd Hoffmann

scsi-disk: restruct emulation: REQUEST_SENSE

Move REQUEST_SENSE emulation from scsi_send_command() to
scsi_disk_emulate_command().

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

37659e51 12/03/2009 05:41 pm Gerd Hoffmann

scsi: move sense to SCSIDevice, create SCSISense struct.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

251882b7 12/03/2009 05:41 pm Gerd Hoffmann

scsi: move dinfo to SCSIDevice

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

ed3a34a3 12/03/2009 05:41 pm Gerd Hoffmann

scsi: move status to SCSIRequest.

Also add and use the scsi_req_complete() helper function for calling the
completion callback.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

4c41d2ef 12/03/2009 05:41 pm Gerd Hoffmann

scsi: create common SCSIRequest structure.

Rename the SCSIRequest structs in scsi-disk.c and scsi-generic.c to
SCSIDiskReq and SCSIGenericReq. Create a SCSIRequest struct and move
the common elements over.

Signed-off-by: Gerd Hoffmann <>...

9af99d98 12/03/2009 05:41 pm Gerd Hoffmann

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....

89b08ae1 12/03/2009 05:41 pm Gerd Hoffmann

scsi: move SCSIRequest management to common code.

Create generic functions to allocate, find and release SCSIRequest
structs. Make scsi-disk and scsi-generic use them.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

b07995e3 12/03/2009 05:41 pm Gerd Hoffmann

scsi: move blocksize from SCSIGenericState to SCSIDevice

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

0d65e1f8 12/03/2009 05:41 pm Gerd Hoffmann

scsi: add scsi-defs.h

Largely based on <scsi/scsi.h> from linux. Added into the tree so we
can use the defines everywhere, not just in scsi-generic.c (which is
linux-specific).

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

91376656 12/03/2009 05:41 pm Gerd Hoffmann

scsi: move type from SCSIGenericState to SCSIDevice

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

ebf46023 12/03/2009 05:41 pm Gerd Hoffmann

scsi: use command defines in scsi-disk.c

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

43b443b6 11/09/2009 04:43 pm Gerd Hoffmann

scsi: move scsi-disk.h -> scsi.h

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

c79662f7 11/09/2009 04:43 pm Naphtali Sprei

Pass the drive's readonly attribute to the guest OS

Implemented for virtio-blk and for scsi

Signed-off-by: Naphtali Sprei <>
Signed-off-by: Anthony Liguori <>

6550f2e6 10/14/2009 09:31 pm Artyom Tarasenko

scsi disk block descriptor v2

The SCSI-2 documentation suggests, that although the block
descriptor 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...

56a14938 10/05/2009 05:32 pm Gerd Hoffmann

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...

01985dcf 10/05/2009 05:32 pm Gerd Hoffmann

Implement scsi device destruction

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

e900a7b7 09/11/2009 06:19 pm Christoph Hellwig

block: add enable_write_cache flag

Add a enable_write_cache flag in the block driver state, and use it to
decide if we claim to have a volatile write cache that needs controlled
flushing from the guest. The flag is off if cache=writethrough is
defined because O_DSYNC guarantees that every write goes to stable...

d52affa7 09/09/2009 10:57 pm Gerd Hoffmann

qdev/scsi: add scsi bus support to qdev, convert drivers.

  • Add SCSIBus. * Add SCSIDeviceInfo, move device callbacks here. * add qdev/scsi helper functions. * convert drivers.

Adding scsi disks via -device works now, i.e. you can do:

-drive id=sda,if=none,......
213189ab 07/30/2009 05:50 pm Markus Armbruster

Fix VM state change handlers running out of order

When a VM state change handler changes VM state, other VM state change
handlers can see the state transitions out of order.

bmdma_map(), scsi_disk_init() and virtio_blk_init() install VM state
change handlers to restart DMA. These handlers can vm_stop() by...

0bf9e31a 07/20/2009 08:19 pm Blue Swirl

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' * /* *//*

Signed-off-by: Blue Swirl <>

001faf32 05/13/2009 08:53 pm Blue Swirl

Replace gcc variadic macro extension with C99 version

Signed-off-by: Blue Swirl <>

3f4cb3d3 04/13/2009 07:31 pm blueswir1

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

c87c0672 04/07/2009 09:43 pm aliguori

remove bdrv_aio_read/bdrv_aio_write (Christoph Hellwig)

Always use the vectored APIs to reduce code churn once we switch the BlockDriver
API to be vectored.

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Anthony Liguori <>...

58a2c436 03/29/2009 06:40 pm blueswir1

Misc scsi disk/cdrom fixes/improvements 4/4

Implement Test Unit Ready command (return NOT READY as above
if !bdrv_is_inserted(...))

Signed-off-by: Juergen Lock <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6954 c046a42c-6fe2-441c-8c8c-71466251a162