Statistics
| Branch: | Revision:

root / hw / scsi-disk.c @ 4e4fa398

History | View | Annotate | Download (53.9 kB)

# Date Author Comment
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 <>

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

scsi: pass correct sense code for ENOMEDIUM

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

67cc61e4 10/28/2011 08:25 pm Paolo Bonzini

atapi/scsi: unify definitions for MMC

The definitions in ide/internal.h are duplicates, since ATAPI commands
actually come from SCSI. Use the ones in scsi-defs.h and move the
missing ones there. Two exceptions:

- MODE_PAGE_WRITE_PARMS conflicts with the "flexible disk geometry"...

8a9c16f6 10/28/2011 08:25 pm Paolo Bonzini

scsi-disk: report media changed via unit attention sense codes

Building on the previous patch, this one adds a media change callback
to scsi-disk.

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

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

scsi-disk: fix coding style issues (braces)

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

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

scsi-disk: add stubs for more MMC commands

This patch adds a few stub implementations for MMC commands to
scsi-disk, to be filled in later in the series. It also adds to
scsi-defs.h constants for commands implemented by ide/atapi.c,
when missing.

Signed-off-by: Paolo Bonzini <>...

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

scsi-disk: store valid mode pages in a table

A small refactoring of the MODE SENSE implementation in scsi-disk.

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

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

atapi/scsi-disk: make mode page values coherent between the two

This patch adds to scsi-disk the missing mode page 0x01 for both disk
and CD-ROM drives, and mode page 0x0e for CD drives only.

A few offsets were wrong in atapi.c. Also change the 2Ah mode page to...

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

9fb118e6 10/11/2011 10:42 am Luiz Capitulino

scsi: Support I/O status

Signed-off-by: Luiz Capitulino <>
Reviewed-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

0461d5a6 10/04/2011 05:02 pm Luiz Capitulino

RunState: Rename enum values as generated by the QAPI

Next commit will convert the query-status command to use the
RunState type as generated by the QAPI.

In order to "transparently" replace the current enum by the QAPI
one, we have to make some changes to some enum values....

c8af89af 09/20/2011 11:21 pm Anthony Liguori

Merge remote-tracking branch 'kwolf/for-anthony' into staging

103b40f5 09/20/2011 01:27 pm Paolo Bonzini

scsi-disk: commonize iovec creation between reads and writes

Also, consistently use qiov.size instead of iov.iov_len.

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

7285477a 09/20/2011 01:27 pm Paolo Bonzini

scsi-disk: lazily allocate bounce buffer

It will not be needed for reads and writes if the HBA provides a sglist.
In addition, this lets scsi-disk refuse commands with an excessive
allocation length, as well as limit memory on usual well-behaved guests.
...

1dfb4dd9 09/15/2011 10:39 pm Luiz Capitulino

Replace the VMSTOP macros with a proper state type

Today, when notifying a VM state change with vm_state_notify(),
we pass a VMSTOP macro as the 'reason' argument. This is not ideal
because the VMSTOP macros tell why qemu stopped and not exactly
what the current VM state is....

7b6f9300 09/12/2011 04:17 pm Markus Armbruster

block: New bdrv_set_buffer_alignment()

Device models should be able to set it without an unclean include of
block_int.h.

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

7d4b4ba5 09/12/2011 04:17 pm Markus Armbruster

block: New change_media_cb() parameter load

To let device models distinguish between eject and load.

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

25ad22bc 09/12/2011 04:17 pm Markus Armbruster

ide/atapi scsi-disk: Make monitor eject -f, then change work

change fails while the tray is locked by the guest. eject -f forces
it open and removes any media. Unfortunately, the tray closes again
instantly. Since the lock remains as it is, there is no way to insert...

68bb01f3 09/12/2011 04:17 pm Markus Armbruster

scsi-disk: Fix START_STOP to fail when it can't eject

Don't fail when tray is already open.

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

2c6942fa 09/12/2011 04:17 pm Markus Armbruster

block: Clean up remaining users of "removable"

BlockDriverState member removable is a confused mess. It is true when
an ide-cd, scsi-cd or floppy qdev is attached, or when the
BlockDriverState was created with -drive if={floppy,sd} or -drive
if={ide,scsi,xen,none},media=cdrom ("created removable"), except when...

9e6a4c91 09/12/2011 04:17 pm Markus Armbruster

block: Drop BlockDriverState member removable

It's a confused mess (see previous commit). No users remain.

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

e4def80b 09/12/2011 04:17 pm Markus Armbruster

