linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Lord <liml@rtr.ca>
To: Tejun Heo <htejun@gmail.com>
Cc: Jeff Garzik <jgarzik@pobox.com>,
	IDE/ATA development list <linux-ide@vger.kernel.org>,
	Alan Cox <alan@redhat.com>
Subject: Re: ata_std_qc_defer not good enough for FIS-based switching ?
Date: Tue, 29 Apr 2008 13:09:56 -0400	[thread overview]
Message-ID: <48175664.5030702@rtr.ca> (raw)
In-Reply-To: <481659B5.7090703@gmail.com>

Tejun Heo wrote:
> Hello, Mark.
> 
> Mark Lord wrote:
>>> Are there controllers which *can* handle such a mix (ahci, sil24 ?)
> 
> Yeap, sil24 can.  ahci can currently only do device based switching but 
> ahci 2.0 can do it too.
> 
>>> So it looks like a I need a .qc_defer() function which examines all 
>>> links
>>> from the common host port for activity, and then asks for command 
>>> deferral
>>> when the new command has a different protocol than those that are 
>>> outstanding.
>>>
>>> Weird that none of the other LLDs need this.  Or do they?
> 
> So, none of the others needs this.
> 
>> This seems (below) to work for sata_mv.  But I still wonder about 
>> other LLDs.
..

Mmm.. Found another problem with sata_mv vs. the standard .qc_defer ops:
they don't prevent PIO commands from getting into the mix.

So now I have this in sata_mv, for all chip versions:

static int mv_qc_defer (struct ata_queued_cmd *qc)
{
	struct ata_link *link = qc->dev->link;
	struct ata_port *ap = link->ap;
	struct mv_port_priv *pp;

	/*
	 * If the port is completely idle, then allow the new qc.
	 */
	if (ap->nr_active_links == 0)
		return 0;
	/*
	 * If the port is not in host-queue mode (EDMA), then defer the new qc.
	 */
	pp = ap->private_data;
	if (!(pp->pp_flags & MV_PP_FLAG_EDMA_EN))
		return ATA_DEFER_PORT;

	if (pp->pp_flags & MV_PP_FLAG_NCQ_EN) {
		/*
		 * The host queue (EDMA) is in NCQ mode.
		 * If the new qc is also an NCQ command,
		 * then allow the new qc.
		 */
		if (qc->tf.protocol == ATA_PROT_NCQ)
			return 0;
	} else {
		/*
		 * The host queue (EDMA) is in non-NCQ, DMA mode.
		 * If the new qc is also a non-NCQ, DMA command,
		 * then allow the new qc.
		 */
		if (qc->tf.protocol == ATA_PROT_DMA)
			return 0;
	}
	return ATA_DEFER_PORT;
}


For the first time ever, I can now *heavily* mix PIO commands
with NCQ/non-NCQ DMA commands, to drives on an attached PM
(well, two attached PMs even), and the thing doesn't croak.
Woo-hoo!


Time to batch up some patches for Jeff.  But sadly, just in time
to have missed his weekly visit to linux-ide.  :)


I wonder if something like that is what bit sata_sil24 the other day
when I had it plugged in, mixing DMA, NCQ, and PIO commands to drives
on an attached PM?

Cheers

  parent reply	other threads:[~2008-04-29 17:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-28 21:06 ata_std_qc_defer not good enough for FIS-based switching ? Mark Lord
2008-04-28 22:08 ` Mark Lord
2008-04-28 23:11   ` Tejun Heo
2008-04-28 23:42     ` Mark Lord
2008-04-29  1:18       ` Tejun Heo
2008-04-29  2:26         ` Mark Lord
2008-05-14 14:11           ` Tejun Heo
2008-05-14 14:45             ` Mark Lord
2008-05-14 14:53               ` Mark Lord
2008-05-14 15:50                 ` Mark Lord
2008-05-14 15:59                   ` Mark Lord
2008-05-15  7:12                     ` Tejun Heo
2008-05-15  6:51                 ` Tejun Heo
2008-04-29 17:09     ` Mark Lord [this message]
2008-04-29 17:17       ` Mark Lord
2008-04-30  9:38       ` Tejun Heo
2008-04-30 14:02       ` Mark Lord

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=48175664.5030702@rtr.ca \
    --to=liml@rtr.ca \
    --cc=alan@redhat.com \
    --cc=htejun@gmail.com \
    --cc=jgarzik@pobox.com \
    --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).