From: Brandon Philips Subject: [PATCH][RFC] Fix bugs in the ATAPI cdrom driver Date: Wed, 29 Aug 2007 11:08:05 -0700 Message-ID: <20070829180805.GA14210@ifup.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Note: This patch was committed to the qemu CVS already, but I am posting to make sure it gets into KVM also. The new libata-eh in the Linux kernel is throwing a fit over the QEMU cdrom device for two reasons: 1) DRQ can be set with ERR_STAT set. This is a violation of the ATAPI state machine. 2) After a TEST_UNIT_READY ATAPI command ERR_STAT is getting set which is fine. But, when the OS issues another ATAPI command ERR_STAT is still set. Which is bad since the next expected command from the OS is REQUEST_SENSE to find out why ERR_STAT is set. bug this fixes: https://bugzilla.novell.com/show_bug.cgi?id=291775 Signed-off-by: Brandon Philips --- qemu/hw/ide.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) Index: kvm-28/qemu/hw/ide.c =================================================================== --- kvm-28.orig/qemu/hw/ide.c +++ kvm-28/qemu/hw/ide.c @@ -586,7 +586,9 @@ static void ide_transfer_start(IDEState s->end_transfer_func = end_transfer_func; s->data_ptr = buf; s->data_end = buf + size; - s->status |= DRQ_STAT; + /* don't violate the HSM */ + if (!(s->status & ERR_STAT)) + s->status |= DRQ_STAT; } static void ide_transfer_stop(IDEState *s) @@ -1805,6 +1807,7 @@ static void ide_ioport_write(void *opaqu /* overlapping commands not supported */ if (s->feature & 0x02) goto abort_cmd; + s->status = READY_STAT; s->atapi_dma = s->feature & 1; s->nsector = 1; ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE, Reply-To: ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/