Skip to contentSkip to conversation

ARM: Qualify enabling of swiotlb_init()

PATCH In review Florian Fainelli 2 participants 2 messages Sep 23, 2021 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: Qualify enabling of swiotlb_init()

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")
---
 arch/arm/mm/init.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mm/init.c +5 -1
index d54d69cf1732..75f3ab531bdf 100644
@@ -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);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 33 lines · Florian Fainelli

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")
---
 arch/arm/mm/init.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mm/init.c +5 -1
index d54d69cf1732..75f3ab531bdf 100644
@@ -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);
Signature · 1 line
2.25.1

Both now queued up, thanks.

greg k-h