All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sdhci: stop poking into swiotlb internals
@ 2021-02-05 16:23 Christoph Hellwig
  2021-02-05 18:43 ` Adrian Hunter
  2021-02-17 13:59 ` Adrian Hunter
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-02-05 16:23 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson; +Cc: linux-mmc

Use the proper API to query the max mapping size instead of guessing
it based on swiotlb internals.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/mmc/host/sdhci.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 646823ddd31715..2d73407ee52ec7 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -20,7 +20,6 @@
 #include <linux/slab.h>
 #include <linux/scatterlist.h>
 #include <linux/sizes.h>
-#include <linux/swiotlb.h>
 #include <linux/regulator/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
@@ -4582,12 +4581,8 @@ int sdhci_setup_host(struct sdhci_host *host)
 		mmc->max_segs = SDHCI_MAX_SEGS;
 	} else if (host->flags & SDHCI_USE_SDMA) {
 		mmc->max_segs = 1;
-		if (swiotlb_max_segment()) {
-			unsigned int max_req_size = (1 << IO_TLB_SHIFT) *
-						IO_TLB_SEGSIZE;
-			mmc->max_req_size = min(mmc->max_req_size,
-						max_req_size);
-		}
+		mmc->max_req_size = min_t(size_t, mmc->max_req_size,
+					  dma_max_mapping_size(mmc_dev(mmc)));
 	} else { /* PIO */
 		mmc->max_segs = SDHCI_MAX_SEGS;
 	}
-- 
2.29.2


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

* Re: [PATCH] sdhci: stop poking into swiotlb internals
  2021-02-05 16:23 [PATCH] sdhci: stop poking into swiotlb internals Christoph Hellwig
@ 2021-02-05 18:43 ` Adrian Hunter
  2021-02-17 12:10   ` Jiri Slaby
  2021-02-17 13:59 ` Adrian Hunter
  1 sibling, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2021-02-05 18:43 UTC (permalink / raw)
  To: Christoph Hellwig, ulf.hansson; +Cc: linux-mmc, Jiri Slaby

+ Jiri Slaby <jslaby@suse.cz>

On 5/02/21 6:23 pm, Christoph Hellwig wrote:
> Use the proper API to query the max mapping size instead of guessing
> it based on swiotlb internals.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/mmc/host/sdhci.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 646823ddd31715..2d73407ee52ec7 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -20,7 +20,6 @@
>  #include <linux/slab.h>
>  #include <linux/scatterlist.h>
>  #include <linux/sizes.h>
> -#include <linux/swiotlb.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/of.h>
> @@ -4582,12 +4581,8 @@ int sdhci_setup_host(struct sdhci_host *host)
>  		mmc->max_segs = SDHCI_MAX_SEGS;
>  	} else if (host->flags & SDHCI_USE_SDMA) {
>  		mmc->max_segs = 1;
> -		if (swiotlb_max_segment()) {
> -			unsigned int max_req_size = (1 << IO_TLB_SHIFT) *
> -						IO_TLB_SEGSIZE;
> -			mmc->max_req_size = min(mmc->max_req_size,
> -						max_req_size);
> -		}
> +		mmc->max_req_size = min_t(size_t, mmc->max_req_size,
> +					  dma_max_mapping_size(mmc_dev(mmc)));
>  	} else { /* PIO */
>  		mmc->max_segs = SDHCI_MAX_SEGS;
>  	}
> 


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

* Re: [PATCH] sdhci: stop poking into swiotlb internals
  2021-02-05 18:43 ` Adrian Hunter
