[xtensa-cvscommit] linux/arch/xtensa/kernel setup.c,1.8,1.9 sysxtensa.c,1.1.1.1,1.2
Brought to you by:
zankel
|
From: <jn...@us...> - 2003-02-28 01:53:27
|
Update of /cvsroot/xtensa/linux/arch/xtensa/kernel
In directory sc8-pr-cvs1:/tmp/cvs-serv6560/arch/xtensa/kernel
Modified Files:
setup.c sysxtensa.c
Log Message:
Added support for caches that have "ways" larger than PAGE_SIZE.
This was mostly copied from the sh-4 port which suffers from the
same feature. There are still some optimizations that can be done
with regard to defering some cache flusing, and reducing some complete
cache flushes to flushes of the appropriate cache lines.
When the cache way size is less than or equal to PAGE_SIZE, all
of these changes should be optimized away, and the port should run
exactly as it did prior to these changes.
Index: setup.c
===================================================================
RCS file: /cvsroot/xtensa/linux/arch/xtensa/kernel/setup.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** setup.c 15 Feb 2003 01:39:31 -0000 1.8
--- setup.c 28 Feb 2003 01:53:09 -0000 1.9
***************
*** 40,43 ****
--- 40,44 ----
#include <asm/timex.h>
#include <asm/machvec.h>
+ #include <asm/page.h>
#include <asm/platform/hardware.h>
***************
*** 295,298 ****
--- 296,302 ----
extern int mem_reserve(unsigned long, unsigned long, int);
extern void memory_init(void);
+ #if XTENSA_CACHE_ALIAS
+ extern void xtensa_cache_init(void);
+ #endif
memcpy(saved_command_line, command_line, CL_SIZE);
***************
*** 346,349 ****
--- 350,357 ----
/* Register panic handler, for debugging purposes only: */
notifier_chain_register(&panic_notifier_list, &xtensa_panic_block);
+ #endif
+
+ #if XTENSA_CACHE_ALIAS
+ xtensa_cache_init();
#endif
}
Index: sysxtensa.c
===================================================================
RCS file: /cvsroot/xtensa/linux/arch/xtensa/kernel/sysxtensa.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** sysxtensa.c 28 Aug 2002 16:10:14 -0000 1.1.1.1
--- sysxtensa.c 28 Feb 2003 01:53:09 -0000 1.2
***************
*** 15,21 ****
--- 15,26 ----
#include <linux/errno.h>
#include <linux/sched.h>
+ #include <linux/mm.h>
#include <asm/sysxtensa.h>
#include <asm/uaccess.h>
#include <asm/xtutil.h>
+ #include <asm/mman.h>
+ #include <asm/shmparam.h>
+ #include <asm/page.h>
+
***************
*** 67,70 ****
--- 72,165 ----
return retval;
}
+
+
+
+ /* 19feb2003 jn
+ * Some versions of xtensa don't have cache alias'ing problems (or benefits)
+ * so, we only include this code if it is actually required.
+ *
+ * This function was borrowed from the very nice folks at SH
+ * and I would like to thank the SH engineers for also having this
+ * cache aliasing problem (or benefit).
+ */
+
+ #if XTENSA_CACHE_ALIAS
+
+ /*
+ * To avoid cache alias, we map all shared pages with same color.
+ *
+ * 19feb2003 -- jn
+ * (this seems a bit restrictive to me, but it will do for now)
+ */
+ #define COLOUR_ALIGN(addr) (( (addr)+SHMLBA-1) & ~(SHMLBA-1) )
+
+ unsigned long arch_get_unmapped_area(
+ struct file *filp,
+ unsigned long addr,
+ unsigned long len,
+ unsigned long pgoff,
+ unsigned long flags)
+ {
+ struct vm_area_struct *vma;
+
+ if (flags & MAP_FIXED) {
+ /* We do not accept a shared mapping if it would violate
+ * cache aliasing constraints.
+ */
+ if ((flags & MAP_SHARED) && (addr & (SHMLBA - 1))) {
+ printk("arch_get_unmapped_area: violoates shared mapping...\n");
+ return -EINVAL;
+ }
+ printk("arch_get_unmapped_area: violoates shared mapping...\n");
+ return addr;
+ }
+
+
+ if (len > TASK_SIZE) {
+ printk("arch_get_unmapped_area: len > TASK_SIZE\n");
+ return -ENOMEM;
+ }
+
+
+ if (!addr) {
+ addr = TASK_UNMAPPED_BASE;
+ }
+
+
+ if (flags & MAP_PRIVATE) {
+ // printk("arch_get_unmapped_area: requesting private area.\n");
+ addr = PAGE_ALIGN(addr);
+ } else {
+ addr = COLOUR_ALIGN(addr);
+ }
+
+ for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) {
+ /* At this point: (!vma || addr < vma->vm_end). */
+ if (TASK_SIZE - len < addr) {
+ printk("arch_get_unmapped_area: no memory avail...\n");
+ return -ENOMEM;
+ }
+
+ if (!vma || addr + len <= vma->vm_start)
+ {
+ // printk("arch_get_unmapped_area returns: 0x%08x\n", addr);
+ return addr;
+ }
+
+ addr = vma->vm_end;
+
+ /* if we are not mapping private, then do the colour align thingy */
+ if (! (flags & MAP_PRIVATE) )
+ addr = COLOUR_ALIGN(addr);
+ #if 0
+ else
+ printk("arch_get_unmapped_area -- looking for a private area.\n");
+ #endif
+ }
+ }
+ #endif
+
+
+
/*
|