linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 1/3] arm64: Implement custom mmap functions for dma mapping
Date: Fri, 28 Mar 2014 10:37:21 +0000	[thread overview]
Message-ID: <20140328103721.GF21330@arm.com> (raw)
In-Reply-To: <CALk7dXr3cZSkQ6dTUyCjUDStOd6=ghGN9-iO5RQiTfHCciGxLg@mail.gmail.com>

On Fri, Mar 28, 2014 at 09:45:08AM +0000, Ritesh Harjani wrote:
> On Sat, Mar 15, 2014 at 1:22 AM, Laura Abbott <lauraa@codeaurora.org> wrote:
> > +static int __dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
> > +                            void *cpu_addr, dma_addr_t dma_addr, size_t size)
> > +{
> > +       int ret = -ENXIO;
> > +       unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >>
> > +                                       PAGE_SHIFT;
> > +       unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
> > +       unsigned long pfn = dma_to_phys(dev, dma_addr) >> PAGE_SHIFT;
> 
> Why not __phys_to_pfn here ?? just asking, I know there is nothing wrong in
> this too..

Because dma_addr is a DMA address (as seen by the device from the other
side of the bus) rather than a CPU physical address. In many cases they
are the same but not always.

-- 
Catalin

  parent reply	other threads:[~2014-03-28 10:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 20:46 Query on patch to be upstream ? Ritesh Harjani
2014-03-11 12:15 ` Catalin Marinas
2014-03-11 18:04   ` Laura Abbott
2014-03-11 18:26     ` Catalin Marinas
2014-03-12 18:20       ` Laura Abbott
2014-03-13 17:45         ` [PATCH 1/2] arm64: Implement custom mmap functions for dma mapping Laura Abbott
2014-03-13 17:49           ` Catalin Marinas
2014-03-14  1:53             ` Laura Abbott
2014-03-13 17:45         ` [PATCH 2/2] arm64: Support DMA_ATTR_WRITE_COMBINE Laura Abbott
2014-03-13 17:52           ` Catalin Marinas
2014-03-14  2:02             ` Laura Abbott
2014-03-14 19:52           ` [PATCHv2 1/3] arm64: Implement custom mmap functions for dma mapping Laura Abbott
2014-03-24 10:33             ` Catalin Marinas
     [not found]             ` <CALk7dXr3cZSkQ6dTUyCjUDStOd6=ghGN9-iO5RQiTfHCciGxLg@mail.gmail.com>
2014-03-28 10:37               ` Catalin Marinas [this message]
2014-03-14 19:52           ` [PATCHv2 2/3] arm64: Support DMA_ATTR_WRITE_COMBINE Laura Abbott
2014-03-14 20:24             ` Rob Herring
2014-03-14 23:07               ` Catalin Marinas
2014-03-14 19:52           ` [PATCHv2 3/3] arm64: Use arm64 coherent APIs for non-coherent freeing Laura Abbott

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=20140328103721.GF21330@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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).