From patchwork Tue Jan 19 17:39:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 8064251 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6105C9F1CC for ; Tue, 19 Jan 2016 17:40:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CDBC720450 for ; Tue, 19 Jan 2016 17:40:10 +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 29FA520265 for ; Tue, 19 Jan 2016 17:40:10 +0000 (UTC) Received: from localhost ([::1]:38531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaGH-0005hz-HG for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Jan 2016 12:40:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaG6-0005d7-Fj for qemu-devel@nongnu.org; Tue, 19 Jan 2016 12:39:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLaG5-00010c-Jd for qemu-devel@nongnu.org; Tue, 19 Jan 2016 12:39:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLaG2-0000z5-Ci; Tue, 19 Jan 2016 12:39:54 -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 0C39EC0ED3EC; Tue, 19 Jan 2016 17:39:54 +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 u0JHdq50013984; Tue, 19 Jan 2016 12:39:53 -0500 From: John Snow To: qemu-block@nongnu.org Date: Tue, 19 Jan 2016 12:39:46 -0500 Message-Id: <1453225191-11871-2-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 1/6] ide: Prohibit RESET on IDE drives 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 This command is meant for ATAPI devices only, prohibit acknowledging it with a command aborted response when an IDE device is busy. Signed-off-by: John Snow --- hw/ide/core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index da3baab..d121f3d 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1876,9 +1876,13 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) return; } - /* Only DEVICE RESET is allowed while BSY or/and DRQ are set */ - if ((s->status & (BUSY_STAT|DRQ_STAT)) && val != WIN_DEVICE_RESET) - return; + /* Only RESET is allowed while BSY and/or DRQ are set, + * and only to ATAPI devices. */ + if (s->status & (BUSY_STAT|DRQ_STAT)) { + if (val != WIN_DEVICE_RESET || s->drive_kind != IDE_CD) { + return; + } + } if (!ide_cmd_permitted(s, val)) { ide_abort_command(s);