010-arm_introduce-dma-fiq-irq-broadcast.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. --- a/arch/arm/include/asm/glue-cache.h
  2. +++ b/arch/arm/include/asm/glue-cache.h
  3. @@ -156,9 +156,15 @@ static inline void nop_dma_unmap_area(co
  4. #define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range)
  5. #define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range)
  6. #define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
  7. -#define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area)
  8. -#define dmac_flush_range __glue(_CACHE,_dma_flush_range)
  9. +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
  10. +# define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area)
  11. +# define dmac_flush_range __glue(_CACHE,_dma_flush_range)
  12. +#else
  13. +# define __cpuc_flush_dcache_area __glue(fiq,_flush_kern_dcache_area)
  14. +# define dmac_flush_range __glue(fiq,_dma_flush_range)
  15. +#endif
  16. +
  17. #endif
  18. #endif
  19. --- a/arch/arm/mm/Kconfig
  20. +++ b/arch/arm/mm/Kconfig
  21. @@ -866,6 +866,17 @@ config DMA_CACHE_RWFO
  22. in hardware, other workarounds are needed (e.g. cache
  23. maintenance broadcasting in software via FIQ).
  24. +config DMA_CACHE_FIQ_BROADCAST
  25. + bool "Enable fiq broadcast DMA cache maintenance"
  26. + depends on CPU_V6K && SMP
  27. + select FIQ
  28. + help
  29. + The Snoop Control Unit on ARM11MPCore does not detect the
  30. + cache maintenance operations and the dma_{map,unmap}_area()
  31. + functions may leave stale cache entries on other CPUs. By
  32. + enabling this option, fiq broadcast in the ARMv6
  33. + DMA cache maintenance functions is performed.
  34. +
  35. config OUTER_CACHE
  36. bool
  37. --- a/arch/arm/mm/flush.c
  38. +++ b/arch/arm/mm/flush.c
  39. @@ -319,6 +319,7 @@ void __sync_icache_dcache(pte_t pteval)
  40. void flush_dcache_page(struct page *page)
  41. {
  42. struct address_space *mapping;
  43. + bool skip_broadcast = true;
  44. /*
  45. * The zero page is never written to, so never has any dirty
  46. @@ -329,7 +330,10 @@ void flush_dcache_page(struct page *page
  47. mapping = page_mapping(page);
  48. - if (!cache_ops_need_broadcast() &&
  49. +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
  50. + skip_broadcast = !cache_ops_need_broadcast();
  51. +#endif
  52. + if (skip_broadcast &&
  53. mapping && !page_mapped(page))
  54. clear_bit(PG_dcache_clean, &page->flags);
  55. else {
  56. --- a/arch/arm/mm/dma.h
  57. +++ b/arch/arm/mm/dma.h
  58. @@ -4,8 +4,13 @@
  59. #include <asm/glue-cache.h>
  60. #ifndef MULTI_CACHE
  61. -#define dmac_map_area __glue(_CACHE,_dma_map_area)
  62. -#define dmac_unmap_area __glue(_CACHE,_dma_unmap_area)
  63. +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
  64. +# define dmac_map_area __glue(_CACHE,_dma_map_area)
  65. +# define dmac_unmap_area __glue(_CACHE,_dma_unmap_area)
  66. +#else
  67. +# define dmac_map_area __glue(fiq,_dma_map_area)
  68. +# define dmac_unmap_area __glue(fiq,_dma_unmap_area)
  69. +#endif
  70. /*
  71. * These are private to the dma-mapping API. Do not use directly.