Linux-Renesas-SoC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] mmc: queue: Fix bigger segments usage
@ 2019-09-10  4:02 Yoshihiro Shimoda
  2019-09-10  4:02 ` [PATCH 1/2] " Yoshihiro Shimoda
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2019-09-10  4:02 UTC (permalink / raw)
  To: ulf.hansson, wsa+renesas
  Cc: treding, linux-mmc, linux-renesas-soc, Yoshihiro Shimoda

This patch series is based on the linux-next / next-20190904 tag.
Thierry reported an issue which caused the SDHCI environment [1]
so that I made this patch series to resolve the issue.

[1]
https://patchwork.kernel.org/patch/11137903/

Also, this patch adds the flag to enable the feature on my
environment.

Yoshihiro Shimoda (2):
  mmc: queue: Fix bigger segments usage
  mmc: renesas_sdhi_internal_dmac: Add MMC_CAP2_MERGE_CAPABLE

 drivers/mmc/core/queue.c                      | 8 +++++++-
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 2 +-
 include/linux/mmc/host.h                      | 1 +
 3 files changed, 9 insertions(+), 2 deletions(-)

-- 
2.7.4


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

* [PATCH 1/2] mmc: queue: Fix bigger segments usage
  2019-09-10  4:02 [PATCH 0/2] mmc: queue: Fix bigger segments usage Yoshihiro Shimoda
@ 2019-09-10  4:02 ` " Yoshihiro Shimoda
  2019-09-10  4:02 ` [PATCH 2/2] mmc: renesas_sdhi_internal_dmac: Add MMC_CAP2_MERGE_CAPABLE Yoshihiro Shimoda
  2019-09-11 12:21 ` [PATCH 0/2] mmc: queue: Fix bigger segments usage Ulf Hansson
  2 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2019-09-10  4:02 UTC (permalink / raw)
  To: ulf.hansson, wsa+renesas
  Cc: treding, linux-mmc, linux-renesas-soc, Yoshihiro Shimoda

The commit 38c38cb73223 ("mmc: queue: use bigger segments if DMA MAP
layer can merge the segments") always enables the bugger segments
if DMA MAP layer can merge the segments, but some controllers (SDHCI)
have strictly limitation about the segments size, and then the commit
breaks on the controllers.

To fix the issue, this patch adds a new flag MMC_CAP2_MERGE_CAPABLE
into the struct mmc_host and the bigger segments usage is disabled
as default.

Reported-by: Thierry Reding <treding@nvidia.com>
Fixes: 38c38cb73223 ("mmc: queue: use bigger segments if DMA MAP layer can merge the segments")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/mmc/core/queue.c | 8 +++++++-
 include/linux/mmc/host.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index 1e29b30..9edc086 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -399,6 +399,11 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
 	init_waitqueue_head(&mq->wait);
 }
 
+static inline bool mmc_merge_capable(struct mmc_host *host)
+{
+	return host->caps2 & MMC_CAP2_MERGE_CAPABLE;
+}
+
 /* Set queue depth to get a reasonable value for q->nr_requests */
 #define MMC_QUEUE_DEPTH 64
 
@@ -441,7 +446,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card)
 	 * the host->can_dma_map_merge should be set before to get max_segs
 	 * from mmc_get_max_segments().
 	 */
