Commit 2464212f authored by Stuart Brady's avatar Stuart Brady Committed by Kyle McMartin

[PARISC] Fix parisc_setup_cache_timing to choose a better flush threshold

update comment about CAFL_STRIDE
Signed-off-by: default avatarKyle McMartin <kyle@parisc-linux.org>

Fixed a bug in parisc_setup_cache_timing() which caused it to calculate
a poor value for parisc_cache_flush_threshold.

Thanks to Joel Soete for spotting the bug.
Thanks to James Bottomley for pointing out the clean way to fix this.
Signed-off-by: default avatarStuart Brady <sdb@parisc-linux.org>
Signed-off-by: default avatarKyle McMartin <kyle@parisc-linux.org>
parent f053725b
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <asm/page.h> #include <asm/page.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/sections.h>
int split_tlb; int split_tlb;
int dcache_stride; int dcache_stride;
...@@ -207,6 +208,9 @@ parisc_cache_init(void) ...@@ -207,6 +208,9 @@ parisc_cache_init(void)
/* "New and Improved" version from Jim Hull /* "New and Improved" version from Jim Hull
* (1 << (cc_block-1)) * (cc_line << (4 + cnf.cc_shift)) * (1 << (cc_block-1)) * (cc_line << (4 + cnf.cc_shift))
* The following CAFL_STRIDE is an optimized version, see
* http://lists.parisc-linux.org/pipermail/parisc-linux/2004-June/023625.html
* http://lists.parisc-linux.org/pipermail/parisc-linux/2004-June/023671.html
*/ */
#define CAFL_STRIDE(cnf) (cnf.cc_line << (3 + cnf.cc_block + cnf.cc_shift)) #define CAFL_STRIDE(cnf) (cnf.cc_line << (3 + cnf.cc_block + cnf.cc_shift))
dcache_stride = CAFL_STRIDE(cache_info.dc_conf); dcache_stride = CAFL_STRIDE(cache_info.dc_conf);
...@@ -339,17 +343,15 @@ int parisc_cache_flush_threshold = FLUSH_THRESHOLD; ...@@ -339,17 +343,15 @@ int parisc_cache_flush_threshold = FLUSH_THRESHOLD;
void parisc_setup_cache_timing(void) void parisc_setup_cache_timing(void)
{ {
unsigned long rangetime, alltime; unsigned long rangetime, alltime;
extern char _text; /* start of kernel code, defined by linker */
extern char _end; /* end of BSS, defined by linker */
unsigned long size; unsigned long size;
alltime = mfctl(16); alltime = mfctl(16);
flush_data_cache(); flush_data_cache();
alltime = mfctl(16) - alltime; alltime = mfctl(16) - alltime;
size = (unsigned long)(&_end - _text); size = (unsigned long)(_end - _text);
rangetime = mfctl(16); rangetime = mfctl(16);
flush_kernel_dcache_range((unsigned long)&_text, size); flush_kernel_dcache_range((unsigned long)_text, size);
rangetime = mfctl(16) - rangetime; rangetime = mfctl(16) - rangetime;
printk(KERN_DEBUG "Whole cache flush %lu cycles, flushing %lu bytes %lu cycles\n", printk(KERN_DEBUG "Whole cache flush %lu cycles, flushing %lu bytes %lu cycles\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment