We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Contiguous Memory Allocator in kernel



  • Hi, I'm trying to pre-allocate contiguos block of memory.
    In kernel_menuconfig I'm selecting cma enabled in Kernel type submenu, and in Device drivers->Generic driver option I'm selecting DMA Contiguous Memory Allocator, trying to apply 16 MB size zone with max page order 6 (I have 16 kB kernel page size). Building image and downloadin in Omega2p.
    When it starts i have message in terminal:

    [ 0.000000] Determined physical RAM map:
    [ 0.000000] memory: 08000000 @ 00000000 (usable)
    [ 0.000000] cma: Failed to reserve 128 MiB

    and after :

    [ 0.000000] Memory: 124736K/131072K available (4117K kernel code, 226K rwdata, 944K rodata, 208K init, 245K bss, 6336K reserved, 0K cma-reserved)

    Idk why it trying reserve 128 MiB, I added in device-tree of Omega2p this block to reserve 64 MB of memory:

    memory@0 {
    	device_type = "memory";
    	reg = <0x0 0x8000000>;
    };
    
    reserved-memory {
    	#address-cells = <1>;
    	#size-cells = <1>;
    	ranges;
    
    	/* global autoconfigured region for contiguous allocations */
    	linux,cma {
    		compatible = "shared-dma-pool";
    		reusable;
    		reg = <0x4000000 0x4000000>;
    		alignment = <0x2000>;
    		linux,cma-default;
    	};
    
    };
    

    It still failing to reserve, if turn on debug messages:

    [ 0.000000] Determined physical RAM map:
    [ 0.000000] memory: 08000000 @ 00000000 (usable)
    [ 0.000000] cma: dma_contiguous_reserve(limit 08000000)
    [ 0.000000] cma: dma_contiguous_reserve: reserving 16 MiB for global area
    [ 0.000000] cma: cma_declare_contiguous(size 0x01000000, base 0x00000000, limit 0x08000000 alignment 0x00000000)
    [ 0.000000] cma: Failed to reserve 128 MiB

    Anyway, mb someone successed with contiguous allocation for DMA buffers?



  • @Mark-Nagaev, why you need too many memory (16Mb)? And I heard DMA can use only down memory, DMA is available only in kernel-mode.



  • @Modest-Polykarpovich 16 MB just for experiment, but I need about 4 MB of contiguous memory for my DMA audio buffer, of course it works in kernel-mode. If it's interesting for u, u can read this article



  • @Mark-Nagaev said in Contiguous Memory Allocator in kernel:

    @Modest-Polykarpovich 16 MB just for experiment, but I need about 4 MB of contiguous memory for my DMA audio buffer, of course it works in kernel-mode. If it's interesting for u, u can read this article

    Oh, you are trying to make your own sound driver - very well, keep me in touch, I'd like to use I2S Audio Interface too. Perhaps it's no need, because many people want sound on MIPS, many Audio Codecs Chips vendors wants to sell it, the drivers are must be. We can only select a chip. And sound driver is a very difficult, I think better choose professional variants.

    Look this:
    Breakout for LinkIt Smart 7688 v2.0 + Breakout for LinkIt Smart 7688 v2.0

    It's Audio Codec WM8960 on the OpenWRT via I2S interface.



  • @Modest-Polykarpovich not my own, but I'm still trying to improve existin driver, here my post, I add some of my fixes, It works better with them, but not perfect with rates higher than 96kHz, I really wanna play bit-perfect 192/24 on i2s Omega2


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.