Commit Graph

34 Commits

Author SHA1 Message Date
aliguori 274fb0e1ed check SCSI read/write requests against max LBA (Rik van Riel)
The bdrv layer uses a signed offset. Furthermore, block-raw-posix
only seeks when that offset is positive. Passing a negative offset
to block-raw-posix can result in data being written at the current
seek cursor's position.

It may be possible to exploit this to seek to the end of the disk
and extend the virtual disk by writing data to a negative sector
offset.  After a reboot, this could lead to the guest having a
larger disk than it had before.

Close the hole by sanity checking the lba against the size of the
disk.

Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6475 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-29 19:59:04 +00:00
aliguori c1c0438c80 SCSI divide capacity by s->cluster_size (Rik van Riel)
Paul Brook pointed out that the number of sectors reported
by the SCSI read capacity commands needs to be divided by
s->cluster_size, because bdrv_get_geometry reports the number
of 512 byte sectors, while emulated CDROMs report 2048 byte
sectors back to the guest.

This has no consequences for emulated hard disks, which use
a cluster size of 1.

aliguori: fixed typo

Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6469 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-28 21:58:29 +00:00
aliguori 86106e5920 support >2TB SCSI disks (Rik van Riel)
Implement SCSI READ(16), WRITE(16) and SAI READ CAPACITY(16) commands,
so SCSI disks larger than 2TB can work with guests that support these
newer SCSI commands.

The cast to (uint64_t) is needed because otherwise gcc will use a
signed int, which gets sign extended into uint64_t lba, resulting
in bad block numbers for READ 10 and READ 16 with block numbers
larger than 2^31.

Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6468 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-28 21:58:25 +00:00
aliguori e035b43d7c fix signed/unsigned overflows in SCSI disk (Rik van Riel)
Sector numbers can overflow on a virtual scsi disk of over 1TB
in size.  Qemu's bdrv_read expects an int64_t, so fix the overflow
by going to that data type.

On large disks, we clip the capacity to 2TB instead of returning
"capacity modulo 2TB".

Turn sector_count into an unsigned to prevent a signed/unsigned
overflow with SCSI transfers larger than 2TB.  We're unlikely to
ever hit this bug, but fixing it is just one line.

Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6467 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-28 21:58:22 +00:00
aliguori ea8a5d7f1f Stop VM on error in scsi-disk (Gleb Natapov)
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6409 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-22 19:52:21 +00:00
blueswir1 00766a4ec9 Make OpenBSD sparc-softmmu compile warning free
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6299 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-14 18:08:08 +00:00
aliguori fa879c6414 add "serial" parameter to -drive flag (Gleb Natapov)
Windows calculates HW "uniqueness" based on a hard drive serial number
among other things. The patch allows to specify drive serial number
from a command line.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6214 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-07 17:32:33 +00:00
balrog 575750581c SCSI: Handle inquiry commands of varying length (Justin Chevrier).
Openserver 5.0.5 sends an Inquiry command to the emulated SCSI disk
expecting a response length of 40 bytes. Currently the response to an
Inquiry command is hardcoded to 36 bytes. When receiving a response of
length 36 instead of 40 Openserver panics.

Modifications to original patch based on feedback from Ryan Harper and Paul
Brook. Thanks guys.

