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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --- a/arch/arm/include/asm/glue-cache.h
  2. +++ b/arch/arm/include/asm/glue-cache.h
  3. @@ -156,11 +156,19 @@ 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. +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
  8. #define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area)
  9. #define dmac_map_area __glue(_CACHE,_dma_map_area)
  10. #define dmac_unmap_area __glue(_CACHE,_dma_unmap_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. +
  15. +#define dmac_map_area __glue(fiq,_dma_map_area)
  16. +#define dmac_unmap_area __glue(fiq,_dma_unmap_area)
  17. +#define dmac_flush_range __glue(fiq,_dma_flush_range)
  18. +#endif /* CONFIG_DMA_CACHE_FIQ_BROADCAST */
  19. #endif
  20. #endif
  21. --- a/arch/arm/mm/Kconfig
  22. +++ b/arch/arm/mm/Kconfig
  23. @@ -844,6 +844,17 @@ config DMA_CACHE_RWFO
  24. in hardware, other workarounds are needed (e.g. cache
  25. maintenance broadcasting in software via FIQ).
  26. +config DMA_CACHE_FIQ_BROADCAST
  27. + bool "Enable fiq broadcast DMA cache maintenance"
  28. + depends on CPU_V6K && SMP
  29. + select FIQ
  30. + help
  31. + The Snoop Control Unit on ARM11MPCore does not detect the
  32. + cache maintenance operations and the dma_{map,unmap}_area()
  33. + functions may leave stale cache entries on other CPUs. By
  34. + enabling this option, fiq broadcast in the ARMv6
  35. + DMA cache maintenance functions is performed.
  36. +
  37. config OUTER_CACHE
  38. bool
  39. --- a/arch/arm/mm/flush.c
  40. +++ b/arch/arm/mm/flush.c
  41. @@ -304,6 +304,7 @@ void __sync_icache_dcache(pte_t pteval)
  42. void flush_dcache_page(struct page *page)
  43. {
  44. struct address_space *mapping;
  45. + bool skip_broadcast = true;
  46. /*
  47. * The zero page is never written to, so never has any dirty
  48. @@ -314,7 +315,10 @@ void flush_dcache_page(struct page *page
  49. mapping = page_mapping(page);
  50. - if (!cache_ops_need_broadcast() &&
  51. +#ifndef CONFIG_DMA_CACHE_FIQ_BROADCAST
  52. + skip_broadcast = !cache_ops_need_broadcast();
  53. +#endif
  54. + if (skip_broadcast &&
  55. mapping && !page_mapped(page))
  56. clear_bit(PG_dcache_clean, &page->flags);
  57. else {