diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2010-06-25 17:04:17 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2010-07-06 13:41:51 -0400 |
commit | 0707ad30d10110aebc01a5a64fb63f4b32d20b73 (patch) | |
tree | 64d8ba73e605ac26e56808d1d77701b3f83cf8b2 /arch/tile/kernel | |
parent | c78095bd8c77fca2619769ff8efb639fd100e373 (diff) |
arch/tile: Miscellaneous cleanup changes.
This commit is primarily changes caused by reviewing "sparse"
and "checkpatch" output on our sources, so is somewhat noisy, since
things like "printk() -> pr_err()" (or whatever) throughout the
codebase tend to get tedious to read. Rather than trying to tease
apart precisely which things changed due to which type of code
review, this commit includes various cleanups in the code:
- sparse: Add declarations in headers for globals.
- sparse: Fix __user annotations.
- sparse: Using gfp_t consistently instead of int.
- sparse: removing functions not actually used.
- checkpatch: Clean up printk() warnings by using pr_info(), etc.;
also avoid partial-line printks except in bootup code.
- checkpatch: Use exposed structs rather than typedefs.
- checkpatch: Change some C99 comments to C89 comments.
In addition, a couple of minor other changes are rolled in
to this commit:
- Add support for a "raise" instruction to cause SIGFPE, etc., to be raised.
- Remove some compat code that is unnecessary when we fully eliminate
some of the deprecated syscalls from the generic syscall ABI.
- Update the tile_defconfig to reflect current config contents.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/tile/kernel')
-rw-r--r-- | arch/tile/kernel/backtrace.c | 81 | ||||
-rw-r--r-- | arch/tile/kernel/compat.c | 28 | ||||
-rw-r--r-- | arch/tile/kernel/compat_signal.c | 10 | ||||
-rw-r--r-- | arch/tile/kernel/early_printk.c | 2 | ||||
-rw-r--r-- | arch/tile/kernel/entry.S | 4 | ||||
-rw-r--r-- | arch/tile/kernel/machine_kexec.c | 38 | ||||
-rw-r--r-- | arch/tile/kernel/messaging.c | 5 | ||||
-rw-r--r-- | arch/tile/kernel/module.c | 16 | ||||
-rw-r--r-- | arch/tile/kernel/process.c | 110 | ||||
-rw-r--r-- | arch/tile/kernel/ptrace.c | 3 | ||||
-rw-r--r-- | arch/tile/kernel/reboot.c | 7 | ||||
-rw-r--r-- | arch/tile/kernel/setup.c | 132 | ||||
-rw-r--r-- | arch/tile/kernel/signal.c | 19 | ||||
-rw-r--r-- | arch/tile/kernel/single_step.c | 75 | ||||
-rw-r--r-- | arch/tile/kernel/smpboot.c | 37 | ||||
-rw-r--r-- | arch/tile/kernel/stack.c | 43 | ||||
-rw-r--r-- | arch/tile/kernel/sys.c | 18 | ||||
-rw-r--r-- | arch/tile/kernel/time.c | 7 | ||||
-rw-r--r-- | arch/tile/kernel/traps.c | 130 | ||||
-rw-r--r-- | arch/tile/kernel/vmlinux.lds.S | 4 |
20 files changed, 420 insertions, 349 deletions
diff --git a/arch/tile/kernel/backtrace.c b/arch/tile/kernel/backtrace.c index 1b0a410ef5e..77265f3b58d 100644 --- a/arch/tile/kernel/backtrace.c +++ b/arch/tile/kernel/backtrace.c @@ -30,18 +30,18 @@ /** A decoded bundle used for backtracer analysis. */ -typedef struct { +struct BacktraceBundle { tile_bundle_bits bits; int num_insns; struct tile_decoded_instruction insns[TILE_MAX_INSTRUCTIONS_PER_BUNDLE]; -} BacktraceBundle; +}; /* This implementation only makes sense for native tools. */ /** Default function to read memory. */ -static bool -bt_read_memory(void *result, VirtualAddress addr, size_t size, void *extra) +static bool bt_read_memory(void *result, VirtualAddress addr, + size_t size, void *extra) { /* FIXME: this should do some horrible signal stuff to catch * SEGV cleanly and fail. @@ -58,11 +58,11 @@ bt_read_memory(void *result, VirtualAddress addr, size_t size, void *extra) * has the specified mnemonic, and whose first 'num_operands_to_match' * operands exactly match those in 'operand_values'. */ -static const struct tile_decoded_instruction* -find_matching_insn(const BacktraceBundle *bundle, - tile_mnemonic mnemonic, - const int *operand_values, - int num_operands_to_match) +static const struct tile_decoded_instruction *find_matching_insn( + const struct BacktraceBundle *bundle, + tile_mnemonic mnemonic, + const int *operand_values, + int num_operands_to_match) { int i, j; bool match; @@ -90,8 +90,7 @@ find_matching_insn(const BacktraceBundle *bundle, } /** Does this bundle contain an 'iret' instruction? */ -static inline bool -bt_has_iret(const BacktraceBundle *bundle) +static inline bool bt_has_iret(const struct BacktraceBundle *bundle) { return find_matching_insn(bundle, TILE_OPC_IRET, NULL, 0) != NULL; } @@ -99,8 +98,7 @@ bt_has_iret(const BacktraceBundle *bundle) /** Does this bundle contain an 'addi sp, sp, OFFSET' or * 'addli sp, sp, OFFSET' instruction, and if so, what is OFFSET? */ -static bool -bt_has_addi_sp(const BacktraceBundle *bundle, int *adjust) +static bool bt_has_addi_sp(const struct BacktraceBundle *bundle, int *adjust) { static const int vals[2] = { TREG_SP, TREG_SP }; @@ -120,8 +118,7 @@ bt_has_addi_sp(const BacktraceBundle *bundle, int *adjust) * as an unsigned value by this code since that's what the caller wants. * Returns the number of info ops found. */ -static int -bt_get_info_ops(const BacktraceBundle *bundle, +static int bt_get_info_ops(const struct BacktraceBundle *bundle, int operands[MAX_INFO_OPS_PER_BUNDLE]) { int num_ops = 0; @@ -143,8 +140,7 @@ bt_get_info_ops(const BacktraceBundle *bundle, /** Does this bundle contain a jrp instruction, and if so, to which * register is it jumping? */ -static bool -bt_has_jrp(const BacktraceBundle *bundle, int *target_reg) +static bool bt_has_jrp(const struct BacktraceBundle *bundle, int *target_reg) { const struct tile_decoded_instruction *insn = find_matching_insn(bundle, TILE_OPC_JRP, NULL, 0); @@ -156,8 +152,7 @@ bt_has_jrp(const BacktraceBundle *bundle, int *target_reg) } /** Does this bundle modify the specified register in any way? */ -static bool -bt_modifies_reg(const BacktraceBundle *bundle, int reg) +static bool bt_modifies_reg(const struct BacktraceBundle *bundle, int reg) { int i, j; for (i = 0; i < bundle->num_insns; i++) { @@ -177,30 +172,26 @@ bt_modifies_reg(const BacktraceBundle *bundle, int reg) } /** Does this bundle modify sp? */ -static inline bool -bt_modifies_sp(const BacktraceBundle *bundle) +static inline bool bt_modifies_sp(const struct BacktraceBundle *bundle) { return bt_modifies_reg(bundle, TREG_SP); } /** Does this bundle modify lr? */ -static inline bool -bt_modifies_lr(const BacktraceBundle *bundle) +static inline bool bt_modifies_lr(const struct BacktraceBundle *bundle) { return bt_modifies_reg(bundle, TREG_LR); } /** Does this bundle contain the instruction 'move fp, sp'? */ -static inline bool -bt_has_move_r52_sp(const BacktraceBundle *bundle) +static inline bool bt_has_move_r52_sp(const struct BacktraceBundle *bundle) { static const int vals[2] = { 52, TREG_SP }; return find_matching_insn(bundle, TILE_OPC_MOVE, vals, 2) != NULL; } /** Does this bundle contain the instruction 'sw sp, lr'? */ -static inline bool -bt_has_sw_sp_lr(const BacktraceBundle *bundle) +static inline bool bt_has_sw_sp_lr(const struct BacktraceBundle *bundle) { static const int vals[2] = { TREG_SP, TREG_LR }; return find_matching_insn(bundle, TILE_OPC_SW, vals, 2) != NULL; @@ -209,11 +200,10 @@ bt_has_sw_sp_lr(const BacktraceBundle *bundle) /** Locates the caller's PC and SP for a program starting at the * given address. */ -static void -find_caller_pc_and_caller_sp(CallerLocation *location, - const VirtualAddress start_pc, - BacktraceMemoryReader read_memory_func, - void *read_memory_func_extra) +static void find_caller_pc_and_caller_sp(CallerLocation *location, + const VirtualAddress start_pc, + BacktraceMemoryReader read_memory_func, + void *read_memory_func_extra) { /* Have we explicitly decided what the sp is, * rather than just the default? @@ -253,7 +243,7 @@ find_caller_pc_and_caller_sp(CallerLocation *location, for (pc = start_pc;; pc += sizeof(tile_bundle_bits)) { - BacktraceBundle bundle; + struct BacktraceBundle bundle; int num_info_ops, info_operands[MAX_INFO_OPS_PER_BUNDLE]; int one_ago, jrp_reg; bool has_jrp; @@ -475,12 +465,11 @@ find_caller_pc_and_caller_sp(CallerLocation *location, } } -void -backtrace_init(BacktraceIterator *state, - BacktraceMemoryReader read_memory_func, - void *read_memory_func_extra, - VirtualAddress pc, VirtualAddress lr, - VirtualAddress sp, VirtualAddress r52) +void backtrace_init(BacktraceIterator *state, + BacktraceMemoryReader read_memory_func, + void *read_memory_func_extra, + VirtualAddress pc, VirtualAddress lr, + VirtualAddress sp, VirtualAddress r52) { CallerLocation location; VirtualAddress fp, initial_frame_caller_pc; @@ -558,8 +547,7 @@ backtrace_init(BacktraceIterator *state, state->read_memory_func_extra = read_memory_func_extra; } -bool -backtrace_next(BacktraceIterator *state) +bool backtrace_next(BacktraceIterator *state) { VirtualAddress next_fp, next_pc, next_frame[2]; @@ -614,12 +602,11 @@ backtrace_next(BacktraceIterator *state) #else /* TILE_CHIP < 10 */ -void -backtrace_init(BacktraceIterator *state, - BacktraceMemoryReader read_memory_func, - void *read_memory_func_extra, - VirtualAddress pc, VirtualAddress lr, - VirtualAddress sp, VirtualAddress r52) +void backtrace_init(BacktraceIterator *state, + BacktraceMemoryReader read_memory_func, + void *read_memory_func_extra, + VirtualAddress pc, VirtualAddress lr, + VirtualAddress sp, VirtualAddress r52) { state->pc = pc; state->sp = sp; diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c index a374c99deeb..b1e06d04155 100644 --- a/arch/tile/kernel/compat.c +++ b/arch/tile/kernel/compat.c @@ -88,34 +88,14 @@ long compat_sys_sched_rr_get_interval(compat_pid_t pid, mm_segment_t old_fs = get_fs(); set_fs(KERNEL_DS); - ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t); + ret = sys_sched_rr_get_interval(pid, + (struct timespec __force __user *)&t); set_fs(old_fs); if (put_compat_timespec(&t, interval)) return -EFAULT; return ret; } -ssize_t compat_sys_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, - size_t count) -{ - mm_segment_t old_fs = get_fs(); - int ret; - off_t of; - - if (offset && get_user(of, offset)) - return -EFAULT; - - set_fs(KERNEL_DS); - ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, - count); - set_fs(old_fs); - - if (offset && put_user(of, offset)) - return -EFAULT; - return ret; -} - - /* * The usual compat_sys_msgsnd() and _msgrcv() seem to be assuming * some different calling convention than our normal 32-bit tile code. @@ -177,6 +157,10 @@ long tile_compat_sys_msgrcv(int msqid, /* Pass full 64-bit values through ptrace. */ #define compat_sys_ptrace tile_compat_sys_ptrace +/* + * Note that we can't include <linux/unistd.h> here since the header + * guard will defeat us; <asm/unistd.h> checks for __SYSCALL as well. + */ void *compat_sys_call_table[__NR_syscalls] = { [0 ... __NR_syscalls-1] = sys_ni_syscall, #include <asm/unistd.h> diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index 9fa4ba8ed5f..d5efb215dd5 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c @@ -32,13 +32,14 @@ #include <asm/processor.h> #include <asm/ucontext.h> #include <asm/sigframe.h> +#include <asm/syscalls.h> #include <arch/interrupts.h> struct compat_sigaction { compat_uptr_t sa_handler; compat_ulong_t sa_flags; compat_uptr_t sa_restorer; - sigset_t sa_mask; /* mask last for extensibility */ + sigset_t sa_mask __packed; }; struct compat_sigaltstack { @@ -170,7 +171,7 @@ long compat_sys_rt_sigqueueinfo(int pid, int sig, if (copy_siginfo_from_user32(&info, uinfo)) return -EFAULT; set_fs(KERNEL_DS); - ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info); + ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __force __user *)&info); set_fs(old_fs); return ret; } @@ -274,7 +275,8 @@ long _compat_sys_sigaltstack(const struct compat_sigaltstack __user *uss_ptr, } seg = get_fs(); set_fs(KERNEL_DS); - ret = do_sigaltstack(uss_ptr ? &uss : NULL, &uoss, + ret = do_sigaltstack(uss_ptr ? (stack_t __user __force *)&uss : NULL, + (stack_t __user __force *)&uoss, (unsigned long)compat_ptr(regs->sp)); set_fs(seg); if (ret >= 0 && uoss_ptr) { @@ -336,7 +338,7 @@ static inline void __user *compat_get_sigframe(struct k_sigaction *ka, * will die with SIGSEGV. */ if (on_sig_stack(sp) && !likely(on_sig_stack(sp - frame_size))) - return (void __user *) -1L; + return (void __user __force *)-1UL; /* This is the X/Open sanctioned signal stack switching. */ if (ka->sa.sa_flags & SA_ONSTACK) { diff --git a/arch/tile/kernel/early_printk.c b/arch/tile/kernel/early_printk.c index e44d441e3f3..2c54fd43a8a 100644 --- a/arch/tile/kernel/early_printk.c +++ b/arch/tile/kernel/early_printk.c @@ -32,7 +32,7 @@ static struct console early_hv_console = { }; /* Direct interface for emergencies */ -struct console *early_console = &early_hv_console; +static struct console *early_console = &early_hv_console; static int early_console_initialized; static int early_console_complete; diff --git a/arch/tile/kernel/entry.S b/arch/tile/kernel/entry.S index 136261f7d7f..3d01383b1b0 100644 --- a/arch/tile/kernel/entry.S +++ b/arch/tile/kernel/entry.S @@ -13,9 +13,9 @@ */ #include <linux/linkage.h> -#include <arch/abi.h> -#include <asm/unistd.h> +#include <linux/unistd.h> #include <asm/irqflags.h> +#include <arch/abi.h> #ifdef __tilegx__ #define bnzt bnezt diff --git a/arch/tile/kernel/machine_kexec.c b/arch/tile/kernel/machine_kexec.c index ed3e1cb8dcc..ba7a265d617 100644 --- a/arch/tile/kernel/machine_kexec.c +++ b/arch/tile/kernel/machine_kexec.c @@ -75,13 +75,13 @@ void machine_crash_shutdown(struct pt_regs *regs) int machine_kexec_prepare(struct kimage *image) { if (num_online_cpus() > 1) { - printk(KERN_WARNING "%s: detected attempt to kexec " + pr_warning("%s: detected attempt to kexec " "with num_online_cpus() > 1\n", __func__); return -ENOSYS; } if (image->type != KEXEC_TYPE_DEFAULT) { - printk(KERN_WARNING "%s: detected attempt to kexec " + pr_warning("%s: detected attempt to kexec " "with unsupported type: %d\n", __func__, image->type); @@ -124,22 +124,13 @@ static unsigned char *kexec_bn2cl(void *pg) return 0; /* - * If we get a checksum mismatch, it's possible that this is - * just a false positive, but relatively unlikely. We dump - * out the contents of the section so we can diagnose better. + * If we get a checksum mismatch, warn with the checksum + * so we can diagnose better. */ csum = ip_compute_csum(pg, bhdrp->b_size); if (csum != 0) { - int i; - unsigned char *p = pg; - int nbytes = min((Elf32_Word)1000, bhdrp->b_size); - printk(KERN_INFO "%s: bad checksum %#x\n", __func__, csum); - printk(KERN_INFO "bytes (%d):", bhdrp->b_size); - for (i = 0; i < nbytes; ++i) - printk(" %02x", p[i]); - if (bhdrp->b_size != nbytes) - printk(" ..."); - printk("\n"); + pr_warning("%s: bad checksum %#x (size %d)\n", + __func__, csum, bhdrp->b_size); return 0; } @@ -156,7 +147,7 @@ static unsigned char *kexec_bn2cl(void *pg) if ((unsigned char *) (nhdrp + 1) > ((unsigned char *) pg) + bhdrp->b_size) { - printk(KERN_INFO "%s: out of bounds\n", __func__); + pr_info("%s: out of bounds\n", __func__); return 0; } } @@ -167,7 +158,7 @@ static unsigned char *kexec_bn2cl(void *pg) while (*desc != '\0') { desc++; if (((unsigned long)desc & PAGE_MASK) != (unsigned long)pg) { - printk(KERN_INFO "%s: ran off end of page\n", + pr_info("%s: ran off end of page\n", __func__); return 0; } @@ -202,23 +193,20 @@ static void kexec_find_and_set_command_line(struct kimage *image) } if (command_line != 0) { - printk(KERN_INFO "setting new command line to \"%s\"\n", + pr_info("setting new command line to \"%s\"\n", command_line); hverr = hv_set_command_line( (HV_VirtAddr) command_line, strlen(command_line)); kunmap_atomic(command_line, KM_USER0); } else { - printk(KERN_INFO "%s: no command line found; making empty\n", + pr_info("%s: no command line found; making empty\n", __func__); hverr = hv_set_command_line((HV_VirtAddr) command_line, 0); } - if (hverr) { - printk(KERN_WARNING - "%s: call to hv_set_command_line returned error: %d\n", - __func__, hverr); - - } + if (hverr) + pr_warning("%s: hv_set_command_line returned error: %d\n", + __func__, hverr); } /* diff --git a/arch/tile/kernel/messaging.c b/arch/tile/kernel/messaging.c index f991f5285d8..6d23ed271d1 100644 --- a/arch/tile/kernel/messaging.c +++ b/arch/tile/kernel/messaging.c @@ -18,13 +18,14 @@ #include <linux/ptrace.h> #include <asm/hv_driver.h> #include <asm/irq_regs.h> +#include <asm/traps.h> #include <hv/hypervisor.h> #include <arch/interrupts.h> /* All messages are stored here */ static DEFINE_PER_CPU(HV_MsgState, msg_state); -void __cpuinit init_messaging() +void __cpuinit init_messaging(void) { /* Allocate storage for messages in kernel space */ HV_MsgState *state = &__get_cpu_var(msg_state); @@ -58,7 +59,7 @@ void hv_message_intr(struct pt_regs *regs, int intnum) { long sp = stack_pointer - (long) current_thread_info(); if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) { - printk(KERN_EMERG "hv_message_intr: " + pr_emerg("hv_message_intr: " "stack overflow: %ld\n", sp - sizeof(struct thread_info)); dump_stack(); diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c index ed3e91161f8..e2ab82b7c7e 100644 --- a/arch/tile/kernel/module.c +++ b/arch/tile/kernel/module.c @@ -107,7 +107,7 @@ int apply_relocate(Elf_Shdr *sechdrs, unsigned int relsec, struct module *me) { - printk(KERN_ERR "module %s: .rel relocation unsupported\n", me->name); + pr_err("module %s: .rel relocation unsupported\n", me->name); return -ENOEXEC; } @@ -119,8 +119,8 @@ int apply_relocate(Elf_Shdr *sechdrs, static int validate_hw2_last(long value, struct module *me) { if (((value << 16) >> 16) != value) { - printk("module %s: Out of range HW2_LAST value %#lx\n", - me->name, value); + pr_warning("module %s: Out of range HW2_LAST value %#lx\n", + me->name, value); return 0; } return 1; @@ -223,10 +223,10 @@ int apply_relocate_add(Elf_Shdr *sechdrs, value -= (unsigned long) location; /* pc-relative */ value = (long) value >> 3; /* count by instrs */ if (!validate_jumpoff(value)) { - printk("module %s: Out of range jump to" - " %#llx at %#llx (%p)\n", me->name, - sym->st_value + rel[i].r_addend, - rel[i].r_offset, location); + pr_warning("module %s: Out of range jump to" + " %#llx at %#llx (%p)\n", me->name, + sym->st_value + rel[i].r_addend, + rel[i].r_offset, location); return -ENOEXEC; } MUNGE(create_JumpOff_X1); @@ -236,7 +236,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, #undef MUNGE default: - printk(KERN_ERR "module %s: Unknown relocation: %d\n", + pr_err("module %s: Unknown relocation: %d\n", me->name, (int) ELF_R_TYPE(rel[i].r_info)); return -ENOEXEC; } diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index c70ff14a48e..ed590ad0acd 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c @@ -24,9 +24,14 @@ #include <linux/compat.h> #include <linux/hardirq.h> #include <linux/syscalls.h> +#include <linux/kernel.h> #include <asm/system.h> #include <asm/stack.h> #include <asm/homecache.h> +#include <asm/syscalls.h> +#ifdef CONFIG_HARDWALL +#include <asm/hardwall.h> +#endif #include <arch/chip.h> #include <arch/abi.h> @@ -43,7 +48,7 @@ static int __init idle_setup(char *str) return -EINVAL; if (!strcmp(str, "poll")) { - printk("using polling idle threads.\n"); + pr_info("using polling idle threads.\n"); no_idle_nap = 1; } else if (!strcmp(str, "halt")) no_idle_nap = 0; @@ -62,7 +67,6 @@ early_param("idle", idle_setup); */ void cpu_idle(void) { - extern void _cpu_idle(void); int cpu = smp_processor_id(); @@ -108,7 +112,7 @@ void cpu_idle(void) struct thread_info *alloc_thread_info(struct task_struct *task) { struct page *page; - int flags = GFP_KERNEL; + gfp_t flags = GFP_KERNEL; #ifdef CONFIG_DEBUG_STACK_USAGE flags |= __GFP_ZERO; @@ -116,7 +120,7 @@ struct thread_info *alloc_thread_info(struct task_struct *task) page = alloc_pages(flags, THREAD_SIZE_ORDER); if (!page) - return 0; + return NULL; return (struct thread_info *)page_address(page); } @@ -129,6 +133,18 @@ void free_thread_info(struct thread_info *info) { struct single_step_state *step_state = info->step_state; +#ifdef CONFIG_HARDWALL + /* + * We free a thread_info from the context of the task that has + * been scheduled next, so the original task is already dead. + * Calling deactivate here just frees up the data structures. + * If the task we're freeing held the last reference to a + * hardwall fd, it would have been released prior to this point + * anyway via exit_files(), and "hardwall" would be NULL by now. + */ + if (info->task->thread.hardwall) + hardwall_deactivate(info->task); +#endif if (step_state) { @@ -154,8 +170,6 @@ void free_thread_info(struct thread_info *info) static void save_arch_state(struct thread_struct *t); -extern void ret_from_fork(void); - int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long stack_size, struct task_struct *p, struct pt_regs *regs) @@ -235,6 +249,10 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, p->thread.proc_status = 0; #endif +#ifdef CONFIG_HARDWALL + /* New thread does not own any networks. */ + p->thread.hardwall = NULL; +#endif /* @@ -257,7 +275,7 @@ struct task_struct *validate_current(void) if (unlikely((unsigned long)tsk < PAGE_OFFSET || (void *)tsk > high_memory || ((unsigned long)tsk & (__alignof__(*tsk) - 1)) != 0)) { - printk("Corrupt 'current' %p (sp %#lx)\n", tsk, stack_pointer); + pr_err("Corrupt 'current' %p (sp %#lx)\n", tsk, stack_pointer); tsk = &corrupt; } return tsk; @@ -447,10 +465,6 @@ void _prepare_arch_switch(struct task_struct *next) } -extern struct task_struct *__switch_to(struct task_struct *prev, - struct task_struct *next, - unsigned long new_system_save_1_0); - struct task_struct *__sched _switch_to(struct task_struct *prev, struct task_struct *next) { @@ -486,6 +500,15 @@ struct task_struct *__sched _switch_to(struct task_struct *prev, } #endif +#ifdef CONFIG_HARDWALL + /* Enable or disable access to the network registers appropriately. */ + if (prev->thread.hardwall != NULL) { + if (next->thread.hardwall == NULL) + restrict_network_mpls(); + } else if (next->thread.hardwall != NULL) { + grant_network_mpls(); + } +#endif /* * Switch kernel SP, PC, and callee-saved registers. @@ -496,14 +519,14 @@ struct task_struct *__sched _switch_to(struct task_struct *prev, return __switch_to(prev, next, next_current_ksp0(next)); } -int _sys_fork(struct pt_regs *regs) +long _sys_fork(struct pt_regs *regs) { return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL); } -int _sys_clone(unsigned long clone_flags, unsigned long newsp, - void __user *parent_tidptr, void __user *child_tidptr, - struct pt_regs *regs) +long _sys_clone(unsigned long clone_flags, unsigned long newsp, + void __user *parent_tidptr, void __user *child_tidptr, + struct pt_regs *regs) { if (!newsp) newsp = regs->sp; @@ -511,7 +534,7 @@ int _sys_clone(unsigned long clone_flags, unsigned long newsp, parent_tidptr, child_tidptr); } -int _sys_vfork(struct pt_regs *regs) +long _sys_vfork(struct pt_regs *regs) { return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->sp, regs, 0, NULL, NULL); @@ -520,10 +543,10 @@ int _sys_vfork(struct pt_regs *regs) /* * sys_execve() executes a new program. */ -int _sys_execve(char __user *path, char __user *__user *argv, - char __user *__user *envp, struct pt_regs *regs) +long _sys_execve(char __user *path, char __user *__user *argv, + char __user *__user *envp, struct pt_regs *regs) { - int error; + long error; char *filename; filename = getname(path); @@ -537,10 +560,10 @@ out: } #ifdef CONFIG_COMPAT -int _compat_sys_execve(char __user *path, compat_uptr_t __user *argv, - compat_uptr_t __user *envp, struct pt_regs *regs) +long _compat_sys_execve(char __user *path, compat_uptr_t __user *argv, + compat_uptr_t __user *envp, struct pt_regs *regs) { - int error; + long error; char *filename; filename = getname(path); @@ -616,31 +639,32 @@ void exit_thread(void) /* Nothing */ } -#ifdef __tilegx__ -# define LINECOUNT 3 -# define EXTRA_NL "\n" -#else -# define LINECOUNT 4 -# define EXTRA_NL "" -#endif - void show_regs(struct pt_regs *regs) { struct task_struct *tsk = validate_current(); - int i, linebreak; - printk("\n"); - printk(" Pid: %d, comm: %20s, CPU: %d\n", + int i; + + pr_err("\n"); + pr_err(" Pid: %d, comm: %20s, CPU: %d\n", tsk->pid, tsk->comm, smp_processor_id()); - for (i = linebreak = 0; i < 53; ++i) { - printk(" r%-2d: "REGFMT, i, regs->regs[i]); - if (++linebreak == LINECOUNT) { - linebreak = 0; - printk("\n"); - } - } - printk(" tp : "REGFMT EXTRA_NL " sp : "REGFMT" lr : "REGFMT"\n", - regs->tp, regs->sp, regs->lr); - printk(" pc : "REGFMT" ex1: %ld faultnum: %ld\n", +#ifdef __tilegx__ + for (i = 0; i < 51; i += 3) + pr_err(" r%-2d: "REGFMT" r%-2d: "REGFMT" r%-2d: "REGFMT"\n", + i, regs->regs[i], i+1, regs->regs[i+1], + i+2, regs->regs[i+2]); + pr_err(" r51: "REGFMT" r52: "REGFMT" tp : "REGFMT"\n", + regs->regs[51], regs->regs[52], regs->tp); + pr_err(" sp : "REGFMT" lr : "REGFMT"\n", regs->sp, regs->lr); +#else + for (i = 0; i < 52; i += 3) + pr_err(" r%-2d: "REGFMT" r%-2d: "REGFMT + " r%-2d: "REGFMT" r%-2d: "REGFMT"\n", + i, regs->regs[i], i+1, regs->regs[i+1], + i+2, regs->regs[i+2], i+3, regs->regs[i+3]); + pr_err(" r52: "REGFMT" tp : "REGFMT" sp : "REGFMT" lr : "REGFMT"\n", + regs->regs[52], regs->tp, regs->sp, regs->lr); +#endif + pr_err(" pc : "REGFMT" ex1: %ld faultnum: %ld\n", regs->pc, regs->ex1, regs->faultnum); dump_stack_regs(regs); diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c index 468054928e7..e5701d1a52d 100644 --- a/arch/tile/kernel/ptrace.c +++ b/arch/tile/kernel/ptrace.c @@ -19,6 +19,7 @@ #include <linux/kprobes.h> #include <linux/compat.h> #include <linux/uaccess.h> +#include <asm/traps.h> void user_enable_single_step(struct task_struct *child) { @@ -76,7 +77,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) if (task_thread_info(child)->status & TS_COMPAT) addr = (u32)addr; #endif - datap = (unsigned long __user *)data; + datap = (unsigned long __user __force *)data; switch (request) { diff --git a/arch/tile/kernel/reboot.c b/arch/tile/kernel/reboot.c index a4523923605..acd86d20beb 100644 --- a/arch/tile/kernel/reboot.c +++ b/arch/tile/kernel/reboot.c @@ -15,6 +15,7 @@ #include <linux/stddef.h> #include <linux/reboot.h> #include <linux/smp.h> +#include <linux/pm.h> #include <asm/page.h> #include <asm/setup.h> #include <hv/hypervisor.h> @@ -46,7 +47,5 @@ void machine_restart(char *cmd) hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd); } -/* - * Power off function, if any - */ -void (*pm_power_off)(void) = machine_power_off; +/* No interesting distinction to be made here. */ +void (*pm_power_off)(void) = NULL; diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index 934136b61ce..4dd21c1e6d5 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c @@ -20,6 +20,7 @@ #include <linux/node.h> #include <linux/cpu.h> #include <linux/ioport.h> +#include <linux/irq.h> #include <linux/kexec.h> #include <linux/pci.h> #include <linux/initrd.h> @@ -109,7 +110,7 @@ static int __init setup_maxmem(char *str) maxmem_pfn = (maxmem_mb >> (HPAGE_SHIFT - 20)) << (HPAGE_SHIFT - PAGE_SHIFT); - printk("Forcing RAM used to no more than %dMB\n", + pr_info("Forcing RAM used to no more than %dMB\n", maxmem_pfn >> (20 - PAGE_SHIFT)); return 0; } @@ -127,7 +128,7 @@ static int __init setup_maxnodemem(char *str) maxnodemem_pfn[node] = (maxnodemem_mb >> (HPAGE_SHIFT - 20)) << (HPAGE_SHIFT - PAGE_SHIFT); - printk("Forcing RAM used on node %ld to no more than %dMB\n", + pr_info("Forcing RAM used on node %ld to no more than %dMB\n", node, maxnodemem_pfn[node] >> (20 - PAGE_SHIFT)); return 0; } @@ -140,7 +141,7 @@ static int __init setup_isolnodes(char *str) return -EINVAL; nodelist_scnprintf(buf, sizeof(buf), isolnodes); - printk("Set isolnodes value to '%s'\n", buf); + pr_info("Set isolnodes value to '%s'\n", buf); return 0; } early_param("isolnodes", setup_isolnodes); @@ -155,7 +156,7 @@ static int __init setup_pci_reserve(char* str) return -EINVAL; pci_reserve_mb = mb; - printk("Reserving %dMB for PCIE root complex mappings\n", + pr_info("Reserving %dMB for PCIE root complex mappings\n", pci_reserve_mb); return 0; } @@ -269,7 +270,7 @@ static void *__init setup_pa_va_mapping(void) * This is up to 4 mappings for lowmem, one mapping per memory * controller, plus one for our text segment. */ -void __cpuinit store_permanent_mappings(void) +static void __cpuinit store_permanent_mappings(void) { int i; @@ -320,14 +321,14 @@ static void __init setup_memory(void) break; #ifdef CONFIG_FLATMEM if (i > 0) { - printk("Can't use discontiguous PAs: %#llx..%#llx\n", + pr_err("Can't use discontiguous PAs: %#llx..%#llx\n", range.size, range.start + range.size); continue; } #endif #ifndef __tilegx__ if ((unsigned long)range.start) { - printk("Range not at 4GB multiple: %#llx..%#llx\n", + pr_err("Range not at 4GB multiple: %#llx..%#llx\n", range.start, range.start + range.size); continue; } @@ -335,51 +336,51 @@ static void __init setup_memory(void) if ((range.start & (HPAGE_SIZE-1)) != 0 || (range.size & (HPAGE_SIZE-1)) != 0) { unsigned long long start_pa = range.start; - unsigned long long size = range.size; + unsigned long long ori |