From patchwork Tue Dec 9 18:15:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 419212 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6A75114003E for ; Wed, 10 Dec 2014 05:17:14 +1100 (AEDT) Received: from localhost ([::1]:41798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyPLU-0000cC-J2 for incoming@patchwork.ozlabs.org; Tue, 09 Dec 2014 13:17:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyPJk-0006rJ-IV for qemu-devel@nongnu.org; Tue, 09 Dec 2014 13:15:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyPJZ-00070f-Uw for qemu-devel@nongnu.org; Tue, 09 Dec 2014 13:15:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyPJZ-00070V-Nw for qemu-devel@nongnu.org; Tue, 09 Dec 2014 13:15:13 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB9IFCeC031242 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 9 Dec 2014 13:15:13 -0500 Received: from dgilbert-t530.redhat.com (ovpn-116-114.ams2.redhat.com [10.36.116.114]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB9IF9Fa017567; Tue, 9 Dec 2014 13:15:11 -0500 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Tue, 9 Dec 2014 18:15:08 +0000 Message-Id: <1418148909-19870-2-git-send-email-dgilbert@redhat.com> In-Reply-To: <1418148909-19870-1-git-send-email-dgilbert@redhat.com> References: <1418148909-19870-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, jsnow@redhat.com Subject: [Qemu-devel] [PATCH 1/2] Restore atapi_dma flag across migration 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Dr. David Alan Gilbert" If a migration happens just after the guest has kicked off an ATAPI command and kicked off DMA, we lose the atapi_dma flag, and the destination tries to complete the command as PIO rather than DMA. This upsets Linux; modern libata based kernels stumble and recover OK, older kernels end up passing bad data to userspace. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: John Snow --- hw/ide/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ide/core.c b/hw/ide/core.c index d4af5e2..ac3f015 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2417,6 +2417,7 @@ static int ide_drive_pio_post_load(void *opaque, int version_id) s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx]; s->data_ptr = s->io_buffer + s->cur_io_buffer_offset; s->data_end = s->data_ptr + s->cur_io_buffer_len; + s->atapi_dma = s->feature & 1; /* as per cmd_packet */ return 0; }