Hi, I’m working at support another PCIe device driver on Khadas VIM3 + kernel 4.9.
The default coherent_pool is set to 2MB in current fenix build. But the driver I’m working on needs a lot DMA coherent allocations (70MB at least).
How could I modify the fenix kernel source to support large DMA coherent allocations? Thanks.
numbqq
2
Hello @Harrison
Please edit dma_size=2M
in /boot/env.txt
to change the size.
E.g.
dma_size=70M
If you build from source code, you can edit this file: config/bootenv/amlogic_default_env.txt
Yes, I tried the parameter set to 4M or 8M. When setting dma_size to 8M, the kernel will reboot automatically after booting the khadas VIM3.
numbqq
4
Please check the booting logs about what happened.
When dma_size is set to 8M, it seems that kernel met a fault.
[ 6.322898@0] BUG: sleeping function called from invalid context at mm/slab.h:393
[ 6.322900@0] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/0
[ 6.322912@0] Preemption disabled at:[<ffffff8009ef0cec>] schedule_preempt_disabled+0x24/0x30
[ 6.322917@0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.232 #2
[ 6.322919@0] Hardware name: Khadas VIM3 (DT)
[ 6.322920@0] Call trace:
[ 6.322926@0] [ffffffc073ef7c10+ 112][<ffffff800908b2f0>] dump_backtrace+0x0/0x248
[ 6.322930@0] [ffffffc073ef7c80+ 32][<ffffff800908b5bc>] show_stack+0x24/0x30
[ 6.322935@0] [ffffffc073ef7ca0+ 48][<ffffff80094e91d8>] dump_stack+0xac/0xd4
[ 6.322939@0] [ffffffc073ef7cd0+ 64][<ffffff80090d7cf8>] ___might_sleep+0x108/0x160
[ 6.322942@0] [ffffffc073ef7d10+ 48][<ffffff80090d7da8>] __might_sleep+0x58/0x90
[ 6.322947@0] [ffffffc073ef7d40+ 96][<ffffff80092243a0>] kmem_cache_alloc_trace+0x228/0x290
[ 6.322952@0] [ffffffc073ef7da0+ 144][<ffffff80099f3d74>] osd_rdma_enable+0x2c4/0x798
[ 6.322955@0] [ffffffc073ef7e30+ 32][<ffffff80099f59f4>] osd_rdma_interrupt_done_clear+0x8c/0x98
[ 6.322960@0] [ffffffc073ef7e50+ 32][<ffffff80099df618>] vsync_isr+0x60/0x90
[ 6.322964@0] [ffffffc073ef7e70+ 112][<ffffff80091141a8>] __handle_irq_event_percpu+0x78/0x2c8
[ 6.322967@0] [ffffffc073ef7ee0+ 48][<ffffff8009114420>] handle_irq_event_percpu+0x28/0x60
[ 6.322970@0] [ffffffc073ef7f10+ 48][<ffffff80091144a8>] handle_irq_event+0x50/0x80
[ 6.322974@0] [ffffffc073ef7f40+ 64][<ffffff8009118474>] handle_fasteoi_irq+0xec/0x1d8
[ 6.322979@0] [ffffffc073ef7f80+ 32][<ffffff80091130dc>] generic_handle_irq+0x34/0x50
[ 6.322983@0] [ffffffc073ef7fa0+ 96][<ffffff80091137ec>] __handle_domain_irq+0x8c/0xf8
[ 6.322986@0] [ffffffc073ef8000+ 64][<ffffff8009081664>] gic_handle_irq+0x5c/0xb0
And PCIe was powered down.
[ 0.552974@4] amlogic-pcie-v2 fc000000.pcieA: amlogic_pcie_probe!
[ 0.555220@4] OF: PCI: host bridge /pcieA@fc000000 ranges:
[ 0.555252@4] OF: PCI: IO 0xfc600000..0xfc6fffff -> 0x00000000
[ 0.555275@4] OF: PCI: MEM 0xfc700000..0xfdffffff -> 0xfc700000
[ 0.556068@4] amlogic-pcie-v2 fc000000.pcieA: Set the RC Bus Master, Memory Space and I/O Space enables.
[ 0.556096@4] amlogic-pcie-v2 fc000000.pcieA: normal gpio
[ 0.556133@4] amlogic-pcie-v2 fc000000.pcieA: GPIO normal: amlogic_pcie_assert_reset
[ 0.647047@4] amlogic-pcie-v2 fc000000.pcieA: Error: Wait linkup timeout.
[ 0.823198@4] amlogic-pcie-v2 fc000000.pcieA: Error: Wait linkup timeout.
[ 0.999353@4] amlogic-pcie-v2 fc000000.pcieA: Error: Wait linkup timeout.
[ 1.351660@4] amlogic-pcie-v2 fc000000.pcieA: Error: Wait linkup timeout.
[ 1.527812@4] amlogic-pcie-v2 fc000000.pcieA: Error: Wait linkup timeout.
[ 1.703963@4] amlogic-pcie-v2 fc000000.pcieA: Error: Wait linkup timeout.
[ 1.880112@4] amlogic-pcie-v2 fc000000.pcieA: Error: Wait linkup timeout.
[ 2.056256@4] amlogic-pcie-v2 fc000000.pcieA: Error: Wait linkup timeout.
[ 2.232407@4] amlogic-pcie-v2 fc000000.pcieA: Error: Wait linkup timeout.
[ 2.326877@4] amlogic-pcie-v2 fc000000.pcieA: phy link never came up
[ 2.327014@4] amlogic-pcie-v2 fc000000.pcieA: PCI host bridge to bus 0000:00
[ 2.327038@4] pci_bus 0000:00: root bus resource [bus 00-ff]
[ 2.327058@4] pci_bus 0000:00: root bus resource [io 0x0000-0xfffff]
[ 2.327077@4] pci_bus 0000:00: root bus resource [mem 0xfc700000-0xfdffffff]
[ 2.327119@4] amlogic-pcie-v2 fc000000.pcieA: link timeout, disable PCIE PLL
[ 2.327143@4] amlogic-pcie-v2 fc000000.pcieA: power down pcie phy