From patchwork Thu Apr 7 08:46:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 90144 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 40BEDB6F72 for ; Thu, 7 Apr 2011 18:51:17 +1000 (EST) Received: from localhost ([127.0.0.1]:32970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7kvq-0004KK-54 for incoming@patchwork.ozlabs.org; Thu, 07 Apr 2011 04:51:14 -0400 Received: from [140.186.70.92] (port=58091 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7krd-0002vw-9E for qemu-devel@nongnu.org; Thu, 07 Apr 2011 04:46:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7krb-0003Tx-7m for qemu-devel@nongnu.org; Thu, 07 Apr 2011 04:46:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7kra-0003TQ-Uz for qemu-devel@nongnu.org; Thu, 07 Apr 2011 04:46:51 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p378kkWQ001043 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 7 Apr 2011 04:46:47 -0400 Received: from localhost (ovpn-113-77.phx2.redhat.com [10.3.113.77]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p378kiBt012835; Thu, 7 Apr 2011 04:46:45 -0400 From: Amit Shah To: qemu list Date: Thu, 7 Apr 2011 14:16:22 +0530 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Gleb Natapov , Juan Quintela , Stefan Hajnoczi , Markus Armbruster , Amit Shah , Paolo Bonzini Subject: [Qemu-devel] [PATCH v3 1/2] cdrom: Allow the TEST_UNIT_READY command after a cdrom change X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We restrict the commands that a guest can send us after a cdrom change event. The current list includes REQUEST_SENSE and INQUIRY commands. Guests can also issue TEST_UNIT_READY to inquire for the status, so allow this command as well. This also gets rid of one cause of the HSM violation errors in Linux guests. Those errors came up because we had the UNIT_ATTENTION event pending and we replied with an error message to a command that should be allowed in such a condition. The guest then did a soft reset to get to a sane state. Signed-off-by: Amit Shah --- hw/ide/core.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index 007a4ee..d55d804 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1105,10 +1105,11 @@ static void ide_atapi_cmd(IDEState *s) /* If there's a UNIT_ATTENTION condition pending, only REQUEST_SENSE and INQUIRY commands are allowed to complete. */ if (s->sense_key == SENSE_UNIT_ATTENTION && - s->io_buffer[0] != GPCMD_REQUEST_SENSE && - s->io_buffer[0] != GPCMD_INQUIRY) { - ide_atapi_cmd_check_status(s); - return; + s->io_buffer[0] != GPCMD_REQUEST_SENSE && + s->io_buffer[0] != GPCMD_INQUIRY && + s->io_buffer[0] != GPCMD_TEST_UNIT_READY) { + ide_atapi_cmd_check_status(s); + return; } switch(s->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: