From nobody Tue Feb 10 19:14:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528312496103685.4372847040155; Wed, 6 Jun 2018 12:14:56 -0700 (PDT) Received: from localhost ([::1]:54159 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQdtT-0004hL-VJ for importer@patchew.org; Wed, 06 Jun 2018 15:14:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQdop-0000jU-S1 for qemu-devel@nongnu.org; Wed, 06 Jun 2018 15:10:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQdoo-0000lA-6e for qemu-devel@nongnu.org; Wed, 06 Jun 2018 15:10:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60626 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fQdoi-0000eR-U1; Wed, 06 Jun 2018 15:09:57 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 895C04075729; Wed, 6 Jun 2018 19:09:56 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-177.bos.redhat.com [10.18.17.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FAB3202699A; Wed, 6 Jun 2018 19:09:56 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Wed, 6 Jun 2018 15:09:51 -0400 Message-Id: <20180606190955.20845-4-jsnow@redhat.com> In-Reply-To: <20180606190955.20845-1-jsnow@redhat.com> References: <20180606190955.20845-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 06 Jun 2018 19:09:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 06 Jun 2018 19:09:56 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 3/7] ide: push end_transfer_func out of start_transfer callback, rename callback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini Now that end_transfer_func is a tail call in ahci_start_transfer, formalize the fact that the callback (of which ahci_start_transfer is the sole implementation) takes care of the transfer too: rename it to pio_transfer and, if it is present, call the end_transfer_func as soon as it returns. Signed-off-by: Paolo Bonzini Signed-off-by: John Snow --- hw/ide/ahci.c | 13 ++++++------- hw/ide/core.c | 8 +++++--- hw/ide/trace-events | 2 +- include/hw/ide/internal.h | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 5871333686..89127f5fb6 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1279,8 +1279,8 @@ out: return 0; } =20 -/* DMA dev <-> ram */ -static void ahci_start_transfer(IDEDMA *dma) +/* Transfer PIO data between RAM and device */ +static void ahci_pio_transfer(IDEDMA *dma) { AHCIDevice *ad =3D DO_UPCAST(AHCIDevice, dma, dma); IDEState *s =3D &ad->port.ifs[0]; @@ -1304,9 +1304,9 @@ static void ahci_start_transfer(IDEDMA *dma) has_sglist =3D 1; } =20 - trace_ahci_start_transfer(ad->hba, ad->port_no, is_write ? "writ" : "r= ead", - size, is_atapi ? "atapi" : "ata", - has_sglist ? "" : "o"); + trace_ahci_pio_transfer(ad->hba, ad->port_no, is_write ? "writ" : "rea= d", + size, is_atapi ? "atapi" : "ata", + has_sglist ? "" : "o"); =20 if (has_sglist && size) { if (is_write) { @@ -1321,7 +1321,6 @@ static void ahci_start_transfer(IDEDMA *dma) out: /* declare that we processed everything */ s->data_ptr =3D s->data_end; - s->end_transfer_func(s); } =20 static void ahci_start_dma(IDEDMA *dma, IDEState *s, @@ -1437,7 +1436,7 @@ static const IDEDMAOps ahci_dma_ops =3D { .start_dma =3D ahci_start_dma, .restart =3D ahci_restart, .restart_dma =3D ahci_restart_dma, - .start_transfer =3D ahci_start_transfer, + .pio_transfer =3D ahci_pio_transfer, .prepare_buf =3D ahci_dma_prepare_buf, .commit_buf =3D ahci_commit_buf, .rw_buf =3D ahci_dma_rw_buf, diff --git a/hw/ide/core.c b/hw/ide/core.c index cc9ca28c33..1a6cb337bf 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -526,16 +526,18 @@ static void ide_clear_retry(IDEState *s) void ide_transfer_start(IDEState *s, uint8_t *buf, int size, EndTransferFunc *end_transfer_func) { - s->end_transfer_func =3D end_transfer_func; s->data_ptr =3D buf; s->data_end =3D buf + size; ide_set_retry(s); if (!(s->status & ERR_STAT)) { s->status |=3D DRQ_STAT; } - if (s->bus->dma->ops->start_transfer) { - s->bus->dma->ops->start_transfer(s->bus->dma); + if (!s->bus->dma->ops->pio_transfer) { + s->end_transfer_func =3D end_transfer_func; + return; } + s->bus->dma->ops->pio_transfer(s->bus->dma); + end_transfer_func(s); } =20 static void ide_cmd_done(IDEState *s) diff --git a/hw/ide/trace-events b/hw/ide/trace-events index 5c0e59ec42..153a7a62c9 100644 --- a/hw/ide/trace-events +++ b/hw/ide/trace-events @@ -101,7 +101,7 @@ handle_cmd_badport(void *s, int port) "ahci(%p)[%d]: gu= est accessed unused port" handle_cmd_badfis(void *s, int port) "ahci(%p)[%d]: guest provided an inva= lid cmd FIS" handle_cmd_badmap(void *s, int port, uint64_t len) "ahci(%p)[%d]: dma_memo= ry_map failed, 0x%02"PRIx64" !=3D 0x80" handle_cmd_unhandled_fis(void *s, int port, uint8_t b0, uint8_t b1, uint8_= t b2) "ahci(%p)[%d]: unhandled FIS type. cmd_fis: 0x%02x-%02x-%02x" -ahci_start_transfer(void *s, int port, const char *rw, uint32_t size, cons= t char *tgt, const char *sgl) "ahci(%p)[%d]: %sing %d bytes on %s w/%s sgli= st" +ahci_pio_transfer(void *s, int port, const char *rw, uint32_t size, const = char *tgt, const char *sgl) "ahci(%p)[%d]: %sing %d bytes on %s w/%s sglist" ahci_start_dma(void *s, int port) "ahci(%p)[%d]: start dma" ahci_dma_prepare_buf(void *s, int port, int32_t io_buffer_size, int32_t li= mit) "ahci(%p)[%d]: prepare buf limit=3D%"PRId32" prepared=3D%"PRId32 ahci_dma_prepare_buf_fail(void *s, int port) "ahci(%p)[%d]: sglist populat= ion failed" diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 88212f59df..f3de6f9b73 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -444,7 +444,7 @@ struct IDEState { =20 struct IDEDMAOps { DMAStartFunc *start_dma; - DMAVoidFunc *start_transfer; + DMAVoidFunc *pio_transfer; DMAInt32Func *prepare_buf; DMAu32Func *commit_buf; DMAIntFunc *rw_buf; --=20 2.14.3