Commit 24805e63 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: pSeries shared processor fixes

It turns out there are more issues with our VPA code:

1. vpa_init doesnt report errors when it fails.  This was masking a bug
   where the VPA spanned 2 pages and phyp failed to register it.

2. We call idle_setup before we initialise the boot cpus vpa.  This
   means we never select the shared processor idle loop.

3. We dont call vpa_init on UP kernels.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 34fb8412
...@@ -259,6 +259,22 @@ int find_udbg_vterm(void) ...@@ -259,6 +259,22 @@ int find_udbg_vterm(void)
return found; return found;
} }
void vpa_init(int cpu)
{
int hwcpu = get_hard_smp_processor_id(cpu);
unsigned long vpa = (unsigned long)&(paca[cpu].lppaca);
long ret;
unsigned long flags;
/* Register the Virtual Processor Area (VPA) */
flags = 1UL << (63 - 18);
ret = register_vpa(flags, hwcpu, __pa(vpa));
if (ret)
printk(KERN_ERR "WARNING: vpa_init: VPA registration for "
"cpu %d (hw %d) of area %lx returns %ld\n",
cpu, hwcpu, __pa(vpa), ret);
}
long pSeries_lpar_hpte_insert(unsigned long hpte_group, long pSeries_lpar_hpte_insert(unsigned long hpte_group,
unsigned long va, unsigned long prpn, unsigned long va, unsigned long prpn,
......
...@@ -234,6 +234,9 @@ static void __init pSeries_setup_arch(void) ...@@ -234,6 +234,9 @@ static void __init pSeries_setup_arch(void)
#endif #endif
pSeries_nvram_init(); pSeries_nvram_init();
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
vpa_init(boot_cpuid);
} }
static int __init pSeries_init_panel(void) static int __init pSeries_init_panel(void)
......
...@@ -59,16 +59,6 @@ ...@@ -59,16 +59,6 @@
extern void pseries_secondary_smp_init(unsigned long); extern void pseries_secondary_smp_init(unsigned long);
static void vpa_init(int cpu)
{
unsigned long flags, pcpu = get_hard_smp_processor_id(cpu);
/* Register the Virtual Processor Area (VPA) */
flags = 1UL << (63 - 18);
register_vpa(flags, pcpu, __pa((unsigned long)&(paca[cpu].lppaca)));
}
/* Get state of physical CPU. /* Get state of physical CPU.
* Return codes: * Return codes:
* 0 - The processor is in the RTAS stopped state * 0 - The processor is in the RTAS stopped state
......
...@@ -1020,11 +1020,11 @@ void __init setup_arch(char **cmdline_p) ...@@ -1020,11 +1020,11 @@ void __init setup_arch(char **cmdline_p)
/* set up the bootmem stuff with available memory */ /* set up the bootmem stuff with available memory */
do_init_bootmem(); do_init_bootmem();
ppc_md.setup_arch();
/* Select the correct idle loop for the platform. */ /* Select the correct idle loop for the platform. */
idle_setup(); idle_setup();
ppc_md.setup_arch();
paging_init(); paging_init();
ppc64_boot_msg(0x15, "Setup Done"); ppc64_boot_msg(0x15, "Setup Done");
} }
......
...@@ -76,8 +76,6 @@ extern unsigned char stab_array[]; ...@@ -76,8 +76,6 @@ extern unsigned char stab_array[];
extern int cpu_idle(void *unused); extern int cpu_idle(void *unused);
void smp_call_function_interrupt(void); void smp_call_function_interrupt(void);
extern long register_vpa(unsigned long flags, unsigned long proc,
unsigned long vpa);
int smt_enabled_at_boot = 1; int smt_enabled_at_boot = 1;
......
...@@ -22,12 +22,14 @@ static inline long cede_processor(void) ...@@ -22,12 +22,14 @@ static inline long cede_processor(void)
return(0); return(0);
} }
static inline long register_vpa(unsigned long flags, unsigned long proc, unsigned long vpa) static inline long register_vpa(unsigned long flags, unsigned long proc,
unsigned long vpa)
{ {
plpar_hcall_norets(H_REGISTER_VPA, flags, proc, vpa); return plpar_hcall_norets(H_REGISTER_VPA, flags, proc, vpa);
return(0);
} }
void vpa_init(int cpu);
static inline long plpar_pte_remove(unsigned long flags, static inline long plpar_pte_remove(unsigned long flags,
unsigned long ptex, unsigned long ptex,
unsigned long avpn, unsigned long avpn,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment