From patchwork Wed Feb 10 19:37:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 8274221 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 A9207BEEE5 for ; Wed, 10 Feb 2016 19:38:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1EA43203A4 for ; Wed, 10 Feb 2016 19:38: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 6FE442012E for ; Wed, 10 Feb 2016 19:38:27 +0000 (UTC) Received: from localhost ([::1]:42423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTaal-00080S-F6 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 10 Feb 2016 14:38:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTaad-0007zz-2B for qemu-devel@nongnu.org; Wed, 10 Feb 2016 14:38:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTaac-00032k-AT for qemu-devel@nongnu.org; Wed, 10 Feb 2016 14:38:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTaac-00032d-4e for qemu-devel@nongnu.org; Wed, 10 Feb 2016 14:38:14 -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 (Postfix) with ESMTPS id A87273A117E; Wed, 10 Feb 2016 19:38:13 +0000 (UTC) Received: from scv.usersys.redhat.com (vpn-56-231.rdu2.redhat.com [10.10.56.231]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1AJc9A9016300; Wed, 10 Feb 2016 14:38:13 -0500 From: John Snow To: qemu-devel@nongnu.org Date: Wed, 10 Feb 2016 14:37:59 -0500 Message-Id: <1455133089-31903-3-git-send-email-jsnow@redhat.com> In-Reply-To: <1455133089-31903-1-git-send-email-jsnow@redhat.com> References: <1455133089-31903-1-git-send-email-jsnow@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: peter.maydell@linaro.org, jsnow@redhat.com Subject: [Qemu-devel] [PULL 01/11] 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 Reported-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi Message-id: 1453225191-11871-2-git-send-email-jsnow@redhat.com --- 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 4c46453..88d5fab 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1877,9 +1877,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);