* Re: PowerPC equivalent to dma_mmap_writecombine()?
2007-07-05 16:41 PowerPC equivalent to dma_mmap_writecombine()? Timur Tabi
@ 2007-07-05 16:13 ` Arnd Bergmann
2007-07-05 20:11 ` Segher Boessenkool
2007-07-06 20:19 ` Timur Tabi
0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2007-07-05 16:13 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Timur Tabi
T24gVGh1cnNkYXkgMDUgSnVseSAyMDA3LCBUaW11ciBUYWJpIHdyb3RlOgo+IHN0YXRpYyBpbnQg
YXQ5MV9wY21fbW1hcChzdHJ1Y3Qgc25kX3BjbV9zdWJzdHJlYW0gKnN1YnN0cmVhbSwKPiCgoKCg
oKCgoHN0cnVjdCB2bV9hcmVhX3N0cnVjdCAqdm1hKQo+IHsKPiCgoKCgoKCgoHN0cnVjdCBzbmRf
cGNtX3J1bnRpbWUgKnJ1bnRpbWUgPSBzdWJzdHJlYW0tPnJ1bnRpbWU7Cj4gCj4goKCgoKCgoKBy
ZXR1cm4gZG1hX21tYXBfd3JpdGVjb21iaW5lKHN1YnN0cmVhbS0+cGNtLT5jYXJkLT5kZXYsIHZt
YSwKPiCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoCCgIKAgcnVudGltZS0+ZG1hX2Fy
ZWEsCj4goKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKAgoCCgIHJ1bnRpbWUtPmRtYV9h
ZGRyLAo+IKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgIKAgoCBydW50aW1lLT5kbWFf
Ynl0ZXMpOwo+IH0KPiAKPiBUaGVyZSBhcmUgbm8gZG1hX21tYXBfeCgpIGZ1bmN0aW9ucyBpbiBh
cmNoL3Bvd2VycGMuIKBDYW4gc29tZW9uZSB0ZWxsIG1lIHdoYXQgdGhlIHBvd2VycGMgCj4gZXF1
aXZhbGVudCB0byBkbWFfbW1hcF93cml0ZWNvbWJpbmUoKSBpcz8KCk5vdCBzdXJlIGV4YWN0bHkg
d2hhdCBhcm0gZG9lcyBoZXJlLCBidXQgaXQgc291bmRzIGxpa2UgeW91IHdhbnQKdG8gY2FsbCBy
ZW1hcF9wZm5fcmFuZ2Ugd2l0aCB0aGUgX1BBR0VfTk9fQ0FDSEUgYml0IHNldCBpbiB0aGUKcHJv
dGVjdGlvbiBmbGFncywgYW5kIF9QQUdFX0dVQVJERUQgbm90IHNldC4KCglBcm5kIDw+PAo=
^ permalink raw reply [flat|nested] 5+ messages in thread
* PowerPC equivalent to dma_mmap_writecombine()?
@ 2007-07-05 16:41 Timur Tabi
2007-07-05 16:13 ` Arnd Bergmann
0 siblings, 1 reply; 5+ messages in thread
From: Timur Tabi @ 2007-07-05 16:41 UTC (permalink / raw)
To: linuxppc-dev
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PowerPC equivalent to dma_mmap_writecombine()?
2007-07-05 16:13 ` Arnd Bergmann
@ 2007-07-05 20:11 ` Segher Boessenkool
2007-07-06 20:19 ` Timur Tabi
1 sibling, 0 replies; 5+ messages in thread
From: Segher Boessenkool @ 2007-07-05 20:11 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev, Timur Tabi
>> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PowerPC equivalent to dma_mmap_writecombine()?
2007-07-05 16:13 ` Arnd Bergmann
2007-07-05 20:11 ` Segher Boessenkool
@ 2007-07-06 20:19 ` Timur Tabi
2007-07-06 21:26 ` Arnd Bergmann
1 sibling, 1 reply; 5+ messages in thread
From: Timur Tabi @ 2007-07-06 20:19 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PowerPC equivalent to dma_mmap_writecombine()?
2007-07-06 20:19 ` Timur Tabi
@ 2007-07-06 21:26 ` Arnd Bergmann
0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2007-07-06 21:26 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
On Friday 06 July 2007, Timur Tabi wrote:
> Arnd Bergmann wrote:
>=20
> > 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 <><
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-06 21:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-05 16:41 PowerPC equivalent to dma_mmap_writecombine()? Timur Tabi
2007-07-05 16:13 ` Arnd Bergmann
2007-07-05 20:11 ` Segher Boessenkool
2007-07-06 20:19 ` Timur Tabi
2007-07-06 21:26 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).