]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc: Cleanup vpa code
authorMichael Ellerman <michael@ellerman.id.au>
Thu, 3 Nov 2005 08:34:38 +0000 (19:34 +1100)
committerMichael Ellerman <michael@ellerman.id.au>
Thu, 3 Nov 2005 08:34:38 +0000 (19:34 +1100)
register_vpa() doesn't actually do a VPA register call it just uses the flags
you pass it, so rename it to vpa_call() to be clearer.

We can then define register_vpa() and unregister_vpa() which are both simple
wrappers around vpa_call(). (we'll need unregister_vpa() for kexec soon)

We can then cleanup vpa_init(), and because vpa_init() is only called from
platforms/pseries we remove the definition in asm-ppc64/smp.h.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
arch/powerpc/platforms/pseries/lpar.c
arch/powerpc/platforms/pseries/plpar_wrappers.h
include/asm-ppc64/smp.h

index 8a7bda3db677561da634c2b8fa9de6c725fa75ae..e384a5a9179607b2af53873fb596122bfe89789b 100644 (file)
@@ -261,22 +261,18 @@ out:
 void vpa_init(int cpu)
 {
        int hwcpu = get_hard_smp_processor_id(cpu);
-       unsigned long vpa = (unsigned long)&(paca[cpu].lppaca);
+       unsigned long vpa = __pa(&paca[cpu].lppaca);
        long ret;
-       unsigned long flags;
-
-       /* Register the Virtual Processor Area (VPA) */
-       flags = 1UL << (63 - 18);
 
        if (cpu_has_feature(CPU_FTR_ALTIVEC))
                paca[cpu].lppaca.vmxregs_in_use = 1;
 
-       ret = register_vpa(flags, hwcpu, __pa(vpa));
+       ret = register_vpa(hwcpu, 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);
+                               cpu, hwcpu, vpa, ret);
 }
 
 long pSeries_lpar_hpte_insert(unsigned long hpte_group,
index 2457be2e217e6fc3ebe3ef641c8a0c77e8bfd8f7..382f8c5b0e7c0978892cf5f9a873ab9754477a25 100644 (file)
@@ -21,13 +21,26 @@ static inline long cede_processor(void)
        return 0;
 }
 
-static inline long register_vpa(unsigned long flags, unsigned long proc,
+static inline long vpa_call(unsigned long flags, unsigned long cpu,
                unsigned long vpa)
 {
-       return plpar_hcall_norets(H_REGISTER_VPA, flags, proc, vpa);
+       /* flags are in bits 16-18 (counting from most significant bit) */
+       flags = flags << (63 - 18);
+
+       return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa);
+}
+
+static inline long unregister_vpa(unsigned long cpu, unsigned long vpa)
+{
+       return vpa_call(0x5, cpu, vpa);
+}
+
+static inline long register_vpa(unsigned long cpu, unsigned long vpa)
+{
+       return vpa_call(0x1, cpu, vpa);
 }
 
-void vpa_init(int cpu);
+extern void vpa_init(int cpu);
 
 static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex,
                unsigned long avpn, unsigned long *old_pteh_ret,
index 0f42fcc1900b9473f4fd1f7bc04d2fec99153fd2..46c04046952d3443cf51c2a120409c41d4f3ef5f 100644 (file)
@@ -85,14 +85,6 @@ extern void smp_generic_take_timebase(void);
 
 extern struct smp_ops_t *smp_ops;
 
-#ifdef CONFIG_PPC_PSERIES
-void vpa_init(int cpu);
-#else
-static inline void vpa_init(int cpu)
-{
-}
-#endif /* CONFIG_PPC_PSERIES */
-
 #endif /* __ASSEMBLY__ */
 
 #endif /* !(_PPC64_SMP_H) */