All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Lord <liml@rtr.ca>
To: Mikael Pettersson <mikpe@it.uu.se>
Cc: jgarzik@pobox.com, htejun@gmail.com, linux-ide@vger.kernel.org
Subject: Re: libata NCQ implementation questions
Date: Mon, 12 May 2008 11:58:48 -0400	[thread overview]
Message-ID: <48286938.1090301@rtr.ca> (raw)
In-Reply-To: <18471.32504.953679.399689@harpo.it.uu.se>

Mikael Pettersson wrote:
> I've started working on NCQ support for sata_promise,
> and I have a few questions regarding NCQ and libata:
> 
> 1. Can I rely not seeing any non-NCQ commands while there
>    are uncompleted NCQ commands on a port?
..

No, you cannot.  So you'll have to code a .qc_defer() method
to hold them off in that case.  For a *really* good example,
see my recently deployed mv_qc_defer() function in sata_mv.c
as of linux-2.6.26-rc2.

> 3. Is qc->tag defined (to zero for instance) for non-NCQ commands?
..

The tag always has a valid value, NCQ or not.

> 4. What are these "internal commands" that map to ATA_TAG_INTERNAL?
>    Are they NCQ or not?
..

Not NCQ, but a valid tag number regardless.
libata reserves one tag for use during error-handling (EH),
primarily for issing the READ_LOG_EXT_10H command to find out which
NCQ command failed and what sector it failed on.


>    Does the existence of ATA_TAG_INTERNAL limit queue depth for NCQ?
..

Yup.  Max depth is 31 instead of 32 for most devices.

> 5. Does dmam_alloc_coherent() give the same alignment guarantees
>    that pci_alloc_consistent() does? That is, both CPU and bus
>    addresses will be aligned to the smallest PAGE_SIZE order that
>    fits the requested size.
..

In sata_mv, I ran into those same concerns, and ended up creating
a couple of pools for local use by the driver.  It uses dmam_pool_create()
(note the extra "m" in "dmam_"), dma_pool_alloc(), and dma_pool_free().

If you just search for "_pool" in sata_mv, you'll find all of the calls
(not many).  The use of "dmam_pool_create()" assures that things will be
cleaned up properly/automatically if the controller ever "goes away".

Cheers

  parent reply	other threads:[~2008-05-12 15:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-11 23:19 libata NCQ implementation questions Mikael Pettersson
2008-05-12  4:05 ` Grant Grundler
2008-05-12 12:22   ` Mikael Pettersson
2008-05-12 15:58 ` Mark Lord [this message]
2008-05-12 19:17   ` Mikael Pettersson
2008-05-13  8:32     ` Tejun Heo
2008-05-13 21:01       ` Mark Lord
2008-05-13  8:40 ` Tejun Heo
2008-05-13  9:25   ` Mikael Pettersson

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=48286938.1090301@rtr.ca \
    --to=liml@rtr.ca \
    --cc=htejun@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=mikpe@it.uu.se \
    /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.