This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
RE: cache configuration for 946es
- From: "Sinan KAYA" <sinan dot kaya at siemens dot com>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Wed, 6 Dec 2006 10:17:29 +0200
- Subject: RE: [ECOS] cache configuration for 946es
Thank you very much for the help. Unfortunately, it did not help. I still receive the same error from kcache2:
Verify data with cache off
INFO:<Data cache gross disable>
FAIL:<cache/memory contained invalidated data> Line: 517, File: /cygdrive/d/View_Storage/tr1k3720_icf_dev/icf_element_
vob/ecos/ecos-2.0/packages/kernel/v2_0/tests/kcache2.c
Besides, there are interesting things happening with kcache1 test. I expect any configuration of dcache on and icache on to be faster then both of them off. However, results do not show the same behaviour.
INFO:<Dcache off Icache off>
stride=1, time=1267
stride=2, time=1306
stride=4, time=1316
stride=8, time=1316
stride=16, time=1318
stride=32, time=1318
stride=64, time=1325
INFO:<Dcache on Icache off>
stride=1, time=1475
stride=2, time=1514
stride=4, time=1515
stride=8, time=1516
stride=16, time=1517
stride=32, time=1517
stride=64, time=1519
INFO:<Dcache off Icache on>
stride=1, time=1514
stride=2, time=1514
stride=4, time=1513
stride=8, time=1524
stride=16, time=1575
stride=32, time=1576
stride=64, time=1578
INFO:<Dcache on Icache on>
stride=1, time=1573
stride=2, time=1572
stride=4, time=1571
stride=8, time=1571
stride=16, time=1365
stride=32, time=1360
stride=64, time=1362
INFO:<Dcache off Icache off (again)>
stride=1, time=1363
stride=2, time=1364
stride=4, time=1363
stride=8, time=1363
stride=16, time=1364
stride=32, time=1364
stride=64, time=1365
INFO:<Dcache on Icache on (again)>
stride=1, time=1357
stride=2, time=1358
stride=4, time=1358
stride=8, time=1358
stride=16, time=1359
stride=32, time=1359
stride=64, time=1382
INFO:<Dcache on Icache on: invalidate ICache each time>
stride=1, time=3431
stride=2, time=3478
stride=4, time=3479
stride=8, time=3478
stride=16, time=3479
stride=32, time=3479
stride=64, time=3478
INFO:<Dcache on Icache on: invalidate DCache (expect bogus times)>
stride=1, time=1
stride=2, time=1
stride=4, time=1
stride=8, time=1
stride=16, time=2
stride=32, time=2
stride=64, time=2
PASS:<End of test>
EXIT:<done>
I initialize mpu like this:
asm("MOV r2, #1;"); // enable region / cache / buffer
asm("MOV r0, #0 ;");// set region base address
asm("LDR r1, =0x0000003E ;");// set region size
asm("ORR r0, r1, #0x00000001 ;");// enable region
asm("MCR p15, 0, r0, c6, c0, 0 ;");// set region 0
asm("MOV r3, #0x00000003;");
asm("ORR r4, r4, r2 ;"); // enable i-cache
asm("ORR r5, r5, r2 ;"); // enable d-cache
asm("ORR r6, r6, r2 ;"); // enable write buffer
asm("ORR r7, r7, r3 ;"); // set access specifier
asm("MCR p15, 0, r4, c2, c0, 1;"); // set instruction cache regions
asm("MCR p15, 0, r5, c2, c0, 0;"); // set data cache regions
asm("MCR p15, 0, r6, c3, c0, 0;"); // set write buffer regions
/*
; * Set access permissions
; */
asm("MCR p15, 0, r7, c5, c0, 2;"); // set data access
asm("MCR p15, 0, r7, c5, c0, 3;"); // set instruction access
// *************** Control ***************************************
asm("MRC p15, 0, r0, c1, c0, 0 ;"); // read CP15 register 1 into r0
asm("ORR r0, r0, #(0x1 <<12) ;"); // enable I Cache
asm("ORR r0, r0, #(0x1 <<2) ;"); // enable D Cache
asm("ORR r0, r0, #0x1 ;"); // enable MPU
asm("MCR p15, 0, r0, c1, c0, 0 ;"); // write cp15 register 1
-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Yin Wen Chao (???)
Sent: Tuesday, December 05, 2006 5:35 PM
To: ecos-discuss
Subject: Re: [ECOS] cache configuration for 946es
Hi,Sinan KAYA
Maybe a bug in macro HAL_DCACHE_SYNC() definition for CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX.
Try the following modifying in packages/hal/arm/arm9/var/<VERSION>/include/hal_cache.h:
1. Add a macro, CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_4WAYS
2. Add a HAL_DCACHE_SYNC() definition for CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_4WAYS
Furthermore, confirm the definition of HAL_DCACHE_QUERY_WRITE_MODE( _mode_ ) correspond to
the region WRITEBACK/WRITETHU attribute in the initialization of Memory Protection Unit.
---
#elif defined(CYGPKG_HAL_ARM_ARM9_ARM946ES)
# define HAL_ICACHE_SIZE 0x2000
# define HAL_ICACHE_LINE_SIZE 32
# define HAL_ICACHE_WAYS 4
# define HAL_ICACHE_SETS
(HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS))
# define HAL_DCACHE_SIZE 0x1000
# define HAL_DCACHE_LINE_SIZE 32
# define HAL_DCACHE_WAYS 4
# define HAL_DCACHE_SETS
(HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS))
//# define CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX
# define CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_4WAY
# define CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_STEP 0x20
# define CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_LIMIT 0x400
#elif defined(CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_4WAYS)
#define HAL_DCACHE_SYNC() \
CYG_MACRO_START \
cyg_uint32 _tmp1, _tmp2; \
asm volatile ( \
"mov %0, #0;" \
"1: " \
"mov %1, #0;" \
"2: " \
"orr r0,%0,%1;" \
"mcr p15,0,r0,c7,c14,2;" /* clean index in DCache */ \
"add %1,%1,%2;" \
"cmp %1,%3;" \
"bne 2b;" \
"add %0,%0,#0x40000000;" /* get to next index, only for 4way cache */ \
"cmp %0,#0;" \
"bne 1b;" \
"mcr p15,0,r0,c7,c10,4;" /* drain the write buffer */ \
: "=r" (_tmp1), "=r" (_tmp2) \
: "I" (CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_STEP), \
"I" (CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_LIMIT) \
: "r0" /* Clobber list */ \
); \
CYG_MACRO_END
#elif defined(CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX)
#define HAL_DCACHE_SYNC() \
CYG_MACRO_START \
cyg_uint32 _tmp1, _tmp2; \
asm volatile ( \
"mov %0, #0;" \
"1: " \
"mov %1, #0;" \
"2: " \
"orr r0,%0,%1;" \
"mcr p15,0,r0,c7,c14,2;" /* clean index in DCache */ \
"add %1,%1,%2;" \
"cmp %1,%3;" \
"bne 2b;" \
"add %0,%0,#0x04000000;" /* get to next index */ \
"cmp %0,#0;" \
"bne 1b;" \
"mcr p15,0,r0,c7,c10,4;" /* drain the write buffer */ \
: "=r" (_tmp1), "=r" (_tmp2) \
: "I" (CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_STEP), \
"I" (CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_LIMIT) \
: "r0" /* Clobber list */ \
); \
CYG_MACRO_END
-----------------------------------
>Hi again,
>? checked the values from cache type register of arm
>?t says
>
>icache_Asc =2 -> four way associative
>?cache_Sz = 4 ->8kb
>?cache_pl = 2 -> 8 words per line
>
>dcache_Asc =2 -> four way associative
>dcache_Sz = 3 ->4kb
>dcache_pl = 2 -> 8 words per line
>
>
># define HAL_ICACHE_SIZE 0x2000
># define HAL_ICACHE_LINE_SIZE 32
># define HAL_ICACHE_WAYS 4
># define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS))
>
># define HAL_DCACHE_SIZE 0x1000
># define HAL_DCACHE_LINE_SIZE 32
># define HAL_DCACHE_WAYS 4
># define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS))
>
>How is the relationship between HAL_ICACHE_LINE_SIZE and 8 words per line. Is the unit of HAL_ICACHE_LINE_SIZE bytes ?
>Sinan.
>
>-----Original Message-----
>From: Yin Wen Chao (尹文超) [mailto:yinwenchao@vimicro.com]
>Sent: Tuesday, December 05, 2006 11:12 AM
>To: Sinan KAYA
>Subject: Re: [ECOS] cache configuration for 946es
>
>Hi,Sinan KAYA
>
> You should compare those cache information from the document you mentioned
>with those from the ARM you have.
>
>Reference:
>http://www.arm.com/pdfs/DDI0155A_946ES.pdf
>
> You can access the cache type register by reading CP15 register c0 with the Opcode_2
>field set to 1. For example:
> MRC p15, 0, <Rd>, c0, c0, 1; returns cache details
>
>-----------------------------------
>>Hi,
>>i have a 946es variant and i'm unable to pass kcache2 test even though
>>other cache tests, cache and kcache1 pass.
>>
>>I googled a little bit. Previous posts say that this test is designed to
>>find misconfigurations. So, i assume i have a misconfiguration. The
>>document of board tells me that i have 8 kb instruction cache, 4kb data
>>cache with four way associative set and 1024 byte segments.
>>
>>Each segment consists of 32 lines with 32 ( 8 x 4 bytes) bytes.
>>
>>and here is my configuration
>>
>>#elif defined(CYGPKG_HAL_ARM_ARM9_ARM946ES)
>>
>># define HAL_ICACHE_SIZE 0x2000
>># define HAL_ICACHE_LINE_SIZE 32
>># define HAL_ICACHE_WAYS 4
>># define HAL_ICACHE_SETS
>>(HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS))
>>
>># define HAL_DCACHE_SIZE 0x1000
>># define HAL_DCACHE_LINE_SIZE 32
>># define HAL_DCACHE_WAYS 4
>># define HAL_DCACHE_SETS
>>(HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS))
>>
>># define HAL_WRITE_BUFFER 32
>># define CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX
>># define CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_STEP 0x20
>># define CYGHWR_HAL_ARM_ARM9_CLEAN_DCACHE_INDEX_LIMIT 0x400
>>
>>
>>can anybody see a mistake?
>>
>>--
>>Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
>>and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>-----------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss