From: Tejun Heo <htejun@gmail.com>
To: Daniel Beichl <daniel_beichl@gmx.net>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH] Re: 2.6.19.1, sata_sil: sata dvd writer doesn't work
Date: Mon, 07 May 2007 10:24:25 +0200 [thread overview]
Message-ID: <463EE239.8060709@gmail.com> (raw)
In-Reply-To: <463B7903.4070206@gmx.net>
[-- Attachment #1: Type: text/plain, Size: 2576 bytes --]
Hello, Daniel.
Daniel Beichl wrote:
>> Okay, I've been thinking about it for some time. I think I know what's
>> going on now. Those authentication related commands are issued by
>> invoking ioctls on the device node. The cdrom driver receives the
>> ioctls and issues respective SCSI commands for it. All those DVD auth
>> commands either transfer or receive data from the device and thus
>> specifies certain data direction when they're issued. libata selects
>> command protocol accordingly.
>>
>> It's all good and dandy till now but the problem is that those commands
>> can be issued with data length of zero! This is allowed by the SCSI MMC
>> standard and used to probe whether the command succeeds or not before
>> taking further actions. When this happens, libata chooses command
>> protocol according to the data direction, but has to feed 0-length data
>> to the DMA engine. It seems sata_sil dma engine barfs if that happens.
>> Can you please add the following code snippet at the head of
>> atapi_xlat()?
>>
>> if (!nodata && !qc->nbytes) {
>> printk("XXX forcing PIO for 0 length data cdb %02x\n",
>> scmd->cmnd[0]);
>> dump_stack();
>> using_pio = 1;
>> }
>>
>> Also, do you mind cc'ing linux-ide@vger.kernel.org?
>>
>>
> Hi Tejun,
>
>
> i inserted the code snippet you mentioned to atapi_xlat() in libata-scsi.c
> and the dvd authentication succeeds.
>
> Please see the attached dmesg file for the generated stack dumps.
Good to know it works. :-)
> The question is whether this is the right place to fix it, as this seems
> to limit all
> drivers to pio if a zero data length command is transferred.
> It would make more sense to me if the individual driver decides this by
> performing a similar check in the check_atapi_dma function implemented
> by the
> individual driver. I did this for the sata_sil driver in the attached
> patch.
The thing is that those commands don't transfer any data at all, so it
doesn't really matter whether the data phase is specified as DMA or PIO.
ATA_PROT_ATAPI degenerates into ATA_PROT_ATAPI_NODATA if there is no
data to transfer (in ATA spec they share the same protocol state machine
and the data request status bit dictates what actually happens).
I think this actually should be fixed in the cdrom driver. It shouldn't
issue data command with 0 data length with data protocol. Can you test
whether the attached patch works? Also, it seems we'll need to add a
WARN_ON() in sr such that bugs like this can be caught more easily.
Thanks.
--
tejun
[-- Attachment #2: DATA_NONE-if-len-zero.patch --]
[-- Type: text/x-patch, Size: 511 bytes --]
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index b36f44d..5a5639d 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -1533,7 +1533,10 @@ void init_cdrom_command(struct packet_co
memset(buf, 0, len);
cgc->buffer = (char *) buf;
cgc->buflen = len;
- cgc->data_direction = type;
+ if (len)
+ cgc->data_direction = type;
+ else
+ cgc->data_direction = CGC_DATA_NONE;
cgc->timeout = CDROM_DEF_TIMEOUT;
}
next prev parent reply other threads:[~2007-05-07 8:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <46362672.7080103@gmx.net>
[not found] ` <4636EA85.40809@t-online.de>
[not found] ` <46371628.9060905@gmail.com>
[not found] ` <46379CA1.601@t-online.de>
[not found] ` <463AEAF9.3000103@gmail.com>
2007-05-04 17:32 ` [PATCH] Re: 2.6.19.1, sata_sil: sata dvd writer doesn't work Harald Dunkel
2007-05-07 10:29 ` Tejun Heo
2007-05-07 18:21 ` Harald Dunkel
2007-05-08 14:27 ` Tejun Heo
2007-05-09 17:37 ` Harald Dunkel
2007-05-10 13:00 ` Tejun Heo
2007-05-10 20:27 ` Harald Dunkel
2007-05-11 8:33 ` Tejun Heo
2007-05-15 17:38 ` Harald Dunkel
2007-06-06 4:38 ` Harald Dunkel
2007-06-19 7:24 ` Tejun Heo
[not found] ` <4636DCA9.9050803@gmail.com>
[not found] ` <4636FBB7.3030605@gmx.net>
[not found] ` <463AE631.9030701@gmail.com>
2007-05-04 18:18 ` Daniel Beichl
2007-05-07 8:24 ` Tejun Heo [this message]
[not found] ` <463F634E.2070103@gmx.net>
2007-05-08 14:42 ` Tejun Heo
2007-05-08 14:51 ` Alan Cox
2007-05-08 14:52 ` Tejun Heo
2007-05-25 3:23 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=463EE239.8060709@gmail.com \
--to=htejun@gmail.com \
--cc=daniel_beichl@gmx.net \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).