Mali & UMP memory allocation

来源:互联网 发布:c语言math函数库 编辑:程序博客网 时间:2024/06/07 01:52

The MALI & UMP device drivers reside in driver/gpu directory:

Mali driver: gpu/mali/mali/linux/mali_kernel_linux.c.

                     It is a platform device, the driver name is "mali-utgard". (ls /sys/bus/platform/drivers),

                     the device name is "mali-utgard.0" (ls /sys/bus/platform/devices)

UMP driver: gpu/mali/ump/linux/ump_kernel_linux.c

                      It is a char device, the driver name is "ump", (ls sys/module/ump)

                      the device name is "ump", (ls /sys/devices/virtual)


Them mali $ UMP drivers both can be configured to allocate memory from

A. Dedicated memory

or

B. Share the Kernel memory


Below are related items in config, SparkPos project.

CONFIG_MALI_GPU=y                                           //The Mali GPU is enabled.The mali driver does not reference this value at all.

CONFIG_MALI400=y                                               //The GPU version.The mali driver does not reference this value at all.

CONFIG_MALI_OS_MEMORY=y                           //Share memory with Kernel.The mali driver does not reference this value at all.

CONFIG_MALI_MEMORY_SIZE=512                   //size in MiB. The mali driver reference this value in gpu/mali/mali/platform/tcc-m400/mali_platform.c

shared_mem_size = CONFIG_MALI_MEMORY_SIZE * 1024UL * 1024UL

CONFIG_MALI400_PROFILING=y                        //mali driver reference this value directly

CONFIG_MALI_UMP=y                                            //UMP is enable, The UMP driver does not reference this value at all.

CONFIG_UMP_OS_MEMORY=y                           //Share memory with Kernel. The UMP module further defines a macro "#define ARCH_UMP_BACKEND_DEFAULT          1" 

                                                                                     //in gpu/mali/ump/arch/config.h

CONFIG_UMP_MEMORY_ADDRESS=0             //The UMP module further defines a macro

                                                                                     //"#define ARCH_UMP_MEMORY_ADDRESS_DEFAULT   CONFIG_UMP_MEMORY_ADDRESS

                                                                                    //ingpu/mali/ump/arch/config.h

CONFIG_UMP_MEMORY_SIZE=64                      //Size in MiB,The UMP module further defines a macro

                                                                                      //#define ARCH_UMP_MEMORY_SIZE_DEFAULT      (CONFIG_UMP_MEMORY_SIZE * 1024UL * 1024UL)

                                                                                      //ingpu/mali/ump/arch/config.h

Below are related logs:

[    1.070000] UMP<2>: Inserting UMP device driver. Compiled: Jul  7 2014, time: 17:56:26
[    1.080000] UMP<2>: Using OS memory backend, allocation limit: 67108864                       //64 MiB
[    1.090000] UMP<2>: Using dedicated memory backend
[    1.090000] UMP<2>: Requesting dedicated memory: 0x82000000, size: 28311552            //27 MiB, 0x1b0,0000
[    1.100000] UMP: UMP device driver 1M loaded
[    1.100000] Mali: Inserting Mali v20 device driver.
[    1.110000] Mali: Compiled: Jun 28 2014, time: 14:41:58.
[    1.110000] Mali: Driver revision: r3p2-01rel1-r1
[    1.120000] Mali: Mali device driver loaded

It turns out that the UMP allocates 64MB memory from kernel memory via kmalloc() routine. At the mean time, UMP occupies 27MB dedicated memory (preserved by pmap) from 0x82000000 to 0x83b00000) . Reference function ump_kernel_constructor() in gpu/mali/ump/common/ump_kernel_common.c.






0 0
原创粉丝点击