Statistics
| Branch: | Revision:

root / hw / scsi-disk.c @ 3cda3462

History | View | Annotate | Download (73.9 kB)

# Date Author Comment
1ceee0d5 09/28/2012 08:40 pm Paolo Bonzini

iostatus: change is_read to a bool

Do this while we are touching this part of the code, before introducing
more uses of "int is_read".

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Eric Blake <>
Signed-off-by: Kevin Wolf <>

3e1caa5f 09/28/2012 08:40 pm Paolo Bonzini

iostatus: reorganize io error code

Move the common part of IDE/SCSI/virtio error handling to the block
layer. The new function bdrv_error_action subsumes all three of
bdrv_emit_qmp_error_event, vm_stop, bdrv_iostatus_set_err.

The same scheme will be used for errors in block jobs....

92aa5c6d 09/28/2012 08:40 pm Paolo Bonzini

iostatus: move BlockdevOnError declaration to QAPI

This will let block-stream reuse the enum. Places that used the enums
are renamed accordingly.

Signed-off-by: Paolo Bonzini <>
Reviewed-by: Eric Blake <>
Signed-off-by: Kevin Wolf <>

ff06f5f3 09/28/2012 08:14 pm Paolo Bonzini

iostatus: rename BlockErrorAction, BlockQMPEventAction

We want to remove knowledge of BLOCK_ERR_STOP_ENOSPC from drivers;
drivers should only be told whether to stop/report/ignore the error.
On the other hand, we want to keep using the nicer BlockErrorAction...

e93176d5 09/21/2012 05:17 pm Paolo Bonzini

scsi-disk: use scsi_data_cdb_length

This simplifies and unifies the parsing of READ, WRITE and WRITE SAME
commands.

Signed-off-by: Paolo Bonzini <>

1109c894 09/21/2012 05:17 pm Ronnie Sahlberg

SCSI: Standard INQUIRY data should report HiSup flag as set.

QEMU as far as I know only reports LUN numbers using the modes that
are described in SAM4.
As such, since all LUN numbers generated by the SCSI emulation in QEMU
follow SAM4, we should set the HiSup bit in the standard INQUIRY data...

444bc908 09/21/2012 05:12 pm Paolo Bonzini

scsi-disk: introduce check_lba_range

Abstract the test for an out-of-range (starting block, block count)
pair.

Signed-off-by: Paolo Bonzini <>

12ca76fc 09/21/2012 05:12 pm Paolo Bonzini

scsi-disk: fix check for out-of-range LBA

This fix is needed to correctly handle 0-block read and writes.
Without it, a 0-block access at LBA 0 would underflow.

Signed-off-by: Paolo Bonzini <>

5bb0b62e 08/30/2012 01:47 am Stefan Weil

scsi-disk: Fix typo (uint32 -> uint32_t)

Cc: Paolo Bonzini <>
Signed-off-by: Stefan Weil <>
Signed-off-by: Anthony Liguori <>

0f1da449 08/28/2012 03:50 pm Paolo Bonzini

scsi: more fixes to properties for passthrough devices

Commit 0384783 (scsi-block: remove properties that are not relevant for
passthrough, 2012-07-09) removed one property that should have been
left there, "bootindex".

It also did not touch scsi-generic, while it should have....

31294261 08/12/2012 01:11 am Anthony Liguori

Merge remote-tracking branch 'bonzini/scsi-next' into staging

  • bonzini/scsi-next:
    scsi-disk: add support for the UNMAP command
    scsi-disk: improve out-of-range LBA detection for WRITE SAME
    scsi-disk: more assertions and resets for aiocb
    virtio-scsi: do not compare 32-bit QEMU tags against 64-bit virtio-scsi tags...
46e3f30e 08/09/2012 04:35 pm Paolo Bonzini

scsi-disk: more assertions and resets for aiocb

Leaving the aiocb to a non-NULL value leads to an assertion failure when
rerror/werror are set to stop or enospc, and the operation is retried.
scsi-disk checks that the aiocb member is NULL before filling it....

