Part Number: AM6442
Hi,
I have some questions regarding SRAM requirements of the ICSSG ethernet driver. For some background, my goal is to allocate an SRAM bank for each R5 core. To accomplish the I have modified the device tree as follows:
oc_sram: sram@70000000 { compatible = "mmio-sram"; reg = <0x00 0x70000000 0x00 0x200000>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x00 0x70000000 0x200000>;
r5f0_0_sram: r5f0_1-sram@80000 { reg = <0x80000 0x40000>; };
r5f0_1_sram: r5f1_0-sram@c0000 { reg = <0xc0000 0x40000>; };
r5f1_0_sram: r5f1_1-sram@100000 { reg = <0x100000 0x40000>; };
r5f1_1_sram: r5f0_0-sram@140000 { reg = <0x140000 0x40000>; };
tfa-sram@1c0000 { reg = <0x1c0000 0x20000>; };
dmsc-sram@1e0000 { reg = <0x1e0000 0x1c000>; };
sproxy-sram@1fc000 { reg = <0x1fc000 0x4000>; }; };
My understading is that the above should be a valid allocation of the SRAM banks as the ICSSG ethernet driver should only require 384 KB of SRAM per this documentation:
|
SoC |
Mode |
SRAM Required per ICSSG Instance |
|---|---|---|
|
AM64X |
Emac Mode |
192 KB |
Note that I am using remoteproc to interface with the R5 cores, and therefore, it is my understanding that the first two 256 KB banks should be free to use as they are not reserved for a SBL. However, when attempting to boot with the above setup the Kernel panics:[ 9.563647] icssg-prueth ethernet: couldn't get ti,pa-stats syscon regmap[ 9.578398] SError Interrupt on CPU1, code 0x00000000bf000002 -- SError[ 9.578434] CPU: 1 UID: 0 PID: 28 Comm: kworker/u8:1 Tainted: G O 6.12.8-gbba00fec-00044-g133701b6ee76 #1[ 9.578450] Tainted: [O]=OOT_MODULE[ 9.578454] Hardware name: PHYTEC phyBOARD-Electra-AM64x RDK (DT)[ 9.578462] Workqueue: events_unbound deferred_probe_work_func[ 9.578494] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)[ 9.578503] pc : __memset_io+0x48/0x90[ 9.578518] lr : prueth_probe+0x378/0x980 [icssg_prueth][ 9.578537] sp : ffff80008168bb10[ 9.578541] x29: ffff80008168bb30 x28: ffff000001499800 x27: ffff00006fd8dbf0[ 9.578554] x26: ffff8000797219c8 x25: ffff00006fd8ea10 x24: ffff00006fd8e620[ 9.578567] x23: ffff000001499810 x22: ffff0000070330c0 x21: 0000000000040000[ 9.578579] x20: ffff000007033080 x19: 0000000000000000 x18: 0000000000000000[ 9.578590] x17: 0000000000000000 x16: 1fffe000001e1ec1 x15: 0000000000000001[ 9.578602] x14: ffffffffffffffff x13: 666c652e77662d68 x12: 74657572702d3175[ 9.578613] x11: 0000000000000000 x10: ffff80007a114985 x9 : 0000000000000008[ 9.578625] x8 : 0000000000000040 x7 : ffffffffffffffff x6 : ffff800081bc0000[ 9.578636] x5 : 0000000000000000 x4 : 0000000000000c70 x3 : ffff800081bbf398[ 9.578647] x2 : 0000000000040000 x1 : 0000000000000000 x0 : ffff800081b80000[ 9.578662] Kernel panic - not syncing: Asynchronous SError Interrupt[ 9.578670] CPU: 1 UID: 0 PID: 28 Comm: kworker/u8:1 Tainted: G O 6.12.8-gbba00fec-00044-g133701b6ee76 #1[ 9.578680] Tainted: [O]=OOT_MODULE[ 9.578683] Hardware name: PHYTEC phyBOARD-Electra-AM64x RDK (DT)[ 9.578687] Workqueue: events_unbound deferred_probe_work_func[ 9.578701] Call trace:[ 9.578706] dump_backtrace+0x90/0xe8[ 9.578721] show_stack+0x18/0x24[ 9.578731] dump_stack_lvl+0x34/0x8c[ 9.578750] dump_stack+0x18/0x24[ 9.578761] panic+0x390/0x3a4[ 9.578773] nmi_panic+0x40/0x8c[ 9.578784] arm64_serror_panic+0x64/0x70[ 9.578796] do_serror+0x3c/0x70[ 9.578803] el1h_64_error_handler+0x30/0x48[ 9.578814] el1h_64_error+0x64/0x68[ 9.578822] __memset_io+0x48/0x90[ 9.578830] platform_probe+0x68/0xc4[ 9.578842] really_probe+0xbc/0x29c[ 9.578852] __driver_probe_device+0x78/0x12c[ 9.578862] driver_probe_device+0xd8/0x15c[ 9.578872] __device_attach_driver+0xb8/0x134[ 9.578882] bus_for_each_drv+0x88/0xe8[ 9.578893] __device_attach+0xa0/0x190[ 9.578904] device_initial_probe+0x14/0x20[ 9.578914] bus_probe_device+0xac/0xb0[ 9.578923] deferred_probe_work_func+0x88/0xc0[ 9.578933] process_one_work+0x148/0x288[ 9.578948] worker_thread+0x2cc/0x3d4[ 9.578959] kthread+0x110/0x114[ 9.578971] ret_from_fork+0x10/0x20[ 9.578983] SMP: stopping secondary CPUs[ 9.579018] Kernel Offset: disabled[ 9.579021] CPU features: 0x00,00000080,00200000,4200420b[ 9.579030] Memory Limit: none[ 9.846574] ---[ end Kernel panic - not syncing: Asynchronous SError Interrupt ]---
The documentation above states that the driver should exit cleanly with "-ENOMEM error". I've briefly looked at the source code and it seems like `gen_pool_alloc_algo` is returning a non-null address, which is why the driver does not exit cleanly with -ENOMEM.
In my attempts to debug I adjusted the SRAM allocation to look like this (Shifted all R5 SRAM allocations down one bank) :
oc_sram: sram@70000000 { compatible = "mmio-sram"; reg = <0x00 0x70000000 0x00 0x200000>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x00 0x70000000 0x200000>;
r5f0_0_sram: r5f0_1-sram@c0000 { reg = <0xc0000 0x40000>; };
r5f0_1_sram: r5f1_0-sram@100000 { reg = <0x100000 0x40000>; };
r5f1_0_sram: r5f1_1-sram@140000 { reg = <0x140000 0x40000>; };
r5f1_1_sram: r5f0_0-sram@180000 { reg = <0x180000 0x40000>; };
tfa-sram@1c0000 { reg = <0x1c0000 0x20000>; };
dmsc-sram@1e0000 { reg = <0x1e0000 0x1c000>; };
sproxy-sram@1fc000 { reg = <0x1fc000 0x4000>; }; };
The above actually works, and I do not get the same Kernel panic on boot.
QUESTIONS:
1) Why does the ethernet driver need 768 KB of SRAM to work? Shouldn't it only need 384 KB, making two 256 KB banks more than enough?
2) Is there a way to explictly allocate SRAM for the ethernet driver instead of the driver allocating the first available unallocated region? Looking at the source code it seems like there is mulitple algorithms that can be utilized for the allocation of SRAM, or maybe I could do the following:
oc_sram: sram@70000000 { compatible = "mmio-sram"; reg = <0x00 0x70000000 0x00 0x200000>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x00 0x70000000 0x200000>;
prueth_sram: prueth-sram@00000 { reg = <0x00000 0x80000>; };
r5f0_0_sram: r5f0_1-sram@c0000 { reg = <0xc0000 0x40000>; };
...
ethernet { compatible = "ti,am642-icssg-prueth"; pinctrl-names = "default"; pinctrl-0 = <&icssg0_rgmii1_pins_default>, <&icssg0_rgmii2_pins_default>;
interrupt-parent = <&icssg0_intc>; interrupts = <24 0 2>, <25 1 3>; interrupt-names = "tx_ts0", "tx_ts1";
sram = <&prueth_sram>;
...
Thanks,
Jared