@ 2021-02-17 12:10   ` Jiri Slaby
  2021-02-17 13:39     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2021-02-17 12:10 UTC (permalink / raw)
  To: Adrian Hunter, Christoph Hellwig, ulf.hansson; +Cc: linux-mmc

On 05. 02. 21, 19:43, Adrian Hunter wrote:
> + Jiri Slaby <jslaby@suse.cz>
> 
> On 5/02/21 6:23 pm, Christoph Hellwig wrote:
>> Use the proper API to query the max mapping size instead of guessing
>> it based on swiotlb internals.
>>
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>> ---
>>   drivers/mmc/host/sdhci.c | 9 ++-------
>>   1 file changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> index 646823ddd31715..2d73407ee52ec7 100644
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
>> @@ -20,7 +20,6 @@
>>   #include <linux/slab.h>
>>   #include <linux/scatterlist.h>
>>   #include <linux/sizes.h>
>> -#include <linux/swiotlb.h>
>>   #include <linux/regulator/consumer.h>
>>   #include <linux/pm_runtime.h>
>>   #include <linux/of.h>
>> @@ -4582,12 +4581,8 @@ int sdhci_setup_host(struct sdhci_host *host)
>>   		mmc->max_segs = SDHCI_MAX_SEGS;
>>   	} else if (host->flags & SDHCI_USE_SDMA) {
>>   		mmc->max_segs = 1;
>> -		if (swiotlb_max_segment()) {
>> -			unsigned int max_req_size = (1 << IO_TLB_SHIFT) *
>> -						IO_TLB_SEGSIZE;
>> -			mmc->max_req_size = min(mmc->max_req_size,
>> -						max_req_size);
>> -		}
>> +		mmc->max_req_size = min_t(size_t, mmc->max_req_size,
>> +					  dma_max_mapping_size(mmc_dev(mmc)));

dma_max_mapping_size() should return the same for swiotlb 
(swiotlb_max_mapping_size()), right?

I don't have the laptop, it was ThinkPad X230 if anyone wants to test 
this...

thanks,
-- 
js
suse labs

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

* Re: [PATCH] sdhci: stop poking into swiotlb internals
  2021-02-17 12:10   ` Jiri Slaby
@ 2021-02-17 13:39     ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-02-17 13:39 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Adrian Hunter, Christoph Hellwig, ulf.hansson, linux-mmc

On Wed, Feb 17, 2021 at 01:10:48PM +0100, Jiri Slaby wrote:
> dma_max_mapping_size() should return the same for swiotlb 
> (swiotlb_max_mapping_size()), right?

Yes.

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

* Re: [PATCH] sdhci: stop poking into swiotlb internals
  2021-02-05 16:23 [PATCH] sdhci: stop poking into swiotlb internals Christoph Hellwig
  2021-02-05 18:43 ` Adrian Hunter
@ 2021-02-17 13:59 ` Adrian Hunter
  1 sibling, 0 replies; 5+ messages in thread
From: Adrian Hunter @ 2021-02-17 13:59 UTC (permalink / raw)
  To: Christoph Hellwig, ulf.hansson; +Cc: linux-mmc

On 5/02/21 6:23 pm, Christoph Hellwig wrote:
> Use the proper API to query the max mapping size instead of guessing
> it based on swiotlb internals.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

> ---
>  drivers/mmc/host/sdhci.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 646823ddd31715..2d73407ee52ec7 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -20,7 +20,6 @@
>  #include <linux/slab.h>
>  #include <linux/scatterlist.h>
>  #include <linux/sizes.h>
> -#include <linux/swiotlb.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/of.h>
> @@ -4582,12 +4581,8 @@ int sdhci_setup_host(struct sdhci_host *host)
>  		mmc->max_segs = SDHCI_MAX_SEGS;
>  	} else if (host->flags & SDHCI_USE_SDMA) {
>  		mmc->max_segs = 1;
> -		if (swiotlb_max_segment()) {
> -			unsigned int max_req_size = (1 << IO_TLB_SHIFT) *
> -						IO_TLB_SEGSIZE;
> -			mmc->max_req_size = min(mmc->max_req_size,
> -						max_req_size);
> -		}
> +		mmc->max_req_size = min_t(size_t, mmc->max_req_size,
> +					  dma_max_mapping_size(mmc_dev(mmc)));
>  	} else { /* PIO */
>  		mmc->max_segs = SDHCI_MAX_SEGS;
>  	}
> 


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 16:23 [PATCH] sdhci: stop poking into swiotlb internals Christoph Hellwig
2021-02-05 18:43 ` Adrian Hunter
2021-02-17 12:10   ` Jiri Slaby
2021-02-17 13:39     ` Christoph Hellwig
2021-02-17 13:59 ` Adrian Hunter

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.