All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mmc: sdhci: Fix issue with uninitialized dma_slave_config
@ 2021-08-10  8:16 Tony Lindgren
  2021-08-10  8:16 ` [PATCH 2/3] mmc: dw_mmc: " Tony Lindgren
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Tony Lindgren @ 2021-08-10  8:16 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Adrian Hunter, Chunyan Zhang, Faiz Abbas,
	Peter Ujfalusi, Vinod Koul

Depending on the DMA driver being used, the struct dma_slave_config may
need to be initialized to zero for the unused data.

For example, we have three DMA drivers using src_port_window_size and
dst_port_window_size. If these are left uninitialized, it can cause DMA
failures at least if external TI SDMA is ever configured for sdhci.

For other external DMA cases, this is probably not currently an issue but
is still good to fix though.

Fixes: 18e762e3b7a7 ("mmc: sdhci: add support for using external DMA devices")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Chunyan Zhang <zhang.chunyan@linaro.org>
Cc: Faiz Abbas <faiz_abbas@ti.com>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Cc: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/sdhci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1222,6 +1222,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
 	if (!host->mapbase)
 		return -EINVAL;
 
+	memset(&cfg, 0, sizeof(cfg));
 	cfg.src_addr = host->mapbase + SDHCI_BUFFER;
 	cfg.dst_addr = host->mapbase + SDHCI_BUFFER;
 	cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
-- 
2.32.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] mmc: dw_mmc: Fix issue with uninitialized dma_slave_config
  2021-08-10  8:16 [PATCH 1/3] mmc: sdhci: Fix issue with uninitialized dma_slave_config Tony Lindgren
@ 2021-08-10  8:16 ` Tony Lindgren
  2021-08-16 13:59   ` Ulf Hansson
  2021-08-10  8:16 ` [PATCH 3/3] mmc: moxart: " Tony Lindgren
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2021-08-10  8:16 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Shawn Lin, Jaehoon Chung, Peter Ujfalusi, Vinod Koul

Depending on the DMA driver being used, the struct dma_slave_config may
need to be initialized to zero for the unused data.

For example, we have three DMA drivers using src_port_window_size and
dst_port_window_size. If these are left uninitialized, it can cause DMA
failures.

For dw_mmc, this is probably not currently an issue but is still good to
fix though.

Fixes: 3fc7eaef44db ("mmc: dw_mmc: Add external dma interface support")
Cc: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Cc: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/dw_mmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -782,6 +782,7 @@ static int dw_mci_edmac_start_dma(struct dw_mci *host,
 	int ret = 0;
 
 	/* Set external dma config: burst size, burst width */
+	memset(&cfg, 0, sizeof(cfg));
 	cfg.dst_addr = host->phy_regs + fifo_offset;
 	cfg.src_addr = cfg.dst_addr;
 	cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
-- 
2.32.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] mmc: moxart: Fix issue with uninitialized dma_slave_config
  2021-08-10  8:16 [PATCH 1/3] mmc: sdhci: Fix issue with uninitialized dma_slave_config Tony Lindgren
  2021-08-10  8:16 ` [PATCH 2/3] mmc: dw_mmc: " Tony Lindgren
@ 2021-08-10  8:16 ` Tony Lindgren
  2021-08-16 13:59   ` Ulf Hansson
  2021-08-10  8:24 ` [PATCH 1/3] mmc: sdhci: " Adrian Hunter
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2021-08-10  8:16 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jonas Jensen, Vinod Koul, Peter Ujfalusi

Depending on the DMA driver being used, the struct dma_slave_config may
need to be initialized to zero for the unused data.

For example, we have three DMA drivers using src_port_window_size and
dst_port_window_size. If these are left uninitialized, it can cause DMA
failures.

For moxart, this is probably not currently an issue but is still good to
fix though.

Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver")
Cc: Jonas Jensen <jonas.jensen@gmail.com>
Cc: Vinod Koul <vkoul@kernel.org>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/mmc/host/moxart-mmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
--- a/drivers/mmc/host/moxart-mmc.c
+++ b/drivers/mmc/host/moxart-mmc.c
@@ -628,6 +628,7 @@ static int moxart_probe(struct platform_device *pdev)
 			 host->dma_chan_tx, host->dma_chan_rx);
 		host->have_dma = true;
 
+		memset(&cfg, 0, sizeof(cfg));
 		cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 		cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
 
