From: John Snow <jsnow@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH 1/4] macio: use the existing IDEDMA aiocb to hold the active DMA aiocb
Date: Wed, 6 Jan 2016 16:09:46 -0500 [thread overview]
Message-ID: <568D829A.1080002@redhat.com> (raw)
In-Reply-To: <1452112646-15969-2-git-send-email-mark.cave-ayland@ilande.co.uk>
On 01/06/2016 03:37 PM, Mark Cave-Ayland wrote:
> Currently the aiocb is held within MACIOIDEState, however the IDE core code
> assumes that the current actvie DMA aiocb is held in aiocb in a few places,
> e.g. ide_bus_reset() and ide_reset().
>
> Switch over to using IDEDMA aiocb to store the aiocb for the current active
> DMA request so that bus resets and restarts are handled correctly. As a
> consequence we can now use ide_set_inactive() rather than handling its
> functionality ourselves.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
> hw/ide/macio.c | 20 ++++++++++++--------
> hw/ppc/mac.h | 1 -
> 2 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/hw/ide/macio.c b/hw/ide/macio.c
> index 3ee962f..560c071 100644
> --- a/hw/ide/macio.c
> +++ b/hw/ide/macio.c
> @@ -119,8 +119,8 @@ static void pmac_dma_read(BlockBackend *blk,
> MACIO_DPRINTF("--- Block read transfer - sector_num: %" PRIx64 " "
> "nsector: %x\n", (offset >> 9), (bytes >> 9));
>
> - m->aiocb = blk_aio_readv(blk, (offset >> 9), &io->iov, (bytes >> 9),
> - cb, io);
> + s->bus->dma->aiocb = blk_aio_readv(blk, (offset >> 9), &io->iov,
> + (bytes >> 9), cb, io);
> }
>
> static void pmac_dma_write(BlockBackend *blk,
> @@ -204,8 +204,8 @@ static void pmac_dma_write(BlockBackend *blk,
> MACIO_DPRINTF("--- Block write transfer - sector_num: %" PRIx64 " "
> "nsector: %x\n", (offset >> 9), (bytes >> 9));
>
> - m->aiocb = blk_aio_writev(blk, (offset >> 9), &io->iov, (bytes >> 9),
> - cb, io);
> + s->bus->dma->aiocb = blk_aio_writev(blk, (offset >> 9), &io->iov,
> + (bytes >> 9), cb, io);
> }
>
> static void pmac_dma_trim(BlockBackend *blk,
> @@ -231,8 +231,8 @@ static void pmac_dma_trim(BlockBackend *blk,
> s->io_buffer_index += io->len;
> io->len = 0;
>
> - m->aiocb = ide_issue_trim(blk, (offset >> 9), &io->iov, (bytes >> 9),
> - cb, io);
> + s->bus->dma->aiocb = ide_issue_trim(blk, (offset >> 9), &io->iov,
> + (bytes >> 9), cb, io);
> }
>
> static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
> @@ -291,6 +291,8 @@ done:
> } else {
> block_acct_done(blk_get_stats(s->blk), &s->acct);
> }
> +
> + ide_set_inactive(s, false);
> io->dma_end(opaque);
>
> return;
> @@ -307,7 +309,6 @@ static void pmac_ide_transfer_cb(void *opaque, int ret)
>
> if (ret < 0) {
> MACIO_DPRINTF("DMA error: %d\n", ret);
> - m->aiocb = NULL;
> ide_dma_error(s);
> goto done;
> }
> @@ -358,6 +359,8 @@ done:
> block_acct_done(blk_get_stats(s->blk), &s->acct);
> }
> }
> +
> + ide_set_inactive(s, false);
> io->dma_end(opaque);
> }
>
> @@ -395,8 +398,9 @@ static void pmac_ide_transfer(DBDMA_io *io)
> static void pmac_ide_flush(DBDMA_io *io)
> {
> MACIOIDEState *m = io->opaque;
> + IDEState *s = idebus_active_if(&m->bus);
>
> - if (m->aiocb) {
> + if (s->bus->dma->aiocb) {
> blk_drain_all();
> }
> }
> diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
> index e375ed2..ecf7792 100644
> --- a/hw/ppc/mac.h
> +++ b/hw/ppc/mac.h
> @@ -134,7 +134,6 @@ typedef struct MACIOIDEState {
>
> MemoryRegion mem;
> IDEBus bus;
> - BlockAIOCB *aiocb;
> IDEDMA dma;
> void *dbdma;
> bool dma_active;
>
Reviewed-by: John Snow <jsnow@redhat.com>
next prev parent reply other threads:[~2016-01-06 21:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-06 20:37 [Qemu-devel] [PATCH 0/4] ppc: loadvm/savevm fixups for macio/DBDMA Mark Cave-Ayland
2016-01-06 20:37 ` [Qemu-devel] [PATCH 1/4] macio: use the existing IDEDMA aiocb to hold the active DMA aiocb Mark Cave-Ayland
2016-01-06 21:09 ` John Snow [this message]
2016-01-06 20:37 ` [Qemu-devel] [PATCH 2/4] macio: add dma_active to VMStateDescription Mark Cave-Ayland
2016-01-06 20:57 ` John Snow
2016-01-06 21:17 ` Mark Cave-Ayland
2016-01-08 20:55 ` John Snow
2016-01-11 23:41 ` Mark Cave-Ayland
2016-01-14 16:51 ` John Snow
2016-01-14 20:18 ` Mark Cave-Ayland
2016-01-06 20:37 ` [Qemu-devel] [PATCH 3/4] mac_dbdma: add DBDMA controller state " Mark Cave-Ayland
2016-01-06 20:37 ` [Qemu-devel] [PATCH 4/4] cuda: add missing fields " Mark Cave-Ayland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=568D829A.1080002@redhat.com \
--to=jsnow@redhat.com \
--cc=agraf@suse.de \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).