From: Aneesh V <aneesh@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/9] arm926ej-s: Invalidate instruction cache in flush_cache
Date: Mon, 21 Mar 2011 11:14:24 +0530 [thread overview]
Message-ID: <4D86E5B8.6090606@ti.com> (raw)
In-Reply-To: <AANLkTi=bM-P4HEurgNHj=i2xCzvZjkJHyGTOD0SwdvfT@mail.gmail.com>
Hi Arden,
On Sunday 20 March 2011 08:00 AM, arden jay wrote:
> Hi Michael,
> Curiously, have any idea how to test cache stuff?
Recently I did some cache testing. Here is the technique I used for
data-cache:
To test flush:
* Write a known pattern to a region of memory
* Flush the region
* Invalidate the region
* Read back the region and see if you get the original pattern. If the
flush was effective you will see the original data.
To test Invalidate:
* Write a known pattern to a region of memory
* Invalidate the region immediately
* Read back the region and see if you get the original pattern. You
should *not* be seeing the expected pattern for the entire region if
the invalidate was successful.
Similar tests can be done for the I-cache, but maybe a little more
tedious.
I agree that these tests may not be 100% fool-proof - for instance what
if both invalidate and flush didn't work in the first case. But these
should at least catch very obvious errors and can be used in
combination with other techniques to make sure that your cache
operations are indeed working.
Additionally, there was a JTAG debugger technique that I found quite
useful. If your processor supports a technique called DAP(Debug Access
Port or Dual Access Port, I am not sure) then a debugger like
Lauterbach can view memory in two modes, one the normal or CPU mode and
the other DAP mode. In normal mode the memory is dumped as if it is
viewed from the CPU, so it goes through the cache and you see the cache
contents if the area in question is in cache. In DAP mode the
real memory contents are dumped. Comparing these two you can see
whether cache and memory are coherent for a given area. It worked quite
well with Lauterbach and OMAP4.
br,
Aneesh
>
> 2011/3/18 Michael Spang<mspang@csclub.uwaterloo.ca>:
>> If U-Boot is loaded from RAM and the OS is loaded into an overlapping
>> region, the instruction cache is not coherent when that OS is started.
>> We must therefore invalidate the instruction cache in addition to
>> cleaning the data cache.
>>
>> Signed-off-by: Michael Spang<mspang@csclub.uwaterloo.ca>
>> ---
>> arch/arm/lib/cache.c | 2 ++
>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/lib/cache.c b/arch/arm/lib/cache.c
>> index 30686fe..047786a 100644
>> --- a/arch/arm/lib/cache.c
>> +++ b/arch/arm/lib/cache.c
>> @@ -37,6 +37,8 @@ void flush_cache (unsigned long dummy1, unsigned long dummy2)
>> asm("0: mrc p15, 0, r15, c7, c10, 3\n\t" "bne 0b\n" : : : "memory");
>> /* disable write buffer as well (page 2-22) */
>> asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (0));
>> + /* invalidate icache for coherence with cleaned dcache */
>> + asm("mcr p15, 0, %0, c7, c5, 0" : : "r" (0));
>> #endif
>> #ifdef CONFIG_OMAP34XX
>> void v7_flush_cache_all(void);
>> --
>> 1.7.2.3
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>>
>
>
>
next prev parent reply other threads:[~2011-03-21 5:44 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-17 19:46 [U-Boot] [PATCH 0/9] TS-7800 port for U-Boot Michael Spang
2011-03-17 19:46 ` [U-Boot] [PATCH 1/9] arm926ej-s: Invalidate instruction cache in flush_cache Michael Spang
2011-03-20 2:30 ` arden jay
2011-03-20 3:44 ` Michael Spang
2011-03-20 5:36 ` arden jay
2011-03-20 8:18 ` Albert ARIBAUD
2011-03-20 14:14 ` arden jay
2011-03-20 18:26 ` Michael Spang
2011-03-21 5:44 ` Aneesh V [this message]
2011-03-21 14:14 ` arden jay
2013-07-29 7:19 ` Albert ARIBAUD
2013-07-29 12:57 ` Michael Spang
2013-07-29 14:09 ` Albert ARIBAUD
2013-07-29 14:22 ` Michael Spang
2011-03-17 19:46 ` [U-Boot] [PATCH 2/9] mvgbe: Support preserving the existing MAC address Michael Spang
2011-04-24 23:50 ` Wolfgang Denk
2011-04-25 11:37 ` Tabi Timur-B04825
2011-04-26 4:23 ` Michael Spang
2011-04-30 4:17 ` Mike Frysinger
2011-04-30 14:34 ` Tabi Timur-B04825
2011-05-01 5:40 ` Mike Frysinger
2011-04-26 4:20 ` Michael Spang
2011-04-30 4:21 ` Mike Frysinger
2011-03-17 19:46 ` [U-Boot] [PATCH 3/9] orion5x: Increase maximum bank size to 128M Michael Spang
2011-03-17 19:46 ` [U-Boot] [PATCH 4/9] orion5x: Fix wrong address in orion5x_sdram_bar Michael Spang
2011-03-17 19:46 ` [U-Boot] [PATCH 5/9] ARM: Rename CONFIG_SKIP_LOWLEVEL_INIT to CONFIG_SKIP_CPU_INIT_CRIT Michael Spang
2011-04-24 23:53 ` Wolfgang Denk
2011-04-26 3:44 ` Michael Spang
2011-03-17 19:47 ` [U-Boot] [PATCH 6/9] ARM: Implement CONFIG_SKIP_LOWLEVEL_INIT for arm926ej-s Michael Spang
2011-04-24 23:55 ` Wolfgang Denk
2011-04-25 7:30 ` Albert ARIBAUD
2011-04-26 4:44 ` Michael Spang
2011-03-17 19:47 ` [U-Boot] [PATCH 7/9] Add board support for TS-7800 Michael Spang
2011-04-24 23:57 ` Wolfgang Denk
2011-04-26 3:38 ` Michael Spang
2011-03-17 19:47 ` [U-Boot] [PATCH 8/9] Add NAND " Michael Spang
2011-03-17 20:22 ` Scott Wood
2011-04-24 23:59 ` Wolfgang Denk
2011-04-26 4:01 ` Michael Spang
2011-04-26 4:27 ` Wolfgang Denk
2011-03-17 19:47 ` [U-Boot] [PATCH 9/9] Add README " Michael Spang
2011-04-25 0:01 ` Wolfgang Denk
2011-04-26 4:03 ` Michael Spang
2011-03-17 19:53 ` [U-Boot] [PATCH 0/9] TS-7800 port for U-Boot Michael Spang
2011-03-17 20:01 ` Albert ARIBAUD
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=4D86E5B8.6090606@ti.com \
--to=aneesh@ti.com \
--cc=u-boot@lists.denx.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