diff options
Diffstat (limited to 'arch/mips/kernel/traps.c')
| -rw-r--r-- | arch/mips/kernel/traps.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index d053bf4759e4..8e9fbe75894e 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/notifier.h> | 29 | #include <linux/notifier.h> |
| 30 | #include <linux/kdb.h> | 30 | #include <linux/kdb.h> |
| 31 | #include <linux/irq.h> | 31 | #include <linux/irq.h> |
| 32 | #include <linux/perf_event.h> | ||
| 32 | 33 | ||
| 33 | #include <asm/bootinfo.h> | 34 | #include <asm/bootinfo.h> |
| 34 | #include <asm/branch.h> | 35 | #include <asm/branch.h> |
| @@ -576,10 +577,16 @@ static inline int simulate_sc(struct pt_regs *regs, unsigned int opcode) | |||
| 576 | */ | 577 | */ |
| 577 | static int simulate_llsc(struct pt_regs *regs, unsigned int opcode) | 578 | static int simulate_llsc(struct pt_regs *regs, unsigned int opcode) |
| 578 | { | 579 | { |
| 579 | if ((opcode & OPCODE) == LL) | 580 | if ((opcode & OPCODE) == LL) { |
| 581 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, | ||
| 582 | 1, 0, regs, 0); | ||
| 580 | return simulate_ll(regs, opcode); | 583 | return simulate_ll(regs, opcode); |
| 581 | if ((opcode & OPCODE) == SC) | 584 | } |
| 585 | if ((opcode & OPCODE) == SC) { | ||
| 586 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, | ||
| 587 | 1, 0, regs, 0); | ||
| 582 | return simulate_sc(regs, opcode); | 588 | return simulate_sc(regs, opcode); |
| 589 | } | ||
| 583 | 590 | ||
| 584 | return -1; /* Must be something else ... */ | 591 | return -1; /* Must be something else ... */ |
| 585 | } | 592 | } |
| @@ -595,6 +602,8 @@ static int simulate_rdhwr(struct pt_regs *regs, unsigned int opcode) | |||
| 595 | if ((opcode & OPCODE) == SPEC3 && (opcode & FUNC) == RDHWR) { | 602 | if ((opcode & OPCODE) == SPEC3 && (opcode & FUNC) == RDHWR) { |
| 596 | int rd = (opcode & RD) >> 11; | 603 | int rd = (opcode & RD) >> 11; |
| 597 | int rt = (opcode & RT) >> 16; | 604 | int rt = (opcode & RT) >> 16; |
| 605 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, | ||
| 606 | 1, 0, regs, 0); | ||
| 598 | switch (rd) { | 607 | switch (rd) { |
| 599 | case 0: /* CPU number */ | 608 | case 0: /* CPU number */ |
| 600 | regs->regs[rt] = smp_processor_id(); | 609 | regs->regs[rt] = smp_processor_id(); |
| @@ -630,8 +639,11 @@ static int simulate_rdhwr(struct pt_regs *regs, unsigned int opcode) | |||
| 630 | 639 | ||
| 631 | static int simulate_sync(struct pt_regs *regs, unsigned int opcode) | 640 | static int simulate_sync(struct pt_regs *regs, unsigned int opcode) |
| 632 | { | 641 | { |
| 633 | if ((opcode & OPCODE) == SPEC0 && (opcode & FUNC) == SYNC) | 642 | if ((opcode & OPCODE) == SPEC0 && (opcode & FUNC) == SYNC) { |
| 643 | perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, | ||
| 644 | 1, 0, regs, 0); | ||
| 634 | return 0; | 645 | return 0; |
| 646 | } | ||
| 635 | 647 | ||
| 636 | return -1; /* Must be something else ... */ | 648 | return -1; /* Must be something else ... */ |
| 637 | } | 649 | } |
| @@ -1469,6 +1481,7 @@ void __cpuinit per_cpu_trap_init(void) | |||
| 1469 | { | 1481 | { |
| 1470 | unsigned int cpu = smp_processor_id(); | 1482 | unsigned int cpu = smp_processor_id(); |
| 1471 | unsigned int status_set = ST0_CU0; | 1483 | unsigned int status_set = ST0_CU0; |
| 1484 | unsigned int hwrena = cpu_hwrena_impl_bits; | ||
| 1472 | #ifdef CONFIG_MIPS_MT_SMTC | 1485 | #ifdef CONFIG_MIPS_MT_SMTC |
| 1473 | int secondaryTC = 0; | 1486 | int secondaryTC = 0; |
| 1474 | int bootTC = (cpu == 0); | 1487 | int bootTC = (cpu == 0); |
| @@ -1501,14 +1514,14 @@ void __cpuinit per_cpu_trap_init(void) | |||
| 1501 | change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX, | 1514 | change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX, |
| 1502 | status_set); | 1515 | status_set); |
| 1503 | 1516 | ||
| 1504 | if (cpu_has_mips_r2) { | 1517 | if (cpu_has_mips_r2) |
| 1505 | unsigned int enable = 0x0000000f | cpu_hwrena_impl_bits; | 1518 | hwrena |= 0x0000000f; |
| 1506 | 1519 | ||
| 1507 | if (!noulri && cpu_has_userlocal) | 1520 | if (!noulri && cpu_has_userlocal) |
| 1508 | enable |= (1 << 29); | 1521 | hwrena |= (1 << 29); |
| 1509 | 1522 | ||
| 1510 | write_c0_hwrena(enable); | 1523 | if (hwrena) |
| 1511 | } | 1524 | write_c0_hwrena(hwrena); |
| 1512 | 1525 | ||
| 1513 | #ifdef CONFIG_MIPS_MT_SMTC | 1526 | #ifdef CONFIG_MIPS_MT_SMTC |
| 1514 | if (!secondaryTC) { | 1527 | if (!secondaryTC) { |
