Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: Revamp PCI DMA coherence Kconfig bits.

Leaving this configurable caused more trouble than it was ever worth, so
just make it explicit. Boards that are verified one way or the other can
fix up their selects accordingly. We presently default to non-coherent
for most platforms.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

+18 -25
+7
arch/sh/Kconfig
··· 169 169 config IO_TRAPPED 170 170 bool 171 171 172 + config DMA_COHERENT 173 + bool 174 + 175 + config DMA_NONCOHERENT 176 + def_bool !DMA_COHERENT 177 + 172 178 source "init/Kconfig" 173 179 174 180 source "kernel/Kconfig.freezer" ··· 223 217 224 218 config CPU_SHX3 225 219 bool 220 + select DMA_COHERENT 226 221 227 222 config ARCH_SHMOBILE 228 223 bool
-12
arch/sh/drivers/pci/Kconfig
··· 5 5 Find out whether you have a PCI motherboard. PCI is the name of a 6 6 bus system, i.e. the way the CPU talks to the other stuff inside 7 7 your box. If you have PCI, say Y, otherwise N. 8 - 9 - config SH_PCIDMA_NONCOHERENT 10 - bool "Cache and PCI noncoherent" 11 - depends on PCI 12 - default y 13 - help 14 - Enable this option if your platform does not have a CPU cache which 15 - remains coherent with PCI DMA. It is safest to say 'Y', although you 16 - will see better performance if you can say 'N', because the PCI DMA 17 - code will not have to flush the CPU's caches. If you have a PCI host 18 - bridge integrated with your SH CPU, refer carefully to the chip specs 19 - to see if you can say 'N' here. Otherwise, leave it as 'Y'.
+7 -13
arch/sh/include/asm/pci.h
··· 57 57 /* pci_unmap_{single,page} being a nop depends upon the 58 58 * configuration. 59 59 */ 60 - #ifdef CONFIG_SH_PCIDMA_NONCOHERENT 61 - #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ 62 - dma_addr_t ADDR_NAME; 63 - #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ 64 - __u32 LEN_NAME; 65 - #define pci_unmap_addr(PTR, ADDR_NAME) \ 66 - ((PTR)->ADDR_NAME) 67 - #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \ 68 - (((PTR)->ADDR_NAME) = (VAL)) 69 - #define pci_unmap_len(PTR, LEN_NAME) \ 70 - ((PTR)->LEN_NAME) 71 - #define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ 72 - (((PTR)->LEN_NAME) = (VAL)) 60 + #ifdef CONFIG_DMA_NONCOHERENT 61 + #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME; 62 + #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME; 63 + #define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME) 64 + #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL)) 65 + #define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME) 66 + #define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL)) 73 67 #else 74 68 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) 75 69 #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
+4
arch/sh/kernel/dma-nommu.c
··· 44 44 return nents; 45 45 } 46 46 47 + #ifdef CONFIG_DMA_NONCOHERENT 47 48 static void nommu_sync_single(struct device *dev, dma_addr_t addr, 48 49 size_t size, enum dma_data_direction dir) 49 50 { ··· 60 59 for_each_sg(sg, s, nelems, i) 61 60 dma_cache_sync(dev, sg_virt(s), s->length, dir); 62 61 } 62 + #endif 63 63 64 64 struct dma_map_ops nommu_dma_ops = { 65 65 .alloc_coherent = dma_generic_alloc_coherent, 66 66 .free_coherent = dma_generic_free_coherent, 67 67 .map_page = nommu_map_page, 68 68 .map_sg = nommu_map_sg, 69 + #ifdef CONFIG_DMA_NONCOHERENT 69 70 .sync_single_for_device = nommu_sync_single, 70 71 .sync_sg_for_device = nommu_sync_sg, 72 + #endif 71 73 .is_phys = 1, 72 74 }; 73 75