]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ARM: Qualify enabling of swiotlb_init()
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 19 Mar 2021 04:03:33 +0000 (21:03 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Sep 2021 12:07:06 +0000 (14:07 +0200)
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: 96ea560103b0 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/mm/init.c

index 0804a6af4a3b7103c729a48d12d898212ecbc0ff..5a3641b5ec2cd09e5638dfbcd07c7ae8823e769c 100644 (file)
@@ -469,7 +469,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);