]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc/pseries: Move CMO code from plapr_wrappers.h to platforms/pseries
authorMichael Ellerman <mpe@ellerman.id.au>
Mon, 14 Nov 2016 05:28:10 +0000 (16:28 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 17 Nov 2016 06:11:46 +0000 (17:11 +1100)
Currently there's some CMO (Cooperative Memory Overcommit) code, in
plpar_wrappers.h. Some of it is #ifdef CONFIG_PSERIES and some of it
isn't. The end result being if a file includes plpar_wrappers.h it won't
build with CONFIG_PSERIES=n.

Fix it by moving the CMO code into platforms/pseries. The two hcall
wrappers can just be moved into their only caller, cmm.c, and the
accessors can go in pseries.h.

Note we need the accessors because cmm.c can be built as a module, so
there needs to be a split between the built-in code vs the module, and
that's achieved by using those accessors.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/hvcall.h
arch/powerpc/include/asm/plpar_wrappers.h
arch/powerpc/platforms/pseries/cmm.c
arch/powerpc/platforms/pseries/lparcfg.c
arch/powerpc/platforms/pseries/pseries.h

index 489748ed21b45a9d0eec744740e81bc0d59894c3..8d5f8352afd70d8674ec05562e636f96ab46bc40 100644 (file)
@@ -413,27 +413,6 @@ static inline unsigned int get_longbusy_msecs(int longbusy_rc)
        }
 }
 
-#ifdef CONFIG_PPC_PSERIES
-extern int CMO_PrPSP;
-extern int CMO_SecPSP;
-extern unsigned long CMO_PageSize;
-
-static inline int cmo_get_primary_psp(void)
-{
-       return CMO_PrPSP;
-}
-
-static inline int cmo_get_secondary_psp(void)
-{
-       return CMO_SecPSP;
-}
-
-static inline unsigned long cmo_get_page_size(void)
-{
-       return CMO_PageSize;
-}
-#endif /* CONFIG_PPC_PSERIES */
-
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_HVCALL_H */
index 1b394247afc2dc86c76a26c9b5ed0274ae0de536..034a588b122c53ebf5bcb67b93f5cb1440f660c7 100644 (file)
@@ -93,38 +93,6 @@ static inline long register_dtl(unsigned long cpu, unsigned long vpa)
        return vpa_call(H_VPA_REG_DTL, cpu, vpa);
 }
 
-static inline long plpar_page_set_loaned(unsigned long vpa)
-{
-       unsigned long cmo_page_sz = cmo_get_page_size();
-       long rc = 0;
-       int i;
-
-       for (i = 0; !rc && i < PAGE_SIZE; i += cmo_page_sz)
-               rc = plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED, vpa + i, 0);
-
-       for (i -= cmo_page_sz; rc && i != 0; i -= cmo_page_sz)
-               plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE,
-                                  vpa + i - cmo_page_sz, 0);
-
-       return rc;
-}
-
-static inline long plpar_page_set_active(unsigned long vpa)
-{
-       unsigned long cmo_page_sz = cmo_get_page_size();
-       long rc = 0;
-       int i;
-
-       for (i = 0; !rc && i < PAGE_SIZE; i += cmo_page_sz)
-               rc = plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE, vpa + i, 0);
-
-       for (i -= cmo_page_sz; rc && i != 0; i -= cmo_page_sz)
-               plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED,
-                                  vpa + i - cmo_page_sz, 0);
-
-       return rc;
-}
-
 extern void vpa_init(int cpu);
 
 static inline long plpar_pte_enter(unsigned long flags,
index 66e7227469b8c279c4ff392be4e9a0ec37c66e8c..97232882938785f2dcf2295796bb3a1e8cb4c7bc 100644 (file)
@@ -41,6 +41,8 @@
 #include <linux/memory.h>
 #include <asm/plpar_wrappers.h>
 
+#include "pseries.h"
+
 #define CMM_DRIVER_VERSION     "1.0.0"
 #define CMM_DEFAULT_DELAY      1
 #define CMM_HOTPLUG_DELAY      5
@@ -109,6 +111,38 @@ static int hotplug_occurred; /* protected by the hotplug mutex */
 
 static struct task_struct *cmm_thread_ptr;
 
+static long plpar_page_set_loaned(unsigned long vpa)
+{
+       unsigned long cmo_page_sz = cmo_get_page_size();
+       long rc = 0;
+       int i;
+
+       for (i = 0; !rc && i < PAGE_SIZE; i += cmo_page_sz)
+               rc = plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED, vpa + i, 0);
+
+       for (i -= cmo_page_sz; rc && i != 0; i -= cmo_page_sz)
+               plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE,
+                                  vpa + i - cmo_page_sz, 0);
+
+       return rc;
+}
+
+static long plpar_page_set_active(unsigned long vpa)
+{
+       unsigned long cmo_page_sz = cmo_get_page_size();
+       long rc = 0;
+       int i;
+
+       for (i = 0; !rc && i < PAGE_SIZE; i += cmo_page_sz)
+               rc = plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_ACTIVE, vpa + i, 0);
+
+       for (i -= cmo_page_sz; rc && i != 0; i -= cmo_page_sz)
+               plpar_hcall_norets(H_PAGE_INIT, H_PAGE_SET_LOANED,
+                                  vpa + i - cmo_page_sz, 0);
+
+       return rc;
+}
+
 /**
  * cmm_alloc_pages - Allocate pages and mark them as loaned
  * @nr:        number of pages to allocate
index afa05a2cb7029b4df7b5fa28d099d8776650aed1..e6397976060e8fdea92139e1df5dae5c73a8580a 100644 (file)
@@ -37,6 +37,7 @@
 #include <asm/mmu.h>
 #include <asm/machdep.h>
 
+#include "pseries.h"
 
 /*
  * This isn't a module but we expose that to userspace
index b1be7b713fe6b0084ef3518d4438e781349f6c17..1361a9db534b76bfdd21cd058e828aaa8ae04dee 100644 (file)
@@ -79,4 +79,23 @@ extern struct pci_controller_ops pseries_pci_controller_ops;
 
 unsigned long pseries_memory_block_size(void);
 
+extern int CMO_PrPSP;
+extern int CMO_SecPSP;
+extern unsigned long CMO_PageSize;
+
+static inline int cmo_get_primary_psp(void)
+{
+       return CMO_PrPSP;
+}
+
+static inline int cmo_get_secondary_psp(void)
+{
+       return CMO_SecPSP;
+}
+
+static inline unsigned long cmo_get_page_size(void)
+{
+       return CMO_PageSize;
+}
+
 #endif /* _PSERIES_PSERIES_H */