-	if (host->max_segs < MMC_DMA_MAP_MERGE_SEGMENTS &&
+	if (mmc_merge_capable(host) &&
+	    host->max_segs < MMC_DMA_MAP_MERGE_SEGMENTS &&
 	    dma_get_merge_boundary(mmc_dev(host)))
 		host->can_dma_map_merge = 1;
 	else
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index c5662b3..3becb28 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -367,6 +367,7 @@ struct mmc_host {
 #define MMC_CAP2_CQE		(1 << 23)	/* Has eMMC command queue engine */
 #define MMC_CAP2_CQE_DCMD	(1 << 24)	/* CQE can issue a direct command */
 #define MMC_CAP2_AVOID_3_3V	(1 << 25)	/* Host must negotiate down from 3.3V */
+#define MMC_CAP2_MERGE_CAPABLE	(1 << 26)	/* Host can merge a segment over the segment size */
 
 	int			fixed_drv_type;	/* fixed driver type for non-removable media */
 
-- 
2.7.4


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

* [PATCH 2/2] mmc: renesas_sdhi_internal_dmac: Add MMC_CAP2_MERGE_CAPABLE
  2019-09-10  4:02 [PATCH 0/2] mmc: queue: Fix bigger segments usage Yoshihiro Shimoda
  2019-09-10  4:02 ` [PATCH 1/2] " Yoshihiro Shimoda
@ 2019-09-10  4:02 ` Yoshihiro Shimoda
  2019-09-11 12:21 ` [PATCH 0/2] mmc: queue: Fix bigger segments usage Ulf Hansson
  2 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2019-09-10  4:02 UTC (permalink / raw)
  To: ulf.hansson, wsa+renesas
  Cc: treding, linux-mmc, linux-renesas-soc, Yoshihiro Shimoda

Since this host controller can merge bigger segments if DMA API
layer cam merge the segments, this patch adds the flag.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 751fe91..a66f8d6 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -106,7 +106,7 @@ static const struct renesas_sdhi_of_data of_rcar_gen3_compatible = {
 			  TMIO_MMC_HAVE_CBSY | TMIO_MMC_MIN_RCAR2,
 	.capabilities	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
 			  MMC_CAP_CMD23,
-	.capabilities2	= MMC_CAP2_NO_WRITE_PROTECT,
+	.capabilities2	= MMC_CAP2_NO_WRITE_PROTECT | MMC_CAP2_MERGE_CAPABLE,
 	.bus_shift	= 2,
 	.scc_offset	= 0x1000,
 	.taps		= rcar_gen3_scc_taps,
-- 
2.7.4


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

* Re: [PATCH 0/2] mmc: queue: Fix bigger segments usage
  2019-09-10  4:02 [PATCH 0/2] mmc: queue: Fix bigger segments usage Yoshihiro Shimoda
  2019-09-10  4:02 ` [PATCH 1/2] " Yoshihiro Shimoda
  2019-09-10  4:02 ` [PATCH 2/2] mmc: renesas_sdhi_internal_dmac: Add MMC_CAP2_MERGE_CAPABLE Yoshihiro Shimoda
@ 2019-09-11 12:21 ` Ulf Hansson
  2019-09-12  3:51   ` Yoshihiro Shimoda
  2 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2019-09-11 12:21 UTC (permalink / raw)
  To: Yoshihiro Shimoda, Christoph Hellwig
  Cc: Wolfram Sang, Thierry Reding, linux-mmc, Linux-Renesas

+ Christoph

On Tue, 10 Sep 2019 at 06:03, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
>
> This patch series is based on the linux-next / next-20190904 tag.
> Thierry reported an issue which caused the SDHCI environment [1]
> so that I made this patch series to resolve the issue.
>
> [1]
> https://patchwork.kernel.org/patch/11137903/
>
> Also, this patch adds the flag to enable the feature on my
> environment.
>
> Yoshihiro Shimoda (2):
>   mmc: queue: Fix bigger segments usage
>   mmc: renesas_sdhi_internal_dmac: Add MMC_CAP2_MERGE_CAPABLE
>
>  drivers/mmc/core/queue.c                      | 8 +++++++-
>  drivers/mmc/host/renesas_sdhi_internal_dmac.c | 2 +-
>  include/linux/mmc/host.h                      | 1 +
>  3 files changed, 9 insertions(+), 2 deletions(-)
>
> --
> 2.7.4
>

I can't apply this to my tree, as it depends on the earlier series
which has been queued by Christoph.

That said, you can add my ack for both of the patches and you probably
also need to repost this to Christoph.

Kind regards
Uffe

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

* RE: [PATCH 0/2] mmc: queue: Fix bigger segments usage
  2019-09-11 12:21 ` [PATCH 0/2] mmc: queue: Fix bigger segments usage Ulf Hansson
@ 2019-09-12  3:51   ` Yoshihiro Shimoda
  0 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2019-09-12  3:51 UTC (permalink / raw)
  To: Ulf Hansson, Christoph Hellwig
  Cc: Wolfram Sang, Thierry Reding, linux-mmc, Linux-Renesas

Hi Ulf,

> From: Ulf Hansson, Sent: Wednesday, September 11, 2019 9:21 PM
> 
> + Christoph
> 
> On Tue, 10 Sep 2019 at 06:03, Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@renesas.com> wrote:
> >
> > This patch series is based on the linux-next / next-20190904 tag.
> > Thierry reported an issue which caused the SDHCI environment [1]
> > so that I made this patch series to resolve the issue.
> >
> > [1]
> > https://patchwork.kernel.org/patch/11137903/
> >
> > Also, this patch adds the flag to enable the feature on my
> > environment.
> >
> > Yoshihiro Shimoda (2):
> >   mmc: queue: Fix bigger segments usage
> >   mmc: renesas_sdhi_internal_dmac: Add MMC_CAP2_MERGE_CAPABLE
> >
> >  drivers/mmc/core/queue.c                      | 8 +++++++-
> >  drivers/mmc/host/renesas_sdhi_internal_dmac.c | 2 +-
> >  include/linux/mmc/host.h                      | 1 +
> >  3 files changed, 9 insertions(+), 2 deletions(-)
> >
> > --
> > 2.7.4
> >
> 
> I can't apply this to my tree, as it depends on the earlier series
> which has been queued by Christoph.
> 
> That said, you can add my ack for both of the patches and you probably
> also need to repost this to Christoph.

Thank you for your review and your ack! As you said, I should have included
Christoph's email account when I have submitted this patch series...

Christoph, I'll repost this patch series to you. This is a "temporary band-aid"
patch series as you said on the other email thread [1] :)

I'm not sure whether my suggested solution for sdhci [2] is succeeded or not, but,
anyway I believe we can have both solutions (I means this patch series and the [2])
if needed.

[1] https://patchwork.kernel.org/patch/11137903/#22876339
[2] https://patchwork.kernel.org/patch/11137903/#22875885

Best regards,
Yoshihiro Shimoda

> Kind regards
> Uffe


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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10  4:02 [PATCH 0/2] mmc: queue: Fix bigger segments usage Yoshihiro Shimoda
2019-09-10  4:02 ` [PATCH 1/2] " Yoshihiro Shimoda
2019-09-10  4:02 ` [PATCH 2/2] mmc: renesas_sdhi_internal_dmac: Add MMC_CAP2_MERGE_CAPABLE Yoshihiro Shimoda
2019-09-11 12:21 ` [PATCH 0/2] mmc: queue: Fix bigger segments usage Ulf Hansson
2019-09-12  3:51   ` Yoshihiro Shimoda

Linux-Renesas-SoC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-renesas-soc/0 linux-renesas-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-renesas-soc linux-renesas-soc/ https://lore.kernel.org/linux-renesas-soc \
		linux-renesas-soc@vger.kernel.org linux-renesas-soc@archiver.kernel.org
	public-inbox-index linux-renesas-soc


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-renesas-soc


AGPL code for this site: git clone https://public-inbox.org/ public-inbox