2007-10-01 09:10:30

by veerasena reddy

[permalink] [raw]
Subject: linux cache routines for Write-back cache policy on MIPS24KE

Hi,

I have ported Linux-2.6.18 kernel on MIPS24KE
processor. I am using write back cache policy.

Could you please guide me under what cases the below
cache API's are being used:
- dma_cache_wback_inv() : Could you explain what
exactly this function does
- dma_cache_wback() : This function write back the
cache data to memory
- dma_cache_inv : This function invalidate the cache
tags. so subsequent access will fetch from memory.

Once I looked the above function definitions in
linux-2.6.18/arch/mips/mm/c-r4k.c.
All these function's implemetation are same except
bc_wbak_inv() is called in both dma_cache_wback-inv()
and dma_cache_wback(), where as bc_inv() is called in
case of dma_cache_inv.

Also, bc_inv()/bc_wbak_inv are define as null
implementation for R4000.
That means all three functions are doing same
functionality in case of R4000.

What are the difference between these three functions.
Under what cases these functions are used.

Please guide me if you have any links which will
explain these API's.
Thanks in advance.

Regards,
Veerasena.


Forgot the famous last words? Access your message archive online at http://in.messenger.yahoo.com/webmessengerpromo.php


2007-10-01 09:23:19

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: linux cache routines for Write-back cache policy on MIPS24KE

On Mon, 1 Oct 2007, veerasena reddy wrote:
> I have ported Linux-2.6.18 kernel on MIPS24KE
> processor. I am using write back cache policy.
>
> Could you please guide me under what cases the below
> cache API's are being used:
> - dma_cache_wback_inv() : Could you explain what
> exactly this function does

It does both write back and invalidate.

> - dma_cache_wback() : This function write back the
> cache data to memory
> - dma_cache_inv : This function invalidate the cache
> tags. so subsequent access will fetch from memory.

Note that 2.6.18 is old. The above functions are intended to be removed.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2007-10-01 11:00:12

by Ralf Baechle

[permalink] [raw]
Subject: Re: linux cache routines for Write-back cache policy on MIPS24KE

On Mon, Oct 01, 2007 at 10:04:32AM +0100, veerasena reddy wrote:

> I have ported Linux-2.6.18 kernel on MIPS24KE
> processor. I am using write back cache policy.
>
> Could you please guide me under what cases the below
> cache API's are being used:
> - dma_cache_wback_inv() : Could you explain what
> exactly this function does
> - dma_cache_wback() : This function write back the
> cache data to memory
> - dma_cache_inv : This function invalidate the cache
> tags. so subsequent access will fetch from memory.
>
> Once I looked the above function definitions in
> linux-2.6.18/arch/mips/mm/c-r4k.c.
> All these function's implemetation are same except
> bc_wbak_inv() is called in both dma_cache_wback-inv()
> and dma_cache_wback(), where as bc_inv() is called in
> case of dma_cache_inv.
>
> Also, bc_inv()/bc_wbak_inv are define as null
> implementation for R4000.
> That means all three functions are doing same
> functionality in case of R4000.
>
> What are the difference between these three functions.
> Under what cases these functions are used.

An internal only interface to be used with I/O cache coherency.

> Please guide me if you have any links which will
> explain these API's.

Easy answer, don't use them, for 2.6.24 I've queued a patch to kill this
API. Documentation/DMA-API.txt documents how to properly deal with I/O
coherency in Linux.

Ralf

2007-10-01 11:42:57

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: linux cache routines for Write-back cache policy on MIPS24KE

On Mon, 1 Oct 2007, veerasena reddy wrote:
> In linux-2.6.18 (for MIPS24KE processor):
> suppose if i want to do flush only then which API i
> should use?