a084a703 08/09/2012 04:35 pm Paolo Bonzini

scsi-disk: improve out-of-range LBA detection for WRITE SAME

Signed-off-by: Paolo Bonzini <>

5222aaf2 08/09/2012 04:35 pm Paolo Bonzini

scsi-disk: add support for the UNMAP command

The unmap command can reuse the same infrastructure as MODE SELECT
for reading the descriptor list into memory. The descriptors are
processed sequentially.

Signed-off-by: Paolo Bonzini <>

b2df4314 08/06/2012 11:39 pm Markus Armbruster

ide scsi: Mess with geometry only for hard disk devices

Legacy -drive cyls=... are now ignored completely when the drive
doesn't back a hard disk device. Before, they were first checked
against a hard disk's limits, then ignored.

Signed-off-by: Markus Armbruster <>...

ae5708b3 08/03/2012 11:01 am Ronnie Sahlberg

SCSI: STARTSTOPUNIT only eject/load media if powercondition is 0

The START STOP UNIT command will only eject/load media if
power condition is zero.

If power condition is !0 then LOEJ and START will be ignored.

From MMC (sbc contains similar wordings too)...

79fb50bb 08/03/2012 11:01 am Paolo Bonzini

scsi-disk: fix compilation with DEBUG_SCSI

Reported-by: Gerhard Wiesinger <>
Signed-off-by: Paolo Bonzini <>

aaebacef 07/27/2012 09:25 am Paolo Bonzini

scsi-disk: report resized disk via sense codes

Linux will not use these, but a very similar mechanism will be used to
report the condition via virtio-scsi events.

Signed-off-by: Paolo Bonzini <>

53200fad 07/27/2012 09:25 am Paolo Bonzini

scsi: report parameter changes to HBA drivers

Signed-off-by: Paolo Bonzini <>

e48e84ea 07/27/2012 09:25 am Paolo Bonzini

scsi: establish precedence levels for unit attention

When a device is resized, we will report a unit attention condition
for CAPACITY DATA HAS CHANGED. However, we should ensure that this
condition does not override a more important unit attention condition....

b456a71c 07/27/2012 09:25 am Paolo Bonzini

scsi-disk: removable hard disks support load/eject

Support for the LOEJ bit of the START/STOP UNIT command right now is
limited to CD-ROMs. This is wrong, since removable hard disks (in the
real world: SD card readers) also support it in pretty much the same way....

6a8a685c 07/26/2012 06:44 pm Ronnie Sahlberg

scsi-disk: Fail medium writes with proper sense for readonly LUNs

Add sense code for DATA_PROTECT/WRITE_PROTECTED and return this error
for any WRITE*/WRITE_VERIFY* calls if the device is readonly=on,
i.e. write-protected

Signed-off-by: Ronnie Sahlberg <>...

4f588b15 07/26/2012 06:44 pm Paolo Bonzini

scsi-disk: fix changeable values for MODE_PAGE_R_W_ERROR

The changeable values were not all-zeros for this mode page, fix it.

Signed-off-by: Paolo Bonzini <>

380feaff 07/26/2012 06:44 pm Paolo Bonzini

scsi-disk: parse MODE SELECT commands and parameters

This adds the bulk of the parsing code for MODE SELECT, including
breaking out changes to different mode pages, and checking that only
changeable values are modified.

In order to report errors correctly two passes are made through the...

96c91bbf 07/26/2012 06:44 pm Paolo Bonzini

scsi-disk: support toggling the write cache

Finally, this uses the "plumbing" in the previous patch to
add support for toggling the WCE bit of the caching mode page.

Signed-off-by: Paolo Bonzini <>

96bdbbab 07/26/2012 06:44 pm Ronnie Sahlberg

scsi-disk: rd/wr/vr-protect !=0 is an error

The QEMU SCSI emulation does not support protection information,
so any READ/WRITE/VERIFY commands that has the protect bits set to
non-zero should fail with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB

