I'm porting a driver from ARM to PowerPC, and I came across this function:
static int at91_pcm_mmap(struct snd_pcm_substream *substream,
struct vm_area_struct *vma)
{
struct snd_pcm_runtime *runtime = substream->runtime;
return dma_mmap_writecombine(substream->pcm->card->dev, vma,
runtime->dma_area,
runtime->dma_addr,
runtime->dma_bytes);
}
There are no dma_mmap_x() functions in arch/powerpc. Can someone tell me what the powerpc
equivalent to dma_mmap_writecombine() is?
--
Timur Tabi
Linux Kernel Developer @ Freescale
T24gVGh1cnNkYXkgMDUgSnVseSAyMDA3LCBUaW11ciBUYWJpIHdyb3RlOgo+IHN0YXRpYyBpbnQg
YXQ5MV9wY21fbW1hcChzdHJ1Y3Qgc25kX3BjbV9zdWJzdHJlYW0gKnN1YnN0cmVhbSwKPiCgoKCg
oKCgoHN0cnVjdCB2bV9hcmVhX3N0cnVjdCAqdm1hKQo+IHsKPiCgoKCgoKCgoHN0cnVjdCBzbmRf
cGNtX3J1bnRpbWUgKnJ1bnRpbWUgPSBzdWJzdHJlYW0tPnJ1bnRpbWU7Cj4gCj4goKCgoKCgoKBy
ZXR1cm4gZG1hX21tYXBfd3JpdGVjb21iaW5lKHN1YnN0cmVhbS0+cGNtLT5jYXJkLT5kZXYsIHZt
YSwKPiCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoCCgIKAgcnVudGltZS0+ZG1hX2Fy
ZWEsCj4goKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKAgoCCgIHJ1bnRpbWUtPmRtYV9h
ZGRyLAo+IKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgIKAgoCBydW50aW1lLT5kbWFf
Ynl0ZXMpOwo+IH0KPiAKPiBUaGVyZSBhcmUgbm8gZG1hX21tYXBfeCgpIGZ1bmN0aW9ucyBpbiBh
cmNoL3Bvd2VycGMuIKBDYW4gc29tZW9uZSB0ZWxsIG1lIHdoYXQgdGhlIHBvd2VycGMgCj4gZXF1
aXZhbGVudCB0byBkbWFfbW1hcF93cml0ZWNvbWJpbmUoKSBpcz8KCk5vdCBzdXJlIGV4YWN0bHkg
d2hhdCBhcm0gZG9lcyBoZXJlLCBidXQgaXQgc291bmRzIGxpa2UgeW91IHdhbnQKdG8gY2FsbCBy
ZW1hcF9wZm5fcmFuZ2Ugd2l0aCB0aGUgX1BBR0VfTk9fQ0FDSEUgYml0IHNldCBpbiB0aGUKcHJv
dGVjdGlvbiBmbGFncywgYW5kIF9QQUdFX0dVQVJERUQgbm90IHNldC4KCglBcm5kIDw+PAo=
quoted
There are no dma_mmap_x() functions in arch/powerpc. Can someone
tell me what the powerpc
equivalent to dma_mmap_writecombine() is?
Not sure exactly what arm does here, but it sounds like you want
to call remap_pfn_range with the _PAGE_NO_CACHE bit set in the
protection flags, and _PAGE_GUARDED not set.
Either that, or just map it as normal cache-coherent DMA
memory.
Segher
Arnd Bergmann wrote:
Not sure exactly what arm does here, but it sounds like you want
to call remap_pfn_range with the _PAGE_NO_CACHE bit set in the
protection flags, and _PAGE_GUARDED not set.
I always have a hard time with these mapping functions. Is this right?
vma->vm_page_prot = __pgprot((pgprot_val(vma->vm_page_prot) | _PAGE_NO_CACHE) &
~_PAGE_GUARDED));
ret = remap_pfn_range(vma, vma->vm_start, runtime->dma_addr, runtime->dma_bytes,
vma->vm_page_prot);
Alternatively, could I use function snd_pcm_lib_mmap_iomem() (sound/core/pcm_native.c)?
It looks like it does the right thing, although it doesn't unset the guarded bit. If
that's wrong, I can submit a patch to unset that bit on PowerPC, but like I said, I can
never quite get my head around this mapping stuff.
--
Timur Tabi
Linux Kernel Developer @ Freescale
On Friday 06 July 2007, Timur Tabi wrote:
Arnd Bergmann wrote:
=20
quoted
Not sure exactly what arm does here, but it sounds like you want
to call remap_pfn_range with the _PAGE_NO_CACHE bit set in the
protection flags, and _PAGE_GUARDED not set.
=20
I always have a hard time with these mapping functions. =A0Is this right?
=20
vma->vm_page_prot =3D __pgprot((pgprot_val(vma->vm_page_prot) | _PAGE_NO_=
CACHE) &=20
~_PAGE_GUARDED));
=20
ret =3D remap_pfn_range(vma, vma->vm_start, runtime->dma_addr, runtime->d=
ma_bytes,=20
vma->vm_page_prot);
=20
Alternatively, could I use function snd_pcm_lib_mmap_iomem() (sound/core/=
pcm_native.c)?=20
It looks like it does the right thing, although it doesn't unset the guar=
ded bit. =A0If=20
that's wrong, I can submit a patch to unset that bit on PowerPC, but like=
I said, I can=20
never quite get my head around this mapping stuff.
The guarded bit is disabled by default, so you don't need t remove it, so
the function you quoted should be alright for this purpose. Not sure if you
need the ioremap in there though.
Arnd <><