ikwzm / udmabuf

User space mappable dma buffer device driver for Linux.
BSD 2-Clause "Simplified" License
539 stars 165 forks source link

Unsupported node format error in Dmesg #104

Closed noelpedro closed 1 year ago

noelpedro commented 1 year ago

Hi Ichiro, anythin obvious in my DTS node that may cause the unsupported node fomrat error?

[    0.000000] OF: fdt: Reserved memory: unsupported node format, ignoring
[    0.000000] cma: Reserved 1252 MiB at 0x000000002f800000

  reserved-memory {
        #address-cells = <2>;
        #size-cells = <1>;
        ranges;
        ddr4_buf0: ddr4_buf@0 {
                compatible = "shared-dma-pool";
                reusable;
                reg = <0x00000005 0x00000000 0x00000000 0x40000000>;
                label = "ddr4_buf0";
                };

        };

        udmabuf@0 {
                compatible = "ikwzm,u-dma-buf";
                device-name = "udmabuf0";
                size = <0x40000000>; // 1GiB
                memory-region = <&ddr4_buf0>;

        };
noelpedro commented 1 year ago

size cell and address cells should each be 2?

noelpedro commented 1 year ago

Fixed it by writing =2, but now getting kernel panic.

[    0.000000] OF: reserved mem: initialized node ddr4_buf@0, compatible id shared-dma-pool
[    0.000000] cma: Reserved 1252 MiB at 0x000000002f800000
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000000000000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000087fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000007fefffff]
[    0.000000]   node   0: [mem 0x0000000800000000-0x000000087fffffff]
[    0.000000] Zeroed struct page in unavailable ranges: 256 pages
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000087fffffff]
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 22 pages/cpu s50968 r8192 d30952 u90112
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: ARM erratum 845719
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1031940
[    0.000000] Kernel command line: console=ttyPS0,115200 earlycon root=/dev/mmcblk0p2 rw rootwait cma=1250M
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0x000000002b800000-0x000000002f800000] (64MB)
[    0.000000] Memory: 2742972K/4193280K available (11776K kernel code, 922K rwdata, 6512K rodata, 1856K init, 546K bss, 18446744073708671300K reserved, 2330624K cma-reserved)
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GIC: Adjusting CPU interface base to 0x00000000f902f000
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] random: get_random_bytes called from start_kernel+0x31c/0x524 with crng_init=0
[    0.000000] arch_timer: cp15 timer(s) running at 99.99MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x171015c90f, max_idle_ns: 440795203080 ns
[    0.000003] sched_clock: 56 bits at 99MHz, resolution 10ns, wraps every 4398046511101ns
[    0.008326] Console: colour dummy device 80x25
[    0.012395] Calibrating delay loop (skipped), value calculated using timer frequency.. 199.99 BogoMIPS (lpj=399996)
[    0.022754] pid_max: default: 32768 minimum: 301
[    0.027488] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.034702] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.043556] rcu: Hierarchical SRCU implementation.
[    0.047515] EFI services will not be available.
[    0.051880] smp: Bringing up secondary CPUs ...
[    0.056623] Detected VIPT I-cache on CPU1
[    0.056664] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.057069] Detected VIPT I-cache on CPU2
[    0.057095] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.057481] Detected VIPT I-cache on CPU3
[    0.057506] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.057558] smp: Brought up 1 node, 4 CPUs
[    0.091694] SMP: Total of 4 processors activated.
[    0.096367] CPU features: detected: 32-bit EL0 Support
[    0.101471] CPU features: detected: CRC32 instructions
[    0.106610] CPU: All CPU(s) started at EL2
[    0.110652] alternatives: patching kernel code
[    0.116140] devtmpfs: initialized
[    0.124711] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.128809] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.135717] ------------[ cut here ]------------
[    0.140218] WARNING: CPU: 0 PID: 1 at mm/cma.c:106 cma_init_reserved_areas+0x80/0x178
[    0.147993] Modules linked in:
[    0.151025] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-xilinx-v2021.2 #1
[    0.158200] Hardware name: ZynqMP Ultrazed EV (DT)
[    0.162960] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
[    0.168929] pc : cma_init_reserved_areas+0x80/0x178
[    0.173772] lr : cma_init_reserved_areas+0x7c/0x178
[    0.178614] sp : ffff80001157bd30
[    0.181901] x29: ffff80001157bd30 x28: 0000000000000000
[    0.187178] x27: ffff8000114d8610 x26: 0000000000000200
[    0.192454] x25: ffff8000110cccc0 x24: 0000000000000000
[    0.197731] x23: fffffdffffe00000 x22: ffff80001118e698
[    0.203007] x21: ffff800011217124 x20: 0000000000500000
[    0.208284] x19: ffff8000114d8610 x18: 0000000000000030
[    0.213560] x17: 00048ccabe7f7ca0 x16: 000000000000000d
[    0.218837] x15: 0000000000000001 x14: 000000000007adfa
[    0.224114] x13: ffff80001149bf78 x12: 0000000000000006
[    0.229390] x11: ffff80001129e7b8 x10: 0000000000000000
[    0.234666] x9 : 0000000000000000 x8 : ffff0008002e8000
[    0.239943] x7 : 0000000000000000 x6 : 000000000000003f
[    0.245220] x5 : ffff8000114d8000 x4 : 0000000000000000
[    0.250496] x3 : ffff00087f7c5f40 x2 : 0000000000500000
[    0.255773] x1 : 0000000000000000 x0 : 0000000000000000
[    0.261050] Call trace:
[    0.263475]  cma_init_reserved_areas+0x80/0x178
[    0.267973]  do_one_initcall+0x54/0x1bc
[    0.271779]  kernel_init_freeable+0x1f4/0x264
[    0.276104]  kernel_init+0x14/0x114
[    0.279562]  ret_from_fork+0x10/0x3c
[    0.283109] ---[ end trace 53e9dd6be7bcf3d8 ]---
[    0.287709] Unable to handle kernel paging request at virtual address fffffe0013e00000
[    0.295569] Mem abort info:
[    0.298331]   ESR = 0x96000006
[    0.301365]   EC = 0x25: DABT (current EL), IL = 32 bits
[    0.306640]   SET = 0, FnV = 0
[    0.309663]   EA = 0, S1PTW = 0
[    0.312781] Data abort info:
[    0.315631]   ISV = 0, ISS = 0x00000006
[    0.319442]   CM = 0, WnR = 0
[    0.322380] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000013f0000
[    0.329044] [fffffe0013e00000] pgd=000000087f7c4003, p4d=000000087f7c4003, pud=000000087f7c3003, pmd=0000000000000000
[    0.339601] Internal error: Oops: 96000006 [#1] SMP
[    0.344436] Modules linked in:
[    0.347466] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W         5.10.0-xilinx-v2021.2 #1
[    0.356027] Hardware name: ZynqMP Ultrazed EV (DT)
[    0.360787] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
[    0.366756] pc : cma_init_reserved_areas+0x94/0x178
[    0.371600] lr : cma_init_reserved_areas+0x7c/0x178
[    0.376441] sp : ffff80001157bd30
[    0.379729] x29: ffff80001157bd30 x28: 0000000000000640
[    0.385005] x27: ffff8000114d8610 x26: 0000000000000200
[    0.390282] x25: ffff8000110cccc0 x24: 0000000000000000
[    0.395558] x23: fffffdffffe00000 x22: ffff80001118e698
[    0.400835] x21: ffff800011217124 x20: 0000000000500000
[    0.406111] x19: ffff8000114d8610 x18: 0000000000000030
[    0.411388] x17: 00048ccabe7f7ca0 x16: 000000000000000d
[    0.416664] x15: 0000000000000001 x14: 000000000007adfa
[    0.421941] x13: ffff80001149bf78 x12: 0000000000000006
[    0.427217] x11: ffff80001129e7b8 x10: 0000000000000000
[    0.432494] x9 : 0000000000000000 x8 : ffff0008002e8000
[    0.437771] x7 : 0000000000000000 x6 : 000000000000003f
[    0.443047] x5 : ffff8000114d8000 x4 : 0000000000000000
[    0.448324] x3 : ffff00087f7c5f40 x2 : 0000000000500000
[    0.453600] x1 : 0000000000000000 x0 : 0000000014000000
[    0.458876] Call trace:
[    0.461302]  cma_init_reserved_areas+0x94/0x178
[    0.465799]  do_one_initcall+0x54/0x1bc
[    0.469606]  kernel_init_freeable+0x1f4/0x264
[    0.473930]  kernel_init+0x14/0x114
[    0.477390]  ret_from_fork+0x10/0x3c
[    0.480940] Code: f94002c0 d280c81c cb803280 d37ae400 (f8776815)
[    0.486997] ---[ end trace 53e9dd6be7bcf3d9 ]---
[    0.491584] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    0.499188] SMP: stopping secondary CPUs
[    0.503086] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
ikwzm commented 1 year ago

This issue does not seem to be related to u-dma-buf. Please check your device tree.

noelpedro commented 1 year ago

True, I Believe that memory region is also being allocated by the default ddr node generated by petalinux.

noelpedro commented 1 year ago

deleted the auto generated ddr node, but still got the error. Commented out my udmabuf node now I dont see the kernel panic. anything in my device tree udmbuf node that my be wrong?

noelpedro commented 1 year ago

For my system the reusable flag was causing the kernel panic, now I'm able to do 1GiB udmabuf and 1 Gb reserved memory region.