* [PATCH] mmc: tmio: Use dma_max_mapping_size() instead of a workaround
@ 2019-06-19 4:55 Yoshihiro Shimoda
2019-06-19 8:07 ` Geert Uytterhoeven
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2019-06-19 4:55 UTC (permalink / raw)
To: ulf.hansson, wsa+renesas
Cc: hch, linux-mmc, linux-renesas-soc, Yoshihiro Shimoda
Since the commit 133d624b1cee ("dma: Introduce dma_max_mapping_size()")
provides a helper function to get the max mapping size, we can use
the function instead of the workaround code for swiotlb.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
This patch is from other patch series [1]. Since this patch can be
applied right now because this patch is independent with other subsystems
on the patch series.
[1]
https://patchwork.kernel.org/patch/10992401/
Changes from the [1] above:
- Use size_t instead of "unsigned int" on min_t.
- Remove #include directive of swiotlb.h.
- Add Acked-by and Reviewed-by.
drivers/mmc/host/tmio_mmc_core.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 83fd943..2cb3f95 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -26,6 +26,7 @@
#include <linux/delay.h>
#include <linux/device.h>
+#include <linux/dma-mapping.h>
#include <linux/highmem.h>
#include <linux/interrupt.h>
#include <linux/io.h>
@@ -45,7 +46,6 @@
#include <linux/scatterlist.h>
#include <linux/sizes.h>
#include <linux/spinlock.h>
-#include <linux/swiotlb.h>
#include <linux/workqueue.h>
#include "tmio_mmc.h"
@@ -1199,19 +1199,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
mmc->max_blk_size = TMIO_MAX_BLK_SIZE;
mmc->max_blk_count = pdata->max_blk_count ? :
(PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs;
- mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
- /*
- * Since swiotlb has memory size limitation, this will calculate
- * the maximum size locally (because we don't have any APIs for it now)
- * and check the current max_req_size. And then, this will update
- * the max_req_size if needed as a workaround.
- */
- if (swiotlb_max_segment()) {
- unsigned int max_size = (1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE;
-
- if (mmc->max_req_size > max_size)
- mmc->max_req_size = max_size;
- }
+ mmc->max_req_size = min_t(size_t,
+ mmc->max_blk_size * mmc->max_blk_count,
+ dma_max_mapping_size(&pdev->dev));
mmc->max_seg_size = mmc->max_req_size;
if (mmc_can_gpio_ro(mmc))
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: tmio: Use dma_max_mapping_size() instead of a workaround
2019-06-19 4:55 [PATCH] mmc: tmio: Use dma_max_mapping_size() instead of a workaround Yoshihiro Shimoda
@ 2019-06-19 8:07 ` Geert Uytterhoeven
2019-06-19 12:15 ` Simon Horman
2019-06-20 13:43 ` Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2019-06-19 8:07 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: Ulf Hansson, Wolfram Sang, Christoph Hellwig, Linux MMC List,
Linux-Renesas
On Wed, Jun 19, 2019 at 6:56 AM Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> Since the commit 133d624b1cee ("dma: Introduce dma_max_mapping_size()")
> provides a helper function to get the max mapping size, we can use
> the function instead of the workaround code for swiotlb.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: tmio: Use dma_max_mapping_size() instead of a workaround
2019-06-19 4:55 [PATCH] mmc: tmio: Use dma_max_mapping_size() instead of a workaround Yoshihiro Shimoda
2019-06-19 8:07 ` Geert Uytterhoeven
@ 2019-06-19 12:15 ` Simon Horman
2019-06-20 13:43 ` Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2019-06-19 12:15 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: ulf.hansson, wsa+renesas, hch, linux-mmc, linux-renesas-soc
On Wed, Jun 19, 2019 at 01:55:30PM +0900, Yoshihiro Shimoda wrote:
> Since the commit 133d624b1cee ("dma: Introduce dma_max_mapping_size()")
> provides a helper function to get the max mapping size, we can use
> the function instead of the workaround code for swiotlb.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: tmio: Use dma_max_mapping_size() instead of a workaround
2019-06-19 4:55 [PATCH] mmc: tmio: Use dma_max_mapping_size() instead of a workaround Yoshihiro Shimoda
2019-06-19 8:07 ` Geert Uytterhoeven
2019-06-19 12:15 ` Simon Horman
@ 2019-06-20 13:43 ` Ulf Hansson
2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2019-06-20 13:43 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: Wolfram Sang, Christoph Hellwig, linux-mmc, Linux-Renesas
On Wed, 19 Jun 2019 at 06:55, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
>
> Since the commit 133d624b1cee ("dma: Introduce dma_max_mapping_size()")
> provides a helper function to get the max mapping size, we can use
> the function instead of the workaround code for swiotlb.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Applied for next, thanks!
Kind regards
Uffe
> ---
> This patch is from other patch series [1]. Since this patch can be
> applied right now because this patch is independent with other subsystems
> on the patch series.
>
> [1]
> https://patchwork.kernel.org/patch/10992401/
>
> Changes from the [1] above:
> - Use size_t instead of "unsigned int" on min_t.
> - Remove #include directive of swiotlb.h.
> - Add Acked-by and Reviewed-by.
>
> drivers/mmc/host/tmio_mmc_core.c | 18 ++++--------------
> 1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index 83fd943..2cb3f95 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -26,6 +26,7 @@
>
> #include <linux/delay.h>
> #include <linux/device.h>
> +#include <linux/dma-mapping.h>
> #include <linux/highmem.h>
> #include <linux/interrupt.h>
> #include <linux/io.h>
> @@ -45,7 +46,6 @@
> #include <linux/scatterlist.h>
> #include <linux/sizes.h>
> #include <linux/spinlock.h>
> -#include <linux/swiotlb.h>
> #include <linux/workqueue.h>
>
> #include "tmio_mmc.h"
> @@ -1199,19 +1199,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
> mmc->max_blk_size = TMIO_MAX_BLK_SIZE;
> mmc->max_blk_count = pdata->max_blk_count ? :
> (PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs;
> - mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
> - /*
> - * Since swiotlb has memory size limitation, this will calculate
> - * the maximum size locally (because we don't have any APIs for it now)
> - * and check the current max_req_size. And then, this will update
> - * the max_req_size if needed as a workaround.
> - */
> - if (swiotlb_max_segment()) {
> - unsigned int max_size = (1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE;
> -
> - if (mmc->max_req_size > max_size)
> - mmc->max_req_size = max_size;
> - }
> + mmc->max_req_size = min_t(size_t,
> + mmc->max_blk_size * mmc->max_blk_count,
> + dma_max_mapping_size(&pdev->dev));
> mmc->max_seg_size = mmc->max_req_size;
>
> if (mmc_can_gpio_ro(mmc))
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-20 13:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-19 4:55 [PATCH] mmc: tmio: Use dma_max_mapping_size() instead of a workaround Yoshihiro Shimoda
2019-06-19 8:07 ` Geert Uytterhoeven
2019-06-19 12:15 ` Simon Horman
2019-06-20 13:43 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).