All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Russell King <rmk@arm.linux.org.uk>, linux-ide@vger.kernel.org
Subject: Re: 2.6.32: Promise UDMA33 card refuses to work in UDMA mode
Date: Mon, 04 Jan 2010 11:32:39 -0500	[thread overview]
Message-ID: <4B421827.6050308@garzik.org> (raw)
In-Reply-To: <20100104154607.0b6e51dd@lxorguk.ukuu.org.uk>

On 01/04/2010 10:46 AM, Alan Cox wrote:
>> Without AltStatus, you would not be able to check and see if a command
>> is complete...  pretty much by definition you should able to access that
>
> Correct - and you may not make that check for 400nS after the command is
> issued. The old IDE code enforces this (I know because I added it to fix
> real problems as PC's got fast enough to go from write to IRQ in 400nS)
>
>> It is certainly conceivable that this is a problem on a rare controller
>> or two, but in general, AltStatus is how you poll for DMA completion.
>> You are allowed to hit it during a DMA transfer.
>
> But not for 400nS after a command is issued, or on certain old
> controllers during a DMA transfer before you halt it.
>
>> HOWEVER, accessing AltStatus prior to the 400ns post-exec-command period
>> is potentially an area of undefined behavior.  Changing this code is
>> only a problem for MMIO-based controllers, which use the AltStatus read
>> to guarantee that the 400ns delay occurs outside any posted writes.
>
> Certainly for pio interfaces we should use ndelay(400). All our MMIO
> controllers are SATA and that's a different world anyway, including the
> fact that an altstatus read isn't going to produce a timing delay !
> Basically we know ndelay(400) works.

I think you misunderstood the "Changing this code..." sentence.  I make 
no claim, nor is there code, that says AltStatus produces the necessary 
400ns delay.

To rephrase/repeat, the AltStatus read in ata_sff_pause() exists to 
ensure that any previous posted MMIO writes -- most notably the taskfile 
registers we just wrote -- are flushed from CPU and PCI bridges etc. to 
the ATA host controller chip.

After the AltStatus read is executed, the delay is executed.  Here is 
the libata implementation, in its entirety:

	void ata_sff_pause(struct ata_port *ap)
	{
	        ata_sff_sync(ap); /* dummy AltStatus register read */
	        ndelay(400);
	}

On MMIO, you cannot guarantee that ndelay(400) occurs after the ATA 
Command register is written, without some method of ensuring that all 
posted writes are flushed.  Typically, this is done by a dummy register 
read of some worthless register -- AltStatus was used in this case.

Absent that, ndelay(400) could occur in _parallel_ with the posted 
taskfile writes, essentially eliminating the spec-required delay.

Thus,

(1a)  The solution for non-MMIO controllers is obvious and easy: remove 
the dummy AltStatus register read, as Russell has done in his test patch.

(1b)  The solution for MMIO controllers is a bit more complex:  replace 
the dummy AltStatus register read with something else.


> SIL680 is MMIO in the old IDE stack but the hardware appears to be doing
> the required magic itself.

You cannot draw such a conclusion from looking only at the SIL680 chip. 
   SIL680 might easily be behind a PCI bridge.

	Jeff



  reply	other threads:[~2010-01-04 16:32 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-24 18:13 2.6.32: Promise UDMA33 card refuses to work in UDMA mode Russell King
2009-12-24 21:54 ` Russell King
2010-01-03  0:23   ` Russell King
2010-01-03  3:08     ` Robert Hancock
2010-01-03 10:05       ` Russell King
2010-01-03 11:40         ` Alan Cox
2010-01-03 22:35     ` [PATCH] Fix Promise UDMA33 IDE driver (pdc202xx_old) Russell King
2010-01-04 19:14       ` Sergei Shtylyov
2010-01-05  6:26         ` David Miller
2010-01-05 17:49           ` Russell King
2010-01-05 17:52             ` Sergei Shtylyov
2010-01-03 23:46     ` 2.6.32: Promise UDMA33 card refuses to work in UDMA mode Russell King
2010-01-04 10:37       ` Alan Cox
2010-01-04 13:30         ` Russell King
2010-01-04 15:16           ` Alan Cox
2010-01-04 15:32             ` Jeff Garzik
2010-01-04 15:44               ` Russell King
2010-01-04 15:55                 ` Alan Cox
2010-01-04 16:15                   ` Russell King
2010-01-04 16:48                     ` Jeff Garzik
2010-01-04 17:16                     ` Sergei Shtylyov
2010-01-04 15:48               ` Alan Cox
2010-01-04 15:25           ` Jeff Garzik
2010-01-04 15:42             ` Russell King
2010-01-05  2:06               ` Robert Hancock
2010-01-05 11:25                 ` Alan Cox
2010-01-05 13:00                   ` Jeff Garzik
2010-01-05 13:37                     ` Alan Cox
2010-01-05 13:11                 ` Jeff Garzik
2010-01-04 15:46             ` Alan Cox
2010-01-04 16:32               ` Jeff Garzik [this message]
2010-01-04 17:02                 ` Alan Cox
2010-01-04 17:27                   ` Jeff Garzik
2010-01-04 17:30                     ` Russell King
2010-01-04 18:03                       ` Jeff Garzik
2010-01-04 18:06                         ` Russell King
2010-01-04 18:35                           ` Jeff Garzik
2010-01-04 17:38                     ` Alan Cox
2010-01-04 18:07                       ` Jeff Garzik
2010-01-04 18:29                   ` Jeff Garzik
2010-01-04 16:31           ` Bartlomiej Zolnierkiewicz
2010-01-04 17:28             ` Russell King
2010-01-04 17:39               ` Alan Cox
2010-01-04 17:46                 ` Russell King
2010-01-04 18:20                   ` Alan Cox
2010-01-04 17:49                 ` Bartlomiej Zolnierkiewicz
2010-01-05  1:03           ` Robert Hancock
2010-01-05 10:04             ` Jeff Garzik
2010-01-05 17:44             ` Russell King
2010-01-06  0:30               ` Robert Hancock

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=4B421827.6050308@garzik.org \
    --to=jeff@garzik.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-ide@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.