mbox series

[0/9] mmc: sdhci: code clean-up and fix cache coherency problem.

Message ID 20200204110906.9377-1-yamada.masahiro@socionext.com
Headers show
Series mmc: sdhci: code clean-up and fix cache coherency problem. | expand

Message

Masahiro Yamada Feb. 4, 2020, 11:08 a.m. UTC
My main motivation of this series is the last patch
"mmc: sdhci: fix missing cache invalidation after reading by DMA".

Currently, read data are occasionally corrupted due to the
missing cache invalidation.

To fix it nicely (adds dma_unmap_single(), which follows the
Linux coding style), I did some cleaups first.

Patch 01 and 02 fix the prototypes of dma_{map,unmap}_single().

Patch 03-08 are code clean-ups.

Patch 09 fixes the bug.



Masahiro Yamada (9):
  dma-mapping: fix the prototype of dma_map_single()
  dma-mapping: fix the prototype of dma_unmap_single()
  mmc: sdhci: put the aligned buffer pointer to struct sdhci_host
  mmc: sdhci: reduce code duplication for aligned buffer
  mmc: sdhci: use lower_32_bit2() and upper_32_bits() for setting
    adma_addr
  mmc: sdhci: remove unneeded casts
  mmc: add mmc_get_dma_dir() helper
  mmc: sdhci: use dma_map_single() instead of flush_cache() before DMA
  mmc: sdhci: fix missing cache invalidation after reading by DMA

 arch/arm/include/asm/dma-mapping.h   |  9 ++-
 arch/nds32/include/asm/dma-mapping.h |  9 ++-
 arch/riscv/include/asm/dma-mapping.h |  9 ++-
 arch/x86/include/asm/dma-mapping.h   |  9 ++-
 drivers/mmc/sdhci.c                  | 96 +++++++++++++---------------
 drivers/mmc/tmio-common.c            |  2 +-
 drivers/mtd/nand/raw/denali.c        |  2 +-
 drivers/net/macb.c                   |  2 +-
 drivers/usb/dwc3/core.c              |  6 +-
 drivers/usb/gadget/udc/udc-core.c    |  2 +-
 include/mmc.h                        |  6 ++
 include/sdhci.h                      |  3 +
 12 files changed, 78 insertions(+), 77 deletions(-)

Comments

Peng Fan Feb. 14, 2020, 12:50 a.m. UTC | #1
Hi Masahiro,

> Subject: [PATCH 0/9] mmc: sdhci: code clean-up and fix cache coherency
> problem.

CI, build fail, please give a check.

      mips:  +   pic32mzdask
+drivers/mmc/sdhci.c:18:10: fatal error: asm/dma-mapping.h: No such file or directory
+ #include <asm/dma-mapping.h>
+          ^~~~~~~~~~~~~~~~~~~
+compilation terminated.
+make[3]: *** [drivers/mmc/sdhci.o] Error 1
+make[2]: *** [drivers/mmc] Error 2
+make[1]: *** [drivers] Error 2
+make: *** [sub-make] Error 2

Thanks,
Peng.

> 
> 
> My main motivation of this series is the last patch
> "mmc: sdhci: fix missing cache invalidation after reading by DMA".
> 
> Currently, read data are occasionally corrupted due to the missing cache
> invalidation.
> 
> To fix it nicely (adds dma_unmap_single(), which follows the Linux coding
> style), I did some cleaups first.
> 
> Patch 01 and 02 fix the prototypes of dma_{map,unmap}_single().
> 
> Patch 03-08 are code clean-ups.
> 
> Patch 09 fixes the bug.
> 
> 
> 
> Masahiro Yamada (9):
>   dma-mapping: fix the prototype of dma_map_single()
>   dma-mapping: fix the prototype of dma_unmap_single()
>   mmc: sdhci: put the aligned buffer pointer to struct sdhci_host
>   mmc: sdhci: reduce code duplication for aligned buffer
>   mmc: sdhci: use lower_32_bit2() and upper_32_bits() for setting
>     adma_addr
>   mmc: sdhci: remove unneeded casts
>   mmc: add mmc_get_dma_dir() helper
>   mmc: sdhci: use dma_map_single() instead of flush_cache() before DMA
>   mmc: sdhci: fix missing cache invalidation after reading by DMA
> 
>  arch/arm/include/asm/dma-mapping.h   |  9 ++-
>  arch/nds32/include/asm/dma-mapping.h |  9 ++-
> arch/riscv/include/asm/dma-mapping.h |  9 ++-
>  arch/x86/include/asm/dma-mapping.h   |  9 ++-
>  drivers/mmc/sdhci.c                  | 96 +++++++++++++---------------
>  drivers/mmc/tmio-common.c            |  2 +-
>  drivers/mtd/nand/raw/denali.c        |  2 +-
>  drivers/net/macb.c                   |  2 +-
>  drivers/usb/dwc3/core.c              |  6 +-
>  drivers/usb/gadget/udc/udc-core.c    |  2 +-
>  include/mmc.h                        |  6 ++
>  include/sdhci.h                      |  3 +
>  12 files changed, 78 insertions(+), 77 deletions(-)
> 
> --
> 2.17.1
Masahiro Yamada Feb. 14, 2020, 5:29 a.m. UTC | #2
Hi Peng,

On Fri, Feb 14, 2020 at 9:50 AM Peng Fan <peng.fan@nxp.com> wrote:
>
> Hi Masahiro,
>
> > Subject: [PATCH 0/9] mmc: sdhci: code clean-up and fix cache coherency
> > problem.
>
> CI, build fail, please give a check.
>
>       mips:  +   pic32mzdask
> +drivers/mmc/sdhci.c:18:10: fatal error: asm/dma-mapping.h: No such file or directory
> + #include <asm/dma-mapping.h>
> +          ^~~~~~~~~~~~~~~~~~~
> +compilation terminated.
> +make[3]: *** [drivers/mmc/sdhci.o] Error 1
> +make[2]: *** [drivers/mmc] Error 2
> +make[1]: *** [drivers] Error 2
> +make: *** [sub-make] Error 2


Ah, right.

I will fix it soon.

Thanks.