block: Show whether the virtual tray is open in info block

Need to ask the device, so this requires new BlockDevOps member
is_tray_open().

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

d1a0739d 09/12/2011 04:17 pm Markus Armbruster

block: Move BlockConf & friends from block_int.h to block.h

It's convenience stuff for block device models, so block.h isn't the
ideal home either, but better than block_int.h.

Permits moving some #include "block_int.h" from device model .h into
.c.

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

bfd52647 09/12/2011 04:17 pm Markus Armbruster

scsi-disk: Factor out scsi_disk_emulate_start_stop()

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

ece0d5e9 09/12/2011 04:17 pm Markus Armbruster

scsi-disk: Track tray open/close state

We already track it in BlockDriverState since commit 4be9762a. As
discussed in that commit's message, we should track it in the device
device models instead, because it's device state.

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

a1aff5bf 09/12/2011 04:17 pm Markus Armbruster

block: Revert entanglement of bdrv_is_inserted() with tray status

Commit 4be9762a changed bdrv_is_inserted() to fail when the tray is
open. Unfortunately, there are two different kinds of users, with
conflicting needs.

1. Device models using bdrv_eject(), currently ide-cd and scsi-cd....

81b1008d 09/12/2011 04:17 pm Markus Armbruster

scsi-disk: Track tray locked state

We already track it in BlockDriverState. Just like tray open/close
state, we should track it in the device models instead, because it's
device state.

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

fdec4404 09/12/2011 04:17 pm Markus Armbruster

block: Leave enforcing tray lock to device models

The device model knows best when to accept the guest's eject command.
No need to detour through the block layer.

bdrv_eject() can't fail anymore. Make it void.

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

f107639a 09/12/2011 04:17 pm Markus Armbruster

block: Drop medium lock tracking, ask device models instead

Requires new BlockDevOps member is_medium_locked(). Implement for IDE
and SCSI CD-ROMs.

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

025e849a 09/12/2011 04:17 pm Markus Armbruster

block: Rename bdrv_set_locked() to bdrv_lock_medium()

While there, make the locked parameter bool.

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

cfc606da 09/06/2011 04:45 pm Paolo Bonzini

scsi: improve MODE SENSE emulation

- do not return extra pages when requesting all pages (PAGE CODE = 0x3f)

- return correct sense code for PC = 3 (saved parameters not supported)

- do not return geometry pages for CD devices

Signed-off-by: Paolo Bonzini <>...

f6515262 09/06/2011 04:14 pm Paolo Bonzini

scsi: refine constants for READ CAPACITY 16

Rename SERVICE_ACTION_IN to SERVICE_ACTION_IN_16 to distinguish
from the 12-byte CDB variant, and add a constant for the subcommand.

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

8e321cc6 09/06/2011 02:15 pm Paolo Bonzini

scsi: fix accounting of writes

Writes go through scsi_write_complete at least twice, the first time
to get some data without having actually written anything. Because
of this, the first time scsi_write_complete is called it will call
bdrv_acct_done and account a read incorrectly. Fix this by looking...

0a4ac106 09/06/2011 02:02 pm Paolo Bonzini

scsi: execute SYNCHRONIZE_CACHE asynchronously

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

a597e79c 08/25/2011 07:18 pm Christoph Hellwig

block: explicit I/O accounting

Decouple the I/O accounting from bdrv_aio_readv/writev/flush and
make the hardware models call directly into the accounting helpers.

This means:
- we do not count internal requests from image formats in addition
to guest originating I/O...

7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

02fa69b6 08/20/2011 12:22 pm Blue Swirl

scsi-disk: fix DPRINTF

The variable 'status' does not exist anymore, adjust DPRINTF
accordingly.

Signed-off-by: Blue Swirl <>

c7b48872 08/12/2011 04:31 pm Paolo Bonzini

scsi: report unit attention on reset

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

739df215 08/12/2011 04:31 pm Paolo Bonzini

scsi: move handling of REQUEST SENSE to common code

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

fdaef069 08/12/2011 04:30 pm Paolo Bonzini

scsi: move handling of REPORT LUNS and invalid LUNs to common code

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

afa46c46 08/12/2011 04:29 pm Paolo Bonzini

scsi: move request parsing to common code

Also introduce the first occurrence of "independent" SCSIReqOps,
to handle invalid commands in common code.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

12010e7b 08/12/2011 04:27 pm Paolo Bonzini

scsi: move request-related callbacks from SCSIDeviceInfo to SCSIReqOps

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Anthony Liguori <>

