linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH stable 5.10] ARM: Qualify enabling of swiotlb_init()
@ 2021-09-23  0:14 Florian Fainelli
  2021-09-23  8:06 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2021-09-23  0:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Sasha Levin, stable, Florian Fainelli,
	Konrad Rzeszutek Wilk, Russell King, Mike Rapoport,
	Andrew Morton, Ard Biesheuvel, Max Filippov,
	moderated list:ARM PORT

commit fcf044891c84e38fc90eb736b818781bccf94e38 upstream

We do not need a SWIOTLB unless we have DRAM that is addressable beyond
the arm_dma_limit. Compare max_pfn with arm_dma_pfn_limit to determine
whether we do need a SWIOTLB to be initialized.

Fixes: ad3c7b18c5b3 ("arm: use swiotlb for bounce buffering on LPAE configs")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 arch/arm/mm/init.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index d54d69cf1732..75f3ab531bdf 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -378,7 +378,11 @@ static void __init free_highpages(void)
 void __init mem_init(void)
 {
 #ifdef CONFIG_ARM_LPAE
-	swiotlb_init(1);
+	if (swiotlb_force == SWIOTLB_FORCE ||
+	    max_pfn > arm_dma_pfn_limit)
+		swiotlb_init(1);
+	else
+		swiotlb_force = SWIOTLB_NO_FORCE;
 #endif
 
 	set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
-- 
2.25.1


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

* Re: [PATCH stable 5.10] ARM: Qualify enabling of swiotlb_init()
  2021-09-23  0:14 [PATCH stable 5.10] ARM: Qualify enabling of swiotlb_init() Florian Fainelli
@ 2021-09-23  8:06 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-23  8:06 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-kernel, Sasha Levin, stable, Konrad Rzeszutek Wilk,
	Russell King, Mike Rapoport, Andrew Morton, Ard Biesheuvel,
	Max Filippov, moderated list:ARM PORT

On Wed, Sep 22, 2021 at 05:14:24PM -0700, Florian Fainelli wrote:
> commit fcf044891c84e38fc90eb736b818781bccf94e38 upstream
> 
> We do not need a SWIOTLB unless we have DRAM that is addressable beyond
> the arm_dma_limit. Compare max_pfn with arm_dma_pfn_limit to determine
> whether we do need a SWIOTLB to be initialized.
> 
> Fixes: ad3c7b18c5b3 ("arm: use swiotlb for bounce buffering on LPAE configs")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  arch/arm/mm/init.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
> index d54d69cf1732..75f3ab531bdf 100644
> --- a/arch/arm/mm/init.c
> +++ b/arch/arm/mm/init.c
> @@ -378,7 +378,11 @@ static void __init free_highpages(void)
>  void __init mem_init(void)
>  {
>  #ifdef CONFIG_ARM_LPAE
> -	swiotlb_init(1);
> +	if (swiotlb_force == SWIOTLB_FORCE ||
> +	    max_pfn > arm_dma_pfn_limit)
> +		swiotlb_init(1);
> +	else
> +		swiotlb_force = SWIOTLB_NO_FORCE;
>  #endif
>  
>  	set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
> -- 
> 2.25.1
> 

Both now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2021-09-23  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23  0:14 [PATCH stable 5.10] ARM: Qualify enabling of swiotlb_init() Florian Fainelli
2021-09-23  8:06 ` Greg Kroah-Hartman

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).