From: Matt Porter <mporter@kernel.crashing.org>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: Jes Sorensen <jes@trained-monkey.org>,
Jamie Wellnitz <Jamie.Wellnitz@emulex.com>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: virt_to_page/pci_map_page vs. pci_map_single
Date: Tue, 4 Nov 2003 10:11:49 -0700 [thread overview]
Message-ID: <20031104101149.B24704@home.com> (raw)
In-Reply-To: <1067964447.1792.116.camel@mulgrave>; from James.Bottomley@steeleye.com on Tue, Nov 04, 2003 at 10:47:25AM -0600
On Tue, Nov 04, 2003 at 10:47:25AM -0600, James Bottomley wrote:
> On Tue, 2003-11-04 at 10:35, Matt Porter wrote:
> > This raises a question for me regarding these rules in 2.4 versus
> > 2.6. While fixing a bug in PPC's 2.4 pci_map_page/pci_map_sg
> > implementations I noticed that a scatterlist created by the IDE
> > subsystem will pass nents by page struct reference with a
> > size > PAGE_SIZE. Is this a 2.4ism resulting from allowing both
> > address and page reference scatterlist entries? This isn't
> > explicitly mentioned in the DMA docs AFAICT. I'm wondering
> > if this is the same expected behavior in 2.6 as well. If
> > pci_map_page() is limited to size <= PAGE_SIZE then I would
> > expect pci_map_sg() to be limited as well (and vice versa).
>
> Not really. By design, the SG interface can handle entries that are
> physically contiguous.
>
> If you have a limit on the length of your SG elements (because of the
> device hardware, say), you can express this to the block layer with the
> blk_queue_max_segment_size() API.
Ok, then to make this clear to implementers of the
pci_map_page()/pci_map_sg() APIs would the following
addition to the docs be correct?
-Matt
===== Documentation/DMA-mapping.txt 1.17 vs edited =====
--- 1.17/Documentation/DMA-mapping.txt Sat Aug 16 11:46:50 2003
+++ edited/Documentation/DMA-mapping.txt Tue Nov 4 09:59:53 2003
@@ -499,7 +499,8 @@
pci_unmap_page(dev, dma_handle, size, direction);
-Here, "offset" means byte offset within the given page.
+Here, "offset" means byte offset within the given page. In addition,
+"size" must be <= PAGE_SIZE - offset.
With scatterlists, you map a region gathered from several regions by:
@@ -520,6 +521,9 @@
advantage for cards which either cannot do scatter-gather or have very
limited number of scatter-gather entries) and returns the actual number
of sg entries it mapped them to.
+
+Note: sglist entries are not limited to PAGE_SIZE, the pci_map_sg()
+implementation must handle entries with size > PAGE_SIZE.
Then you should loop count times (note: this can be less than nents times)
and use sg_dma_address() and sg_dma_len() macros where you previously
next prev parent reply other threads:[~2003-11-04 17:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-03 18:48 virt_to_page/pci_map_page vs. pci_map_single James Bottomley
2003-11-03 22:03 ` Jamie Wellnitz
2003-11-04 9:48 ` Jes Sorensen
2003-11-04 16:35 ` Matt Porter
2003-11-04 16:47 ` James Bottomley
2003-11-04 17:11 ` Matt Porter [this message]
2003-11-04 16:43 ` James Bottomley
2003-11-05 16:23 ` Anton Blanchard
2003-11-06 8:28 ` Jes Sorensen
[not found] <NuZH.1a5.7@gated-at.bofh.it>
[not found] ` <NI6s.1MM.3@gated-at.bofh.it>
[not found] ` <NMtC.7Vs.21@gated-at.bofh.it>
[not found] ` <NNSy.1Cd.1@gated-at.bofh.it>
[not found] ` <NV3O.5w7.19@gated-at.bofh.it>
[not found] ` <NWCA.7Qv.19@gated-at.bofh.it>
2003-11-04 8:41 ` Ihar 'Philips' Filipau
-- strict thread matches above, loose matches on Subject: below --
2003-11-02 18:12 Jamie Wellnitz
2003-11-03 8:10 ` Jes Sorensen
2003-11-03 12:52 ` Jamie Wellnitz
2003-11-03 14:17 ` Jes Sorensen
2003-11-03 22:02 ` David Mosberger
2003-11-04 0:41 ` David S. Miller
2003-11-04 9:44 ` Jes Sorensen
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=20031104101149.B24704@home.com \
--to=mporter@kernel.crashing.org \
--cc=James.Bottomley@steeleye.com \
--cc=Jamie.Wellnitz@emulex.com \
--cc=jes@trained-monkey.org \
--cc=linux-kernel@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