microblaze: Enable CMA
v2 cover microblaze: Enable CMA
Hi,
the patchset enable CMA on Microblaze. Based on Christoph request I have created the first patch which makes dma-continugous.h mandatory for all archs before Microblaze wiring.
Thanks,
Michal
Changes in v2:
- New patch suggested by Christoph
- Align commit message
- Remove adding dma-contigous.h via Kbuild because it is done by previous patch
Michal Simek (2):
asm-generic: Make dma-contiguous.h a mandatory include/asm header
microblaze: Wire CMA allocator
arch/arm64/include/asm/Kbuild | 1 - arch/csky/include/asm/Kbuild | 1 - arch/microblaze/Kconfig | 1 + arch/microblaze/configs/mmu_defconfig | 2 ++ arch/microblaze/mm/init.c | 4 ++++ arch/mips/include/asm/Kbuild | 1 - arch/riscv/include/asm/Kbuild | 1 - arch/s390/include/asm/Kbuild | 1 - arch/x86/include/asm/Kbuild | 1 - arch/xtensa/include/asm/Kbuild | 1 - include/asm-generic/Kbuild | 1 + 11 files changed, 8 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.0
PATCH v2 1/2 asm-generic: Make dma-contiguous.h a mandatory include/asm header
dma-continuguous.h is generic for all architectures except arm32 which has its own version.
Similar change was done for msi.h by commit a1b39bae16a6 ("asm-generic: Make msi.h a mandatory include/asm header")
---
Changes in v2:
- New patch suggested by Christoph
arch/arm64/include/asm/Kbuild | 1 - arch/csky/include/asm/Kbuild | 1 - arch/mips/include/asm/Kbuild | 1 - arch/riscv/include/asm/Kbuild | 1 - arch/s390/include/asm/Kbuild | 1 - arch/x86/include/asm/Kbuild | 1 - arch/xtensa/include/asm/Kbuild | 1 - include/asm-generic/Kbuild | 1 + 8 files changed, 1 insertion(+), 7 deletions(-)
arch/arm64/include/asm/Kbuild +0 -1
@@ -3,7 +3,6 @@ generic-y += bugs.h generic-y += delay.h generic-y += div64.h generic-y += dma.h -generic-y += dma-contiguous.h generic-y += dma-mapping.h generic-y += early_ioremap.h generic-y += emergency-restart.h
arch/csky/include/asm/Kbuild +0 -1
@@ -7,7 +7,6 @@ generic-y += delay.h generic-y += device.h generic-y += div64.h generic-y += dma.h -generic-y += dma-contiguous.h generic-y += dma-mapping.h generic-y += emergency-restart.h generic-y += exec.h
arch/mips/include/asm/Kbuild +0 -1
@@ -6,7 +6,6 @@ generated-y += syscall_table_64_n64.h generated-y += syscall_table_64_o32.h generic-y += current.h generic-y += device.h -generic-y += dma-contiguous.h generic-y += emergency-restart.h generic-y += export.h generic-y += irq_work.h
arch/riscv/include/asm/Kbuild +0 -1
@@ -7,7 +7,6 @@ generic-y += div64.h generic-y += extable.h generic-y += flat.h generic-y += dma.h -generic-y += dma-contiguous.h generic-y += dma-mapping.h generic-y += emergency-restart.h generic-y += exec.h
arch/s390/include/asm/Kbuild +0 -1
@@ -7,7 +7,6 @@ generated-y += unistd_nr.h generic-y += asm-offsets.h generic-y += cacheflush.h generic-y += device.h -generic-y += dma-contiguous.h generic-y += dma-mapping.h generic-y += div64.h generic-y += emergency-restart.h
arch/x86/include/asm/Kbuild +0 -1
@@ -7,7 +7,6 @@ generated-y += unistd_32_ia32.h generated-y += unistd_64_x32.h generated-y += xen-hypercalls.h -generic-y += dma-contiguous.h generic-y += early_ioremap.h generic-y += export.h generic-y += mcs_spinlock.h
arch/xtensa/include/asm/Kbuild +0 -1
@@ -4,7 +4,6 @@ generic-y += bug.h generic-y += compat.h generic-y += device.h generic-y += div64.h -generic-y += dma-contiguous.h generic-y += dma-mapping.h generic-y += emergency-restart.h generic-y += exec.h
include/asm-generic/Kbuild +1 -0
@@ -4,5 +4,6 @@ # (This file is not included when SRCARCH=um since UML borrows several # asm headers from the host architecutre.) +mandatory-y += dma-contiguous.h mandatory-y += msi.h mandatory-y += simd.h
Signature · 1 line
2.25.0
Re: [PATCH v2 1/2] asm-generic: Make dma-contiguous.h a mandatory include/asm header
Quoted 8 lines · Michal Simek
dma-continuguous.his generic for all architectures except arm32 which has its own version.Similar change was done for
msi.hby commita1b39bae16a6("asm-generic: Makemsi.ha mandatoryinclude/asmheader")Suggested-by Christoph Hellwig <[email protected]>Signed-off-by Michal Simek <[email protected]>
Looks good,
Re: [PATCH v2 1/2] asm-generic: Make dma-contiguous.h a mandatory include/asm header
In reply to Michal SimekQuoted 8 lines · Michal Simek
dma-continuguous.his generic for all architectures except arm32 which has its own version.Similar change was done for
msi.hby commita1b39bae16a6("asm-generic: Makemsi.ha mandatoryinclude/asmheader")Suggested-by Christoph Hellwig <[email protected]>Signed-off-by Michal Simek <[email protected]>
Re: [PATCH v2 1/2] asm-generic: Make dma-contiguous.h a mandatory include/asm header
In reply to Michal SimekQuoted 7 lines · Michal Simek
dma-continuguous.his generic for all architectures except arm32 which has its own version.Similar change was done for
msi.hby commita1b39bae16a6("asm-generic: Makemsi.ha mandatoryinclude/asmheader")
Quoted 6 lines
Suggested-by Christoph Hellwig <[email protected]>Signed-off-by Michal Simek <[email protected]>---
Changes in v2:
- New patch suggested by Christoph
Re: [PATCH v2 1/2] asm-generic: Make dma-contiguous.h a mandatory include/asm header
In reply to Michal SimekQuoted 10 lines · Michal Simek
dma-continuguous.his generic for all architectures except arm32 which has its own version.Similar change was done for
msi.hby commita1b39bae16a6("asm-generic: Makemsi.ha mandatoryinclude/asmheader")Suggested-by Christoph Hellwig <[email protected]>Signed-off-by Michal Simek <[email protected]>---
Re: [PATCH v2 1/2] asm-generic: Make dma-contiguous.h a mandatory include/asm header
In reply to Michal SimekQuoted 8 lines · Michal Simek
dma-continuguous.his generic for all architectures except arm32 which has its own version.Similar change was done for
msi.hby commita1b39bae16a6("asm-generic: Makemsi.ha mandatoryinclude/asmheader")Suggested-by Christoph Hellwig <[email protected]>Signed-off-by Michal Simek <[email protected]>
- Paul
Re: [PATCH v2 1/2] asm-generic: Make dma-contiguous.h a mandatory include/asm header
In reply to Michal SimekHi.
Quoted 3 lines · Michal Simek
dma-continuguous.his generic for all architectures except arm32 which has its own version.
Currently, <asm/dma-contiguous.h> is present for only architectures that select HAVE_DMA_CONTIGUOUS.
After this commit, the other architectures will end up with generating the unused header.
That would not be a big deal, but
it could be mentioned in the commit message?
Quoted 119 lines
Similar change was done for
msi.hby commita1b39bae16a6("asm-generic: Makemsi.ha mandatoryinclude/asmheader")Suggested-by Christoph Hellwig <[email protected]>Signed-off-by Michal Simek <[email protected]>---
Changes in v2:
- New patch suggested by Christopharch/arm64/include/asm/Kbuild | 1 - arch/csky/include/asm/Kbuild | 1 - arch/mips/include/asm/Kbuild | 1 - arch/riscv/include/asm/Kbuild | 1 - arch/s390/include/asm/Kbuild | 1 - arch/x86/include/asm/Kbuild | 1 - arch/xtensa/include/asm/Kbuild | 1 -include/asm-generic/Kbuild | 1 + 8 files changed, 1 insertion(+), 7 deletions(-)arch/arm64/include/asm/Kbuild +0
-1@@ -3,7 +3,6 @@ generic-y += bugs.h generic-y += delay.h generic-y += div64.h generic-y += dma.h -generic-y += dma-contiguous.h generic-y += dma-mapping.h generic-y += early_ioremap.h generic-y += emergency-restart.harch/csky/include/asm/Kbuild +0
-1@@ -7,7 +7,6 @@ generic-y += delay.h generic-y += device.h generic-y += div64.h generic-y += dma.h -generic-y += dma-contiguous.h generic-y += dma-mapping.h generic-y += emergency-restart.h generic-y += exec.harch/mips/include/asm/Kbuild +0
-1@@ -6,7 +6,6 @@ generated-y += syscall_table_64_n64.h generated-y += syscall_table_64_o32.h generic-y += current.h generic-y += device.h -generic-y += dma-contiguous.h generic-y += emergency-restart.h generic-y += export.h generic-y += irq_work.harch/riscv/include/asm/Kbuild +0
-1@@ -7,7 +7,6 @@ generic-y += div64.h generic-y += extable.h generic-y += flat.h generic-y += dma.h -generic-y += dma-contiguous.h generic-y += dma-mapping.h generic-y += emergency-restart.h generic-y += exec.harch/s390/include/asm/Kbuild +0
-1@@ -7,7 +7,6 @@ generated-y += unistd_nr.h generic-y += asm-offsets.h generic-y += cacheflush.h generic-y += device.h -generic-y += dma-contiguous.h generic-y += dma-mapping.h generic-y += div64.h generic-y += emergency-restart.harch/x86/include/asm/Kbuild +0
-1@@ -7,7 +7,6 @@ generated-y += unistd_32_ia32.h generated-y += unistd_64_x32.h generated-y += xen-hypercalls.h -generic-y += dma-contiguous.h generic-y += early_ioremap.h generic-y += export.h generic-y += mcs_spinlock.harch/xtensa/include/asm/Kbuild +0
-1@@ -4,7 +4,6 @@ generic-y += bug.h generic-y += compat.h generic-y += device.h generic-y += div64.h -generic-y += dma-contiguous.h generic-y += dma-mapping.h generic-y += emergency-restart.h generic-y += exec.hinclude/asm-generic/Kbuild +1
-1@@ -4,5 +4,6 @@ # (This file is not included when SRCARCH=um since UML borrows several # asm headers from the host architecutre.) +mandatory-y += dma-contiguous.h mandatory-y += msi.h mandatory-y += simd.h --2.25.0
Signature · 2 lines
Best Regards Masahiro Yamada
Michal Simek
maintainerRe: [PATCH v2 1/2] asm-generic: Make dma-contiguous.h a mandatory include/asm header
Quoted 9 lines · Masahiro Yamada
Hi.
Quoted 3 lines · Michal Simek
dma-continuguous.his generic for all architectures except arm32 which has its own version.
Quoted 8 lines
Currently, <
asm/dma-contiguous.h> is present for only architectures that selectHAVE_DMA_CONTIGUOUS.After this commit, the other architectures will end up with generating the unused header.
That would not be a big deal, but
it could be mentioned in the commit message?
I have not a problem with mentioning it but not sure if this was done in past.
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
PATCH v2 2/2 microblaze: Wire CMA allocator
In reply to Michal SimekBased on commit 04e3543e228f ("microblaze: use the generic dma coherent remap allocator")
CMA can be easily enabled by calling dma_contiguous_reserve() at the end of mmu_init(). High limit is end of lowmem space which is completely unused at this point of time.
---
Changes in v2:
- Align commit message
- Remove adding dma-contigous.h via Kbuild because it is done by previous patch
Christoph: Can you please review this patch?
I have used this cma allocator
https://lwn.net/Articles/485193/
also together with allocating and freeing via debugfs interface.
If there is any other good way how to test cma please let me know.
--- arch/microblaze/Kconfig | 1 + arch/microblaze/configs/mmu_defconfig | 2 ++ arch/microblaze/mm/init.c | 4 ++++ 3 files changed, 7 insertions(+)
arch/microblaze/Kconfig +1 -0
@@ -27,6 +27,7 @@ config MICROBLAZE select HAVE_ARCH_HASH select HAVE_ARCH_KGDB select HAVE_DEBUG_KMEMLEAK + select HAVE_DMA_CONTIGUOUS select HAVE_DYNAMIC_FTRACE select HAVE_FTRACE_MCOUNT_RECORD select HAVE_FUNCTION_GRAPH_TRACER
arch/microblaze/configs/mmu_defconfig +2 -0
@@ -26,6 +26,7 @@ CONFIG_MODULE_UNLOAD=y # CONFIG_BLK_DEV_BSG is not set CONFIG_PARTITION_ADVANCED=y # CONFIG_EFI_PARTITION is not set +CONFIG_CMA=y CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y
@@ -82,6 +83,7 @@ CONFIG_NFS_FS=y CONFIG_CIFS=y CONFIG_CIFS_STATS2=y CONFIG_ENCRYPTED_KEYS=y +CONFIG_DMA_CMA=y CONFIG_DEBUG_INFO=y CONFIG_KGDB=y CONFIG_KGDB_TESTS=y
arch/microblaze/mm/init.c +4 -0
@@ -7,6 +7,7 @@* for more details. */ +#include <linux/dma-contiguous.h> #include <linux/memblock.h> #include <linux/init.h> #include <linux/kernel.h>
@@ -345,6 +346,9 @@ asmlinkage void __init mmu_init(void)/* This will also cause that unflatten device tree will be allocated * inside 768MB limit */ memblock_set_current_limit (memory_start + lowmem_size -1 ); + +/* CMA initialization */ +dma_contiguous_reserve (memory_start + lowmem_size -1 ); }/* This is only called until mem_init is done. */
Signature · 1 line
2.25.0
Re: [PATCH v2 2/2] microblaze: Wire CMA allocator
Quoted 7 lines · Michal Simek
Based on commit
04e3543e228f("microblaze: use the generic dma coherent remap allocator")
CMA can be easily enabled by callingdma_contiguous_reserve()at the end ofmmu_init(). High limit is end of lowmem space which is completely unused at this point of time.Signed-off-by Michal Simek <[email protected]>
Looks good,
Quoted 19 lines · Michal Simek
Hi,
the patchset enable CMA on Microblaze. Based on Christoph request I have created the first patch which makes
dma-continugous.hmandatory for all archs before Microblaze wiring.Thanks,
MichalChanges in v2:
- New patch suggested by Christoph
- Align commit message
- Remove addingdma-contigous.hviaKbuildbecause it is done by previous patchMichal Simek (2):
asm-generic: Makedma-contiguous.ha mandatoryinclude/asmheader
microblaze: Wire CMA allocator
Quoted 13 lines
arch/arm64/include/asm/Kbuild | 1 - arch/csky/include/asm/Kbuild | 1 - arch/microblaze/Kconfig | 1 + arch/microblaze/configs/mmu_defconfig | 2 ++ arch/microblaze/mm/init.c | 4 ++++ arch/mips/include/asm/Kbuild | 1 - arch/riscv/include/asm/Kbuild | 1 - arch/s390/include/asm/Kbuild | 1 - arch/x86/include/asm/Kbuild | 1 - arch/xtensa/include/asm/Kbuild | 1 - include/asm-generic/Kbuild | 1 + 11 files changed, 8 insertions(+), 7 deletions(-)
Applied.
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs