SUPERH platform development
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: ALSA dma_area not utilizing D-cahce
Date: Wed, 16 May 2012 05:38:57 +0000	[thread overview]
Message-ID: <20120516053856.GL7988@linux-sh.org> (raw)
In-Reply-To: <20120516095123.73abdf103d1ca64996d9c23c@kanno.co.jp>

On Wed, May 16, 2012 at 09:51:23AM +0900, MASAO TAKAHASHI wrote:
> Hi everybody. 
> Please advice me to resolve my problem.
> 1.  My environment
>     Hardware	Alpha-project MS104-SH4AG with SH7764
> 	kernel		sh-linux-2.6.29
> 2. My problem
> 	I am ussing a proprietary ALSA driver for SH7764 SSI.
> 	I have found runtime->dma_area address refers DMA area
> 	via D-cache.
> 	So, playback is too late after executing snd_pcm_writei().
> 	Until D-cache writeback is done, sound data stays in D-cache.
> 	I want to read and write from/to main memory 
> 	without D-cache.
> 
> 3. My idea to solve this problem
> 	add some codes in xxx_prepare() routine as follows
> 	
> 	save_playback_area = runtime->dma_area;
> 	runtime->dma_area = P2SEGADDR(runtime->dma_area);
> 
> Is my idea right?
> 
There are a couple of places that need to be fixed. At a quick glance:

	- snd_pcm_default_page_ops()
	- snd_pcm_lib_default_mmap()

Both are in need of fixing up.

The snd_pcm_default_page_ops() case is easy, as we can use the same
approach that MIPS does (sh also provides a CAC_ADDR definition).

The snd_pcm_lib_default_mmap() case is a bit more involved. The last time
this topic came up a generic pgprot_noncached() solution was stalled as
pgprot_noncached() wasn't available on all of the platforms. That's been
addressed now, so it may be worth revisiting.

At present the biggest problem with fixing up the default mmap behaviour
is that we don't have any easy way for working out the coherence model on
a struct device level. ie, we may have snooping enabled on the PCI side
for device<->memory coherence while at the same time being non-coherent
for the L1 D-cache case at the platform device level.

There also exists a snd_pcm_lib_mmap_iomem() now that handles the
pgprot_noncached() case which you might be able to use with your driver.

That being said, P2SEGADDR is non-portable legacy garbage -- drivers
should never use it directly. Unfortunately we don't have any easy way to
use it in the headers while forcibly blowing up the build for anything
else.

  reply	other threads:[~2012-05-16  5:38 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 [this message]
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
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=20120516053856.GL7988@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