简体   繁体   English

cma缓冲区内存分配失败

[英]cma buffer memory allocation failed

I am trying to write a driver for DMA Linux, and my driver has been failing to execute dma_coherent_alloc, I already increased CMA memory, and coherent_pool ... 我正在尝试为DMA Linux写驱动程序,但我的驱动程序无法执行dma_coherent_alloc,我已经增加了CMA内存,并增加了coherent_pool ...

what am I missing ? 我想念什么?

dmesg Booting Linux on physical CPU 0x0 dmesg在物理CPU 0x0上引导Linux
Linux version 4.14.0-xilinx-v2018.2 (oe-user@oe-host) (gcc version 7.2.0 (GCC)) #5 SMP PREEMPT Sun Feb 17 23:20:49 PST 2019 Linux版本4.14.0-xilinx-v2018.2(oe-user @ oe-host)(gcc版本7.2.0(GCC))#5 SMP PREEMPT PST 2019年2月17日23:20:49
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d CPU:ARMv7处理器[413fc090]修订版0(ARMv7),cr = 18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache CPU:PIPT / VIPT非混叠数据高速缓存,VIPT混叠指令高速缓存
OF: fdt: Machine model: xlnx,zynq-7000 OF:fdt:机器型号:xlnx,zynq-7000
bootconsole [earlycon0] enabled bootconsole [earlycon0]已启用
Memory policy: Data cache writealloc 内存策略:数据缓存writealloc
OF: fdt: Reserved memory: unsupported node format, ignoring OF:fdt:保留的内存:不支持的节点格式,忽略
cma: dma_contiguous_reserve(limit ffffffff) cma:dma_contiguous_reserve(限制ffffffff)
cma: dma_contiguous_reserve: reserving 60 MiB for global area cma:dma_contiguous_reserve:为全局区域保留60 MiB
cma: cma_declare_contiguous(size 0x03c00000, base 0x00000000, limit 0xffffffff alignment 0x00000000) cma:cma_declare_contiguous(大小0x03c00000,基数0x00000000,限制0xffffffff对齐方式0x00000000)
cma: Reserved 60 MiB at 0x3c400000 cma:在0x3c400000保留60 MiB
On node 0 totalpages: 262144 在节点0总页数上:262144
free_area_init_node: node 0, pgdat c183af40, node_mem_map ef7f7000 free_area_init_node:节点0,pgdat c183af40,node_mem_map ef7f7000
Normal zone: 1536 pages used for memmap 普通区域:用于memmap的1536页
Normal zone: 0 pages reserved 普通区域:保留0页
Normal zone: 196608 pages, LIFO batch:31 普通区域:196608页,后进先出批次:31
HighMem zone: 65536 pages, LIFO batch:15 HighMem区域:65536页,LIFO批次:15
percpu: Embedded 16 pages/cpu @ef7ce000 s34764 r8192 d22580 u65536 percpu:嵌入式16页/ cpu @ ef7ce000 s34764 r8192 d22580 u65536
pcpu-alloc: s34764 r8192 d22580 u65536 alloc=16*4096 pcpu-alloc:s34764 r8192 d22580 u65536 alloc = 16 * 4096
pcpu-alloc: [0] 0 [0] 1 pcpu-alloc:[0] 0 [0] 1
Built 1 zonelists, mobility grouping on. 建立了1个区域列表,并进行了移动分组。 Total pages: 260608 总页数:260608
Kernel command line: console=ttyPS0,115200 earlyprintk coherent_pool=32MiB 内核命令行:console = ttyPS0,115200 earlyprintk coherent_pool = 32MiB
PID hash table entries: 4096 (order: 2, 16384 bytes) PID哈希表条目:4096(顺序:2、16384字节)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes) Dentry缓存哈希表条目:131072(顺序:7,524288字节)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes) Inode缓存哈希表条目:65536(顺序:6,262144字节)
Memory: 953428K/1048576K available (6144K kernel code, 238K rwdata, 1568K rodata, 15360K init, 218K bss, 33708K reserved, 61440K cma-reserved, 200704K highmem) 内存:953428K / 1048576K可用(6144K内核代码,238K rwdata,1568K rodata,15360K init,218K bss,33708K保留,61440K cma保留,200704K highmem)
Virtual kernel memory layout: 虚拟内核内存布局:
vector : 0xffff0000 - 0xffff1000 ( 4 kB) 向量:0xffff0000-0xffff1000(4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB) 固定地图:0xffc00000-0xfff00000(3072 kB)
vmalloc : 0xf0800000 - 0xff800000 ( 240 MB) vmalloc:0xf0800000-0xff800000(240 MB)
lowmem : 0xc0000000 - 0xf0000000 ( 768 MB) 低内存:0xc0000000-0xf0000000(768 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB) pkmap:0xbfe00000-0xc0000000(2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB) 模块:0xbf000000-0xbfe00000(14 MB)
.text : 0xc0008000 - 0xc0700000 (7136 kB) .text:0xc0008000-0xc0700000(7136 kB)
.init : 0xc0900000 - 0xc1800000 (15360 kB) .init:0xc0900000-0xc1800000(15360 kB)
.data : 0xc1800000 - 0xc183bb40 ( 239 kB) .data:0xc1800000-0xc183bb40(239 kB)
.bss : 0xc183bb40 - 0xc1872344 ( 219 kB) .bss:0xc183bb40-0xc1872344(219 kB)
Preemptible hierarchical RCU implementation. 可抢占的分层RCU实现。
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2. RCU将CPU从NR_CPUS = 4限制为nr_cpu_ids = 2。
Tasks RCU enabled. 任务已启用RCU。
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2 RCU:调整rcu_fanout_leaf = 16,nr_cpu_ids = 2的几何
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16 NR_IRQS:16,nr_irqs:16,预分配的irqs:16
efuse mapped to f0802000 废物映射到f0802000
slcr mapped to f0804000 slcr映射到f0804000
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000 L2C:平台修改辅助控制寄存器:0x72360000-> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000 L2C:DT /平台修改辅助控制寄存器:0x72360000-> 0x72760000
L2C-310 erratum 769419 enabled L2C-310勘误表769419已启用
L2C-310 enabling early BRESP for Cortex-A9 L2C-310支持Cortex-A9的早期BRESP
L2C-310 full line of zeros enabled for Cortex-A9 支持Cortex-A9的L2C-310全零行
L2C-310 ID prefetch enabled, offset 1 lines 启用L2C-310 ID预取,偏移1行
L2C-310 dynamic clock gating enabled, standby mode enabled L2C-310动态时钟门控已启用,待机模式已启用
L2C-310 cache controller enabled, 8 ways, 512 kB 已启用L2C-310高速缓存控制器,8路,512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001 L2C-310:CACHE_ID 0x410000c8,AUX_CTRL 0x76760001
zynq_clock_init: clkc starts at f0804100 zynq_clock_init:clkc从f0804100开始
Zynq clock init Zynq时钟初始化
sched_clock: 64 bits at 249MHz, resolution 4ns, wraps every 4398046511102ns sched_clock:249MHz时为64位,分辨率为4ns,每隔4398046511102ns换行
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x7350b89c29, max_idle_ns: 881590431910 ns 时钟源:arm_global_timer:掩码:0xffffffffffffffff max_cycles:0x7350b89c29,max_idle_ns:881590431910 ns
Switching to timer-based delay loop, resolution 4ns 切换到基于计时器的延迟循环,分辨率为4ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 716713566 ns clocksource:ttc_clocksource:mask:0xffff max_cycles:0xffff,max_idle_ns:716713566 ns
timer #0 at f080c000, irq=17 f080c000上的计时器#0,irq = 17
Console: colour dummy device 80x30 控制台:彩色虚拟设备80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 499.99 BogoMIPS (lpj=2499999) 校准延迟回路(跳过),使用计时器频率计算得出的值。499.99 BogoMIPS(lpj = 2499999)
pid_max: default: 32768 minimum: 301 pid_max:默认值:32768最小值:301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes) Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes) 装入高速缓存哈希表条目:2048(顺序:1,8192字节)装入高速缓存哈希表条目:2048(顺序:1,8192字节)
CPU: Testing write buffer coherency: ok CPU:测试写缓冲区一致性:确定
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 CPU0:线程-1,cpu 0,套接字0,mpidr 80000000
Setting up static identity map for 0x100000 - 0x100060 为0x100000-0x100060设置静态身份映射
Hierarchical SRCU implementation. 分层SRCU实施。
smp: Bringing up secondary CPUs ... smp:启动辅助CPU ...
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001 CPU1:线程-1,cpu 1,套接字0,mpidr 80000001
smp: Brought up 1 node, 2 CPUs smp:启动1个节点,2个CPU
SMP: Total of 2 processors activated (999.99 BogoMIPS). SMP:总共激活了2个处理器(999.99 BogoMIPS)。
CPU: All CPU(s) started in SVC mode. CPU:所有CPU在SVC模式下启动。
devtmpfs: initialized devtmpfs:已初始化
random: get_random_u32 called from bucket_table_alloc+0x1c4/0x204 with crng_init=0 随机:从bucket_table_alloc + 0x1c4 / 0x204中调用的get_random_u32具有crng_init = 0
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4 VFP支持v0.3:实现者41架构3第30部分变体9修订版4
DMA-API: preallocated 4096 debug entries DMA-API:预分配的4096条调试条目
DMA-API: debugging enabled by kernel config DMA-API:调试由内核配置启用
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns 时钟源:jiffies:掩码:0xffffffff max_cycles:0xffffffff,max_idle_ns:19112604462750000 ns
futex hash table entries: 512 (order: 3, 32768 bytes) futex哈希表条目:512(顺序:3、32768字节)
pinctrl core: initialized pinctrl subsystem pinctrl核心:已初始化的pinctrl子系统
random: fast init done 随机:快速初始化完成
NET: Registered protocol family 16 NET:注册协议系列16
cma: cma_alloc(cma c184d3e0, count 8192, align 8) cma:cma_alloc(cma c184d3e0,计数8192,对齐8)
cma: cma_alloc(): returned eff7f000 cma:cma_alloc():返回eff7f000
DMA: preallocated 32768 KiB pool for atomic coherent allocations DMA:预分配的32768 KiB池用于原子相关分配
cpuidle: using governor menu cpuidle:使用调控器菜单
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers. hw-breakpoint:找到5个(+1个保留)断点和1个观察点寄存器。
hw-breakpoint: maximum watchpoint size is 4 bytes. hw-breakpoint:最大观察点大小为4个字节。
zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xf2840000 zynq-ocm f800c000.ocmc:ZYNQ OCM池:256 KiB @ 0xf2840000
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized zynq-pinctrl 700.pinctrl:已初始化zynq pinctrl
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 28, base_baud = 6249999) is a xuartps e0001000.serial:MMIO 0xe0001000(ir​​q = 28,base_baud = 6249999)上的ttyPS0是一个xuartps
console [ttyPS0] enabled 控制台[ttyPS0]已启用
bootconsole [earlycon0] disabled bootconsole [earlycon0]已禁用
vgaarb: loaded vgaarb:已加载
SCSI subsystem initialized SCSI子系统已初始化
usbcore: registered new interface driver usbfs usbcore:已注册的新接口驱动程序usbfs
usbcore: registered new interface driver hub usbcore:注册的新接口驱动程序中心
usbcore: registered new device driver usb usbcore:已注册的新设备驱动程序usb
media: Linux media interface: v0.10 媒体:Linux媒体接口:v0.10
Linux video capture interface: v2.00 Linux视频捕获接口:v2.00
pps_core: LinuxPPS API ver. pps_core:LinuxPPS API版本。 1 registered 1个注册
pps_core: Software ver. pps_core:软件版本。 5.3.6 - Copyright 2005-2007 Rodolfo Giometti 5.3.6-版权所有2005-2007 Rodolfo Giometti
PTP clock support registered 已注册PTP时钟支持
EDAC MC: Ver: 3.0.0 EDAC MC:版本:3.0.0
FPGA manager framework FPGA管理器框架
fpga-region fpga-full: FPGA Region probed fpga区域fpga完整:探测到的FPGA区域
Advanced Linux Sound Architecture Driver Initialized. 初始化高级Linux声音体系结构驱动程序。
clocksource: Switched to clocksource arm_global_timer clocksource:切换到clocksource arm_global_timer
NET: Registered protocol family 2 NET:注册协议族2
TCP established hash table entries: 8192 (order: 3, 32768 bytes) TCP建立的哈希表条目:8192(顺序:3,32768字节)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes) TCP绑定哈希表条目:8192(顺序:4、65536字节)
TCP: Hash tables configured (established 8192 bind 8192) TCP:已配置哈希表(已建立8192绑定8192)
UDP hash table entries: 512 (order: 2, 16384 bytes) UDP哈希表条目:512(顺序:2、16384字节)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes) UDP-Lite哈希表条目:512(顺序:2、16384字节)
NET: Registered protocol family 1 NET:注册协议系列1
RPC: Registered named UNIX socket transport module. RPC:注册的命名UNIX套接字传输模块。
RPC: Registered udp transport module. RPC:注册的udp传输模块。
RPC: Registered tcp transport module. RPC:已注册的tcp传输模块。
RPC: Registered tcp NFSv4.1 backchannel transport module. RPC:已注册的tcp NFSv4.1反向通道传输模块。
PCI: CLS 0 bytes, default 64 PCI:CLS 0字节,默认64
hw perfevents: no interrupt-affinity property for /pmu@f8891000, guessing. 硬件性能:猜测/ pmu @ f8891000没有中断相似性属性。
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available 硬件性能:通过armv7_cortex_a9 PMU驱动程序启用,有7个计数器
workingset: timestamp_bits=30 max_order=18 bucket_order=0 工作集:timestamp_bits = 30 max_order = 18 bucket_order = 0
jffs2: version 2.2. jffs2:2.2版。 (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc. (NAND)(摘要)©2001-2006 Red Hat,Inc.
bounce: pool size: 64 pages 跳出:泳池大小:64页
io scheduler noop registered io Scheduler Noop已注册
io scheduler deadline registered io Scheduler截止日期已注册
io scheduler cfq registered (default) io调度程序cfq已注册(默认)
io scheduler mq-deadline registered io Scheduler MQ截止日期已注册
io scheduler kyber registered io调度程序kyber注册
cma: cma_alloc(cma c184d3e0, count 1, align 0) cma:cma_alloc(cma c184d3e0,计数1,对齐0)
cma: cma_alloc(): returned effbf000 cma:cma_alloc():返回effbf000
dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330 dma-pl330 f8003000.dmac:已加载PL330 DMAC-241330的驱动程序
dma-pl330 f8003000.dmac: DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16 dma-pl330 f8003000.dmac:DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
brd: module loaded loop: module loaded m25p80 spi0.0: found s25fl128s, expected n25q512a m25p80 spi0.0: s25fl128s (16384 Kbytes) brd:模块加载循环:模块加载m25p80 spi0.0:找到s25fl128s,预期的n25q512a m25p80 spi0.0:s25fl128s(16384 KB)
4 ofpart partitions found on MTD device spi0.0 在MTD设备spi0.0上找到4个partpart分区
Creating 4 MTD partitions on "spi0.0": 在“ spi0.0”上创建4个MTD分区:
0x000000000000-0x000000500000 : "boot" 0x000000000000-0x000000500000:“启动”
0x000000500000-0x000000520000 : "bootenv" 0x000000500000-0x000000520000:“ bootenv”
0x000000520000-0x000000fa0000 : "kernel" 0x000000520000-0x000000fa0000:“内核”
0x000000fa0000-0x000001000000 : "spare" 0x000000fa0000-0x000001000000:“备用”
libphy: Fixed MDIO Bus: probed libphy:固定的MDIO总线:已探测
CAN device driver interface CAN设备驱动程序接口
libphy: MACB_mii_bus: probed libphy:MACB_mii_bus:已探查

cma: cma_alloc(cma c184d3e0, count 1, align 0) cma:cma_alloc(cma c184d3e0,计数1,对齐0)
cma: cma_alloc(): returned effbf020 cma:cma_alloc():返回effbf020
mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA mmc0:使用ADMA在e0100000.sdhci [e0100000.sdhci]上的SDHCI控制器
ledtrig-cpu: registered to indicate activity on CPUs ledtrig-cpu:注册以指示CPU上的活动
usbcore: registered new interface driver usbhid usbcore:已注册的新接口驱动程序usbhid
usbhid: USB HID core driver usbhid:USB HID核心驱动程序
fpga_manager fpga0: Xilinx Zynq FPGA Manager registered fpga_manager fpga0:Xilinx Zynq FPGA Manager已注册
NET: Registered protocol family 10 NET:注册协议族10

Freeing unused kernel memory: 15360K 释放未使用的内核内存:15360K
udevd[758]: starting version 3.2.2 udevd [758]:起始版本3.2.2
udevd[759]: starting eudev-3.2.2 udevd [759]:启动eudev-3.2.2
cma: cma_alloc(cma c184d3e0, count 1, align 0) cma:cma_alloc(cma c184d3e0,计数1,对齐0)
cma: cma_alloc(): returned effbf040 cma:cma_alloc():返回effbf040
cma: cma_alloc(cma c184d3e0, count 1, align 0) cma:cma_alloc(cma c184d3e0,计数1,对齐0)
cma: cma_alloc(): returned effbf060 cma:cma_alloc():返回effbf060
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready IPv6:ADDRCONF(NETDEV_UP):eth0:链接未准备好
macb e000b000.ethernet eth0: link up (1000/Full) macb e000b000.ethernet eth0:链接(1000 /完整)
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready IPv6:ADDRCONF(NETDEV_CHANGE):eth0:链接已准备就绪
luscher2: disagrees about version of symbol module_layout luscher2:不同意符号module_layout的版本
random: crng init done 随机:crng初始化完成
luscher2: disagrees about version of symbol module_layout luscher2:不同意符号module_layout的版本
luscher2: disagrees about version of symbol module_layout luscher2:不同意符号module_layout的版本
luscher3: loading out-of-tree module taints kernel. luscher3:加载树外模块taints内核。
luscher 40400000.dma: Device Tree Probing luscher 40400000.dma:设备树探测
luscher 40400000.dma: luscher at 0x40400000 mapped to 0xf2990000, irq=49 luscher 40400000.dma:位于0x40400000的luscher映射到0xf2990000,irq = 49
buff size 0x00000000 增益大小0x00000000
buff number 0x00000000 增益号0x00000000
cma: cma_alloc(cma c184d3e0, count 0, align 8) cma:cma_alloc(cma c184d3e0,计数0,对齐8)
luscher 40400000.dma: Buffer memory allocation failed luscher 40400000.dma:缓冲区内存分配失败
Buffer memory allocation failed 缓冲存储器分配失败
luscher: probe of 40400000.dma failed with error -12 luscher:40400000.dma探针失败,错误-12

函数cma_alloc参数count等于0,它直接返回失败,请检查下面的count参数:

cma: cma_alloc(cma c184d3e0, count 0, align 8)

in my case it was a difference between the name set in the field "compatible" of the device tree and the name of the module (they must match). 就我而言,这是在设备树的“兼容”字段中设置的名称与模块名称(它们必须匹配)之间的区别。 I also increase the coherent_pool with : 我还通过增加了coherent_pool:

chosen {
        bootargs = "console=ttyPS0,115200 earlyprintk coherent_pool=32MiB";
           };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM