diff options
author | Jason Baron <jbaron@redhat.com> | 2012-08-03 15:57:06 -0400 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-08-10 10:25:12 +0200 |
commit | 61f52e06f0a21bab782f98ef3ea789aa6d0aa046 (patch) | |
tree | e60508f702ec2b898782a3bdb5366d2f90ce00fb /hw/ide/internal.h | |
parent | 730a9c53b4e52681fcfe31cf38854cbf91e132c7 (diff) | |
download | qemu-61f52e06f0a21bab782f98ef3ea789aa6d0aa046.zip qemu-61f52e06f0a21bab782f98ef3ea789aa6d0aa046.tar.gz qemu-61f52e06f0a21bab782f98ef3ea789aa6d0aa046.tar.bz2 |
ahci: Fix ahci cdrom read corruptions for reads > 128k
While testing q35, which has its cdrom attached to the ahci controller, I found
that the Fedora 17 install would panic on boot. The panic occurs while
squashfs is trying to read from the cdrom. The errors are:
[ 8.622711] SQUASHFS error: xz_dec_run error, data probably corrupt
[ 8.625180] SQUASHFS error: squashfs_read_data failed to read block
0x20be48a
I was also able to produce corrupt data reads using an installed piix based
qemu machine, using 'dd'. I found that the corruptions were only occuring when
then read size was greater than 128k. For example, the following command
results in corrupted reads:
dd if=/dev/sr0 of=/tmp/blah bs=256k iflag=direct
The > 128k size reads exercise a different code path than 128k and below. In
ide_atapi_cmd_read_dma_cb() s->io_buffer_size is capped at 128k. Thus,
ide_atapi_cmd_read_dma_cb() is called a second time when the read is > 128k.
However, ahci_dma_rw_buf() restart the read from offset 0, instead of at 128k.
Thus, resulting in a corrupted read.
To fix this, I've introduced 'io_buffer_offset' field in IDEState to keep
track of the offset. I've also modified ahci_populate_sglist() to take a new
3rd offset argument, so that the sglist is property initialized.
I've tested this patch using 'dd' testing, and Fedora 17 now correctly boots
and installs on q35 with the cdrom ahci controller.
Signed-off-by: Jason Baron <jbaron@redhat.com>
Tested-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/internal.h')
-rw-r--r-- | hw/ide/internal.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/ide/internal.h b/hw/ide/internal.h index 7170bd9..bf7d313 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -393,6 +393,7 @@ struct IDEState { struct iovec iov; QEMUIOVector qiov; /* ATA DMA state */ + int io_buffer_offset; int io_buffer_size; QEMUSGList sg; /* PIO transfer handling */ |