-- 
2.32.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] mmc: sdhci: Fix issue with uninitialized dma_slave_config
  2021-08-10  8:16 [PATCH 1/3] mmc: sdhci: Fix issue with uninitialized dma_slave_config Tony Lindgren
  2021-08-10  8:16 ` [PATCH 2/3] mmc: dw_mmc: " Tony Lindgren
  2021-08-10  8:16 ` [PATCH 3/3] mmc: moxart: " Tony Lindgren
@ 2021-08-10  8:24 ` Adrian Hunter
  2021-08-10  8:31 ` Péter Ujfalusi
  2021-08-16 13:59 ` Ulf Hansson
  4 siblings, 0 replies; 8+ messages in thread
From: Adrian Hunter @ 2021-08-10  8:24 UTC (permalink / raw)
  To: Tony Lindgren, Ulf Hansson
  Cc: linux-mmc, Chunyan Zhang, Faiz Abbas, Peter Ujfalusi, Vinod Koul

On 10/08/21 11:16 am, Tony Lindgren wrote:
> Depending on the DMA driver being used, the struct dma_slave_config may
> need to be initialized to zero for the unused data.
> 
> For example, we have three DMA drivers using src_port_window_size and
> dst_port_window_size. If these are left uninitialized, it can cause DMA
> failures at least if external TI SDMA is ever configured for sdhci.
> 
> For other external DMA cases, this is probably not currently an issue but
> is still good to fix though.
> 
> Fixes: 18e762e3b7a7 ("mmc: sdhci: add support for using external DMA devices")
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Chunyan Zhang <zhang.chunyan@linaro.org>
> Cc: Faiz Abbas <faiz_abbas@ti.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
> Cc: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1222,6 +1222,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
>  	if (!host->mapbase)
>  		return -EINVAL;
>  
> +	memset(&cfg, 0, sizeof(cfg));
>  	cfg.src_addr = host->mapbase + SDHCI_BUFFER;
>  	cfg.dst_addr = host->mapbase + SDHCI_BUFFER;
>  	cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] mmc: sdhci: Fix issue with uninitialized dma_slave_config
  2021-08-10  8:16 [PATCH 1/3] mmc: sdhci: Fix issue with uninitialized dma_slave_config Tony Lindgren
                   ` (2 preceding siblings ...)
  2021-08-10  8:24 ` [PATCH 1/3] mmc: sdhci: " Adrian Hunter
@ 2021-08-10  8:31 ` Péter Ujfalusi
  2021-08-16 13:59 ` Ulf Hansson
  4 siblings, 0 replies; 8+ messages in thread
From: Péter Ujfalusi @ 2021-08-10  8:31 UTC (permalink / raw)
  To: Tony Lindgren, Ulf Hansson
  Cc: linux-mmc, Adrian Hunter, Chunyan Zhang, Faiz Abbas, Vinod Koul



On 10/08/2021 11:16, Tony Lindgren wrote:
> Depending on the DMA driver being used, the struct dma_slave_config may
> need to be initialized to zero for the unused data.
> 
> For example, we have three DMA drivers using src_port_window_size and
> dst_port_window_size. If these are left uninitialized, it can cause DMA
> failures at least if external TI SDMA is ever configured for sdhci.
> 
> For other external DMA cases, this is probably not currently an issue but
> is still good to fix though.

Reviewed-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>

> Fixes: 18e762e3b7a7 ("mmc: sdhci: add support for using external DMA devices")
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Chunyan Zhang <zhang.chunyan@linaro.org>
> Cc: Faiz Abbas <faiz_abbas@ti.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
> Cc: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/mmc/host/sdhci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1222,6 +1222,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
>  	if (!host->mapbase)
>  		return -EINVAL;
>  
> +	memset(&cfg, 0, sizeof(cfg));
>  	cfg.src_addr = host->mapbase + SDHCI_BUFFER;
>  	cfg.dst_addr = host->mapbase + SDHCI_BUFFER;
>  	cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> 

-- 
Péter

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] mmc: sdhci: Fix issue with uninitialized dma_slave_config
  2021-08-10  8:16 [PATCH 1/3] mmc: sdhci: Fix issue with uninitialized dma_slave_config Tony Lindgren
                   ` (3 preceding siblings ...)
  2021-08-10  8:31 ` Péter Ujfalusi
@ 2021-08-16 13:59 ` Ulf Hansson
  4 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2021-08-16 13:59 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-mmc, Adrian Hunter, Chunyan Zhang, Faiz Abbas,
	Peter Ujfalusi, Vinod Koul

