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 02:10:04 +0000 [thread overview]
Message-ID: <20120521021003.GA31763@linux-sh.org> (raw)
In-Reply-To: <20120516095123.73abdf103d1ca64996d9c23c@kanno.co.jp>
On Mon, May 21, 2012 at 10:44:14AM +0900, MASAO TAKAHASHI wrote:
> diff -Nru a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
> --- a/arch/sh/include/asm/page.h 2012-05-21 09:05:58.556556493 +0900
> +++ b/arch/sh/include/asm/page.h 2012-05-21 09:14:44.649922912 +0900
> @@ -136,6 +136,11 @@
> #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
> #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
> #endif
> +/* add 2012/5/21 */
> +#if defined(CONFIG_29BIT)
> +#define UNCAC_ADDR(addr) P2SEGADDR(addr)
> +#define CAC_ADDR(addr) P1SEGADDR(addr)
> +#endif
>
> #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
> #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
Are you using an old kernel? UNCAC_ADDR/CAC_ADDR should already be
defined in page.h, and do the P2/P1 wrapping for the 29-bit phys case.
> +static int sh7764_pcm_mmap(struct snd_pcm_substream *substream,
> + struct vm_area_struct *area)
> +{
..
> +#ifdef pgprot_noncached
> + /*
> + * disable non-chahe attribute cause
> + */
> + area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
> +#endif
You don't want the ifdef here. pgprot_noncached() is now part of the
generic API, so you can always rely on it. It's worse if you don't have
it defined and suddenly end up with a cached attribute for the VMA that
you weren't expecting.
> + 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.
next prev parent reply other threads:[~2012-05-21 2:10 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 [this message]
2012-05-21 2:40 ` MASAO TAKAHASHI
2012-05-21 3:21 ` Paul Mundt
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=20120521021003.GA31763@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