Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe166148 authored by Will Deacon's avatar Will Deacon Committed by Russell King
Browse files

ARM: 6073/1: oprofile: remove old files and update KConfig



Enable hardware perf-events if CPU_HAS_PMU and select
HAVE_OPROFILE if HAVE_PERF_EVENTS. If no hardware support
is present, OProfile will fall back to timer mode.

This patch also removes the old OProfile drivers in favour
of the code implemented by perf.

Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 8c1fc96f
Loading
Loading
Loading
Loading
+2 −24
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ config ARM
	select RTC_LIB
	select SYS_SUPPORTS_APM_EMULATION
	select GENERIC_ATOMIC64 if (!CPU_32v6K)
	select HAVE_OPROFILE
	select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
	select HAVE_ARCH_KGDB
	select HAVE_KPROBES if (!XIP_KERNEL)
	select HAVE_KRETPROBES if (HAVE_KPROBES)
@@ -181,28 +181,6 @@ config ARM_L1_CACHE_SHIFT_6
	help
	  Setting ARM L1 cache line size to 64 Bytes.

if OPROFILE

config OPROFILE_ARMV6
	def_bool y
	depends on CPU_V6 && !SMP
	select OPROFILE_ARM11_CORE

config OPROFILE_MPCORE
	def_bool y
	depends on CPU_V6 && SMP
	select OPROFILE_ARM11_CORE

config OPROFILE_ARM11_CORE
	bool

config OPROFILE_ARMV7
	def_bool y
	depends on CPU_V7 && !SMP
	bool

endif

config VECTORS_BASE
	hex
	default 0xffff0000 if MMU || CPU_HIGH_VECTOR
@@ -1334,7 +1312,7 @@ config HIGHPTE

config HW_PERF_EVENTS
	bool "Enable hardware performance counter support for perf events"
	depends on PERF_EVENTS && CPU_HAS_PMU && (CPU_V6 || CPU_V7)
	depends on PERF_EVENTS && CPU_HAS_PMU
	default y
	help
	  Enable hardware performance counter support for perf events. If
+1 −6
Original line number Diff line number Diff line
@@ -6,9 +6,4 @@ DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
		oprofilefs.o oprofile_stats.o \
		timer_int.o )

oprofile-y				:= $(DRIVER_OBJS) common.o backtrace.o
oprofile-$(CONFIG_CPU_XSCALE)		+= op_model_xscale.o
oprofile-$(CONFIG_OPROFILE_ARM11_CORE)	+= op_model_arm11_core.o
oprofile-$(CONFIG_OPROFILE_ARMV6)	+= op_model_v6.o
oprofile-$(CONFIG_OPROFILE_MPCORE)	+= op_model_mpcore.o
oprofile-$(CONFIG_OPROFILE_ARMV7)	+= op_model_v7.o
oprofile-y				:= $(DRIVER_OBJS) common.o

arch/arm/oprofile/backtrace.c

deleted100644 → 0
+0 −83
Original line number Diff line number Diff line
/*
 * Arm specific backtracing code for oprofile
 *
 * Copyright 2005 Openedhand Ltd.
 *
 * Author: Richard Purdie <rpurdie@openedhand.com>
 *
 * Based on i386 oprofile backtrace code by John Levon, David Smith
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */

#include <linux/oprofile.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/uaccess.h>
#include <asm/ptrace.h>
#include <asm/stacktrace.h>

static int report_trace(struct stackframe *frame, void *d)
{
	unsigned int *depth = d;

	if (*depth) {
		oprofile_add_trace(frame->pc);
		(*depth)--;
	}

	return *depth == 0;
}

/*
 * The registers we're interested in are at the end of the variable
 * length saved register structure. The fp points at the end of this
 * structure so the address of this struct is:
 * (struct frame_tail *)(xxx->fp)-1
 */
struct frame_tail {
	struct frame_tail *fp;
	unsigned long sp;
	unsigned long lr;
} __attribute__((packed));

static struct frame_tail* user_backtrace(struct frame_tail *tail)
{
	struct frame_tail buftail[2];

	/* Also check accessibility of one struct frame_tail beyond */
	if (!access_ok(VERIFY_READ, tail, sizeof(buftail)))
		return NULL;
	if (__copy_from_user_inatomic(buftail, tail, sizeof(buftail)))
		return NULL;

	oprofile_add_trace(buftail[0].lr);

	/* frame pointers should strictly progress back up the stack
	 * (towards higher addresses) */
	if (tail >= buftail[0].fp)
		return NULL;

	return buftail[0].fp-1;
}

void arm_backtrace(struct pt_regs * const regs, unsigned int depth)
{
	struct frame_tail *tail = ((struct frame_tail *) regs->ARM_fp) - 1;

	if (!user_mode(regs)) {
		struct stackframe frame;
		frame.fp = regs->ARM_fp;
		frame.sp = regs->ARM_sp;
		frame.lr = regs->ARM_lr;
		frame.pc = regs->ARM_pc;
		walk_stackframe(&frame, report_trace, &depth);
		return;
	}

	while (depth-- && tail && !((unsigned long) tail & 3))
		tail = user_backtrace(tail);
}

arch/arm/oprofile/op_arm_model.h

deleted100644 → 0
+0 −35
Original line number Diff line number Diff line
/**
 * @file op_arm_model.h
 * interface to ARM machine specific operations
 *
 * @remark Copyright 2004 Oprofile Authors
 * @remark Read the file COPYING
 *
 * @author Zwane Mwaikambo
 */

#ifndef OP_ARM_MODEL_H
#define OP_ARM_MODEL_H

struct op_arm_model_spec {
	int (*init)(void);
	unsigned int num_counters;
	int (*setup_ctrs)(void);
	int (*start)(void);
	void (*stop)(void);
	char *name;
};

#ifdef CONFIG_CPU_XSCALE
extern struct op_arm_model_spec op_xscale_spec;
#endif

extern struct op_arm_model_spec op_armv6_spec;
extern struct op_arm_model_spec op_mpcore_spec;
extern struct op_arm_model_spec op_armv7_spec;

extern void arm_backtrace(struct pt_regs * const regs, unsigned int depth);

extern int __init op_arm_init(struct oprofile_operations *ops, struct op_arm_model_spec *spec);
extern void op_arm_exit(void);
#endif /* OP_ARM_MODEL_H */

arch/arm/oprofile/op_counter.h

deleted100644 → 0
+0 −27
Original line number Diff line number Diff line
/**
 * @file op_counter.h
 *
 * @remark Copyright 2004 Oprofile Authors
 * @remark Read the file COPYING
 *
 * @author Zwane Mwaikambo
 */

#ifndef OP_COUNTER_H
#define OP_COUNTER_H

/* Per performance monitor configuration as set via
 * oprofilefs.
 */
struct op_counter_config {
	unsigned long count;
	unsigned long enabled;
	unsigned long event;
	unsigned long unit_mask;
	unsigned long kernel;
	unsigned long user;
};

extern struct op_counter_config *counter_config;

#endif /* OP_COUNTER_H */
Loading