]> err.no Git - linux-2.6/commitdiff
[POWERPC] Check cache coherency of kernel vs firmware
authorDale Farnsworth <dale@farnsworth.org>
Sat, 12 May 2007 00:57:35 +0000 (10:57 +1000)
committerPaul Mackerras <paulus@samba.org>
Sat, 12 May 2007 01:32:50 +0000 (11:32 +1000)
check_cache_coherency() verifies that the cache coherency setting of
the kernel (CONFIG_NOT_COHERENT_CACHE) matches that left by the firmware,
as indicated by coherency-off device tree property.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/Kconfig
arch/powerpc/kernel/setup-common.c
arch/powerpc/platforms/embedded6xx/Kconfig

index ccc5410af996a5cf87a45d6e2eda9a7a97f31df6..64089b11a9ee11e627336997a85e16c0081b8b24 100644 (file)
@@ -389,6 +389,9 @@ config NOT_COHERENT_CACHE
        bool
        depends on 4xx || 8xx || E200
        default y
+
+config CONFIG_CHECK_CACHE_COHERENCY
+       bool
 endmenu
 
 source "init/Kconfig"
index 370803722e4773f9f69a09e8b2fa8d7ab8d3d3f0..ed07a198f8d665a9b9b90461cb48d464f57abd16 100644 (file)
@@ -530,3 +530,44 @@ void __init setup_panic(void)
 {
        atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block);
 }
+
+#ifdef CONFIG_CHECK_CACHE_COHERENCY
+/*
+ * For platforms that have configurable cache-coherency.  This function
+ * checks that the cache coherency setting of the kernel matches the setting
+ * left by the firmware, as indicated in the device tree.  Since a mismatch
+ * will eventually result in DMA failures, we print * and error and call
+ * BUG() in that case.
+ */
+
+#ifdef CONFIG_NOT_COHERENT_CACHE
+#define KERNEL_COHERENCY       0
+#else
+#define KERNEL_COHERENCY       1
+#endif
+
+static int __init check_cache_coherency(void)
+{
+       struct device_node *np;
+       const void *prop;
+       int devtree_coherency;
+
+       np = of_find_node_by_path("/");
+       prop = of_get_property(np, "coherency-off", NULL);
+       of_node_put(np);
+
+       devtree_coherency = prop ? 0 : 1;
+
+       if (devtree_coherency != KERNEL_COHERENCY) {
+               printk(KERN_ERR
+                       "kernel coherency:%s != device tree_coherency:%s\n",
+                       KERNEL_COHERENCY ? "on" : "off",
+                       devtree_coherency ? "on" : "off");
+               BUG();
+       }
+
+       return 0;
+}
+
+late_initcall(check_cache_coherency);
+#endif /* CONFIG_CHECK_CACHE_COHERENCY */
index bafd05765a72f1dac9e85a7692cb40d8776b5dd2..15a1e9a778729a840e3064215527f5f283375a2d 100644 (file)
@@ -49,6 +49,7 @@ config MPC10X_BRIDGE
 config MV64X60
        bool
        select PPC_INDIRECT_PCI
+       select CONFIG_CHECK_CACHE_COHERENCY
 
 config MPC10X_OPENPIC
        bool