From patchwork Tue Jan 19 17:39:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 8064271 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 64248BEEE5 for ; Tue, 19 Jan 2016 17:41:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAD0E20513 for ; Tue, 19 Jan 2016 17:41:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0E73204E3 for ; Tue, 19 Jan 2016 17:41:27 +0000 (UTC) Received: from localhost ([::1]:38549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaHW-0008H5-TD for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Jan 2016 12:41:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaG8-0005hB-JP for qemu-devel@nongnu.org; Tue, 19 Jan 2016 12:40:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLaG7-00015I-Mr for qemu-devel@nongnu.org; Tue, 19 Jan 2016 12:40:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaG6-00010t-0N; Tue, 19 Jan 2016 12:39:58 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id A3D1A3024BE; Tue, 19 Jan 2016 17:39:57 +0000 (UTC) Received: from scv.usersys.redhat.com (vpn-54-49.rdu2.redhat.com [10.10.54.49]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0JHdq54013984; Tue, 19 Jan 2016 12:39:56 -0500 From: John Snow To: qemu-block@nongnu.org Date: Tue, 19 Jan 2016 12:39:50 -0500 Message-Id: <1453225191-11871-6-git-send-email-jsnow@redhat.com> In-Reply-To: <1453225191-11871-1-git-send-email-jsnow@redhat.com> References: <1453225191-11871-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com, John Snow , qemu-devel@nongnu.org, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v2 5/6] ide: Add silent DRQ cancellation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Split apart the ide_transfer_stop function into two versions: one that interrupts and one that doesn't. The one that doesn't can be used to halt any PIO transfers that are in the DRQ phase. It will not halt any PIO transfers that are currently in the process of buffering data for the guest to read. Signed-off-by: John Snow --- hw/ide/core.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index cf0b5ec..9bc8e58 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -486,13 +486,26 @@ static void ide_cmd_done(IDEState *s) } } -void ide_transfer_stop(IDEState *s) +static void ide_transfer_halt(IDEState *s, void(*etf)(IDEState *), bool notify) { - s->end_transfer_func = ide_transfer_stop; + s->end_transfer_func = etf; s->data_ptr = s->io_buffer; s->data_end = s->io_buffer; s->status &= ~DRQ_STAT; - ide_cmd_done(s); + if (notify) { + ide_cmd_done(s); + } +} + +void ide_transfer_stop(IDEState *s) +{ + ide_transfer_halt(s, ide_transfer_stop, true); +} + +__attribute__((__unused__)) +static void ide_transfer_cancel(IDEState *s) +{ + ide_transfer_halt(s, ide_transfer_cancel, false); } int64_t ide_get_sector(IDEState *s)