8dbd4574 08/12/2011 04:27 pm Paolo Bonzini

scsi: introduce SCSIReqOps

This will let allow requests to be dispatched through different callbacks,
either common or per-device.

This patch adjusts the API, the next one will move members to SCSIReqOps.

Signed-off-by: Paolo Bonzini <>...

b45ef674 08/12/2011 04:27 pm Paolo Bonzini

scsi: move sense handling to generic code

With this patch, sense data is stored in the generic data structures
for SCSI devices and requests. The SCSI layer takes care of storing
sense data in the SCSIDevice for the subsequent REQUEST SENSE command.

At the same time, get_sense is removed and scsi_req_get_sense can use...

e44089c7 08/12/2011 04:27 pm Paolo Bonzini

scsi-disk: no need to call scsi_req_data on a short read

In fact, if the HBA's transfer_data callback goes on with scsi_req_continue
the request will be completed successfully instead of showing a failure.
It can even cause a segmentation fault.

An easy way to trigger it is "eject -f cd" during installation (during media...

682a9b21 08/12/2011 04:27 pm Paolo Bonzini

scsi: pass status when completing

A small improvement in the SCSI request API. Pass the status
at the time the request is completed, so that we can assert that
no request is completed twice. This would have detected the
problem fixed in the previous patch....

5f71d32f 08/01/2011 01:10 pm Hannes Reinecke

scsi-disk: Codingstyle fixes

Replace tabs with spaces.

Signed-off-by: Hannes Reinecke <>
Signed-off-by: Kevin Wolf <>

8bd3e139 08/01/2011 01:10 pm Hannes Reinecke

scsi: Remove REZERO_UNIT emulation

REZERO_UNIT command is obsolete. Remove support for it.

Signed-off-by: Hannes Reinecke <>
Signed-off-by: Kevin Wolf <>

5e30a07d 08/01/2011 01:10 pm Hannes Reinecke

scsi: Sanitize command definitions

Sanitize SCSI command definitions.
Add _10 suffix to READ_CAPACITY, WRITE_VERIFY, VERIFY, READ_LONG,
WRITE_LONG, and WRITE_SAME.
Add new command definitions for LOCATE_10, UNMAP, VARLENGTH_CDB,
WRITE_FILEMARKS_16, EXTENDED_COPY, ATA_PASSTHROUGH, ACCESS_CONTROL_IN,...

f37bd73b 08/01/2011 01:10 pm Hannes Reinecke

scsi-disk: Remove 'drive_kind'

Instead of using its own definitions scsi-disk should
be using the device type of the parent device.

Signed-off-by: Hannes Reinecke <>
Signed-off-by: Kevin Wolf <>

8e31bf38 07/23/2011 07:26 pm Matthew Fernandez

Correct spelling of licensed

Correct typos of "licenced" to "licensed".

Reviewed-by: Stefan Weil <>
Reviewed-by: Andreas F=E4rber <>
Signed-off-by: Matthew Fernandez <>
Signed-off-by: Anthony Liguori <>

653c1c3f 07/19/2011 04:39 pm Hannes Reinecke

scsi-disk: Fixup debugging statement

A debugging statement wasn't converted to the new interface.

Signed-off-by: Hannes Reinecke <>
Acked-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

3e1c0c9a 07/19/2011 04:39 pm Hannes Reinecke

scsi-disk: Mask out serial number EVPD

If the serial number is not set we should mask it out in the
list of supported VPD pages and mark it as not supported.

Signed-off-by: Hannes Reinecke <>
Acked-by: Paolo Bonzini <>
Signed-off-by: Kevin Wolf <>

c5bf71a9 07/19/2011 04:38 pm Hannes Reinecke

scsi: Add 'hba_private' to SCSIRequest

'tag' is just an abstraction to identify the command
from the driver. So we should make that explicit by
replacing 'tag' with a driver-defined pointer 'hba_private'.
This saves the lookup for driver handling several commands...

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

scsi: make write_data return void

The return value is unused anyway.

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

1455084e 05/26/2011 01:14 pm Paolo Bonzini

scsi: ignore LUN field in the CDB

The LUN field in the CDB is a historical relic. Ignore it as reserved,
which is what modern SCSI specifications actually say.

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

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

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

scsi-disk: add data direction checking

scsi_req_parse() already provides for a data direction setting,
so we should be using it to check for correct direction.
And we should return the sense code 'INVALID FIELD IN CDB'
in these cases.

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