powerpc: Make CMO paging space pool ID and page size available
authorRobert Jennings <rcj@linux.vnet.ibm.com>
Fri, 15 Aug 2008 19:07:31 +0000 (05:07 +1000)
committerPaul Mackerras <paulus@samba.org>
Mon, 18 Aug 2008 04:22:34 +0000 (14:22 +1000)
During platform setup, save off the primary/secondary paging space
pool IDs and the page size.  Added accessors in hvcall.h for these
variables.  This is needed for a subsequent fix.

Submitted-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/include/asm/hvcall.h
arch/powerpc/platforms/pseries/setup.c

index fbe2932..6251a4b 100644 (file)
@@ -291,6 +291,28 @@ struct hvcall_mpp_data {
 };
 
 int h_get_mpp(struct hvcall_mpp_data *);
 };
 
 int h_get_mpp(struct hvcall_mpp_data *);
+
+#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 */
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_HVCALL_H */
index 063a0d2..3ce8a13 100644 (file)
@@ -68,6 +68,9 @@
 #include "plpar_wrappers.h"
 #include "pseries.h"
 
 #include "plpar_wrappers.h"
 #include "pseries.h"
 
+int CMO_PrPSP = -1;
+int CMO_SecPSP = -1;
+unsigned long CMO_PageSize = (ASM_CONST(1) << IOMMU_PAGE_SHIFT);
 
 int fwnmi_active;  /* TRUE if an FWNMI handler is present */
 
 
 int fwnmi_active;  /* TRUE if an FWNMI handler is present */
 
@@ -325,8 +328,7 @@ void pSeries_cmo_feature_init(void)
 {
        char *ptr, *key, *value, *end;
        int call_status;
 {
        char *ptr, *key, *value, *end;
        int call_status;
-       int PrPSP = -1;
-       int SecPSP = -1;
+       int page_order = IOMMU_PAGE_SHIFT;
 
        pr_debug(" -> fw_cmo_feature_init()\n");
        spin_lock(&rtas_data_buf_lock);
 
        pr_debug(" -> fw_cmo_feature_init()\n");
        spin_lock(&rtas_data_buf_lock);
@@ -365,21 +367,31 @@ void pSeries_cmo_feature_init(void)
                                break;
                        }
 
                                break;
                        }
 
-                       if (0 == strcmp(key, "PrPSP"))
-                               PrPSP = simple_strtol(value, NULL, 10);
+                       if (0 == strcmp(key, "CMOPageSize"))
+                               page_order = simple_strtol(value, NULL, 10);
+                       else if (0 == strcmp(key, "PrPSP"))
+                               CMO_PrPSP = simple_strtol(value, NULL, 10);
                        else if (0 == strcmp(key, "SecPSP"))
                        else if (0 == strcmp(key, "SecPSP"))
-                               SecPSP = simple_strtol(value, NULL, 10);
+                               CMO_SecPSP = simple_strtol(value, NULL, 10);
                        value = key = ptr + 1;
                }
                ptr++;
        }
 
                        value = key = ptr + 1;
                }
                ptr++;
        }
 
-       if (PrPSP != -1 || SecPSP != -1) {
+       /* Page size is returned as the power of 2 of the page size,
+        * convert to the page size in bytes before returning
+        */
+       CMO_PageSize = 1 << page_order;
+       pr_debug("CMO_PageSize = %lu\n", CMO_PageSize);
+
+       if (CMO_PrPSP != -1 || CMO_SecPSP != -1) {
                pr_info("CMO enabled\n");
                pr_info("CMO enabled\n");
-               pr_debug("CMO enabled, PrPSP=%d, SecPSP=%d\n", PrPSP, SecPSP);
+               pr_debug("CMO enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP,
+                        CMO_SecPSP);
                powerpc_firmware_features |= FW_FEATURE_CMO;
        } else
                powerpc_firmware_features |= FW_FEATURE_CMO;
        } else
-               pr_debug("CMO not enabled, PrPSP=%d, SecPSP=%d\n", PrPSP, SecPSP);
+               pr_debug("CMO not enabled, PrPSP=%d, SecPSP=%d\n", CMO_PrPSP,
+                        CMO_SecPSP);
        spin_unlock(&rtas_data_buf_lock);
        pr_debug(" <- fw_cmo_feature_init()\n");
 }
        spin_unlock(&rtas_data_buf_lock);
        pr_debug(" <- fw_cmo_feature_init()\n");
 }