From: William Lee Irwin III <wli@holomorphy.com>

From: Anton Blanchard <anton@samba.org>

- Remove iseries specific profiling, there were no complaints when I
  suggested removal on the linuxppc64 list a few weeks ago.

- Also remove another instance of that pesky abs() function.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/ppc64/kernel/asm-offsets.c   |    5 --
 25-akpm/arch/ppc64/kernel/head.S          |   25 --------------
 25-akpm/arch/ppc64/kernel/iSeries_setup.c |   52 ------------------------------
 25-akpm/arch/ppc64/kernel/misc.S          |    6 ---
 25-akpm/arch/ppc64/kernel/smp.c           |    9 -----
 25-akpm/include/asm-ppc64/paca.h          |   15 --------
 6 files changed, 2 insertions(+), 110 deletions(-)

diff -puN arch/ppc64/kernel/asm-offsets.c~remove-iseries-profiling arch/ppc64/kernel/asm-offsets.c
--- 25/arch/ppc64/kernel/asm-offsets.c~remove-iseries-profiling	2004-08-16 23:42:25.006571464 -0700
+++ 25-akpm/arch/ppc64/kernel/asm-offsets.c	2004-08-16 23:42:25.017569792 -0700
@@ -98,11 +98,6 @@ int main(void)
 	DEFINE(PACAHTLBSEGS, offsetof(struct paca_struct, context.htlb_segs));
 #endif /* CONFIG_HUGETLB_PAGE */
 	DEFINE(PACADEFAULTDECR, offsetof(struct paca_struct, default_decr));
-	DEFINE(PACAPROFENABLED, offsetof(struct paca_struct, prof_enabled));
-	DEFINE(PACAPROFLEN, offsetof(struct paca_struct, prof_len));
-	DEFINE(PACAPROFSHIFT, offsetof(struct paca_struct, prof_shift));
-	DEFINE(PACAPROFBUFFER, offsetof(struct paca_struct, prof_buffer));
-	DEFINE(PACAPROFSTEXT, offsetof(struct paca_struct, prof_stext));
         DEFINE(PACA_EXGEN, offsetof(struct paca_struct, exgen));
         DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc));
         DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb));
diff -puN arch/ppc64/kernel/head.S~remove-iseries-profiling arch/ppc64/kernel/head.S
--- 25/arch/ppc64/kernel/head.S~remove-iseries-profiling	2004-08-16 23:42:25.008571160 -0700
+++ 25-akpm/arch/ppc64/kernel/head.S	2004-08-16 23:42:25.018569640 -0700
@@ -322,36 +322,11 @@ label##_Iseries:							\
 	HMT_MEDIUM;							\
 	mtspr	SPRG1,r13;		/* save r13 */			\
 	EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN);				\
-	lbz	r10,PACAPROFENABLED(r13);				\
-	cmpwi	r10,0;							\
-	bne-	label##_Iseries_profile;				\
-label##_Iseries_prof_ret:						\
 	lbz	r10,PACAPROCENABLED(r13);				\
 	cmpwi	0,r10,0;						\
 	beq-	label##_Iseries_masked;					\
 	EXCEPTION_PROLOG_ISERIES_2;					\
 	b	label##_common;						\
-label##_Iseries_profile:						\
-	ld	r12,PACALPPACA+LPPACASRR1(r13);				\
-	andi.	r12,r12,MSR_PR;		/* Test if in kernel */		\
-	bne	label##_Iseries_prof_ret;				\
-	ld	r11,PACALPPACA+LPPACASRR0(r13);				\
-	ld	r12,PACAPROFSTEXT(r13);	/* _stext */			\
-	subf	r11,r12,r11;		/* offset into kernel */	\
-	lwz	r12,PACAPROFSHIFT(r13);					\
-	srd	r11,r11,r12;						\
-	lwz	r12,PACAPROFLEN(r13);	/* profile table length - 1 */	\
-	cmpd	r11,r12;		/* off end? */			\
-	ble	1f;							\
-	mr	r11,r12;		/* force into last entry */	\
-1:	sldi	r11,r11,2;		/* convert to offset */		\
-	ld	r12,PACAPROFBUFFER(r13);/* profile buffer */		\
-	add	r12,r12,r11;						\
-2:	lwarx	r11,0,r12;		/* atomically increment */	\
-	addi	r11,r11,1;						\
-	stwcx.	r11,0,r12;						\
-	bne-	2b;							\
-	b	label##_Iseries_prof_ret
 
 #ifdef DO_SOFT_DISABLE
 #define DISABLE_INTS				\
