lkml.org 
[lkml]   [2019]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 4/4] arm64: mm: set direct_dma_min_mask according to dma-ranges
Date
Now that we parse the dma-ranges during initialization we can fine-tune
the DMA mask used by the direct DMA implementation.

We set the mask based on the size of the DMA addressable memory, and if
bigger than 4GB we force it to DMA_BIT_MASK(32) as it's always been.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
arch/arm64/mm/init.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 5708adf0db52..f8af2c99667c 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -52,6 +52,8 @@ EXPORT_SYMBOL(memstart_addr);

phys_addr_t arm64_dma_phys_limit __ro_after_init;

+extern u64 dma_direct_min_mask;
+
#ifdef CONFIG_KEXEC_CORE
/*
* reserve_crashkernel() - reserves memory for crash kernel
@@ -198,8 +200,12 @@ static int __init early_init_dt_scan_dma_ranges(unsigned long node,
if (size > (1ULL << 32))
size = 1ULL << 32;

- if (*dma_phys_limit > (phys_addr + size))
+ if (*dma_phys_limit > (phys_addr + size)) {
+ /* Set min DMA mask in case is was smaller than 32 */
+ dma_direct_min_mask = size - 1;
+
*dma_phys_limit = phys_addr + size;
+ }

return 0;
}
--
2.22.0
\
 
 \ /
  Last update: 2019-07-17 17:32    [W:0.146 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site