On Tue, 10 Aug 2021 at 10:16, Tony Lindgren <tony@atomide.com> wrote:
>
> Depending on the DMA driver being used, the struct dma_slave_config may
> need to be initialized to zero for the unused data.
>
> For example, we have three DMA drivers using src_port_window_size and
> dst_port_window_size. If these are left uninitialized, it can cause DMA
> failures at least if external TI SDMA is ever configured for sdhci.
>
> For other external DMA cases, this is probably not currently an issue but
> is still good to fix though.
>
> Fixes: 18e762e3b7a7 ("mmc: sdhci: add support for using external DMA devices")
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Chunyan Zhang <zhang.chunyan@linaro.org>
> Cc: Faiz Abbas <faiz_abbas@ti.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
> Cc: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1222,6 +1222,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
>         if (!host->mapbase)
>                 return -EINVAL;
>
> +       memset(&cfg, 0, sizeof(cfg));
>         cfg.src_addr = host->mapbase + SDHCI_BUFFER;
>         cfg.dst_addr = host->mapbase + SDHCI_BUFFER;
>         cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> --
> 2.32.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] mmc: dw_mmc: Fix issue with uninitialized dma_slave_config
  2021-08-10  8:16 ` [PATCH 2/3] mmc: dw_mmc: " Tony Lindgren
@ 2021-08-16 13:59   ` Ulf Hansson
  0 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2021-08-16 13:59 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-mmc, Shawn Lin, Jaehoon Chung, Peter Ujfalusi, Vinod Koul

On Tue, 10 Aug 2021 at 10:16, Tony Lindgren <tony@atomide.com> wrote:
>
> Depending on the DMA driver being used, the struct dma_slave_config may
> need to be initialized to zero for the unused data.
>
> For example, we have three DMA drivers using src_port_window_size and
> dst_port_window_size. If these are left uninitialized, it can cause DMA
> failures.
>
> For dw_mmc, this is probably not currently an issue but is still good to
> fix though.
>
> Fixes: 3fc7eaef44db ("mmc: dw_mmc: Add external dma interface support")
> Cc: Shawn Lin <shawn.lin@rock-chips.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
> Cc: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/dw_mmc.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -782,6 +782,7 @@ static int dw_mci_edmac_start_dma(struct dw_mci *host,
>         int ret = 0;
>
>         /* Set external dma config: burst size, burst width */
> +       memset(&cfg, 0, sizeof(cfg));
>         cfg.dst_addr = host->phy_regs + fifo_offset;
>         cfg.src_addr = cfg.dst_addr;
>         cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
> --
> 2.32.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] mmc: moxart: Fix issue with uninitialized dma_slave_config
  2021-08-10  8:16 ` [PATCH 3/3] mmc: moxart: " Tony Lindgren
@ 2021-08-16 13:59   ` Ulf Hansson
  0 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2021-08-16 13:59 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-mmc, Jonas Jensen, Vinod Koul, Peter Ujfalusi

On Tue, 10 Aug 2021 at 10:16, Tony Lindgren <tony@atomide.com> wrote:
>
> Depending on the DMA driver being used, the struct dma_slave_config may
> need to be initialized to zero for the unused data.
>
> For example, we have three DMA drivers using src_port_window_size and
> dst_port_window_size. If these are left uninitialized, it can cause DMA
> failures.
>
> For moxart, this is probably not currently an issue but is still good to
> fix though.
>
> Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver")
> Cc: Jonas Jensen <jonas.jensen@gmail.com>
> Cc: Vinod Koul <vkoul@kernel.org>
> Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/moxart-mmc.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
> --- a/drivers/mmc/host/moxart-mmc.c
> +++ b/drivers/mmc/host/moxart-mmc.c
> @@ -628,6 +628,7 @@ static int moxart_probe(struct platform_device *pdev)
>                          host->dma_chan_tx, host->dma_chan_rx);
>                 host->have_dma = true;
>
> +               memset(&cfg, 0, sizeof(cfg));
>                 cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
>                 cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
>
> --
> 2.32.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-16 14:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10  8:16 [PATCH 1/3] mmc: sdhci: Fix issue with uninitialized dma_slave_config Tony Lindgren
2021-08-10  8:16 ` [PATCH 2/3] mmc: dw_mmc: " Tony Lindgren
2021-08-16 13:59   ` Ulf Hansson
2021-08-10  8:16 ` [PATCH 3/3] mmc: moxart: " Tony Lindgren
2021-08-16 13:59   ` Ulf Hansson
2021-08-10  8:24 ` [PATCH 1/3] mmc: sdhci: " Adrian Hunter
2021-08-10  8:31 ` Péter Ujfalusi
2021-08-16 13:59 ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.