aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2006-08-07 02:19:19 -0400
committerPaul Mackerras <paulus@samba.org>2006-08-08 03:08:56 -0400
commit2f6093c84730b4bad65bcd0f2f904a5769b1dfc5 (patch)
treeab4e64a0520e944062f418e91706ff968e23a6ea /arch/powerpc/platforms
parent452b5e21216011f2f068e80443568f5f3f3f4d63 (diff)
[POWERPC] Implement SLB shadow buffer
This adds a shadow buffer for the SLBs and regsiters it with PHYP. Only the bolted SLB entries (top 3) are shadowed. The SLB shadow buffer tells the hypervisor what the kernel needs to have in the SLB for the kernel to be able to function. The hypervisor can use this information to speed up partition context switches. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c24
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h10
-rw-r--r--arch/powerpc/platforms/pseries/setup.c12
3 files changed, 40 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 6cbf14266d5e..1820a0b0a8c6 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -252,18 +252,34 @@ out:
252void vpa_init(int cpu) 252void vpa_init(int cpu)
253{ 253{
254 int hwcpu = get_hard_smp_processor_id(cpu); 254 int hwcpu = get_hard_smp_processor_id(cpu);
255 unsigned long vpa = __pa(&lppaca[cpu]); 255 unsigned long addr;
256 long ret; 256 long ret;
257 257
258 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 258 if (cpu_has_feature(CPU_FTR_ALTIVEC))
259 lppaca[cpu].vmxregs_in_use = 1; 259 lppaca[cpu].vmxregs_in_use = 1;
260 260
261 ret = register_vpa(hwcpu, vpa); 261 addr = __pa(&lppaca[cpu]);
262 ret = register_vpa(hwcpu, addr);
262 263
263 if (ret) 264 if (ret) {
264 printk(KERN_ERR "WARNING: vpa_init: VPA registration for " 265 printk(KERN_ERR "WARNING: vpa_init: VPA registration for "
265 "cpu %d (hw %d) of area %lx returns %ld\n", 266 "cpu %d (hw %d) of area %lx returns %ld\n",
266 cpu, hwcpu, vpa, ret); 267 cpu, hwcpu, addr, ret);
268 return;
269 }
270 /*
271 * PAPR says this feature is SLB-Buffer but firmware never
272 * reports that. All SPLPAR support SLB shadow buffer.
273 */
274 addr = __pa(&slb_shadow[cpu]);
275 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
276 ret = register_slb_shadow(hwcpu, addr);
277 if (ret)
278 printk(KERN_ERR
279 "WARNING: vpa_init: SLB shadow buffer "
280 "registration for cpu %d (hw %d) of area %lx "
281 "returns %ld\n", cpu, hwcpu, addr, ret);
282 }
267} 283}
268 284
269long pSeries_lpar_hpte_insert(unsigned long hpte_group, 285long pSeries_lpar_hpte_insert(unsigned long hpte_group,
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index ebd15de7597e..3eb7b294d92f 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -37,6 +37,16 @@ static inline long register_vpa(unsigned long cpu, unsigned long vpa)
37 return vpa_call(0x1, cpu, vpa); 37 return vpa_call(0x1, cpu, vpa);
38} 38}
39 39
40static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa)
41{
42 return vpa_call(0x7, cpu, vpa);
43}
44
45static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
46{
47 return vpa_call(0x3, cpu, vpa);
48}
49
40extern void vpa_init(int cpu); 50extern void vpa_init(int cpu);
41 51
42static inline long plpar_pte_enter(unsigned long flags, 52static inline long plpar_pte_enter(unsigned long flags,
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index de214d86ff44..6ebeecfd6bcb 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -234,9 +234,17 @@ static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary)
234{ 234{
235 /* Don't risk a hypervisor call if we're crashing */ 235 /* Don't risk a hypervisor call if we're crashing */
236 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) { 236 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
237 unsigned long vpa = __pa(get_lppaca()); 237 unsigned long addr;
238 238
239 if (unregister_vpa(hard_smp_processor_id(), vpa)) { 239 addr = __pa(get_slb_shadow());
240 if (unregister_slb_shadow(hard_smp_processor_id(), addr))
241 printk("SLB shadow buffer deregistration of "
242 "cpu %u (hw_cpu_id %d) failed\n",
243 smp_processor_id(),
244 hard_smp_processor_id());
245
246 addr = __pa(get_lppaca());
247 if (unregister_vpa(hard_smp_processor_id(), addr)) {
240 printk("VPA deregistration of cpu %u (hw_cpu_id %d) " 248 printk("VPA deregistration of cpu %u (hw_cpu_id %d) "
241 "failed\n", smp_processor_id(), 249 "failed\n", smp_processor_id(),
242 hard_smp_processor_id()); 250 hard_smp_processor_id());