`flush' is fuzzy terminology: some people mean invalidate, others mean
write back, others mean both.

> Similarly, if i want to do invalidation only which API
> i should use?

dma_cache_inv().

> --- Geert Uytterhoeven <[email protected]> wrote:
>
> > On Mon, 1 Oct 2007, veerasena reddy wrote:
> > > I have ported Linux-2.6.18 kernel on MIPS24KE
> > > processor. I am using write back cache policy.
> > >
> > > Could you please guide me under what cases the
> > below
> > > cache API's are being used:
> > > - dma_cache_wback_inv() : Could you explain what
> > > exactly this function does
> >
> > It does both write back and invalidate.
> >
> > > - dma_cache_wback() : This function write back the
> > > cache data to memory
> > > - dma_cache_inv : This function invalidate the
> > cache
> > > tags. so subsequent access will fetch from memory.
> >
> > Note that 2.6.18 is old. The above functions are
> > intended to be removed.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2007-10-01 20:07:07

by veerasena reddy

[permalink] [raw]
Subject: Re: linux cache routines for Write-back cache policy on MIPS24KE

Hi Ralf,

Thanks for the reply.

Is there any problem if we use the below API's in
linxu-2.6.18
- dma_cache_wback_inv()
- dma_cache_wback()
- dma_cache_inv()

functionality wise, especially in r4k.c i dont see any
difference between the implementation of these APIs.

Can we apply the 2.6.24 patch to kill these APIs on
2.6.18 kernel? In this case what APIs i can use for
writeback, invalidation or both?

I couldn't find any info. related to the above API in
DMA-API.txt. Could you please give some pointers on
the usage/working of these APIs.

Regards,
Veerasena.

--- Ralf Baechle <[email protected]> wrote:

> On Mon, Oct 01, 2007 at 10:04:32AM +0100, veerasena
> reddy wrote:
>
> > I have ported Linux-2.6.18 kernel on MIPS24KE
> > processor. I am using write back cache policy.
> >
> > Could you please guide me under what cases the
> below
> > cache API's are being used:
> > - dma_cache_wback_inv() : Could you explain what
> > exactly this function does
> > - dma_cache_wback() : This function write back the
> > cache data to memory
> > - dma_cache_inv : This function invalidate the
> cache
> > tags. so subsequent access will fetch from memory.
> >
> > Once I looked the above function definitions in
> > linux-2.6.18/arch/mips/mm/c-r4k.c.
> > All these function's implemetation are same except
> > bc_wbak_inv() is called in both
> dma_cache_wback-inv()
> > and dma_cache_wback(), where as bc_inv() is called
> in
> > case of dma_cache_inv.
> >
> > Also, bc_inv()/bc_wbak_inv are define as null
> > implementation for R4000.
> > That means all three functions are doing same
> > functionality in case of R4000.
> >
> > What are the difference between these three
> functions.
> > Under what cases these functions are used.
>
> An internal only interface to be used with I/O cache
> coherency.
>
> > Please guide me if you have any links which will
> > explain these API's.
>
> Easy answer, don't use them, for 2.6.24 I've queued
> a patch to kill this
> API. Documentation/DMA-API.txt documents how to
> properly deal with I/O
> coherency in Linux.
>
> Ralf
>



Save all your chat conversations. Find them online at http://in.messenger.yahoo.com/webmessengerpromo.php

2007-10-03 01:43:59

by veerasena reddy

[permalink] [raw]
Subject: Re: linux cache routines for Write-back cache policy on MIPS24KE

hi Geert,

here i mean 'flush' is 'write-back only'

Regards,
Veerasena.
--- Geert Uytterhoeven <[email protected]> wrote:

> On Mon, 1 Oct 2007, veerasena reddy wrote:
> > In linux-2.6.18 (for MIPS24KE processor):
> > suppose if i want to do flush only then which API
> i
> > should use?
>
> `flush' is fuzzy terminology: some people mean
> invalidate, others mean
> write back, others mean both.
>
> > Similarly, if i want to do invalidation only which
> API
> > i should use?
>
> dma_cache_inv().
>
> > --- Geert Uytterhoeven <[email protected]>
> wrote:
> >
> > > On Mon, 1 Oct 2007, veerasena reddy wrote:
> > > > I have ported Linux-2.6.18 kernel on MIPS24KE
> > > > processor. I am using write back cache policy.
> > > >
> > > > Could you please guide me under what cases the
> > > below
> > > > cache API's are being used:
> > > > - dma_cache_wback_inv() : Could you explain
> what
> > > > exactly this function does
> > >
> > > It does both write back and invalidate.
> > >
> > > > - dma_cache_wback() : This function write back
> the
> > > > cache data to memory
> > > > - dma_cache_inv : This function invalidate
> the
> > > cache
> > > > tags. so subsequent access will fetch from
> memory.
> > >
> > > Note that 2.6.18 is old. The above functions are
> > > intended to be removed.
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond
> ia32 -- [email protected]
>
> In personal conversations with technical people, I
> call myself a hacker. But
> when I'm talking to journalists I just say
> "programmer" or something like that.
> -- Linus Torvalds
>
>



Forgot the famous last words? Access your message archive online at http://in.messenger.yahoo.com/webmessengerpromo.php

2007-10-03 08:11:46

by veerasena reddy

[permalink] [raw]
Subject: Re: linux cache routines for Write-back cache policy on MIPS24KE

Hi Geert,

Thanks for your repsonse.

In linux-2.6.18 (for MIPS24KE processor):
suppose if i want to do flush only then which API i
should use?
Similarly, if i want to do invalidation only which API
i should use?

Thanks again.

Regards,
Veerasena.
--- Geert Uytterhoeven <[email protected]> wrote:

> On Mon, 1 Oct 2007, veerasena reddy wrote:
> > I have ported Linux-2.6.18 kernel on MIPS24KE
> > processor. I am using write back cache policy.
> >
> > Could you please guide me under what cases the
> below
> > cache API's are being used:
> > - dma_cache_wback_inv() : Could you explain what
> > exactly this function does
>
> It does both write back and invalidate.
>
> > - dma_cache_wback() : This function write back the
> > cache data to memory
> > - dma_cache_inv : This function invalidate the
> cache
> > tags. so subsequent access will fetch from memory.
>
> Note that 2.6.18 is old. The above functions are
> intended to be removed.
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond
> ia32 -- [email protected]
>
> In personal conversations with technical people, I
> call myself a hacker. But
> when I'm talking to journalists I just say
> "programmer" or something like that.
> -- Linus Torvalds
>



