[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL for-2.2 03/11] ahci: unify sglist preparation
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL for-2.2 03/11] ahci: unify sglist preparation |
Date: |
Fri, 14 Nov 2014 11:05:49 +0000 |
From: John Snow <address@hidden>
The intent of this patch is to further unify the creation and
deletion of the sglist used for all AHCI transfers, including
emulated PIO, ATAPI R/W, and native DMA R/W.
By replacing ahci_start_transfer's call to ahci_populate_sglist
with ahci_dma_prepare_buf, we reduce the number of direct calls
where we manipulate the scatter-gather list in the AHCI code.
To make this switch, the constant "0" passed as an offset
in ahci_dma_prepare_buf is adjusted to use io_buffer_offset.
For DMA pathways, this has no effect: io_buffer_offset is always
updated to 0 at the beginning of a DMA transfer loop regardless.
DMA pathways through ide_dma_cb() update the io_buffer_offset
accordingly, and for circumstances where we might make several
trips through this loop, this may actually correct a design flaw.
For PIO pathways, the newly updated ahci_dma_prepare_buf will
now prepare the sglist at the correct offset. It will also set
io_buffer_size, but this is not used in the cmd_read_pio or
cmd_write_pio pathways.
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/ide/ahci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index dbd6773..28aa105 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1093,7 +1093,7 @@ static void ahci_start_transfer(IDEDMA *dma)
goto out;
}
- if (!ahci_populate_sglist(ad, &s->sg, s->io_buffer_offset)) {
+ if (ahci_dma_prepare_buf(dma, is_write)) {
has_sglist = 1;
}
@@ -1145,7 +1145,7 @@ static int ahci_dma_prepare_buf(IDEDMA *dma, int is_write)
AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
IDEState *s = &ad->port.ifs[0];
- ahci_populate_sglist(ad, &s->sg, 0);
+ ahci_populate_sglist(ad, &s->sg, s->io_buffer_offset);
s->io_buffer_size = s->sg.size;
DPRINTF(ad->port_no, "len=%#x\n", s->io_buffer_size);
--
2.1.0
- [Qemu-devel] [PULL for-2.2 00/11] Block patches, Stefan Hajnoczi, 2014/11/14
- [Qemu-devel] [PULL for-2.2 01/11] ahci: Fix byte count regression for ATAPI/PIO, Stefan Hajnoczi, 2014/11/14
- [Qemu-devel] [PULL for-2.2 02/11] ide: repair PIO transfers for cases where nsector > 1, Stefan Hajnoczi, 2014/11/14
- [Qemu-devel] [PULL for-2.2 03/11] ahci: unify sglist preparation,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL for-2.2 04/11] ide: Correct handling of malformed/short PRDTs, Stefan Hajnoczi, 2014/11/14
- [Qemu-devel] [PULL for-2.2 05/11] ahci: add is_ncq predicate helper, Stefan Hajnoczi, 2014/11/14
- [Qemu-devel] [PULL for-2.2 06/11] ahci: Fix FIS decomposition, Stefan Hajnoczi, 2014/11/14
- [Qemu-devel] [PULL for-2.2 07/11] ahci: Reorder error cases in handle_cmd, Stefan Hajnoczi, 2014/11/14
- [Qemu-devel] [PULL for-2.2 08/11] ahci: Check cmd_fis[1] more explicitly, Stefan Hajnoczi, 2014/11/14
- [Qemu-devel] [PULL for-2.2 09/11] ahci: factor out FIS decomposition from handle_cmd, Stefan Hajnoczi, 2014/11/14
- [Qemu-devel] [PULL for-2.2 10/11] block: Fix max nb_sectors in bdrv_make_zero, Stefan Hajnoczi, 2014/11/14
- [Qemu-devel] [PULL for-2.2 11/11] vmdk: Leave bdi intact if -ENOTSUP in vmdk_get_info, Stefan Hajnoczi, 2014/11/14
- Re: [Qemu-devel] [PULL for-2.2 00/11] Block patches, Peter Maydell, 2014/11/14