aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2010-08-12 16:18:15 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-09-02 00:07:31 -0400
commit8154c5d22d91cd16bd9985b0638c8957e4688d0e (patch)
tree3f86ef67c9242a585f08a1220d3113718b438869 /arch/powerpc/platforms
parente1f0ece113fe028593b6869fe191a991322c5d85 (diff)
powerpc: Abstract indexing of lppaca structs
Currently we have the lppaca structs as a simple array of NR_CPUS entries, taking up space in the data section of the kernel image. In future we would like to allocate them dynamically, so this abstracts out the accesses to the array, making it easier to change how we locate the lppaca for a given cpu in future. Specifically, lppaca[cpu] changes to lppaca_of(cpu). Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/iseries/dt.c4
-rw-r--r--arch/powerpc/platforms/iseries/smp.c2
-rw-r--r--arch/powerpc/platforms/pseries/dtl.c8
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c4
4 files changed, 9 insertions, 9 deletions
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c
index 7f45a51fe79..fdb7384c0c4 100644
--- a/arch/powerpc/platforms/iseries/dt.c
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -243,7 +243,7 @@ static void __init dt_cpus(struct iseries_flat_dt *dt)
243 pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE); 243 pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE);
244 244
245 for (i = 0; i < NR_CPUS; i++) { 245 for (i = 0; i < NR_CPUS; i++) {
246 if (lppaca[i].dyn_proc_status >= 2) 246 if (lppaca_of(i).dyn_proc_status >= 2)
247 continue; 247 continue;
248 248
249 snprintf(p, 32 - (p - buf), "@%d", i); 249 snprintf(p, 32 - (p - buf), "@%d", i);
@@ -251,7 +251,7 @@ static void __init dt_cpus(struct iseries_flat_dt *dt)
251 251
252 dt_prop_str(dt, "device_type", device_type_cpu); 252 dt_prop_str(dt, "device_type", device_type_cpu);
253 253
254 index = lppaca[i].dyn_hv_phys_proc_index; 254 index = lppaca_of(i).dyn_hv_phys_proc_index;
255 d = &xIoHriProcessorVpd[index]; 255 d = &xIoHriProcessorVpd[index];
256 256
257 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024); 257 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024);
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
index 6590850045a..6c6029914db 100644
--- a/arch/powerpc/platforms/iseries/smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -91,7 +91,7 @@ static void smp_iSeries_kick_cpu(int nr)
91 BUG_ON((nr < 0) || (nr >= NR_CPUS)); 91 BUG_ON((nr < 0) || (nr >= NR_CPUS));
92 92
93 /* Verify that our partition has a processor nr */ 93 /* Verify that our partition has a processor nr */
94 if (lppaca[nr].dyn_proc_status >= 2) 94 if (lppaca_of(nr).dyn_proc_status >= 2)
95 return; 95 return;
96 96
97 /* The processor is currently spinning, waiting 97 /* The processor is currently spinning, waiting
diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index a00addb5594..adfd5441b61 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -107,14 +107,14 @@ static int dtl_enable(struct dtl *dtl)
107 } 107 }
108 108
109 /* set our initial buffer indices */ 109 /* set our initial buffer indices */
110 dtl->last_idx = lppaca[dtl->cpu].dtl_idx = 0; 110 dtl->last_idx = lppaca_of(dtl->cpu).dtl_idx = 0;
111 111
112 /* ensure that our updates to the lppaca fields have occurred before 112 /* ensure that our updates to the lppaca fields have occurred before
113 * we actually enable the logging */ 113 * we actually enable the logging */
114 smp_wmb(); 114 smp_wmb();
115 115
116 /* enable event logging */ 116 /* enable event logging */
117 lppaca[dtl->cpu].dtl_enable_mask = dtl_event_mask; 117 lppaca_of(dtl->cpu).dtl_enable_mask = dtl_event_mask;
118 118
119 return 0; 119 return 0;
120} 120}
@@ -123,7 +123,7 @@ static void dtl_disable(struct dtl *dtl)
123{ 123{
124 int hwcpu = get_hard_smp_processor_id(dtl->cpu); 124 int hwcpu = get_hard_smp_processor_id(dtl->cpu);
125 125
126 lppaca[dtl->cpu].dtl_enable_mask = 0x0; 126 lppaca_of(dtl->cpu).dtl_enable_mask = 0x0;
127 127
128 unregister_dtl(hwcpu, __pa(dtl->buf)); 128 unregister_dtl(hwcpu, __pa(dtl->buf));
129 129
@@ -171,7 +171,7 @@ static ssize_t dtl_file_read(struct file *filp, char __user *buf, size_t len,
171 /* actual number of entries read */ 171 /* actual number of entries read */
172 n_read = 0; 172 n_read = 0;
173 173
174 cur_idx = lppaca[dtl->cpu].dtl_idx; 174 cur_idx = lppaca_of(dtl->cpu).dtl_idx;
175 last_idx = dtl->last_idx; 175 last_idx = dtl->last_idx;
176 176
177 if (cur_idx - last_idx > dtl->buf_entries) { 177 if (cur_idx - last_idx > dtl->buf_entries) {
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index cf79b46d8f8..a17fe4a9059 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -250,9 +250,9 @@ void vpa_init(int cpu)
250 long ret; 250 long ret;
251 251
252 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 252 if (cpu_has_feature(CPU_FTR_ALTIVEC))
253 lppaca[cpu].vmxregs_in_use = 1; 253 lppaca_of(cpu).vmxregs_in_use = 1;
254 254
255 addr = __pa(&lppaca[cpu]); 255 addr = __pa(&lppaca_of(cpu));
256 ret = register_vpa(hwcpu, addr); 256 ret = register_vpa(hwcpu, addr);
257 257
258 if (ret) { 258 if (ret) {