diff options
author | Dale Farnsworth <dale@farnsworth.org> | 2007-05-12 10:57:35 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-05-12 11:32:50 +1000 |
commit | 06cce43cf0980d0ed3581458fd23522ca2d24e42 (patch) | |
tree | 853deee52d58559515a846a8d316adba4c7ebf58 /arch | |
parent | e1a3107b06a9619773596cd46a9ce0574419aed4 (diff) | |
download | op-kernel-dev-06cce43cf0980d0ed3581458fd23522ca2d24e42.zip op-kernel-dev-06cce43cf0980d0ed3581458fd23522ca2d24e42.tar.gz |
[POWERPC] Check cache coherency of kernel vs firmware
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/Kconfig | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 41 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/Kconfig | 1 |
3 files changed, 45 insertions, 0 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index ccc5410..64089b1 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -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" diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 3708037..ed07a19 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -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 */ diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig index bafd057..15a1e9a 100644 --- a/arch/powerpc/platforms/embedded6xx/Kconfig +++ b/arch/powerpc/platforms/embedded6xx/Kconfig @@ -49,6 +49,7 @@ config MPC10X_BRIDGE config MV64X60 bool select PPC_INDIRECT_PCI + select CONFIG_CHECK_CACHE_COHERENCY config MPC10X_OPENPIC bool |