aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2011-10-28scsi: make reqops constPaolo Bonzini4-11/+10
Also delete a stale occurrence of SCSIReqOps inside SCSIDeviceInfo. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi: move max_lba to SCSIDevicePaolo Bonzini3-8/+10
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. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: small clean up to INQUIRYPaolo Bonzini1-25/+21
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). Also set s->removable is set consistently and we can use it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: remove cluster_sizePaolo Bonzini1-19/+16
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 <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: do not duplicate BlockDriverState memberPaolo Bonzini1-47/+45
Same as for scsi-generic, avoid duplication even if it causes longer lines. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-generic: snoop READ CAPACITY commands to get block sizePaolo Bonzini1-41/+25
Instead of "guessing" the block size when there is no medium in the drive, wait for the guest to send a READ CAPACITY command and snoop it from there. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-generic: look at host statusPaolo Bonzini1-4/+16
Pass down the host status so that failing transport can be detected by the guest. Similar treatment of host status could be done in virtio-blk, too. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-generic: check ioctl statuses when SG_IO succeedsPaolo Bonzini1-4/+4
A succeeding ioctl does not imply that the SCSI command succeeded. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-generic: remove scsi_req_fixupPaolo Bonzini1-15/+0
This is not needed anymore, since asynchronous ioctls were introduced by commit 221f715 (new scsi-generic abstraction, use SG_IO, 2009-03-28). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-generic: drop SCSIGenericStatePaolo Bonzini1-50/+40
It is not needed, because s->bs is already stored in SCSIDevice, and can be reached from the conf.bs member. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: fix retrying a flushPaolo Bonzini1-6/+3
Flush does not go anymore through scsi_disk_emulate_command. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: fail READ CAPACITY if LBA != 0 but PMI == 0Paolo Bonzini1-0/+6
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 ADDRESS field is not set to zero, then the device server shall terminate the command with CHECK CONDITION status with the sense key set to ILLEGAL REQUEST and the additional sense code set to INVALID FIELD IN CDB". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi: add channel to addressingPaolo Bonzini5-21/+25
This also requires little more than adding the new argument to scsi_device_find, and the qdev property. All devices by default end up on channel 0. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi: allow arbitrary LUNsPaolo Bonzini6-24/+75
This only requires changes in two places: in SCSIBus, we need to look for a free LUN if somebody creates a device with a pre-existing scsi-id but the default LUN (-1, meaning "search for a free spot"); in vSCSI, we need to actually parse the LUN according to the SCSI spec. For vSCSI, max_target/max_lun are set according to the logical unit addressing format in SAM. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi: implement REPORT LUNS for arbitrary LUNsPaolo Bonzini1-10/+39
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi: remove devs array from SCSIBusPaolo Bonzini6-52/+50
Change the devs array into a linked list, and add a scsi_device_find function to navigate the children list instead. This lets the SCSI bus use more complex addressing, and HBAs can talk to the correct device when there are multiple LUNs per target. scsi_device_find may return another LUN on the same target if none is found that matches exactly. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28qdev: switch children device list to QTAILQPaolo Bonzini8-28/+28
SCSI buses will need to read the children list first-to-last. This requires using a QTAILQ, because hell breaks loose if you just try inserting at the tail (thus reversing the order of all existing visits from last-to-first to first-to-tail). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo)Paolo Bonzini7-32/+39
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: report media changed via GET EVENT STATUS NOTIFICATIONPaolo Bonzini1-4/+53
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 <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: support READ DVD STRUCTUREPaolo Bonzini1-1/+101
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: support DVD profile in GET CONFIGURATIONPaolo Bonzini1-8/+42
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28atapi/scsi-disk: make mode page values coherent between the twoPaolo Bonzini2-16/+31
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 expose DVD media read capabilities in the IDE cdrom. This lets you run dvd+rw-mediainfo on the virtual DVD drives. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: store valid mode pages in a tablePaolo Bonzini1-12/+13
A small refactoring of the MODE SENSE implementation in scsi-disk. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: add stubs for more MMC commandsPaolo Bonzini2-5/+65
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 <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: fix coding style issues (braces)Paolo Bonzini1-25/+46
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi-disk: report media changed via unit attention sense codesPaolo Bonzini3-1/+35
Building on the previous patch, this one adds a media change callback to scsi-disk. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi: notify the device when unit attention is reportedPaolo Bonzini2-5/+29
Reporting media change events via unit attention sense codes requires a small state machine: first report "NO MEDIUM", then report "MEDIUM MAY HAVE CHANGED". Unfortunately there is no good hooking point for the device to notice that its pending unit attention condition has been reported. This patch reworks the generic machinery to add one. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28atapi: cleanup/fix mode sense resultsPaolo Bonzini1-4/+6
The first two bytes (after the 8-byte ATAPI header) are the mode page number and the number of bytes after the length field itself. Make this clear in the code. The AUDIO_CTL page was filled with wrong values. It is not anymore in MMC, but at least keep the values sane. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28atapi: move GESN definitions to scsi-defs.hPaolo Bonzini2-37/+27
As a complement to the previous patch, move definitions for GET EVENT STATUS NOTIFICATION from the two functions to scsi-defs.h. The NCR_* constants are just bit values corresponding to the ENC_* values, with no offsets even, so keep just one copy. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28atapi/scsi: unify definitions for MMCPaolo Bonzini7-104/+101
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" page in scsi-disk.c. It is unused, so pick the latter. - GPCMD_* is left in ide/internal.h, at least for now. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28scsi: pass correct sense code for ENOMEDIUMPaolo Bonzini1-0/+3
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28Documentation: Add syntax for using sheepdog devicesRonnie Sahlberg1-0/+27
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28block: reinitialize across bdrv_close()/bdrv_open()Stefan Hajnoczi1-2/+4
Several BlockDriverState fields are not being reinitialized across bdrv_close()/bdrv_open(). Make sure they are reset to their default values. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28block: set bs->read_only before .bdrv_open()Stefan Hajnoczi1-2/+2
Several block drivers set bs->read_only in .bdrv_open() but block.c:bdrv_open_common() clobbers its value. Additionally, QED uses bdrv_is_read_only() in .bdrv_open() to decide whether to perform consistency checks. The correct ordering is to initialize bs->read_only from the open flags before calling .bdrv_open(). This way block drivers can override it if necessary and can use bdrv_is_read_only() in .bdrv_open(). Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28qemu-io: delete bs instead of leaking itStefan Hajnoczi1-2/+3
Using bdrv_close() is not enough to free a BlockDriverState. Since we explicitly create it with bdrv_new(), use bdrv_delete() to close and delete it. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28block: fix qcow2_co_flush deadlockDong Xu Wang1-0/+2
If qcow2_cache_flush failed, s->lock will not be unlock. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28Documentation: Describe NBD URL syntaxRonnie Sahlberg1-0/+21
This patch adds a short description of how to specify a NBD device to QEMU. Syntax for both TCP and Unix Domain Sockets are provided as well as examples. Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28vmdk: Fix possible segfaultsKevin Wolf1-1/+6
Data we read from the disk isn't necessarily null terminated and may not contain the string we're looking for. The code needs to be a bit more careful here. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28vmdk: Improve error handlingKevin Wolf1-6/+15
Return the right error values in some more places. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28vmdk: Fix use of uninitialised valueKevin Wolf1-1/+1
In error cases, cid is never set. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28ide: Fix off-by-one error in array index checkKevin Wolf1-1/+1
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-28qcow: Fix bdrv_write_compressed error handlingKevin Wolf1-11/+19
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-28block: Fix bdrv_open use after freeKevin Wolf1-1/+1
tmp_filename was used outside the block it was defined in, i.e. after it went out of scope. Move its declaration to the top level. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28block: Remove dead codeKevin Wolf1-5/+1
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28qcow2: fix some errors and typo in qcow2.txtZhi Yong Wu1-3/+3
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28Teach block/vdi about "discarded" (no longer allocated) blocksEric Sunshine1-9/+14
An entry in the VDI block map will hold an offset to the actual block if the block is allocated, or one of two specially-interpreted values if not allocated. Using VirtualBox terminology, value VDI_IMAGE_BLOCK_FREE (0xffffffff) represents a never-allocated block (semantically arbitrary content). VDI_IMAGE_BLOCK_ZERO (0xfffffffe) represents a "discarded" block (semantically zero-filled). block/vdi knows only about VDI_IMAGE_BLOCK_FREE. Teach it about VDI_IMAGE_BLOCK_ZERO. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28Documentation: Add iSCSI sectionRonnie Sahlberg1-0/+42
Add new section for device URL syntax for special files and describe the iSCSI URL with examples Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-28iSCSI block driverRonnie Sahlberg4-0/+629
This provides built-in support for iSCSI to QEMU. This has the advantage that the iSCSI devices need not be made visible to the host, which is useful if you have very many virtual machines and very many iscsi devices. It also has the benefit that non-root users of QEMU can access iSCSI devices across the network without requiring root privilege on the host. This driver interfaces with the multiplatform posix library for iscsi initiator/client access to iscsi devices hosted at git://github.com/sahlberg/libiscsi.git The patch adds the driver to interface with the iscsi library. It also updated the configure script to * by default, probe is libiscsi is available and if so, build qemu against libiscsi. * --enable-libiscsi Force a build against libiscsi. If libiscsi is not available the build will fail. * --disable-libiscsi Do not link against libiscsi, even if it is available. When linked with libiscsi, qemu gains support to access iscsi resources such as disks and cdrom directly, without having to make the devices visible to the host. You can specify devices using a iscsi url of the form : iscsi://[<username>[:<password>@]]<host>[:<port]/<target-iqn-name>/<lun> When using authentication, the password can optionally be set with LIBISCSI_CHAP_PASSWORD="password" to avoid it showing up in the process list Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-27Merge branch 'rth/vis2' of git://repo.or.cz/qemu/rthBlue Swirl11-1043/+1400
* 'rth/vis2' of git://repo.or.cz/qemu/rth: target-sparc: Implement FALIGNDATA inline. target-sparc: Implement BMASK/BSHUFFLE. target-sparc: Implement ALIGNADDR* inline. target-sparc: Implement EDGE* instructions. target-sparc: Implement fpack{16,32,fix}. target-sparc: Implement PDIST. target-sparc: Do exceptions management fully inside the helpers. target-sparc: Change fpr representation to doubles. target-sparc: Undo cpu_fpr rename. target-sparc: Extract float128 move to a function. target-sparc: Extract common code for floating-point operations. target-sparc: Make FPU/VIS helpers const when possible. target-sparc: Pass float64 parameters instead of dt0/1 temporaries. target-sparc: Add accessors for double-precision fpr access. target-sparc: Mark fprs dirty in store accessor. target-sparc: Add accessors for single-precision fpr access.
2011-10-27Merge branch 'target-arm.for-upstream' of ↵Andrzej Zaborowski8-12/+760
git://git.linaro.org/people/pmaydell/qemu-arm