From SCSI SBC :...

ba6095cd 07/26/2012 06:44 pm Ronnie Sahlberg

scsi-disk: improve the lba-out-of-range tests for read/write/verify

Improve the tests for the LBA to cover more cases.

For the 16 byte opcodes, the lba is a uint64, so we need to check is to
make sure that we do not wrap. For example if an opcode would specify...

353815aa 07/26/2012 06:44 pm Dmitry Fleytman

scsi-disk: let the user customize vendor and product name

This patch adds two new properties vendor and product to SCSI disks.
These options let the user customize the inquiry data returned by the
disk.

Signed-off-by: Yan Vugenfirer <>...

c1b35247 07/26/2012 06:44 pm Paolo Bonzini

scsi-disk: make discard asynchronous

By making discard asynchronous, we can reuse all the error handling
code that is used for other commands.

Signed-off-by: Paolo Bonzini <>

101aa85f 07/26/2012 06:44 pm Paolo Bonzini

scsi-disk: move all non-DMA commands to scsi_disk_emulate_command

We want to use separate SCSIReqOps for emulated commands needing an
allocated buffer vs. those that are zerocopy when the HBA supports
S/G lists. Ensure that all of the former are in scsi_disk_emulate_command....

b08d0ea0 07/26/2012 06:44 pm Paolo Bonzini

scsi-disk: split scsi-disk reqops

Only checks for present medium were still done in scsi_send_command
for emulated commands. So move those to scsi_disk_emulate_command
and return different SCSIReqOps depending on the kind of command.

Checks for present medium can be done unconditionally for the...

314a3299 07/26/2012 06:44 pm Paolo Bonzini

scsi-disk: separate read_data/write_data implementation for emulate_reqops

The previous patch only separated the send_command callback.
Use different implementations also for read_data and write_data.
The latter is still unreachable, so it aborts for now....

af6d510d 07/26/2012 06:44 pm Paolo Bonzini

scsi-disk: support emulated TO_DEV requests

This adds the implementation of write_data for the emulated
command case. The first time through it asks for more data,
the second time it finishes the processing of the command.

MODE SELECT and MODE SELECT can now be re-enabled, but they...

ef405611 07/26/2012 06:44 pm Paolo Bonzini

scsi-disk: adjust offsets in MODE SENSE by 2

This will make offsets the same when implementing MODE SELECT. This is
because MODE SELECT has to deal with both 2-byte and 4-byte headers.
Unfortunately, this means that the offsets are now off by two compared...

03847837 07/26/2012 06:44 pm Paolo Bonzini

scsi-block: remove properties that are not relevant for passthrough

scsi-block is a passthrough device and does not allow customization
of vendor, product, removable, DPOFUA, block size or any other piece of
information. Thus, drop DEFINE_SCSI_DISK_PROPERTIES() from the...

911525db 07/17/2012 05:48 pm Markus Armbruster

hw/block-common: Factor out fall back to legacy -drive serial=...

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

b7eb0c9f 07/17/2012 05:48 pm Markus Armbruster

hw/block-common: Factor out fall back to legacy -drive cyls=...

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

9db1c0f7 07/17/2012 05:48 pm Markus Armbruster

hd-geometry: Move disk geometry guessing back from block.c

Commit f3d54fc4 factored it out of hw/ide.c for reuse. Sensible,
except it was put into block.c. Device-specific functionality should
be kept in device code, not the block layer. Move it to
hw/hd-geometry.c, and make stylistic changes required to keep...

e2f3dc2b 07/17/2012 05:48 pm Markus Armbruster

hd-geometry: Cut out block layer translation middleman

hd_geometry_guess() picks geometry and translation. Callers can get
the geometry directly, via parameters, but for translation they need
to go through the block layer.

Add a parameter for translation, so it can optionally be gotten just...

1f24d7b4 07/17/2012 05:48 pm Markus Armbruster

