diff options
| -rw-r--r-- | arch/arm64/include/asm/processor.h | 3 | ||||
| -rw-r--r-- | arch/arm64/mm/dma-mapping.c | 16 | ||||
| -rw-r--r-- | arch/arm64/mm/init.c | 14 |
3 files changed, 14 insertions, 19 deletions
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index f9be30ea1cbd..20e9591a60cf 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h | |||
| @@ -45,7 +45,8 @@ | |||
| 45 | #define STACK_TOP STACK_TOP_MAX | 45 | #define STACK_TOP STACK_TOP_MAX |
| 46 | #endif /* CONFIG_COMPAT */ | 46 | #endif /* CONFIG_COMPAT */ |
| 47 | 47 | ||
| 48 | #define ARCH_LOW_ADDRESS_LIMIT PHYS_MASK | 48 | extern phys_addr_t arm64_dma_phys_limit; |
| 49 | #define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit - 1) | ||
| 49 | #endif /* __KERNEL__ */ | 50 | #endif /* __KERNEL__ */ |
| 50 | 51 | ||
| 51 | struct debug_info { | 52 | struct debug_info { |
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 0a24b9b8c698..58e0c2bdde04 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c | |||
| @@ -348,8 +348,6 @@ static struct dma_map_ops swiotlb_dma_ops = { | |||
| 348 | .mapping_error = swiotlb_dma_mapping_error, | 348 | .mapping_error = swiotlb_dma_mapping_error, |
| 349 | }; | 349 | }; |
| 350 | 350 | ||
| 351 | extern int swiotlb_late_init_with_default_size(size_t default_size); | ||
| 352 | |||
| 353 | static int __init atomic_pool_init(void) | 351 | static int __init atomic_pool_init(void) |
| 354 | { | 352 | { |
| 355 | pgprot_t prot = __pgprot(PROT_NORMAL_NC); | 353 | pgprot_t prot = __pgprot(PROT_NORMAL_NC); |
| @@ -411,21 +409,13 @@ out: | |||
| 411 | return -ENOMEM; | 409 | return -ENOMEM; |
| 412 | } | 410 | } |
| 413 | 411 | ||
| 414 | static int __init swiotlb_late_init(void) | 412 | static int __init arm64_dma_init(void) |
| 415 | { | 413 | { |
| 416 | size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT); | 414 | int ret; |
| 417 | 415 | ||
| 418 | dma_ops = &swiotlb_dma_ops; | 416 | dma_ops = &swiotlb_dma_ops; |
| 419 | 417 | ||
| 420 | return swiotlb_late_init_with_default_size(swiotlb_size); | 418 | ret = atomic_pool_init(); |
| 421 | } | ||
| 422 | |||
| 423 | static int __init arm64_dma_init(void) | ||
| 424 | { | ||
| 425 | int ret = 0; | ||
| 426 | |||
| 427 | ret |= swiotlb_late_init(); | ||
| 428 | ret |= atomic_pool_init(); | ||
| 429 | 419 | ||
| 430 | return ret; | 420 | return ret; |
| 431 | } | 421 | } |
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 71145f952070..ae85da6307bb 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
| 34 | #include <linux/dma-contiguous.h> | 34 | #include <linux/dma-contiguous.h> |
| 35 | #include <linux/efi.h> | 35 | #include <linux/efi.h> |
| 36 | #include <linux/swiotlb.h> | ||
| 36 | 37 | ||
| 37 | #include <asm/fixmap.h> | 38 | #include <asm/fixmap.h> |
| 38 | #include <asm/memory.h> | 39 | #include <asm/memory.h> |
| @@ -45,6 +46,7 @@ | |||
| 45 | #include "mm.h" | 46 | #include "mm.h" |
| 46 | 47 | ||
| 47 | phys_addr_t memstart_addr __read_mostly = 0; | 48 | phys_addr_t memstart_addr __read_mostly = 0; |
| 49 | phys_addr_t arm64_dma_phys_limit __read_mostly; | ||
| 48 | 50 | ||
| 49 | #ifdef CONFIG_BLK_DEV_INITRD | 51 | #ifdef CONFIG_BLK_DEV_INITRD |
| 50 | static int __init early_initrd(char *p) | 52 | static int __init early_initrd(char *p) |
| @@ -85,7 +87,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) | |||
| 85 | 87 | ||
| 86 | /* 4GB maximum for 32-bit only capable devices */ | 88 | /* 4GB maximum for 32-bit only capable devices */ |
| 87 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { | 89 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { |
| 88 | max_dma = PFN_DOWN(max_zone_dma_phys()); | 90 | max_dma = PFN_DOWN(arm64_dma_phys_limit); |
| 89 | zone_size[ZONE_DMA] = max_dma - min; | 91 | zone_size[ZONE_DMA] = max_dma - min; |
| 90 | } | 92 | } |
| 91 | zone_size[ZONE_NORMAL] = max - max_dma; | 93 | zone_size[ZONE_NORMAL] = max - max_dma; |
| @@ -156,8 +158,6 @@ early_param("mem", early_mem); | |||
| 156 | 158 | ||
| 157 | void __init arm64_memblock_init(void) | 159 | void __init arm64_memblock_init(void) |
| 158 | { | 160 | { |
| 159 | phys_addr_t dma_phys_limit = 0; | ||
| 160 | |||
| 161 | memblock_enforce_memory_limit(memory_limit); | 161 | memblock_enforce_memory_limit(memory_limit); |
| 162 | 162 | ||
| 163 | /* | 163 | /* |
| @@ -174,8 +174,10 @@ void __init arm64_memblock_init(void) | |||
| 174 | 174 | ||
| 175 | /* 4GB maximum for 32-bit only capable devices */ | 175 | /* 4GB maximum for 32-bit only capable devices */ |
| 176 | if (IS_ENABLED(CONFIG_ZONE_DMA)) | 176 | if (IS_ENABLED(CONFIG_ZONE_DMA)) |
| 177 | dma_phys_limit = max_zone_dma_phys(); | 177 | arm64_dma_phys_limit = max_zone_dma_phys(); |
| 178 | dma_contiguous_reserve(dma_phys_limit); | 178 | else |
| 179 | arm64_dma_phys_limit = PHYS_MASK + 1; | ||
| 180 | dma_contiguous_reserve(arm64_dma_phys_limit); | ||
| 179 | 181 | ||
| 180 | memblock_allow_resize(); | 182 | memblock_allow_resize(); |
| 181 | memblock_dump_all(); | 183 | memblock_dump_all(); |
| @@ -276,6 +278,8 @@ static void __init free_unused_memmap(void) | |||
| 276 | */ | 278 | */ |
| 277 | void __init mem_init(void) | 279 | void __init mem_init(void) |
| 278 | { | 280 | { |
| 281 | swiotlb_init(1); | ||
| 282 | |||
| 279 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); | 283 | set_max_mapnr(pfn_to_page(max_pfn) - mem_map); |
| 280 | 284 | ||
| 281 | #ifndef CONFIG_SPARSEMEM_VMEMMAP | 285 | #ifndef CONFIG_SPARSEMEM_VMEMMAP |
