Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Cullen <david.cullen@teligy.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Jason Yates <jason.yates@teligy.com>, alsa-devel@lists.sourceforge.net
Subject: Re: Call to mmap in ALSA lib 1.0.13 fails in src/pcm/pcm_mmap.c line 367
Date: Mon, 08 Jan 2007 10:37:40 -0500	[thread overview]
Message-ID: <45A26544.3000201@teligy.com> (raw)
In-Reply-To: <s5hejqtryn9.wl%tiwai@suse.de>

Dear Mr. Iwai,

Takashi Iwai wrote:
> The implementation depends pretty much on the architecture.
> (Also, dma_mmap() is no global function but specific only for ARM.)
> Since the vm_region struct is different between ppc and arm (the page
> pointer is missing in ppc version), it cannot be copied as it is.
> 
> A simple (but totally untested) version would be like below:
> 
> int dma_mmap_coherent(struct device *dev,
> 		struct vm_area_struct *vma, void *cpu_addr,
> 		dma_addr_t dma_addr, size_t size)
> {
> 	unsigned long pfn;
> 
> 	pfn = page_to_pfn(virt_to_page(bus_to_virt(dma_addr)));
> 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
> 	return remap_pfn_range(vma, vma->vm_start, pfn + vma->vm_pgoff,
> 				vma->vm_end - vma->vm_start,
> 				vma->vm_pgprot);
> }
> 
> (This might not work for some ppc models, though...)
> 
> Then either add .mmap callback to each of snd_pcm_ops table in ca0106
> that calls dma_mmap_coherent() above, or change snd_pcm_default_mmap
> to call dma_mmap_coherent() directly instead of nopage method.
> For the former way, take a look at sound/arm/aaci.c (and devdma.c) as
> a reference.
> 

I implemented the "former way".  However, when I put a breakpoint in
__dma_alloc_coherent it does not get called when I run speaker-test.
 It does get called during execution of "modprobe snd-ca0106".

Also, when I try to look at the memory allocated by the problematic
call to mmap in gdb, I get the following results:

Breakpoint 1, snd_pcm_mmap (pcm=0x10031880) at pcm_mmap.c:383
383                 ptr = mmap(NULL, size, PROT_READ|PROT_WRITE,
MAP_FILE|MAP_SHARED, i->u.mmap.fd, i->u.mmap.offset);
(gdb) n
384                 if (ptr == MAP_FAILED) {
(gdb) print (void *)ptr
$1 = (void *) 0x3001e000
(gdb) print ptr[0]
Cannot access memory at address 0x3001e000

So, while these changes eliminate the bugcheck, it does not appear
to be the correct solution.

-- 
Thank you,
David Cullen
Teligy
(864) 527-1263 Office
(864) 415-7063 Cell

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

  parent reply	other threads:[~2007-01-08 15:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-19 15:12 Call to mmap in ALSA lib 1.0.13 fails in src/pcm/pcm_mmap.c line 367 David Cullen
2006-12-20 18:03 ` Takashi Iwai
2006-12-20 18:29   ` David Cullen
2006-12-20 18:35     ` Takashi Iwai
2006-12-20 19:06       ` David Cullen
2006-12-21 16:39         ` Takashi Iwai
2007-01-05 18:41           ` David Cullen
2007-01-08 15:37           ` David Cullen [this message]
2007-01-15 16:11             ` Takashi Iwai
2006-12-21 16:07       ` David Cullen
2006-12-21 16:41         ` Takashi Iwai
2006-12-21 17:01           ` David Cullen
2006-12-21 17:02             ` Takashi Iwai
2006-12-21 17:50               ` David Cullen
2006-12-21 18:00                 ` Takashi Iwai
2006-12-21 19:53                   ` David Cullen
  -- strict thread matches above, loose matches on Subject: below --
2006-11-27 22:01 David Cullen
2006-11-29 17:07 ` Takashi Iwai
2006-11-29 18:31   ` David Cullen

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=45A26544.3000201@teligy.com \
    --to=david.cullen@teligy.com \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=jason.yates@teligy.com \
    --cc=tiwai@suse.de \
    /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