hd-geometry: Switch to uint32_t to match BlockConf

Best to use the same type, to avoid unwanted truncation or sign
extension.

BlockConf can't use plain int for cyls, heads and secs, because
integer properties require an exact width.

Signed-off-by: Markus Armbruster <>...

d252df48 07/17/2012 05:48 pm Markus Armbruster

scsi-hd: qdev properties for disk geometry

Geometry needs to be qdev properties, because it belongs to the
disk's guest part.

Maintain backward compatibility exactly like for serial: fall back to
DriveInfo's geometry, set with -drive cyls=...

Do this only for scsi-hd. scsi-disk is legacy. scsi-cd doesn't have...

27395add 07/02/2012 11:18 am Paolo Bonzini

scsi: add a qdev property for the disk's WWN

Signed-off-by: Paolo Bonzini <>

1a4f0c3a 07/02/2012 11:18 am Paolo Bonzini

scsi-disk: implement READ DISC INFORMATION

This command is not necessary for CD-ROM and DVD-ROM, but some versions of
udev trip on its absence.

Cc: Kevin Wolf <>
Cc: Markus Armbruster <>
Signed-off-by: Paolo Bonzini <>

82579390 07/02/2012 11:18 am Paolo Bonzini

scsi: simplify handling of the VPD page length field

The last four bytes of the thin provisioning page were cut out.

Signed-off-by: Paolo Bonzini <>

93bfef4c 06/19/2012 09:36 pm Crístian Viana

Allow machines to configure the QEMU_VERSION that's exposed via hardware

QEMU exposes its version to the guest's hardware and in some cases that is wrong
(e.g. Windows prints messages about driver updates when you switch
the QEMU version).
There is a new field now on the struct QEmuMachine, hw_version, which may...

137745c5 06/15/2012 03:03 pm Markus Armbruster

scsi-disk: Don't peek behind the BlockDriverState abstraction

Use the appropriate interface instead.

Signed-off-by: Markus Armbruster <>
Acked-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

18eef3bc 06/07/2012 11:02 am Gerd Hoffmann

scsi: prepare migration code for usb-storage support

usb-storage can't handle requests in one go as the data transfer can be
splitted into lots of usb packets. Because of that there can be
normal in-flight requests at savevm time and we need to handle that....

3c3d8a95 05/07/2012 09:44 am Paolo Bonzini

scsi: do not require a minimum allocation length for INQUIRY

The requirements on the INQUIRY buffer size are not in my copy of SPC
(SPC-4 r27) and not observed by LIO. Rip them out.

Signed-off-by: Paolo Bonzini <>

2a92fbff 05/07/2012 09:44 am Paolo Bonzini

scsi: remove useless debug messages

Optional inquiry information is declared obsolete in the latest versions
of the standard; invalid CDBs or unsupported VPD pages are supported
can be diagnosed with trace_scsi_inquiry.

Signed-off-by: Paolo Bonzini <>

da8365db 05/07/2012 09:44 am Paolo Bonzini

scsi-disk: add dpofua property

Linux expects REQ_FUA to be advertised only if WRITE+FUA is faster than
WRITE+SYNCHRONIZE CACHE, so we should not set the DPOFUA bit. However,
it is useful to have it for testing purposes, so add a qdev property to
set it....

bfe3d7ac 05/07/2012 09:43 am Paolo Bonzini

scsi: change "removable" field to host many features

It is pointless to add a uint32_t field for every new feature.
Since we will need a new feature soon, convert accesses to "removable"
to look at bit 0 only.

Signed-off-by: Paolo Bonzini <>

31e8fd86 05/04/2012 11:39 am Paolo Bonzini

scsi: fix refcounting for reads

Recently introduced FUA support also gave us a use-after-free
of the BlockAcctCookie within a SCSIDiskReq, due to unbalanced
reference counting.

