Skip to content

Commit

Permalink
sparc64: Initial hw perf counter support.
Browse files Browse the repository at this point in the history
Only supports one simple counter and only UltraSPARC-IIIi chips.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Sep 10, 2009
1 parent 5686f9c commit 59abbd1
Show file tree
Hide file tree
Showing 5 changed files with 538 additions and 2 deletions.
3 changes: 3 additions & 0 deletions arch/sparc/include/asm/nmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ extern void nmi_adjust_hz(unsigned int new_hz);

extern atomic_t nmi_active;

extern void start_nmi_watchdog(void *unused);
extern void stop_nmi_watchdog(void *unused);

#endif /* __NMI_H */
6 changes: 6 additions & 0 deletions arch/sparc/include/asm/perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ extern void set_perf_counter_pending(void);

#define PERF_COUNTER_INDEX_OFFSET 0

#ifdef CONFIG_PERF_COUNTERS
extern void init_hw_perf_counters(void);
#else
static inline void init_hw_perf_counters(void) { }
#endif

#endif
3 changes: 3 additions & 0 deletions arch/sparc/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,6 @@ obj-$(CONFIG_SUN_LDOMS) += ldc.o vio.o viohs.o ds.o
obj-$(CONFIG_AUDIT) += audit.o
audit--$(CONFIG_AUDIT) := compat_audit.o
obj-$(CONFIG_COMPAT) += $(audit--y)

pc--$(CONFIG_PERF_COUNTERS) := perf_counter.o
obj-$(CONFIG_SPARC64) += $(pc--y)
8 changes: 6 additions & 2 deletions arch/sparc/kernel/nmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/delay.h>
#include <linux/smp.h>

#include <asm/perf_counter.h>
#include <asm/ptrace.h>
#include <asm/local.h>
#include <asm/pcr.h>
Expand Down Expand Up @@ -156,7 +157,7 @@ static void report_broken_nmi(int cpu, int *prev_nmi_count)
atomic_dec(&nmi_active);
}

static void stop_nmi_watchdog(void *unused)
void stop_nmi_watchdog(void *unused)
{
pcr_ops->write(PCR_PIC_PRIV);
__get_cpu_var(wd_enabled) = 0;
Expand Down Expand Up @@ -210,7 +211,7 @@ static int __init check_nmi_watchdog(void)
return err;
}

static void start_nmi_watchdog(void *unused)
void start_nmi_watchdog(void *unused)
{
__get_cpu_var(wd_enabled) = 1;
atomic_inc(&nmi_active);
Expand Down Expand Up @@ -263,6 +264,9 @@ int __init nmi_init(void)
atomic_set(&nmi_active, -1);
}
}
if (!err)
init_hw_perf_counters();

return err;
}

Expand Down
Loading

0 comments on commit 59abbd1

Please sign in to comment.