diff -puN arch/ppc64/kernel/iSeries_setup.c~remove-iseries-profiling arch/ppc64/kernel/iSeries_setup.c
--- 25/arch/ppc64/kernel/iSeries_setup.c~remove-iseries-profiling	2004-08-16 23:42:25.009571008 -0700
+++ 25-akpm/arch/ppc64/kernel/iSeries_setup.c	2004-08-16 23:42:25.020569336 -0700
@@ -36,6 +36,7 @@
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
 #include <asm/cputable.h>
+#include <asm/sections.h>
 
 #include <asm/time.h>
 #include "iSeries_setup.h"
@@ -54,17 +55,12 @@
 #include <asm/iSeries/mf.h>
 
 /* Function Prototypes */
-extern void abort(void);
 extern void ppcdbg_initialize(void);
-extern void iSeries_pcibios_init(void);
 extern void tce_init_iSeries(void);
 
 static void build_iSeries_Memory_Map(void);
 static void setup_iSeries_cache_sizes(void);
 static void iSeries_bolt_kernel(unsigned long saddr, unsigned long eaddr);
-extern void build_valid_hpte(unsigned long vsid, unsigned long ea, unsigned long pa,
-			     pte_t *ptep, unsigned hpteflags, unsigned bolted);
-static void iSeries_setup_dprofile(void);
 extern void iSeries_setup_arch(void);
 extern void iSeries_pci_final_fixup(void);
 
@@ -77,16 +73,10 @@ static unsigned long tbFreqHz;
 static unsigned long tbFreqMhz;
 static unsigned long tbFreqMhzHundreths;
 
-unsigned long dprof_shift;
-unsigned long dprof_len;
-unsigned int *dprof_buffer;
-
 int piranha_simulator;
 
 int boot_cpuid;
 
-extern char _end[];
-
 extern int rd_size;		/* Defined in drivers/block/rd.c */
 extern unsigned long klimit;
 extern unsigned long embedded_sysmap_start;
@@ -366,30 +356,6 @@ void __init iSeries_init(unsigned long r
 	}
 	*p = 0;
 
-        if (strstr(cmd_line, "dprofile=")) {
-                for (q = cmd_line; (p = strstr(q, "dprofile=")) != 0; ) {
-			unsigned long size, new_klimit;
-
-                        q = p + 9;
-                        if ((p > cmd_line) && (p[-1] != ' '))
-                                continue;
-                        dprof_shift = simple_strtoul(q, &q, 0);
-			dprof_len = (unsigned long)_etext -
-				(unsigned long)_stext;
-			dprof_len >>= dprof_shift;
-			size = ((dprof_len * sizeof(unsigned int)) +
-					(PAGE_SIZE-1)) & PAGE_MASK;
-			dprof_buffer = (unsigned int *)((klimit +
-						(PAGE_SIZE-1)) & PAGE_MASK);
-			new_klimit = ((unsigned long)dprof_buffer) + size;
-			lmb_reserve(__pa(klimit), (new_klimit-klimit));
-			klimit = new_klimit;
-			memset(dprof_buffer, 0, size);
-                }
-        }
-
-	iSeries_setup_dprofile();
-
 	mf_init();
 	mf_initialized = 1;
 	mb();
@@ -837,22 +803,6 @@ void iSeries_fixup_klimit(void)
 	}
 }
 
