riscv: Only initialize swiotlb when necessary
The SWIOTLB buffer is not needed unless the physical address space is beyond the limit of dma, only initialize swiotlb when swiotlb_force is true or not all system memory is DMA-able. Also move the swiotlb_init() into mem_init(). Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
This commit is contained in:
parent
ae3d69bcc4
commit
ce3aca0465
@ -17,7 +17,6 @@
|
|||||||
#include <linux/of_fdt.h>
|
#include <linux/of_fdt.h>
|
||||||
#include <linux/of_platform.h>
|
#include <linux/of_platform.h>
|
||||||
#include <linux/sched/task.h>
|
#include <linux/sched/task.h>
|
||||||
#include <linux/swiotlb.h>
|
|
||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
#include <linux/efi.h>
|
#include <linux/efi.h>
|
||||||
#include <linux/crash_dump.h>
|
#include <linux/crash_dump.h>
|
||||||
@ -295,10 +294,6 @@ void __init setup_arch(char **cmdline_p)
|
|||||||
protect_kernel_linear_mapping_text_rodata();
|
protect_kernel_linear_mapping_text_rodata();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SWIOTLB
|
|
||||||
swiotlb_init(1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_KASAN
|
#ifdef CONFIG_KASAN
|
||||||
kasan_init();
|
kasan_init();
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
#include <linux/initrd.h>
|
#include <linux/initrd.h>
|
||||||
#include <linux/swap.h>
|
#include <linux/swap.h>
|
||||||
|
#include <linux/swiotlb.h>
|
||||||
#include <linux/sizes.h>
|
#include <linux/sizes.h>
|
||||||
#include <linux/of_fdt.h>
|
#include <linux/of_fdt.h>
|
||||||
#include <linux/of_reserved_mem.h>
|
#include <linux/of_reserved_mem.h>
|
||||||
@ -109,6 +110,13 @@ void __init mem_init(void)
|
|||||||
BUG_ON(!mem_map);
|
BUG_ON(!mem_map);
|
||||||
#endif /* CONFIG_FLATMEM */
|
#endif /* CONFIG_FLATMEM */
|
||||||
|
|
||||||
|
#ifdef CONFIG_SWIOTLB
|
||||||
|
if (swiotlb_force == SWIOTLB_FORCE ||
|
||||||
|
max_pfn > PFN_DOWN(dma32_phys_limit))
|
||||||
|
swiotlb_init(1);
|
||||||
|
else
|
||||||
|
swiotlb_force = SWIOTLB_NO_FORCE;
|
||||||
|
#endif
|
||||||
high_memory = (void *)(__va(PFN_PHYS(max_low_pfn)));
|
high_memory = (void *)(__va(PFN_PHYS(max_low_pfn)));
|
||||||
memblock_free_all();
|
memblock_free_all();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user