Commit f7f6f4fe authored by David Gibson's avatar David Gibson Committed by Paul Mackerras
Browse files

[PATCH] powerpc: Merge ppc64 pmc.[ch] with ppc32 perfmon.[ch]



This patches the ppc32 and ppc64 versions of the headers and .c files
with helper functions for manipulating the performance counting
hardware.  As a side effect, it removes use of the term "perfmon" from
ppc32, thus avoiding confusion with the unrelated performance counter
interface from HP Labs also called "perfmon".

Built, but not booted, for g5, pSeries, iSeries, and 32-bit Powermac
with both ARCH=powerpc and ARCH=ppc{,64} as appropriate.

Signed-off-by: default avatarDavid Gibson <dwg@au1.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 3d904eef
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ CFLAGS_btext.o += -fPIC
endif

obj-y				:= semaphore.o cputable.o ptrace.o syscalls.o \
				   signal_32.o
				   signal_32.o pmc.o
obj-$(CONFIG_PPC64)		+= binfmt_elf32.o sys_ppc32.o ptrace32.o
obj-$(CONFIG_ALTIVEC)		+= vecemu.o vector.o
obj-$(CONFIG_POWER4)		+= idle_power4.o
+25 −1
Original line number Diff line number Diff line
/*
 *  linux/arch/ppc64/kernel/pmc.c
 *  arch/powerpc/kernel/pmc.c
 *
 *  Copyright (C) 2004 David Gibson, IBM Corporation.
 *  Includes code formerly from arch/ppc/kernel/perfmon.c:
 *    Author: Andy Fleming
 *    Copyright (c) 2004 Freescale Semiconductor, Inc
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
@@ -17,6 +20,20 @@
#include <asm/processor.h>
#include <asm/pmc.h>

#if defined(CONFIG_FSL_BOOKE) && !defined(CONFIG_E200)
static void dummy_perf(struct pt_regs *regs)
{
	unsigned int pmgc0 = mfpmr(PMRN_PMGC0);

	pmgc0 &= ~PMGC0_PMIE;
	mtpmr(PMRN_PMGC0, pmgc0);
}
#elif defined(CONFIG_PPC64) || defined(CONFIG_6xx)

#ifndef MMCR0_PMAO
#define MMCR0_PMAO	0
#endif

/* Ensure exceptions are disabled */
static void dummy_perf(struct pt_regs *regs)
{
@@ -25,6 +42,11 @@ static void dummy_perf(struct pt_regs *regs)
	mmcr0 &= ~(MMCR0_PMXE|MMCR0_PMAO);
	mtspr(SPRN_MMCR0, mmcr0);
}
#else
static void dummy_perf(struct pt_regs *regs)
{
}
#endif

static DEFINE_SPINLOCK(pmc_owner_lock);
static void *pmc_owner_caller; /* mostly for debugging */
@@ -66,6 +88,7 @@ void release_pmc_hardware(void)
}
EXPORT_SYMBOL_GPL(release_pmc_hardware);

#ifdef CONFIG_PPC64
void power4_enable_pmcs(void)
{
	unsigned long hid0;
@@ -86,3 +109,4 @@ void power4_enable_pmcs(void)
		"isync" : "=&r" (hid0) : "i" (SPRN_HID0), "0" (hid0):
		"memory");
}
#endif /* CONFIG_PPC64 */
+1 −2
Original line number Diff line number Diff line
@@ -40,9 +40,9 @@
#include <asm/machdep.h>
#include <asm/rtas.h>
#include <asm/xmon.h>
#include <asm/pmc.h>
#ifdef CONFIG_PPC32
#include <asm/reg.h>
#include <asm/perfmon.h>
#endif
#ifdef CONFIG_PMAC_BACKLIGHT
#include <asm/backlight.h>
@@ -51,7 +51,6 @@
#include <asm/firmware.h>
#include <asm/processor.h>
#include <asm/systemcfg.h>
#include <asm/pmc.h>
#endif

#ifdef CONFIG_PPC64	/* XXX */
+0 −4
Original line number Diff line number Diff line
@@ -22,11 +22,7 @@
#include <linux/errno.h>
#include <asm/ptrace.h>
#include <asm/system.h>
#ifdef __powerpc64__
#include <asm/pmc.h>
#else /* __powerpc64__ */
#include <asm/perfmon.h>
#endif /* __powerpc64__ */
#include <asm/cputable.h>
#include <asm/oprofile_impl.h>

+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
#include <asm/cputable.h>
#include <asm/reg_booke.h>
#include <asm/page.h>
#include <asm/perfmon.h>
#include <asm/pmc.h>
#include <asm/oprofile_impl.h>

static unsigned long reset_value[OP_MAX_COUNTER];
Loading