The patch fixes this by making scsi_do_read look like a combination
of scsi_*_complete + scsi_*_data. It does both a ref (like...

a5ee9085 05/04/2012 11:39 am Paolo Bonzini

scsi: fix WRITE SAME transfer length and direction

Signed-off-by: Paolo Bonzini <>

f644a290 04/19/2012 05:26 pm Ronnie Sahlberg

SCSI emulation: should tell the guest that we actually support thin provisioning

Signed-off-by: Ronnie Sahlberg <>
[Actually, we should report it only if discard_granularity is nonzero.
Older SBC drafts assigned 0 to thin provisioning and 1 to thick...

a0e66a69 04/19/2012 05:16 pm Paolo Bonzini

scsi: add a started field to SCSIDiskReq

Signed-off-by: Paolo Bonzini <>

ac668426 04/19/2012 05:16 pm Paolo Bonzini

scsi: support FUA on reads

To force unit access on reads, flush the cache before doing the read.

Signed-off-by: Paolo Bonzini <>

e590ecbe 04/19/2012 05:16 pm Paolo Bonzini

scsi: small refactoring of MMC mode-sense

Make DBD a boolean value, and force device-specific parameter to zero.

Signed-off-by: Paolo Bonzini <>

6a2de0f2 04/19/2012 05:16 pm Paolo Bonzini

scsi: advertise DPOFUA

Signed-off-by: Paolo Bonzini <>

c9e4d828 04/19/2012 05:16 pm Ronnie Sahlberg

SCSI emulation: Support unmap via WRITE_SAME_10.

This was added in SBC r26 in place of the reserved bits that were
present up to that version.

It is the same as WRITE_SAME_16 as far as QEMU is concerned.

Signed-off-by: Ronnie Sahlberg <>...

7f64f8e2 04/19/2012 05:15 pm Paolo Bonzini

scsi: force unit access on VERIFY

Also DMA data from the host, to avoid that the host reports an
underrun.

Signed-off-by: Paolo Bonzini <>

80624c93 04/19/2012 04:27 pm Paolo Bonzini

scsi: make code more homogeneous in AIO callback functions

First scsi_flush_complete, like scsi_dma_complete, is always called with
an active AIOCB.

Second, always test for "ret < 0" to check for errors.

Signed-off-by: Paolo Bonzini <>

b77912a7 04/19/2012 04:27 pm Paolo Bonzini

scsi: move scsi_flush_complete around

Signed-off-by: Paolo Bonzini <>

7e8c49c5 04/19/2012 04:27 pm Paolo Bonzini

scsi: add support for FUA on writes

To force unit access, add a flush operation after the actual write.
WRITE AND VERIFY commands always flush according to SBC, so do it
even though we do not perform the reread.

Signed-off-by: Paolo Bonzini <>

b8aba8d7 04/19/2012 04:27 pm Paolo Bonzini

scsi: add missing test for cancelled request

Signed-off-by: Paolo Bonzini <>

9bcaf4fe 03/19/2012 05:35 pm Paolo Bonzini

scsi-cd: check ready condition before processing several commands

This commit is more or less obvious. What it caused is less obvious:
SCSI CD drives failed to eject under Linux, though for example the
"change" command worked okay. This happens because of the autoclose...

fd930791 03/19/2012 05:35 pm Paolo Bonzini

scsi: copy serial number into VPD page 0x83

Currently QEMU passes the qdev device id to the guest in an ASCII-string
designator in page 0x83. While this is fine, it does not match what
real hardware does; usually the ASCII-string designator there hosts
another copy of the serial number (there can be other designators,...

7c1daf34 02/24/2012 05:45 pm Anthony Liguori

Merge remote-tracking branch 'qmp/queue/qmp' into staging

  • qmp/queue/qmp:
    qmp: add DEVICE_TRAY_MOVED event
    ide: drop ide_tray_state_post_load()
    block: Don't call bdrv_eject() if the tray state didn't change
    block: bdrv_eject(): Make eject_flag a real bool...
eaccf49e 02/24/2012 03:54 pm Paolo Bonzini

scsi-block: always use scsi_generic_ops for cache != none

Signed-off-by: Paolo Bonzini <>

d88b1819 02/22/2012 09:23 pm Luiz Capitulino

block: Don't call bdrv_eject() if the tray state didn't change

It's not needed. Besides we can then assume that bdrv_eject() is
only called when there's a tray state change, which is useful to
the DEVICE_TRAY_MOVED event (going to be added in a future
commit)....

329c0a48 02/22/2012 09:22 pm Luiz Capitulino

block: Rename bdrv_mon_event() & BlockMonEventAction

They are QMP events, not monitor events. Rename them accordingly.

Also, move bdrv_emit_qmp_error_event() up in the file. A new event will
be added soon and it's good to have them next each other.

Signed-off-by: Luiz Capitulino <>...

5d0d2467 02/22/2012 02:29 pm Paolo Bonzini

scsi-disk: enable scatter/gather functionality

Signed-off-by: Paolo Bonzini <>

43b978b9 02/22/2012 02:29 pm Paolo Bonzini

scsi-disk: add migration support

Signed-off-by: Paolo Bonzini <>

83f7d43a 02/15/2012 05:39 pm Andreas Färber

qom: Unify type registration

Replace device_init() with generalized type_init().

While at it, unify naming convention: type_init([$prefix_]register_types)
Also, type_init() is a function, so add preceding blank line where
necessary and don't put a semicolon after the closing brace....

39bffca2 02/03/2012 06:41 pm Anthony Liguori

qdev: register all types natively through QEMU Object Model

This was done in a mostly automated fashion. I did it in three steps and then
rebased it into a single step which avoids repeatedly touching every file in
the tree.

The first step was a sed-based addition of the parent type to the subclass...

b9eea3e6 01/27/2012 06:50 pm Anthony Liguori

scsi: convert to QEMU Object Model

Signed-off-by: Anthony Liguori <>

e2f0c49f 01/26/2012 03:49 pm Thomas Higdon

scsi: Guard against buflen exceeding req->cmd.xfer in scsi_disk_emulate_command

Limit the return value (corresponding to the length of the buffer to be
DMAed back to the intiator) to the value in req->cmd.xfer, which is the
amount of data that the initiator expects. Eliminate now-duplicate code...

6a84cb1f 01/06/2012 05:07 pm Markus Armbruster

scsi virtio-blk usb-msd: Clean up device init error messages

Replace

error_report("DEVICE-NAME: MESSAGE");

by just

error_report("MESSAGE");

in block device init functions.

DEVICE-NAME is bogus in some cases: it's "scsi-disk" for device
scsi-hd and scsi-cd, "virtio-blk-pci" for virtio-blk-s390, and...

ad54ae80 12/15/2011 01:40 pm Paolo Bonzini

block: bdrv_aio_* do not return NULL

Initially done with the following semantic patch:

rule1
expression E;
statement S;
@@
E =
(
bdrv_aio_readv | bdrv_aio_writev | bdrv_aio_flush | bdrv_aio_discard | bdrv_aio_ioctl
)
(...);
(
- if (E == NULL) { ... }...

33ebad12 11/18/2011 03:14 pm Paolo Bonzini

scsi-block: always use SG_IO for MMC devices

CD burning messes up the state of the host page cache and host block
device. Just pass all operations down to the device, even though that
might have slightly worse performance. Everything else just is not
reliable in combination with burning....

f3b338ef 11/18/2011 03:12 pm Paolo Bonzini

scsi: pass down REQUEST SENSE to the device when there is no stored sense

This will let scsi-block/scsi-generic report progress on long
operations.

Reported-by: Thomas Schmitt <>
Tested-by: Thomas Schmitt <>...

0fd76ff4 11/18/2011 03:09 pm Paolo Bonzini

scsi: remove block descriptors from CDs

Reported-by: Thomas Schmitt <>
Tested-by: Thomas Schmitt <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

00a01ad4 11/18/2011 02:57 pm Paolo Bonzini

scsi: update list of commands

Add more commands and their names, and remove SEEK which is obsolete.
Instead, use SET_CAPACITY which is still in SSC.

Tested-by: Thomas Schmitt <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

245d0049 11/18/2011 02:37 pm Paolo Bonzini

scsi-disk: guess geometry

Old operating systems rely on correct geometry to convert from CHS
addresses to LBA. Providing correct data is necessary for them to boot.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

7082826e 11/18/2011 02:35 pm Paolo Bonzini

scsi: fix fw path

The pre-1.0 firmware path for SCSI devices already included the LUN
using the suffix argument to add_boot_device_path. I missed that when
making channel and LUN customizable. Avoid that it is included twice, and
convert the colons to commas for consistency with other kinds of devices...

4480de19 11/11/2011 03:02 pm Paolo Bonzini

scsi-disk: implement eject requests

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

44740c38 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: do not duplicate BlockDriverState member

Same as for scsi-generic, avoid duplication even if it causes longer
lines.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

69377307 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: remove cluster_size

This field is redundant, and having it makes it more complicated
to share reqops between the upcoming scsi-block and scsi-generic.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

e39be482 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: small clean up to INQUIRY

Set s->removable, s->qdev.blocksize and s->qdev.type in the callers
of scsi_initfn.

With this in place, s->qdev.type is allowed, and we can just reuse it
as the first byte in VPD data (just like we do in standard INQUIRY data)....

7877903a 10/28/2011 08:25 pm Paolo Bonzini

scsi: move max_lba to SCSIDevice

The field is only in scsi-disk for now. Moving it up to SCSIDevice makes
it easier to reuse the scsi-generic reqops elsewhere.

At the same time, make scsi-generic get max_lba from snooped READ CAPACITY
commands as well....

adcf2754 10/28/2011 08:25 pm Paolo Bonzini

scsi: make reqops const

Also delete a stale occurrence of SCSIReqOps inside SCSIDeviceInfo.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

63db0f0e 10/28/2011 08:25 pm Paolo Bonzini

scsi: pass cdb to alloc_req

This will let scsi-block choose between passthrough and emulation.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

c7bae6a7 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: bump SCSIRequest reference count until aio completion runs

In some cases a request may be canceled before the completion callback
runs. Keep a reference to the request between starting an AIO operation
and the corresponding scsi_req_cancel or scsi_*_complete....

71544d30 10/28/2011 08:25 pm Paolo Bonzini

scsi: push request restart to SCSIDevice

The request restart mechanism is generic and could be reused for
scsi-generic. In the meanwhile, pushing it to SCSIDevice avoids
that scsi_dma_restart_bh looks at SCSIGenericReqs when working on
a scsi-block device....

336a6915 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: add scsi-block for device passthrough

scsi-block is a new device that supports device passthrough of Linux
block devices (i.e. /dev/sda, not /dev/sg0). It uses SG_IO for commands
other than I/O commands, and regular AIO read/writes for I/O commands....

3c2f7c12 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: report media changed via GET EVENT STATUS NOTIFICATION

This adds support for media change notification via the GET EVENT STATUS
NOTIFICATION command, used by Linux versions 2.6.38 and newer.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

afd4030c 10/28/2011 08:25 pm Paolo Bonzini

scsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo)

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

7cec78b6 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: fail READ CAPACITY if LBA != 0 but PMI == 0

Tested by the Windows Logo Kit SCSI Compliance test. From SBC-3, paragraph
5.25: "The LOGICAL BLOCK ADDRESS field shall be set to zero if the PMI
bit is set to zero. If the PMI bit is set to zero and the LOGICAL BLOCK...

628e95b6 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: fix retrying a flush

Flush does not go anymore through scsi_disk_emulate_command.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

430ee2f2 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: support DVD profile in GET CONFIGURATION

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

ceb792ef 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: support READ DVD STRUCTURE

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>