From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: ALSA dma_area not utilizing D-cahce
Date: Mon, 21 May 2012 03:21:22 +0000 [thread overview]
Message-ID: <20120521032121.GB31763@linux-sh.org> (raw)
In-Reply-To: <20120516095123.73abdf103d1ca64996d9c23c@kanno.co.jp>
On Mon, May 21, 2012 at 11:40:05AM +0900, MASAO TAKAHASHI wrote:
>
> On Mon, 21 May 2012 11:10:04 +0900
> Paul Mundt <lethal@linux-sh.org> wrote:
> > > + offset = area->vm_pgoff << PAGE_SHIFT;
> > > + runtime = substream->runtime;
> > > + map_size = runtime->dma_bytes;
> > > + mp = (unsigned long)runtime->dma_addr;
> > > + map = virt_to_page(mp);
> > > + mapend = virt_to_page(mp+map_size - 1);
> > > + for (ip = map; ip <= mapend; ip++){
> > > + SetPageReserved(ip);
> > > + }
> > > + area->vm_ops = &sh7764_pcm_vm_ops_data;
> > > + area->vm_private_data = substream;
> > > + area->vm_flags |= VM_IO;
> > > + ret = io_remap_pfn_range(area, area->vm_start, mp>>PAGE_SHIFT,
> > > + area->vm_end - area->vm_start,
> > > area->vm_page_prot);
> > > + if (ret ){
> > > + pr_debug("sh7764-pcm.c:remap_pfn_range returned EAGAIN\n");
> > > + return -EAGAIN;
> > > + }
> > > + atomic_inc(&substream->mmap_count);
> > > + return 0;
> > > +}
> > > +
> > Do you really need this? It looks like you could just use
> > snd_pcm_lib_mmap_iomem() directly.
> Is SetPageReserved() not needed ?
>
No, VM_IO on the VMA ensures that no one's going to touch the pages. If
we switch to using our own VMA for consistent mapping the consistent DMA
allocator then we would need to take care of it, but this is nothing your
mmap routine needs to worry about.
next prev parent reply other threads:[~2012-05-21 3:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 0:51 ALSA dma_area not utilizing D-cahce MASAO TAKAHASHI
2012-05-16 5:38 ` Paul Mundt
2012-05-17 5:16 ` MASAO TAKAHASHI
2012-05-17 7:22 ` Paul Mundt
2012-05-17 7:51 ` MASAO TAKAHASHI
2012-05-17 8:03 ` Paul Mundt
2012-05-17 8:31 ` MASAO TAKAHASHI
2012-05-21 1:07 ` MASAO TAKAHASHI
2012-05-21 1:44 ` MASAO TAKAHASHI
2012-05-21 2:10 ` Paul Mundt
2012-05-21 2:40 ` MASAO TAKAHASHI
2012-05-21 3:21 ` Paul Mundt [this message]
2012-05-21 3:50 ` MASAO TAKAHASHI
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=20120521032121.GB31763@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=linux-sh@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