aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/traps.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/traps.c')
-rw-r--r--arch/mips/kernel/traps.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index d053bf4759e4..8d79b8774b30 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 */
577static int simulate_llsc(struct pt_regs *regs, unsigned int opcode) 578static 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
631static int simulate_sync(struct pt_regs *regs, unsigned int opcode) 640static 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}