From: Mikael Pettersson <mikpe@csd.uu.se>

Part 1/3 of perfctr control API changes:
- Switch per-counter control fields from struct-of-arrays
  to array-of-struct layout, placed at the end of the
  perfctr_cpu_control struct for flexibility.
- Drop ____cacheline_aligned from per-cpu cache object.

Signed-off-by: Mikael Pettersson <mikpe@csd.uu.se>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/perfctr/ppc.c     |   14 +++++++-------
 25-akpm/include/asm-ppc/perfctr.h |   10 ++++++----
 2 files changed, 13 insertions(+), 11 deletions(-)

diff -puN drivers/perfctr/ppc.c~perfctr-ppc32-update-2 drivers/perfctr/ppc.c
--- 25/drivers/perfctr/ppc.c~perfctr-ppc32-update-2	2004-11-28 00:51:13.569181624 -0800
+++ 25-akpm/drivers/perfctr/ppc.c	2004-11-28 00:51:13.575180712 -0800
@@ -1,4 +1,4 @@
-/* $Id: ppc.c,v 1.27 2004/10/24 00:07:44 mikpe Exp $
+/* $Id: ppc.c,v 1.30 2004/11/24 00:23:27 mikpe Exp $
  * PPC32 performance-monitoring counters driver.
  *
  * Copyright (C) 2004  Mikael Pettersson
@@ -20,7 +20,7 @@ struct per_cpu_cache {	/* roughly a subs
 	} k1;
 	/* Physically indexed cache of the MMCRs. */
 	unsigned int ppc_mmcr[3];
-} ____cacheline_aligned;
+};
 static DEFINE_PER_CPU(struct per_cpu_cache, per_cpu_cache);
 #define get_cpu_cache()	(&__get_cpu_var(per_cpu_cache))
 
@@ -297,13 +297,13 @@ static int ppc_check_control(struct perf
 	pmc_mask = 0;
 	memset(evntsel, 0, sizeof evntsel);
 	for(i = 0; i < nrctrs; ++i) {
-		pmc = state->control.pmc_map[i];
+		pmc = state->control.pmc[i].map;
 		state->pmc[i].map = pmc;
 		if (pmc >= nr_pmcs || (pmc_mask & (1<<pmc)))
 			return -EINVAL;
 		pmc_mask |= (1<<pmc);
 
-		evntsel[pmc] = state->control.evntsel[i];
+		evntsel[pmc] = state->control.pmc[i].evntsel;
 		if (evntsel[pmc] > pmc_max_event(pmc))
 			return -EINVAL;
 	}
@@ -484,7 +484,7 @@ unsigned int perfctr_cpu_identify_overfl
 	for(pmc_mask = 0; pmc < nrctrs; ++pmc) {
 		if ((int)state->pmc[pmc].start < 0) { /* PPC-specific */
 			/* XXX: "+=" to correct for overshots */
-			state->pmc[pmc].start = state->control.ireset[pmc];
+			state->pmc[pmc].start = state->control.pmc[pmc].ireset;
 			pmc_mask |= (1 << pmc);
 		}
 	}
@@ -501,7 +501,7 @@ static inline int check_ireset(const str
 	i = state->control.nractrs;
 	nrctrs = i + state->control.nrictrs;
 	for(; i < nrctrs; ++i)
-		if (state->control.ireset[i] < 0)	/* PPC-specific */
+		if (state->control.pmc[i].ireset < 0)	/* PPC-specific */
 			return -EINVAL;
 	return 0;
 }
@@ -513,7 +513,7 @@ static inline void setup_imode_start_val
 	cstatus = state->cstatus;
 	nrctrs = perfctr_cstatus_nrctrs(cstatus);
 	for(i = perfctr_cstatus_nractrs(cstatus); i < nrctrs; ++i)
-		state->pmc[i].start = state->control.ireset[i];
+		state->pmc[i].start = state->control.pmc[i].ireset;
 }
 
 #else	/* PERFCTR_INTERRUPT_SUPPORT */
diff -puN include/asm-ppc/perfctr.h~perfctr-ppc32-update-2 include/asm-ppc/perfctr.h
--- 25/include/asm-ppc/perfctr.h~perfctr-ppc32-update-2	2004-11-28 00:51:13.571181320 -0800
+++ 25-akpm/include/asm-ppc/perfctr.h	2004-11-28 00:51:13.576180560 -0800
@@ -1,4 +1,4 @@
-/* $Id: perfctr.h,v 1.6 2004/05/30 14:47:34 mikpe Exp $
+/* $Id: perfctr.h,v 1.12 2004/11/24 00:20:57 mikpe Exp $
  * PPC32 Performance-Monitoring Counters driver
  *
  * Copyright (C) 2004  Mikael Pettersson
@@ -23,9 +23,6 @@ struct perfctr_cpu_control {
 	unsigned int tsc_on;
 	unsigned int nractrs;		/* # of a-mode counters */
 	unsigned int nrictrs;		/* # of i-mode counters */
-	unsigned int pmc_map[8];
-	unsigned int evntsel[8];	/* one per counter, even on P5 */
-	int ireset[8];			/* [0,0x7fffffff], for i-mode counters */
 	struct {
 		unsigned int mmcr0;	/* sans PMC{1,2}SEL */
 		unsigned int mmcr2;	/* only THRESHMULT */
@@ -35,6 +32,11 @@ struct perfctr_cpu_control {
 	unsigned int _reserved2;
 	unsigned int _reserved3;
 	unsigned int _reserved4;
+	struct {
+		unsigned int map;	/* physical counter to use */
+		unsigned int evntsel;
+		int ireset;		/* [0,0x7fffffff], for i-mode counters */
+	} pmc[8];
 };
 
 struct perfctr_cpu_state {
_