===== arch/ppc/Kconfig 1.42 vs edited ===== --- 1.42/arch/ppc/Kconfig Wed Jul 16 18:38:55 2003 +++ edited/arch/ppc/Kconfig Fri Jul 18 01:06:59 2003 @@ -1464,6 +1464,14 @@ If you say Y here, various routines which may sleep will become very noisy if they are called with a spinlock held. +config DEBUG_CONSISTENT_SYNC + bool "Check for unaligned buffers in consistent_sync" + depends on DEBUG_KERNEL + help + This option enables checking for L1-cache line size alignment of + buffers passed to consistent_sync when DMA direction is set + to PCI_DMA_FROMDEVICE. Disable for production systems. + config KGDB bool "Include kgdb kernel debugger" depends on DEBUG_KERNEL ===== arch/ppc/mm/cachemap.c 1.13 vs edited ===== --- 1.13/arch/ppc/mm/cachemap.c Tue May 20 23:19:04 2003 +++ edited/arch/ppc/mm/cachemap.c Fri Jul 18 01:08:08 2003 @@ -146,6 +146,20 @@ case PCI_DMA_NONE: BUG(); case PCI_DMA_FROMDEVICE: /* invalidate only */ + +#ifdef CONFIG_DEBUG_CONSISTENT_SYNC + if (unlikely(start & (L1_CACHE_LINE_SIZE - 1)) || + unlikely(end & (L1_CACHE_LINE_SIZE - 1))) + { + static unsigned int count = 0; + if (++count < 10){ + printk(KERN_WARNING + "consistent_sync: 0x%08lx-0x%08lx " + "is not properly aligned\n", start, end); + dump_stack(); + } + } +#endif invalidate_dcache_range(start, end); break; case PCI_DMA_TODEVICE: /* writeback only */