mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <petkovbb@googlemail.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Michael Roth <mroth@nessie.de>, linux-kernel@vger.kernel.org
Subject: Re: Bug in 2.6.29 ide-cd: Kernel freeze: bisected + unacceptable workaround
Date: Tue, 31 Mar 2009 09:45:08 +0200	[thread overview]
Message-ID: <20090331074508.GA16403@liondog.tnic> (raw)
In-Reply-To: <200903302228.54601.bzolnier@gmail.com>

Hi,

> > @Bart: can you take at look at this. Somehow, if the device is behind a
> > PCI IDE controller, the order of issuing the command and enabling DMA is
> > important. Seen something like that before?
> 
> Spec is unclear on the ordering but empirically it seems that some hosts
> may need packet command to start DMA.  I think that we should proceed with
> your patch (please repost with patch description) and also apply the same
> change to the rest of ATAPI devices in a subsequent patch.

Why two patches, do we really need to differentiate between ide-cd and
other ATAPI devices? Besides the patch is so simple: 4 lines moved up.
Anyway, I lightly tested it with ide-cd and ide-floppy and both seem to
take it ok. Also, if I remember correctly, the original ide-cd behavior
was to issue the command and _then_ start DMA so we're back to that. I
guess now we should be concerned whether the other ATAPI devices can
handle the reverse situation where you first issue a command and _then_
start DMA.. Hmm...

--
From: Borislav Petkov <petkovbb@gmail.com>
Date: Tue, 31 Mar 2009 09:36:44 +0200
Subject: [PATCH] ide-atapi: start DMA after issuing a packet command
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Apparently¹, some ATAPI devices want to see the packet command first
before enabling DMA otherwise they simply hang indefinitely. Reorder the
two steps and start DMA only after having issued the command first.

[1] http://marc.info/?l=linux-kernel&m=123835520317235&w=2

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
 drivers/ide/ide-atapi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index c139cc7..3e43b88 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -563,6 +563,10 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)
 					     : ide_pc_intr),
 			timeout);
 
+	/* Send the actual packet */
+	if ((drive->atapi_flags & IDE_AFLAG_ZIP_DRIVE) == 0)
+		hwif->tp_ops->output_data(drive, NULL, rq->cmd, cmd_len);
+
 	/* Begin DMA, if necessary */
 	if (dev_is_idecd(drive)) {
 		if (drive->dma)
@@ -574,10 +578,6 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)
 		}
 	}
 
-	/* Send the actual packet */
-	if ((drive->atapi_flags & IDE_AFLAG_ZIP_DRIVE) == 0)
-		hwif->tp_ops->output_data(drive, NULL, rq->cmd, cmd_len);
-
 	return ide_started;
 }
 
-- 
1.6.2.1


-- 
Regards/Gruss,
    Boris.

  reply	other threads:[~2009-03-31  7:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-29 19:25 Michael Roth
2009-03-29 20:13 ` Borislav Petkov
2009-03-29 21:37   ` Michael Roth
2009-03-30  7:27     ` Borislav Petkov
2009-03-30 11:10       ` Michael Roth
2009-03-30 11:38       ` Michael Roth
2009-03-30 11:50         ` Michael Roth
2009-03-30 20:28       ` Bartlomiej Zolnierkiewicz
2009-03-31  7:45         ` Borislav Petkov [this message]
2009-03-31 11:28           ` Alan Cox
2009-03-31 12:35             ` Michael Roth
2009-03-31 14:06               ` Borislav Petkov
2009-03-31 18:01           ` Bartlomiej Zolnierkiewicz

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=20090331074508.GA16403@liondog.tnic \
    --to=petkovbb@googlemail.com \
    --cc=bzolnier@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mroth@nessie.de \
    --cc=petkovbb@gmail.com \
    /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

all inboxes | Powered by JetHome®