Signed-off-by: Justin Chevrier <address@hidden>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5903 c046a42c-6fe2-441c-8c8c-71466251a162
2008-12-07 03:12:54 +00:00
blueswir1 22864256db Correct SCSI error reporting (Laurent Vivier)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5455 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-11 09:33:03 +00:00
aurel32 f0f72ffe64 qemu: improve scsi dma speed by increasing the dma buffer size
taken from Xen 17267:f4a92f0db20f, original patch by Samuel Thibault.

Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5385 c046a42c-6fe2-441c-8c8c-71466251a162
2008-10-01 21:46:23 +00:00
blueswir1 5e65a31037 Add rigid and flexible disk geometry page support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4821 c046a42c-6fe2-441c-8c8c-71466251a162
2008-07-02 15:16:18 +00:00
ths 1235fc066a Spelling fixes, by Stefan Weil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4655 c046a42c-6fe2-441c-8c8c-71466251a162
2008-06-03 19:51:57 +00:00
blueswir1 b1fa716443 Revert v4260, breaks Sparc32
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4280 c046a42c-6fe2-441c-8c8c-71466251a162
2008-04-29 16:08:54 +00:00
balrog 47e4ca5abd Fix scsi-disk sense-key/status confusion (Marcelo Tosatti).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4260 c046a42c-6fe2-441c-8c8c-71466251a162
2008-04-26 15:56:05 +00:00
balrog 1d4db89c09 Implement more INQUIRY command replies for scsi disk (Igor Kovalenko).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3955 c046a42c-6fe2-441c-8c8c-71466251a162
2008-02-03 04:05:50 +00:00
balrog 33f002714b Add "cache" parameter to "-drive" (Laurent Vivier).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3848 c046a42c-6fe2-441c-8c8c-71466251a162
2007-12-24 14:33:24 +00:00
ths 96b8f136f5 Fix bdrv_get_geometry to return uint64_t, by Andre Przywara.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3825 c046a42c-6fe2-441c-8c8c-71466251a162
2007-12-17 01:35:20 +00:00
ths 8ccc2ace56 SCSI cleanup, by Laurent Vivier.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3797 c046a42c-6fe2-441c-8c8c-71466251a162
2007-12-10 02:58:34 +00:00
pbrook 87ecb68bdf Break up vl.h.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3674 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-17 17:14:51 +00:00
ths e91c8a7783 Spelling fixes, by Stefan Weil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2927 c046a42c-6fe2-441c-8c8c-71466251a162
2007-06-03 13:35:16 +00:00
ths 67cd24a897 Buffer length fixes, by Wang Cheng Yeh.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2736 c046a42c-6fe2-441c-8c8c-71466251a162
2007-04-28 20:47:59 +00:00
pbrook a917d384ac SCSI TCQ support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2139 c046a42c-6fe2-441c-8c8c-71466251a162
2006-08-29 04:52:16 +00:00
bellard a9f277ba8f no need for bdrv_close()
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2125 c046a42c-6fe2-441c-8c8c-71466251a162
2006-08-19 11:58:10 +00:00
pbrook 35f1df84b6 scsi empty drive fix (Blue Swirl).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2109 c046a42c-6fe2-441c-8c8c-71466251a162
2006-08-14 15:08:12 +00:00
pbrook 4d611c9a2f SCSI and USB async IO support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2107 c046a42c-6fe2-441c-8c8c-71466251a162
2006-08-12 01:04:27 +00:00
pbrook 1aacf3489b Add missing #define.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2092 c046a42c-6fe2-441c-8c8c-71466251a162
2006-08-06 13:27:39 +00:00
pbrook 51c1ebb1bc Fix SCSI off-by-one device size.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2091 c046a42c-6fe2-441c-8c8c-71466251a162
2006-08-06 11:31:06 +00:00
pbrook 7a6cba611d Disk cache flush support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1949 c046a42c-6fe2-441c-8c8c-71466251a162
2006-06-04 11:39:07 +00:00
pbrook 17acfe326c More SCSI commands (Blue Swirl).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1948 c046a42c-6fe2-441c-8c8c-71466251a162
2006-06-03 14:23:34 +00:00
pbrook 7d8406be69 PCI SCSI HBA emulation.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1946 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-30 01:48:12 +00:00
pbrook 0fc5c15a4f SCSI lun probing fix.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1945 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-26 21:53:41 +00:00
pbrook cac782d496 Small read fix.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1944 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-26 18:08:11 +00:00
pbrook 7c22dd5216 Fix scsi sector size confusion (Blue Swirl).
Fix short TOC read.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1942 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-26 16:46:55 +00:00
pbrook 2e5d83bbef Rearrange SCSI disk emulation code.
Add USB mass storage device emulation.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1940 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-25 23:58:51 +00:00