-static void iSeries_setup_dprofile(void)
-{
-	if (dprof_buffer) {
-		unsigned i;
-
-		for (i = 0; i < NR_CPUS; ++i) {
-			paca[i].prof_shift = dprof_shift;
-			paca[i].prof_len = dprof_len - 1;
-			paca[i].prof_buffer = dprof_buffer;
-			paca[i].prof_stext = (unsigned *)_stext;
-			mb();
-			paca[i].prof_enabled = 1;
-		}
-	}
-}
-
 int __init iSeries_src_init(void)
 {
         /* clear the progress line */
diff -puN arch/ppc64/kernel/misc.S~remove-iseries-profiling arch/ppc64/kernel/misc.S
--- 25/arch/ppc64/kernel/misc.S~remove-iseries-profiling	2004-08-16 23:42:25.011570704 -0700
+++ 25-akpm/arch/ppc64/kernel/misc.S	2004-08-16 23:42:25.021569184 -0700
@@ -454,12 +454,6 @@ _GLOBAL(_outsl_ns)
 	sync
 	blr	
 
-_GLOBAL(abs)
-	cmpi	0,r3,0
-	bge	10f
-	neg	r3,r3
-10:	blr
-
 _GLOBAL(_get_PVR)
 	mfspr	r3,PVR
 	blr
diff -puN arch/ppc64/kernel/smp.c~remove-iseries-profiling arch/ppc64/kernel/smp.c
--- 25/arch/ppc64/kernel/smp.c~remove-iseries-profiling	2004-08-16 23:42:25.012570552 -0700
+++ 25-akpm/arch/ppc64/kernel/smp.c	2004-08-16 23:42:25.022569032 -0700
@@ -592,10 +592,7 @@ void __init smp_init_pSeries(void)
 
 void smp_local_timer_interrupt(struct pt_regs * regs)
 {
-	if (!--(get_paca()->prof_counter)) {
-		update_process_times(user_mode(regs));
-		(get_paca()->prof_counter)=get_paca()->prof_multiplier;
-	}
+	update_process_times(user_mode(regs));
 }
 
 void smp_message_recv(int msg, struct pt_regs *regs)
@@ -824,8 +821,6 @@ void __init smp_prepare_cpus(unsigned in
 	/* Fixup boot cpu */
 	smp_store_cpu_info(boot_cpuid);
 	cpu_callin_map[boot_cpuid] = 1;
-	paca[boot_cpuid].prof_counter = 1;
-	paca[boot_cpuid].prof_multiplier = 1;
 
 #ifndef CONFIG_PPC_ISERIES
 	paca[boot_cpuid].next_jiffy_update_tb = tb_last_stamp = get_tb();
@@ -878,8 +873,6 @@ int __devinit __cpu_up(unsigned int cpu)
 	if (system_state == SYSTEM_BOOTING && !cpu_present(cpu))
 		return -ENOENT;
 
-	paca[cpu].prof_counter = 1;
-	paca[cpu].prof_multiplier = 1;
 	paca[cpu].default_decr = tb_ticks_per_jiffy / decr_overclock;
 
 	if (!(cur_cpu_spec->cpu_features & CPU_FTR_SLB)) {
diff -puN include/asm-ppc64/paca.h~remove-iseries-profiling include/asm-ppc64/paca.h
--- 25/include/asm-ppc64/paca.h~remove-iseries-profiling	2004-08-16 23:42:25.014570248 -0700
+++ 25-akpm/include/asm-ppc64/paca.h	2004-08-16 23:42:25.022569032 -0700
@@ -105,21 +105,6 @@ struct paca_struct {
 	 */
 	struct ItLpPaca lppaca __attribute__((aligned(0x80)));
 	struct ItLpRegSave reg_save;
-
-	/*
-	 * iSeries profiling support
-	 *
-	 * FIXME: do we still want this, or can we ditch it in favour
-	 * of oprofile?
-	 */
-	u32 *prof_buffer;		/* iSeries profiling buffer */
-	u32 *prof_stext;		/* iSeries start of kernel text */
-	u32 prof_multiplier;
-	u32 prof_counter;
-	u32 prof_shift;			/* iSeries shift for profile
-					 * bucket size */
-	u32 prof_len;			/* iSeries length of profile */
-	u8 prof_enabled;		/* 1=iSeries profiling enabled */
 };
 
 #endif /* _PPC64_PACA_H */
_