diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-15 20:31:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-15 20:31:43 -0400 |
commit | 7a1b29a82ba76427de791098c095ce31dab9333d (patch) | |
tree | 077a1563ce243b6ac619397a0b7904623a28de50 /arch/tile/kernel | |
parent | d7824370e26325c881b665350ce64fb0a4fde24a (diff) | |
parent | a5854dd7f30c3849edf9b9711362e2dd51d3f855 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
* git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
arch/tile: don't validate CROSS_COMPILE needlessly
arch/tile: export only COMMAND_LINE_SIZE to userspace.
arch/tile: rename ARCH_KMALLOC_MINALIGN to ARCH_DMA_MINALIGN
arch/tile: Rename the hweight() implementations to __arch_hweight()
arch/tile: extend syscall ABI to set r1 on return as well.
arch/tile: Various cleanups.
arch/tile: support backtracing on TILE-Gx
arch/tile: Fix a couple of issues with the COMPAT code for TILE-Gx.
arch/tile: Use separate, better minsec values for clocksource and sched_clock.
arch/tile: correct a bug in freeing bootmem by VA for the optional second initrd.
arch: tile: mm: pgtable.c: Removed duplicated #include
arch: tile: kernel/proc.c Removed duplicated #include
Add fanotify syscalls to <asm-generic/unistd.h>.
arch/tile: support new kunmap_atomic() naming convention.
tile: remove unused ISA_DMA_THRESHOLD define
Conflicts in arch/tile/configs/tile_defconfig (pick the mainline version
with the reduced defconfig).
Diffstat (limited to 'arch/tile/kernel')
-rw-r--r-- | arch/tile/kernel/backtrace.c | 137 | ||||
-rw-r--r-- | arch/tile/kernel/compat_signal.c | 4 | ||||
-rw-r--r-- | arch/tile/kernel/intvec_32.S | 14 | ||||
-rw-r--r-- | arch/tile/kernel/proc.c | 1 | ||||
-rw-r--r-- | arch/tile/kernel/setup.c | 4 | ||||
-rw-r--r-- | arch/tile/kernel/stack.c | 8 | ||||
-rw-r--r-- | arch/tile/kernel/time.c | 33 | ||||
-rw-r--r-- | arch/tile/kernel/traps.c | 4 |
8 files changed, 138 insertions, 67 deletions
diff --git a/arch/tile/kernel/backtrace.c b/arch/tile/kernel/backtrace.c index 77265f3b58d6..d3c41c1ff6bd 100644 --- a/arch/tile/kernel/backtrace.c +++ b/arch/tile/kernel/backtrace.c | |||
@@ -19,9 +19,6 @@ | |||
19 | 19 | ||
20 | #include <arch/chip.h> | 20 | #include <arch/chip.h> |
21 | 21 | ||
22 | #if TILE_CHIP < 10 | ||
23 | |||
24 | |||
25 | #include <asm/opcode-tile.h> | 22 | #include <asm/opcode-tile.h> |
26 | 23 | ||
27 | 24 | ||
@@ -29,6 +26,27 @@ | |||
29 | #define TREG_LR 55 | 26 | #define TREG_LR 55 |
30 | 27 | ||
31 | 28 | ||
29 | #if TILE_CHIP >= 10 | ||
30 | #define tile_bundle_bits tilegx_bundle_bits | ||
31 | #define TILE_MAX_INSTRUCTIONS_PER_BUNDLE TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE | ||
32 | #define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEGX_BUNDLE_ALIGNMENT_IN_BYTES | ||
33 | #define tile_decoded_instruction tilegx_decoded_instruction | ||
34 | #define tile_mnemonic tilegx_mnemonic | ||
35 | #define parse_insn_tile parse_insn_tilegx | ||
36 | #define TILE_OPC_IRET TILEGX_OPC_IRET | ||
37 | #define TILE_OPC_ADDI TILEGX_OPC_ADDI | ||
38 | #define TILE_OPC_ADDLI TILEGX_OPC_ADDLI | ||
39 | #define TILE_OPC_INFO TILEGX_OPC_INFO | ||
40 | #define TILE_OPC_INFOL TILEGX_OPC_INFOL | ||
41 | #define TILE_OPC_JRP TILEGX_OPC_JRP | ||
42 | #define TILE_OPC_MOVE TILEGX_OPC_MOVE | ||
43 | #define OPCODE_STORE TILEGX_OPC_ST | ||
44 | typedef long long bt_int_reg_t; | ||
45 | #else | ||
46 | #define OPCODE_STORE TILE_OPC_SW | ||
47 | typedef int bt_int_reg_t; | ||
48 | #endif | ||
49 | |||
32 | /** A decoded bundle used for backtracer analysis. */ | 50 | /** A decoded bundle used for backtracer analysis. */ |
33 | struct BacktraceBundle { | 51 | struct BacktraceBundle { |
34 | tile_bundle_bits bits; | 52 | tile_bundle_bits bits; |
@@ -41,7 +59,7 @@ struct BacktraceBundle { | |||
41 | /* This implementation only makes sense for native tools. */ | 59 | /* This implementation only makes sense for native tools. */ |
42 | /** Default function to read memory. */ | 60 | /** Default function to read memory. */ |
43 | static bool bt_read_memory(void *result, VirtualAddress addr, | 61 | static bool bt_read_memory(void *result, VirtualAddress addr, |
44 | size_t size, void *extra) | 62 | unsigned int size, void *extra) |
45 | { | 63 | { |
46 | /* FIXME: this should do some horrible signal stuff to catch | 64 | /* FIXME: this should do some horrible signal stuff to catch |
47 | * SEGV cleanly and fail. | 65 | * SEGV cleanly and fail. |
@@ -106,6 +124,12 @@ static bool bt_has_addi_sp(const struct BacktraceBundle *bundle, int *adjust) | |||
106 | find_matching_insn(bundle, TILE_OPC_ADDI, vals, 2); | 124 | find_matching_insn(bundle, TILE_OPC_ADDI, vals, 2); |
107 | if (insn == NULL) | 125 | if (insn == NULL) |
108 | insn = find_matching_insn(bundle, TILE_OPC_ADDLI, vals, 2); | 126 | insn = find_matching_insn(bundle, TILE_OPC_ADDLI, vals, 2); |
127 | #if TILE_CHIP >= 10 | ||
128 | if (insn == NULL) | ||
129 | insn = find_matching_insn(bundle, TILEGX_OPC_ADDXLI, vals, 2); | ||
130 | if (insn == NULL) | ||
131 | insn = find_matching_insn(bundle, TILEGX_OPC_ADDXI, vals, 2); | ||
132 | #endif | ||
109 | if (insn == NULL) | 133 | if (insn == NULL) |
110 | return false; | 134 | return false; |
111 | 135 | ||
@@ -190,13 +214,52 @@ static inline bool bt_has_move_r52_sp(const struct BacktraceBundle *bundle) | |||
190 | return find_matching_insn(bundle, TILE_OPC_MOVE, vals, 2) != NULL; | 214 | return find_matching_insn(bundle, TILE_OPC_MOVE, vals, 2) != NULL; |
191 | } | 215 | } |
192 | 216 | ||
193 | /** Does this bundle contain the instruction 'sw sp, lr'? */ | 217 | /** Does this bundle contain a store of lr to sp? */ |
194 | static inline bool bt_has_sw_sp_lr(const struct BacktraceBundle *bundle) | 218 | static inline bool bt_has_sw_sp_lr(const struct BacktraceBundle *bundle) |
195 | { | 219 | { |
196 | static const int vals[2] = { TREG_SP, TREG_LR }; | 220 | static const int vals[2] = { TREG_SP, TREG_LR }; |
197 | return find_matching_insn(bundle, TILE_OPC_SW, vals, 2) != NULL; | 221 | return find_matching_insn(bundle, OPCODE_STORE, vals, 2) != NULL; |
222 | } | ||
223 | |||
224 | #if TILE_CHIP >= 10 | ||
225 | /** Track moveli values placed into registers. */ | ||
226 | static inline void bt_update_moveli(const struct BacktraceBundle *bundle, | ||
227 | int moveli_args[]) | ||
228 | { | ||
229 | int i; | ||
230 | for (i = 0; i < bundle->num_insns; i++) { | ||
231 | const struct tile_decoded_instruction *insn = | ||
232 | &bundle->insns[i]; | ||
233 | |||
234 | if (insn->opcode->mnemonic == TILEGX_OPC_MOVELI) { | ||
235 | int reg = insn->operand_values[0]; | ||
236 | moveli_args[reg] = insn->operand_values[1]; | ||
237 | } | ||
238 | } | ||
198 | } | 239 | } |
199 | 240 | ||
241 | /** Does this bundle contain an 'add sp, sp, reg' instruction | ||
242 | * from a register that we saw a moveli into, and if so, what | ||
243 | * is the value in the register? | ||
244 | */ | ||
245 | static bool bt_has_add_sp(const struct BacktraceBundle *bundle, int *adjust, | ||
246 | int moveli_args[]) | ||
247 | { | ||
248 | static const int vals[2] = { TREG_SP, TREG_SP }; | ||
249 | |||
250 | const struct tile_decoded_instruction *insn = | ||
251 | find_matching_insn(bundle, TILEGX_OPC_ADDX, vals, 2); | ||
252 | if (insn) { | ||
253 | int reg = insn->operand_values[2]; | ||
254 | if (moveli_args[reg]) { | ||
255 | *adjust = moveli_args[reg]; | ||
256 | return true; | ||
257 | } | ||
258 | } | ||
259 | return false; | ||
260 | } | ||
261 | #endif | ||
262 | |||
200 | /** Locates the caller's PC and SP for a program starting at the | 263 | /** Locates the caller's PC and SP for a program starting at the |
201 | * given address. | 264 | * given address. |
202 | */ | 265 | */ |
@@ -227,6 +290,11 @@ static void find_caller_pc_and_caller_sp(CallerLocation *location, | |||
227 | int next_bundle = 0; | 290 | int next_bundle = 0; |
228 | VirtualAddress pc; | 291 | VirtualAddress pc; |
229 | 292 | ||
293 | #if TILE_CHIP >= 10 | ||
294 | /* Naively try to track moveli values to support addx for -m32. */ | ||
295 | int moveli_args[TILEGX_NUM_REGISTERS] = { 0 }; | ||
296 | #endif | ||
297 | |||
230 | /* Default to assuming that the caller's sp is the current sp. | 298 | /* Default to assuming that the caller's sp is the current sp. |
231 | * This is necessary to handle the case where we start backtracing | 299 | * This is necessary to handle the case where we start backtracing |
232 | * right at the end of the epilog. | 300 | * right at the end of the epilog. |
@@ -380,7 +448,11 @@ static void find_caller_pc_and_caller_sp(CallerLocation *location, | |||
380 | 448 | ||
381 | if (!sp_determined) { | 449 | if (!sp_determined) { |
382 | int adjust; | 450 | int adjust; |
383 | if (bt_has_addi_sp(&bundle, &adjust)) { | 451 | if (bt_has_addi_sp(&bundle, &adjust) |
452 | #if TILE_CHIP >= 10 | ||
453 | || bt_has_add_sp(&bundle, &adjust, moveli_args) | ||
454 | #endif | ||
455 | ) { | ||
384 | location->sp_location = SP_LOC_OFFSET; | 456 | location->sp_location = SP_LOC_OFFSET; |
385 | 457 | ||
386 | if (adjust <= 0) { | 458 | if (adjust <= 0) { |
@@ -427,6 +499,11 @@ static void find_caller_pc_and_caller_sp(CallerLocation *location, | |||
427 | sp_determined = true; | 499 | sp_determined = true; |
428 | } | 500 | } |
429 | } | 501 | } |
502 | |||
503 | #if TILE_CHIP >= 10 | ||
504 | /* Track moveli arguments for -m32 mode. */ | ||
505 | bt_update_moveli(&bundle, moveli_args); | ||
506 | #endif | ||
430 | } | 507 | } |
431 | 508 | ||
432 | if (bt_has_iret(&bundle)) { | 509 | if (bt_has_iret(&bundle)) { |
@@ -502,11 +579,10 @@ void backtrace_init(BacktraceIterator *state, | |||
502 | break; | 579 | break; |
503 | } | 580 | } |
504 | 581 | ||
505 | /* The frame pointer should theoretically be aligned mod 8. If | 582 | /* If the frame pointer is not aligned to the basic word size |
506 | * it's not even aligned mod 4 then something terrible happened | 583 | * something terrible happened and we should mark it as invalid. |
507 | * and we should mark it as invalid. | ||
508 | */ | 584 | */ |
509 | if (fp % 4 != 0) | 585 | if (fp % sizeof(bt_int_reg_t) != 0) |
510 | fp = -1; | 586 | fp = -1; |
511 | 587 | ||
512 | /* -1 means "don't know initial_frame_caller_pc". */ | 588 | /* -1 means "don't know initial_frame_caller_pc". */ |
@@ -547,9 +623,16 @@ void backtrace_init(BacktraceIterator *state, | |||
547 | state->read_memory_func_extra = read_memory_func_extra; | 623 | state->read_memory_func_extra = read_memory_func_extra; |
548 | } | 624 | } |
549 | 625 | ||
626 | /* Handle the case where the register holds more bits than the VA. */ | ||
627 | static bool valid_addr_reg(bt_int_reg_t reg) | ||
628 | { | ||
629 | return ((VirtualAddress)reg == reg); | ||
630 | } | ||
631 | |||
550 | bool backtrace_next(BacktraceIterator *state) | 632 | bool backtrace_next(BacktraceIterator *state) |
551 | { | 633 | { |
552 | VirtualAddress next_fp, next_pc, next_frame[2]; | 634 | VirtualAddress next_fp, next_pc; |
635 | bt_int_reg_t next_frame[2]; | ||
553 | 636 | ||
554 | if (state->fp == -1) { | 637 | if (state->fp == -1) { |
555 | /* No parent frame. */ | 638 | /* No parent frame. */ |
@@ -563,11 +646,9 @@ bool backtrace_next(BacktraceIterator *state) | |||
563 | } | 646 | } |
564 | 647 | ||
565 | next_fp = next_frame[1]; | 648 | next_fp = next_frame[1]; |
566 | if (next_fp % 4 != 0) { | 649 | if (!valid_addr_reg(next_frame[1]) || |
567 | /* Caller's frame pointer is suspect, so give up. | 650 | next_fp % sizeof(bt_int_reg_t) != 0) { |
568 | * Technically it should be aligned mod 8, but we will | 651 | /* Caller's frame pointer is suspect, so give up. */ |
569 | * be forgiving here. | ||
570 | */ | ||
571 | return false; | 652 | return false; |
572 | } | 653 | } |
573 | 654 | ||
@@ -585,7 +666,7 @@ bool backtrace_next(BacktraceIterator *state) | |||
585 | } else { | 666 | } else { |
586 | /* Get the caller PC from the frame linkage area. */ | 667 | /* Get the caller PC from the frame linkage area. */ |
587 | next_pc = next_frame[0]; | 668 | next_pc = next_frame[0]; |
588 | if (next_pc == 0 || | 669 | if (!valid_addr_reg(next_frame[0]) || next_pc == 0 || |
589 | next_pc % TILE_BUNDLE_ALIGNMENT_IN_BYTES != 0) { | 670 | next_pc % TILE_BUNDLE_ALIGNMENT_IN_BYTES != 0) { |
590 | /* The PC is suspect, so give up. */ | 671 | /* The PC is suspect, so give up. */ |
591 | return false; | 672 | return false; |
@@ -599,23 +680,3 @@ bool backtrace_next(BacktraceIterator *state) | |||
599 | 680 | ||
600 | return true; | 681 | return true; |
601 | } | 682 | } |
602 | |||
603 | #else /* TILE_CHIP < 10 */ | ||
604 | |||
605 | void backtrace_init(BacktraceIterator *state, | ||
606 | BacktraceMemoryReader read_memory_func, | ||
607 | void *read_memory_func_extra, | ||
608 | VirtualAddress pc, VirtualAddress lr, | ||
609 | VirtualAddress sp, VirtualAddress r52) | ||
610 | { | ||
611 | state->pc = pc; | ||
612 | state->sp = sp; | ||
613 | state->fp = -1; | ||
614 | state->initial_frame_caller_pc = -1; | ||
615 | state->read_memory_func = read_memory_func; | ||
616 | state->read_memory_func_extra = read_memory_func_extra; | ||
617 | } | ||
618 | |||
619 | bool backtrace_next(BacktraceIterator *state) { return false; } | ||
620 | |||
621 | #endif /* TILE_CHIP < 10 */ | ||
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index d5efb215dd5f..9c710db43f13 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c | |||
@@ -56,13 +56,15 @@ struct compat_ucontext { | |||
56 | sigset_t uc_sigmask; /* mask last for extensibility */ | 56 | sigset_t uc_sigmask; /* mask last for extensibility */ |
57 | }; | 57 | }; |
58 | 58 | ||
59 | #define COMPAT_SI_PAD_SIZE ((SI_MAX_SIZE - 3 * sizeof(int)) / sizeof(int)) | ||
60 | |||
59 | struct compat_siginfo { | 61 | struct compat_siginfo { |
60 | int si_signo; | 62 | int si_signo; |
61 | int si_errno; | 63 | int si_errno; |
62 | int si_code; | 64 | int si_code; |
63 | 65 | ||
64 | union { | 66 | union { |
65 | int _pad[SI_PAD_SIZE]; | 67 | int _pad[COMPAT_SI_PAD_SIZE]; |
66 | 68 | ||
67 | /* kill() */ | 69 | /* kill() */ |
68 | struct { | 70 | struct { |
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S index 3404c75f8e64..84f296ca9e63 100644 --- a/arch/tile/kernel/intvec_32.S +++ b/arch/tile/kernel/intvec_32.S | |||
@@ -952,7 +952,7 @@ STD_ENTRY(interrupt_return) | |||
952 | * able to safely read all the remaining words on those cache | 952 | * able to safely read all the remaining words on those cache |
953 | * lines without waiting for the memory subsystem. | 953 | * lines without waiting for the memory subsystem. |
954 | */ | 954 | */ |
955 | pop_reg_zero r0, r1, sp, PTREGS_OFFSET_REG(30) - PTREGS_OFFSET_REG(0) | 955 | pop_reg_zero r0, r28, sp, PTREGS_OFFSET_REG(30) - PTREGS_OFFSET_REG(0) |
956 | pop_reg_zero r30, r2, sp, PTREGS_OFFSET_PC - PTREGS_OFFSET_REG(30) | 956 | pop_reg_zero r30, r2, sp, PTREGS_OFFSET_PC - PTREGS_OFFSET_REG(30) |
957 | pop_reg_zero r21, r3, sp, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_PC | 957 | pop_reg_zero r21, r3, sp, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_PC |
958 | pop_reg_zero lr, r4, sp, PTREGS_OFFSET_REG(52) - PTREGS_OFFSET_EX1 | 958 | pop_reg_zero lr, r4, sp, PTREGS_OFFSET_REG(52) - PTREGS_OFFSET_EX1 |
@@ -1017,7 +1017,17 @@ STD_ENTRY(interrupt_return) | |||
1017 | { move r22, zero; move r23, zero } | 1017 | { move r22, zero; move r23, zero } |
1018 | { move r24, zero; move r25, zero } | 1018 | { move r24, zero; move r25, zero } |
1019 | { move r26, zero; move r27, zero } | 1019 | { move r26, zero; move r27, zero } |
1020 | { move r28, zero; move r29, zero } | 1020 | |
1021 | /* Set r1 to errno if we are returning an error, otherwise zero. */ | ||
1022 | { | ||
1023 | moveli r29, 1024 | ||
1024 | sub r1, zero, r0 | ||
1025 | } | ||
1026 | slt_u r29, r1, r29 | ||
1027 | { | ||
1028 | mnz r1, r29, r1 | ||
1029 | move r29, zero | ||
1030 | } | ||
1021 | iret | 1031 | iret |
1022 | 1032 | ||
1023 | /* | 1033 | /* |
diff --git a/arch/tile/kernel/proc.c b/arch/tile/kernel/proc.c index 92ef925d2f8d..2e02c41ddf3b 100644 --- a/arch/tile/kernel/proc.c +++ b/arch/tile/kernel/proc.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/sysctl.h> | 23 | #include <linux/sysctl.h> |
24 | #include <linux/hardirq.h> | 24 | #include <linux/hardirq.h> |
25 | #include <linux/mman.h> | 25 | #include <linux/mman.h> |
26 | #include <linux/smp.h> | ||
27 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
28 | #include <asm/processor.h> | 27 | #include <asm/processor.h> |
29 | #include <asm/sections.h> | 28 | #include <asm/sections.h> |
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index 4dd21c1e6d5e..e7d54c73d5c1 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -953,7 +953,7 @@ static void __init load_hv_initrd(void) | |||
953 | if (rc != stat.size) { | 953 | if (rc != stat.size) { |
954 | pr_err("Error reading %d bytes from hvfs file '%s': %d\n", | 954 | pr_err("Error reading %d bytes from hvfs file '%s': %d\n", |
955 | stat.size, initramfs_file, rc); | 955 | stat.size, initramfs_file, rc); |
956 | free_bootmem((unsigned long) initrd, stat.size); | 956 | free_initrd_mem((unsigned long) initrd, stat.size); |
957 | return; | 957 | return; |
958 | } | 958 | } |
959 | initrd_start = (unsigned long) initrd; | 959 | initrd_start = (unsigned long) initrd; |
@@ -962,7 +962,7 @@ static void __init load_hv_initrd(void) | |||
962 | 962 | ||
963 | void __init free_initrd_mem(unsigned long begin, unsigned long end) | 963 | void __init free_initrd_mem(unsigned long begin, unsigned long end) |
964 | { | 964 | { |
965 | free_bootmem(begin, end - begin); | 965 | free_bootmem(__pa(begin), end - begin); |
966 | } | 966 | } |
967 | 967 | ||
968 | static void __init validate_hv(void) | 968 | static void __init validate_hv(void) |
diff --git a/arch/tile/kernel/stack.c b/arch/tile/kernel/stack.c index b6268d3ae869..38a68b0b4581 100644 --- a/arch/tile/kernel/stack.c +++ b/arch/tile/kernel/stack.c | |||
@@ -108,7 +108,6 @@ static bool read_memory_func(void *result, VirtualAddress address, | |||
108 | /* Return a pt_regs pointer for a valid fault handler frame */ | 108 | /* Return a pt_regs pointer for a valid fault handler frame */ |
109 | static struct pt_regs *valid_fault_handler(struct KBacktraceIterator* kbt) | 109 | static struct pt_regs *valid_fault_handler(struct KBacktraceIterator* kbt) |
110 | { | 110 | { |
111 | #ifndef __tilegx__ | ||
112 | const char *fault = NULL; /* happy compiler */ | 111 | const char *fault = NULL; /* happy compiler */ |
113 | char fault_buf[64]; | 112 | char fault_buf[64]; |
114 | VirtualAddress sp = kbt->it.sp; | 113 | VirtualAddress sp = kbt->it.sp; |
@@ -146,7 +145,6 @@ static struct pt_regs *valid_fault_handler(struct KBacktraceIterator* kbt) | |||
146 | } | 145 | } |
147 | if (!kbt->profile || (INT_MASK(p->faultnum) & QUEUED_INTERRUPTS) == 0) | 146 | if (!kbt->profile || (INT_MASK(p->faultnum) & QUEUED_INTERRUPTS) == 0) |
148 | return p; | 147 | return p; |
149 | #endif | ||
150 | return NULL; | 148 | return NULL; |
151 | } | 149 | } |
152 | 150 | ||
@@ -351,12 +349,6 @@ void tile_show_stack(struct KBacktraceIterator *kbt, int headers) | |||
351 | kbt->task->pid, kbt->task->tgid, kbt->task->comm, | 349 | kbt->task->pid, kbt->task->tgid, kbt->task->comm, |
352 | smp_processor_id(), get_cycles()); | 350 | smp_processor_id(), get_cycles()); |
353 | } | 351 | } |
354 | #ifdef __tilegx__ | ||
355 | if (kbt->is_current) { | ||
356 | __insn_mtspr(SPR_SIM_CONTROL, | ||
357 | SIM_DUMP_SPR_ARG(SIM_DUMP_BACKTRACE)); | ||
358 | } | ||
359 | #endif | ||
360 | kbt->verbose = 1; | 352 | kbt->verbose = 1; |
361 | i = 0; | 353 | i = 0; |
362 | for (; !KBacktraceIterator_end(kbt); KBacktraceIterator_next(kbt)) { | 354 | for (; !KBacktraceIterator_end(kbt); KBacktraceIterator_next(kbt)) { |
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c index b9ab25a889b5..6bed820e1421 100644 --- a/arch/tile/kernel/time.c +++ b/arch/tile/kernel/time.c | |||
@@ -36,16 +36,6 @@ | |||
36 | /* How many cycles per second we are running at. */ | 36 | /* How many cycles per second we are running at. */ |
37 | static cycles_t cycles_per_sec __write_once; | 37 | static cycles_t cycles_per_sec __write_once; |
38 | 38 | ||
39 | /* | ||
40 | * We set up shift and multiply values with a minsec of five seconds, | ||
41 | * since our timer counter counts down 31 bits at a frequency of | ||
42 | * no less than 500 MHz. See @minsec for clocks_calc_mult_shift(). | ||
43 | * We could use a different value for the 64-bit free-running | ||
44 | * cycle counter, but we use the same one for consistency, and since | ||
45 | * we will be reasonably precise with this value anyway. | ||
46 | */ | ||
47 | #define TILE_MINSEC 5 | ||
48 | |||
49 | cycles_t get_clock_rate(void) | 39 | cycles_t get_clock_rate(void) |
50 | { | 40 | { |
51 | return cycles_per_sec; | 41 | return cycles_per_sec; |
@@ -68,6 +58,14 @@ cycles_t get_cycles(void) | |||
68 | } | 58 | } |
69 | #endif | 59 | #endif |
70 | 60 | ||
61 | /* | ||
62 | * We use a relatively small shift value so that sched_clock() | ||
63 | * won't wrap around very often. | ||
64 | */ | ||
65 | #define SCHED_CLOCK_SHIFT 10 | ||
66 | |||
67 | static unsigned long sched_clock_mult __write_once; | ||
68 | |||
71 | static cycles_t clocksource_get_cycles(struct clocksource *cs) | 69 | static cycles_t clocksource_get_cycles(struct clocksource *cs) |
72 | { | 70 | { |
73 | return get_cycles(); | 71 | return get_cycles(); |
@@ -78,6 +76,7 @@ static struct clocksource cycle_counter_cs = { | |||
78 | .rating = 300, | 76 | .rating = 300, |
79 | .read = clocksource_get_cycles, | 77 | .read = clocksource_get_cycles, |
80 | .mask = CLOCKSOURCE_MASK(64), | 78 | .mask = CLOCKSOURCE_MASK(64), |
79 | .shift = 22, /* typical value, e.g. x86 tsc uses this */ | ||
81 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 80 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
82 | }; | 81 | }; |
83 | 82 | ||
@@ -88,8 +87,10 @@ static struct clocksource cycle_counter_cs = { | |||
88 | void __init setup_clock(void) | 87 | void __init setup_clock(void) |
89 | { | 88 | { |
90 | cycles_per_sec = hv_sysconf(HV_SYSCONF_CPU_SPEED); | 89 | cycles_per_sec = hv_sysconf(HV_SYSCONF_CPU_SPEED); |
91 | clocksource_calc_mult_shift(&cycle_counter_cs, cycles_per_sec, | 90 | sched_clock_mult = |
92 | TILE_MINSEC); | 91 | clocksource_hz2mult(cycles_per_sec, SCHED_CLOCK_SHIFT); |
92 | cycle_counter_cs.mult = | ||
93 | clocksource_hz2mult(cycles_per_sec, cycle_counter_cs.shift); | ||
93 | } | 94 | } |
94 | 95 | ||
95 | void __init calibrate_delay(void) | 96 | void __init calibrate_delay(void) |
@@ -117,9 +118,14 @@ void __init time_init(void) | |||
117 | * counter, plus bit 31, which signifies that the counter has wrapped | 118 | * counter, plus bit 31, which signifies that the counter has wrapped |
118 | * from zero to (2**31) - 1. The INT_TILE_TIMER interrupt will be | 119 | * from zero to (2**31) - 1. The INT_TILE_TIMER interrupt will be |
119 | * raised as long as bit 31 is set. | 120 | * raised as long as bit 31 is set. |
121 | * | ||
122 | * The TILE_MINSEC value represents the largest range of real-time | ||
123 | * we can possibly cover with the timer, based on MAX_TICK combined | ||
124 | * with the slowest reasonable clock rate we might run at. | ||
120 | */ | 125 | */ |
121 | 126 | ||
122 | #define MAX_TICK 0x7fffffff /* we have 31 bits of countdown timer */ | 127 | #define MAX_TICK 0x7fffffff /* we have 31 bits of countdown timer */ |
128 | #define TILE_MINSEC 5 /* timer covers no more than 5 seconds */ | ||
123 | 129 | ||
124 | static int tile_timer_set_next_event(unsigned long ticks, | 130 | static int tile_timer_set_next_event(unsigned long ticks, |
125 | struct clock_event_device *evt) | 131 | struct clock_event_device *evt) |
@@ -211,8 +217,7 @@ void do_timer_interrupt(struct pt_regs *regs, int fault_num) | |||
211 | unsigned long long sched_clock(void) | 217 | unsigned long long sched_clock(void) |
212 | { | 218 | { |
213 | return clocksource_cyc2ns(get_cycles(), | 219 | return clocksource_cyc2ns(get_cycles(), |
214 | cycle_counter_cs.mult, | 220 | sched_clock_mult, SCHED_CLOCK_SHIFT); |
215 | cycle_counter_cs.shift); | ||
216 | } | 221 | } |
217 | 222 | ||
218 | int setup_profiling_timer(unsigned int multiplier) | 223 | int setup_profiling_timer(unsigned int multiplier) |
diff --git a/arch/tile/kernel/traps.c b/arch/tile/kernel/traps.c index 3870abbeeaa2..0f362dc2c57f 100644 --- a/arch/tile/kernel/traps.c +++ b/arch/tile/kernel/traps.c | |||
@@ -128,7 +128,9 @@ static int special_ill(bundle_bits bundle, int *sigp, int *codep) | |||
128 | #ifdef __tilegx__ | 128 | #ifdef __tilegx__ |
129 | if ((bundle & TILEGX_BUNDLE_MODE_MASK) != 0) | 129 | if ((bundle & TILEGX_BUNDLE_MODE_MASK) != 0) |
130 | return 0; | 130 | return 0; |
131 | if (get_Opcode_X1(bundle) != UNARY_OPCODE_X1) | 131 | if (get_Opcode_X1(bundle) != RRR_0_OPCODE_X1) |
132 | return 0; | ||
133 | if (get_RRROpcodeExtension_X1(bundle) != UNARY_RRR_0_OPCODE_X1) | ||
132 | return 0; | 134 | return 0; |
133 | if (get_UnaryOpcodeExtension_X1(bundle) != ILL_UNARY_OPCODE_X1) | 135 | if (get_UnaryOpcodeExtension_X1(bundle) != ILL_UNARY_OPCODE_X1) |
134 | return 0; | 136 | return 0; |