Skip to content

Commit

Permalink
tile/perf: Support perf_events on tilegx and tilepro
Browse files Browse the repository at this point in the history
Add perf support for tile architecture.

Signed-off-by: Zhigang Lu <zlu@tilera.com>
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
  • Loading branch information
Zhigang Lu authored and Chris Metcalf committed Mar 7, 2014
1 parent ba67823 commit 8d61dd7
Show file tree
Hide file tree
Showing 5 changed files with 1,048 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/tile/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

config TILE
def_bool y
select HAVE_PERF_EVENTS
select USE_PMC if PERF_EVENTS
select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG
select HAVE_KVM if !TILEGX
Expand Down
22 changes: 22 additions & 0 deletions arch/tile/include/asm/perf_event.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2014 Tilera Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for
* more details.
*/

#ifndef _ASM_TILE_PERF_EVENT_H
#define _ASM_TILE_PERF_EVENT_H

#include <linux/percpu.h>
DECLARE_PER_CPU(u64, perf_irqs);

unsigned long handle_syscall_link_address(void);
#endif /* _ASM_TILE_PERF_EVENT_H */
1 change: 1 addition & 0 deletions arch/tile/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ obj-$(CONFIG_PCI) += pci_gx.o
else
obj-$(CONFIG_PCI) += pci.o
endif
obj-$(CONFIG_PERF_EVENTS) += perf_event.o
obj-$(CONFIG_USE_PMC) += pmc.o
obj-$(CONFIG_TILE_USB) += usb.o
obj-$(CONFIG_TILE_HVGLUE_TRACE) += hvglue_trace.o
Expand Down
18 changes: 18 additions & 0 deletions arch/tile/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <hv/drv_pcie_rc_intf.h>
#include <arch/spr_def.h>
#include <asm/traps.h>
#include <linux/perf_event.h>

/* Bit-flag stored in irq_desc->chip_data to indicate HW-cleared irqs. */
#define IS_HW_CLEARED 1
Expand Down Expand Up @@ -260,6 +261,23 @@ void ack_bad_irq(unsigned int irq)
pr_err("unexpected IRQ trap at vector %02x\n", irq);
}

/*
* /proc/interrupts printing:
*/
int arch_show_interrupts(struct seq_file *p, int prec)
{
#ifdef CONFIG_PERF_EVENTS
int i;

seq_printf(p, "%*s: ", prec, "PMI");

for_each_online_cpu(i)
seq_printf(p, "%10llu ", per_cpu(perf_irqs, i));
seq_puts(p, " perf_events\n");
#endif
return 0;
}

/*
* Generic, controller-independent functions:
*/
Expand Down
Loading

0 comments on commit 8d61dd7

Please sign in to comment.