Get the freedom to save as many mails as you wish. To know how, go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html

2007-10-03 10:58:03

by Ralf Baechle

[permalink] [raw]
Subject: Re: linux cache routines for Write-back cache policy on MIPS24KE

On Mon, Oct 01, 2007 at 01:10:59PM +0100, veerasena reddy wrote:

> Is there any problem if we use the below API's in
> linxu-2.6.18
> - dma_cache_wback_inv()
> - dma_cache_wback()
> - dma_cache_inv()
>
> functionality wise, especially in r4k.c i dont see any
> difference between the implementation of these APIs.
>
> Can we apply the 2.6.24 patch to kill these APIs on
> 2.6.18 kernel? In this case what APIs i can use for
> writeback, invalidation or both?
>
> I couldn't find any info. related to the above API in
> DMA-API.txt. Could you please give some pointers on
> the usage/working of these APIs.

dma_cache_* were never documented. They respresent the earliest attempt
at coming up with an API that enables portable drivers and it has a few
shortcomings and like so many early things it was never formally documented,
so don't expect any well defined semantics. The functions never got
formally retired probably because it somehow managed to stay under the
radar.

Any drivers should use the APIs documented in Documentation/DMA-API.txt
only. The almost equivalent operation for dma_cache_* would be
dma_sync_single and dma_sync_sg.

Don't even dream about using dma_cache_* for anything but DMA coherency.
They're all internal low level APIs which know nothing about Linux's
virtual memory system.

Anyway, it would be much easier to help you if we knew what you are trying
to achieve with these functions.

Ralf

2007-10-08 13:58:48

by veerasena reddy

[permalink] [raw]
Subject: Re: linux cache routines for Write-back cache policy on MIPS24KE

Ralf,

thanks for the detailed information.
> Anyway, it would be much easier to help you if we
> knew what you are trying
> to achieve with these functions.

Basically our target has a MIPS24KE host processor on
which Linux runs and a networking processor (NP) which
sits between the EMAC contoller and the host processor
to receive/transmit the data/packets.

This peripheral networking processor uses the physical
addresses only. We are using write-back caching policy
on MIPS24KE. So,
1. when we want to transmit the packet from the host
to peripheral processor, we need to convert packet
buffer into physical address (CPHYSADDR) and put it
into the NP's Tx queue, which will be sent to EMAC.
Before converting into physical address we need to
flush the corresponding cache entries.
Which API should be used to achieve the above
functionlaity in Linux-2.6.18 kernel?

2.Similarly in receivng path, the peripheral processor
gives the physical address of the buffer containing
the received packet. So, on host we need to convert
this physical address into cached address (KSEG0ADDR).
Before converting to cached address we need to
invalidate the corresponding cache entries.

Which API should be used to achieve the above
functionlaity in Linux-2.6.18 kernel?

currently we are using dma_cache_wback_inv() to
achieve above two functionalities.
Could you please suggest us the right API to be used?

Thanks in advance.

Regards,
Veerasena.

--- Ralf Baechle <[email protected]> wrote:

> On Mon, Oct 01, 2007 at 01:10:59PM +0100, veerasena
> reddy wrote:
>
> > Is there any problem if we use the below API's in
> > linxu-2.6.18
> > - dma_cache_wback_inv()
> > - dma_cache_wback()
> > - dma_cache_inv()
> >
> > functionality wise, especially in r4k.c i dont see
> any
> > difference between the implementation of these
> APIs.
> >
> > Can we apply the 2.6.24 patch to kill these APIs
> on
> > 2.6.18 kernel? In this case what APIs i can use
> for
> > writeback, invalidation or both?
> >
> > I couldn't find any info. related to the above API
> in
> > DMA-API.txt. Could you please give some pointers
> on
> > the usage/working of these APIs.
>
> dma_cache_* were never documented. They respresent
> the earliest attempt
> at coming up with an API that enables portable
> drivers and it has a few
> shortcomings and like so many early things it was
> never formally documented,
> so don't expect any well defined semantics. The
> functions never got
> formally retired probably because it somehow managed
> to stay under the
> radar.
>
> Any drivers should use the APIs documented in
> Documentation/DMA-API.txt
> only. The almost equivalent operation for
> dma_cache_* would be
> dma_sync_single and dma_sync_sg.
>
> Don't even dream about using dma_cache_* for
> anything but DMA coherency.
> They're all internal low level APIs which know
> nothing about Linux's
> virtual memory system.
>
> Anyway, it would be much easier to help you if we
> knew what you are trying
> to achieve with these functions.
>
> Ralf
>



Chat on a cool, new interface. No download required. Go to http://in.messenger.yahoo.com/webmessengerpromo.php