From 601149775158ea825326734c2db5d90190249bd7 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 18 Feb 2011 14:29:20 +0100 Subject: microblaze: Fix unaligned.h for endians Synchronized with mips unaligned.h. Signed-off-by: Michal Simek --- arch/microblaze/include/asm/unaligned.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/unaligned.h b/arch/microblaze/include/asm/unaligned.h index 2b97cbe500e9..b162ed880495 100644 --- a/arch/microblaze/include/asm/unaligned.h +++ b/arch/microblaze/include/asm/unaligned.h @@ -12,18 +12,19 @@ # ifdef __KERNEL__ -# include -# include -# include - - # ifdef __MICROBLAZEEL__ +# include +# include # define get_unaligned __get_unaligned_le # define put_unaligned __put_unaligned_le # else +# include +# include # define get_unaligned __get_unaligned_be # define put_unaligned __put_unaligned_be # endif +# include + # endif /* __KERNEL__ */ #endif /* _ASM_MICROBLAZE_UNALIGNED_H */ -- cgit v1.2.1 From 6e83557c38b40d6e9d1c82ad0ae59d8e5db9c50c Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 31 Jan 2011 15:10:04 +0100 Subject: microblaze: Remove r0_ram pointer and PTO alignment r0_ram pool was used for saving/restoring register content if hw exception happen. This poll was replaced by pt_pool_space with PT_SIZE size. Based on this change SAVE_STATE_ARG_SPACE was removed which caused that PTO offset is zero that's why is also removed. r0_ram space was used as scratchpad by v850. In early Microblaze Linux developing phase was this part of code blindly copied. Signed-off-by: Michal Simek --- arch/microblaze/include/asm/entry.h | 36 --------------------------------- arch/microblaze/include/asm/processor.h | 2 +- 2 files changed, 1 insertion(+), 37 deletions(-) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/entry.h b/arch/microblaze/include/asm/entry.h index ec89f2ad0fe1..af0144b91b79 100644 --- a/arch/microblaze/include/asm/entry.h +++ b/arch/microblaze/include/asm/entry.h @@ -31,40 +31,4 @@ DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */ DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */ # endif /* __ASSEMBLY__ */ -#ifndef CONFIG_MMU - -/* noMMU hasn't any space for args */ -# define STATE_SAVE_ARG_SPACE (0) - -#else /* CONFIG_MMU */ - -/* If true, system calls save and restore all registers (except result - * registers, of course). If false, then `call clobbered' registers - * will not be preserved, on the theory that system calls are basically - * function calls anyway, and the caller should be able to deal with it. - * This is a security risk, of course, as `internal' values may leak out - * after a system call, but that certainly doesn't matter very much for - * a processor with no MMU protection! For a protected-mode kernel, it - * would be faster to just zero those registers before returning. - * - * I can not rely on the glibc implementation. If you turn it off make - * sure that r11/r12 is saved in user-space. --KAA - * - * These are special variables using by the kernel trap/interrupt code - * to save registers in, at a time when there are no spare registers we - * can use to do so, and we can't depend on the value of the stack - * pointer. This means that they must be within a signed 16-bit - * displacement of 0x00000000. - */ - -/* A `state save frame' is a struct pt_regs preceded by some extra space - * suitable for a function call stack frame. */ - -/* Amount of room on the stack reserved for arguments and to satisfy the - * C calling conventions, in addition to the space used by the struct - * pt_regs that actually holds saved values. */ -#define STATE_SAVE_ARG_SPACE (6*4) /* Up to six arguments */ - -#endif /* CONFIG_MMU */ - #endif /* _ASM_MICROBLAZE_ENTRY_H */ diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h index 8eeb09211ece..aed2a6be8e27 100644 --- a/arch/microblaze/include/asm/processor.h +++ b/arch/microblaze/include/asm/processor.h @@ -155,7 +155,7 @@ unsigned long get_wchan(struct task_struct *p); # define task_regs(task) ((struct pt_regs *)task_tos(task) - 1) # define task_pt_regs_plus_args(tsk) \ - (((void *)task_pt_regs(tsk)) - STATE_SAVE_ARG_SPACE) + ((void *)task_pt_regs(tsk)) # define task_sp(task) (task_regs(task)->r1) # define task_pc(task) (task_regs(task)->pc) -- cgit v1.2.1 From a706729c3df22d5cf4a50a02c25f5ebfcb370c82 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 28 May 2010 14:45:38 +0200 Subject: microblaze: Fix GDB issue caused by cache issue Used the same solution as SH. Changed len to PAGE_SIZE in copy_to_user_page macro. Implement flush_cache_page macro. Signed-off-by: Michal Simek --- arch/microblaze/include/asm/cacheflush.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/cacheflush.h b/arch/microblaze/include/asm/cacheflush.h index 7ebd955460d9..5a5d835ae16d 100644 --- a/arch/microblaze/include/asm/cacheflush.h +++ b/arch/microblaze/include/asm/cacheflush.h @@ -89,7 +89,9 @@ do { \ #define flush_cache_vmap(start, end) do { } while (0) #define flush_cache_vunmap(start, end) do { } while (0) #define flush_cache_mm(mm) do { } while (0) -#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) + +#define flush_cache_page(vma, vmaddr, pfn) \ + flush_dcache_range(pfn << PAGE_SHIFT, (pfn << PAGE_SHIFT) + PAGE_SIZE); /* MS: kgdb code use this macro, wrong len with FLASH */ #if 0 @@ -104,9 +106,13 @@ do { \ #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ do { \ u32 addr = virt_to_phys(dst); \ - invalidate_icache_range((unsigned) (addr), (unsigned) (addr) + (len));\ memcpy((dst), (src), (len)); \ - flush_dcache_range((unsigned) (addr), (unsigned) (addr) + (len));\ + if (vma->vm_flags & VM_EXEC) { \ + invalidate_icache_range((unsigned) (addr), \ + (unsigned) (addr) + PAGE_SIZE); \ + flush_dcache_range((unsigned) (addr), \ + (unsigned) (addr) + PAGE_SIZE); \ + } \ } while (0) #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ -- cgit v1.2.1 From 702d54277af852b99c05c42cc988bb2f9dede93b Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 8 Feb 2011 14:55:09 +0100 Subject: microblaze: Fix coding style - ptrace.h Use tab instead of spaces. Signed-off-by: Michal Simek --- arch/microblaze/include/asm/ptrace.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/ptrace.h b/arch/microblaze/include/asm/ptrace.h index d74dbfb92c04..d9b66304d5dd 100644 --- a/arch/microblaze/include/asm/ptrace.h +++ b/arch/microblaze/include/asm/ptrace.h @@ -66,13 +66,13 @@ void show_regs(struct pt_regs *); #else /* __KERNEL__ */ /* pt_regs offsets used by gdbserver etc in ptrace syscalls */ -#define PT_GPR(n) ((n) * sizeof(microblaze_reg_t)) -#define PT_PC (32 * sizeof(microblaze_reg_t)) -#define PT_MSR (33 * sizeof(microblaze_reg_t)) -#define PT_EAR (34 * sizeof(microblaze_reg_t)) -#define PT_ESR (35 * sizeof(microblaze_reg_t)) -#define PT_FSR (36 * sizeof(microblaze_reg_t)) -#define PT_KERNEL_MODE (37 * sizeof(microblaze_reg_t)) +#define PT_GPR(n) ((n) * sizeof(microblaze_reg_t)) +#define PT_PC (32 * sizeof(microblaze_reg_t)) +#define PT_MSR (33 * sizeof(microblaze_reg_t)) +#define PT_EAR (34 * sizeof(microblaze_reg_t)) +#define PT_ESR (35 * sizeof(microblaze_reg_t)) +#define PT_FSR (36 * sizeof(microblaze_reg_t)) +#define PT_KERNEL_MODE (37 * sizeof(microblaze_reg_t)) #endif /* __KERNEL */ -- cgit v1.2.1 From 0a2e1d23f2976287904e611b195f628a52b299b1 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 21 Jul 2009 12:58:21 +0200 Subject: microblaze: trivial: Add one empty line Add one empty line to microblaze_ksyms.c. Remove one empty line to cacheflush.h. Signed-off-by: Michal Simek --- arch/microblaze/include/asm/cacheflush.h | 1 - 1 file changed, 1 deletion(-) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/cacheflush.h b/arch/microblaze/include/asm/cacheflush.h index 5a5d835ae16d..0f553bc009a0 100644 --- a/arch/microblaze/include/asm/cacheflush.h +++ b/arch/microblaze/include/asm/cacheflush.h @@ -84,7 +84,6 @@ do { \ #define flush_dcache_mmap_lock(mapping) do { } while (0) #define flush_dcache_mmap_unlock(mapping) do { } while (0) - #define flush_cache_dup_mm(mm) do { } while (0) #define flush_cache_vmap(start, end) do { } while (0) #define flush_cache_vunmap(start, end) do { } while (0) -- cgit v1.2.1 From f699980b0d3c0f4f31e07ef45a48bbe860510a89 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 7 Feb 2011 11:36:25 +0100 Subject: microblaze: Fix sparse warning - sw_exceptions Function sw_exception is linked with asm code. Warning log: CHECK arch/microblaze/kernel/exceptions.c arch/microblaze/kernel/exceptions.c:53:6: warning: symbol 'sw_exception' was not declared. Should it be static? Signed-off-by: Michal Simek --- arch/microblaze/include/asm/exceptions.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/exceptions.h b/arch/microblaze/include/asm/exceptions.h index 6479097b802b..23c0f71db8e3 100644 --- a/arch/microblaze/include/asm/exceptions.h +++ b/arch/microblaze/include/asm/exceptions.h @@ -66,6 +66,8 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, int fsr, int addr); +asmlinkage void sw_exception(struct pt_regs *regs); + void die(const char *str, struct pt_regs *fp, long err); void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); -- cgit v1.2.1 From c1df53b33c818d28d5e3b287530373e78a7904e7 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 7 Feb 2011 11:38:57 +0100 Subject: microblaze: Fix sparse warnings - ptrace Warning log: CHECK arch/microblaze/kernel/ptrace.c arch/microblaze/kernel/ptrace.c:126:11: warning: incorrect type in initializer (different address spaces) arch/microblaze/kernel/ptrace.c:126:11: expected unknown type 2[noderef] *__pu_addr arch/microblaze/kernel/ptrace.c:126:11: got unsigned long * arch/microblaze/kernel/ptrace.c:134:17: warning: symbol 'do_syscall_trace_enter' was not declared. Should it be static? arch/microblaze/kernel/ptrace.c:157:17: warning: symbol 'do_syscall_trace_leave' was not declared. Should it be static? Signed-off-by: Michal Simek --- arch/microblaze/include/asm/syscall.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/syscall.h b/arch/microblaze/include/asm/syscall.h index 048dfcd8d89d..9bc431783105 100644 --- a/arch/microblaze/include/asm/syscall.h +++ b/arch/microblaze/include/asm/syscall.h @@ -96,4 +96,7 @@ static inline void syscall_set_arguments(struct task_struct *task, microblaze_set_syscall_arg(regs, i++, *args++); } +asmlinkage long do_syscall_trace_enter(struct pt_regs *regs); +asmlinkage void do_syscall_trace_leave(struct pt_regs *regs); + #endif /* __ASM_MICROBLAZE_SYSCALL_H */ -- cgit v1.2.1 From cd44da154241170be3f1fadb1f2ca689f6802628 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 7 Feb 2011 11:42:37 +0100 Subject: microblaze: Fix sparse warning - consistent_alloc function Warning in dma.c was caused by incorrect type in consistent_alloc function. Warning log: CHECK arch/microblaze/kernel/dma.c arch/microblaze/kernel/dma.c:53:26: warning: incorrect type in argument 1 (different base types) arch/microblaze/kernel/dma.c:53:26: expected int [signed] gfp arch/microblaze/kernel/dma.c:53:26: got restricted unsigned int [usertype] flag Signed-off-by: Michal Simek --- arch/microblaze/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h index 885574a73f01..b2af42311a12 100644 --- a/arch/microblaze/include/asm/pgtable.h +++ b/arch/microblaze/include/asm/pgtable.h @@ -572,7 +572,7 @@ void __init *early_get_page(void); extern unsigned long ioremap_bot, ioremap_base; -void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle); +void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle); void consistent_free(size_t size, void *vaddr); void consistent_sync(void *vaddr, size_t size, int direction); void consistent_sync_page(struct page *page, unsigned long offset, -- cgit v1.2.1 From 8afe3839a993beda2ebc119c0a545dcc5baecc08 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 7 Feb 2011 11:56:14 +0100 Subject: microblaze: Fix sparse warning - cpuinfo.h Warning log: CHECK arch/microblaze/kernel/cpu/cpuinfo-static.c arch/microblaze/include/asm/cpuinfo.h:101:21: warning: incorrect type in argument 1 (different signedness) arch/microblaze/include/asm/cpuinfo.h:101:21: expected unsigned int const [usertype] *p arch/microblaze/include/asm/cpuinfo.h:101:21: got int *[assigned] val ... Signed-off-by: Michal Simek --- arch/microblaze/include/asm/cpuinfo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/cpuinfo.h b/arch/microblaze/include/asm/cpuinfo.h index cd257537ae54..d8f013347a9e 100644 --- a/arch/microblaze/include/asm/cpuinfo.h +++ b/arch/microblaze/include/asm/cpuinfo.h @@ -96,8 +96,8 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu); static inline unsigned int fcpu(struct device_node *cpu, char *n) { - int *val; - return (val = (int *) of_get_property(cpu, n, NULL)) ? + const __be32 *val; + return (val = of_get_property(cpu, n, NULL)) ? be32_to_cpup(val) : 0; } -- cgit v1.2.1 From 4302e5254a8a9e726db444763be1e95e063406fb Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 7 Feb 2011 12:22:55 +0100 Subject: microblaze: Fix missing microblaze specific syscalls declaration Warning log: CHECK arch/microblaze/kernel/sys_microblaze.c arch/microblaze/kernel/sys_microblaze.c:37:17: warning: symbol 'microblaze_vfork' was not declared. Should it be static? arch/microblaze/kernel/sys_microblaze.c:43:17: warning: symbol 'microblaze_clone' was not declared. Should it be static? arch/microblaze/kernel/sys_microblaze.c:50:17: warning: symbol 'microblaze_execve' was not declared. Should it be static? Signed-off-by: Michal Simek --- arch/microblaze/include/asm/syscalls.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/syscalls.h b/arch/microblaze/include/asm/syscalls.h index 720761cc741f..27f2f4c0f39f 100644 --- a/arch/microblaze/include/asm/syscalls.h +++ b/arch/microblaze/include/asm/syscalls.h @@ -1,5 +1,13 @@ #ifndef __ASM_MICROBLAZE_SYSCALLS_H +asmlinkage long microblaze_vfork(struct pt_regs *regs); +asmlinkage long microblaze_clone(int flags, unsigned long stack, + struct pt_regs *regs); +asmlinkage long microblaze_execve(const char __user *filenamei, + const char __user *const __user *argv, + const char __user *const __user *envp, + struct pt_regs *regs); + asmlinkage long sys_clone(int flags, unsigned long stack, struct pt_regs *regs); #define sys_clone sys_clone -- cgit v1.2.1 From 5213a9c3b663dd946d7c8bdfc9180983bd03a2a1 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 7 Feb 2011 12:24:39 +0100 Subject: microblaze: Fix sparse warning - fault.c Warning log: CHECK arch/microblaze/mm/fault.c arch/microblaze/mm/fault.c:51:6: warning: incorrect type in initializer (different address spaces) arch/microblaze/mm/fault.c:51:6: expected unknown type 2const [noderef] *__gu_addr arch/microblaze/mm/fault.c:51:6: got unsigned int * arch/microblaze/mm/fault.c:68:6: warning: symbol 'bad_page_fault' was not declared. Should it be static? Signed-off-by: Michal Simek --- arch/microblaze/include/asm/exceptions.h | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/exceptions.h b/arch/microblaze/include/asm/exceptions.h index 23c0f71db8e3..e6a8ddea1dca 100644 --- a/arch/microblaze/include/asm/exceptions.h +++ b/arch/microblaze/include/asm/exceptions.h @@ -67,6 +67,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, int fsr, int addr); asmlinkage void sw_exception(struct pt_regs *regs); +void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig); void die(const char *str, struct pt_regs *fp, long err); void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); -- cgit v1.2.1 From 6f3946b421395ff853bc0bcdab9c26b50ebbba8f Mon Sep 17 00:00:00 2001 From: "Steven J. Magnani" Date: Thu, 10 Feb 2011 12:12:13 -0600 Subject: microblaze: Fix /dev/zero corruption from __clear_user() A userland read of more than PAGE_SIZE bytes from /dev/zero results in (a) not all of the bytes returned being zero, and (b) memory corruption due to zeroing of bytes beyond the user buffer. This is caused by improper constraints on the assembly __clear_user function. The constrints don't indicate to the compiler that the pointer argument is modified. Since the function is inline, this results in double-incrementing of the pointer when __clear_user() is invoked through a multi-page read() of /dev/zero. Signed-off-by: Steven J. Magnani Acked-by: Michal Simek CC: stable@kernel.org --- arch/microblaze/include/asm/uaccess.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index d840f4a2d3c9..5bb95a11880d 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h @@ -120,16 +120,16 @@ static inline unsigned long __must_check __clear_user(void __user *to, { /* normal memset with two words to __ex_table */ __asm__ __volatile__ ( \ - "1: sb r0, %2, r0;" \ + "1: sb r0, %1, r0;" \ " addik %0, %0, -1;" \ " bneid %0, 1b;" \ - " addik %2, %2, 1;" \ + " addik %1, %1, 1;" \ "2: " \ __EX_TABLE_SECTION \ ".word 1b,2b;" \ ".previous;" \ - : "=r"(n) \ - : "0"(n), "r"(to) + : "=r"(n), "=r"(to) \ + : "0"(n), "1"(to) ); return n; } -- cgit v1.2.1 From caa66ce9055d15fb319075ebcf30fbc666b41665 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 10 Mar 2011 10:39:51 +0100 Subject: microblaze: Fix circular headers dependency when ftrace is enabled. Remove compilation failure when ftrace in enabled. Error log: CC kernel/trace/power-traces.o In file included from arch/microblaze/include/asm/irq.h:15, from include/linux/irq.h:27, from include/asm-generic/hardirq.h:12, from arch/microblaze/include/asm/hardirq.h:15, from include/linux/hardirq.h:7, from include/linux/ftrace_event.h:7, from include/trace/ftrace.h:19, from include/trace/define_trace.h:96, from include/trace/events/power.h:240, from kernel/trace/power-traces.c:14: include/linux/interrupt.h: In function '__raise_softirq_irqoff': include/linux/interrupt.h:413: error: implicit declaration of function 'trace_softirq_raise' In file included from include/trace/ftrace.h:554, from include/trace/define_trace.h:96, from include/trace/events/power.h:240, from kernel/trace/power-traces.c:14: include/trace/events/irq.h: In function 'ftrace_test_probe_irq_handler_entry': include/trace/events/irq.h:37: error: implicit declaration of function 'check_trace_callback_type_irq_handler_entry' include/trace/events/irq.h: In function 'ftrace_test_probe_irq_handler_exit': include/trace/events/irq.h:67: error: implicit declaration of function 'check_trace_callback_type_irq_handler_exit' include/trace/events/irq.h: In function 'ftrace_test_probe_softirq_entry': include/trace/events/irq.h:112: error: implicit declaration of function 'check_trace_callback_type_softirq_entry' include/trace/events/irq.h: In function 'ftrace_test_probe_softirq_exit': include/trace/events/irq.h:126: error: implicit declaration of function 'check_trace_callback_type_softirq_exit' include/trace/events/irq.h: In function 'ftrace_test_probe_softirq_raise': include/trace/events/irq.h:140: error: implicit declaration of function 'check_trace_callback_type_softirq_raise' make[5]: *** [kernel/trace/power-traces.o] Error 1 make[4]: *** [kernel/trace] Error 2 make[3]: *** [kernel] Error 2 Suggested-by: Steven Rostedt Signed-off-by: Michal Simek --- arch/microblaze/include/asm/irq.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch/microblaze/include') diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index ec5583d6111c..cc54187f3d38 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h @@ -12,8 +12,6 @@ #define NR_IRQS 32 #include -#include - /* This type is the placeholder for a hardware interrupt number. It has to * be big enough to enclose whatever representation is used by a given * platform. -- cgit v1.2.1