Vim2 ethernet problem with - mainline kernel

@hyphop there is true mainline kernel, and then there’s various branches with lots of extra patches included (like mine). What kernel sources are you using?

for example this one: https://git.kernel.org/torvalds/t/linux-5.4-rc5.tar.gz

but u can use any previous ! its same
https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.3.7.tar.xz

if u know any workable mainline kernel source - plz share - i will happy to check it :wink:

hi @chewitt, :wink:

i have check libreelec image too!
and libreelec is no exception too! have same problems!!!

i think its common Ethernet problem for VIM2 and mainline linux
!!! poor Ethernet driver quality !!!
very interesting why nobody notice this issue ?! i now about this about 2 month already !

we can easy reproduce it

LibreELEC:/ $ uname -a
Linux LibreELEC 5.3.0-rc8 #1 SMP Wed Sep 11 11:52:50 MSK 2019 aarch64 GNU/Linux

LibreELEC:/ $ ping 8.8.8.8 -c1 && echo ok
ok

LibreELEC:/ $ dmesg -c >/dev/null

LibreELEC:/ $ ifconfig eth0 down

## after this ethernet never come again ;)
LibreELEC:/ $ ifconfig eth0 up
> ifconfig: ioctl 0x8914 failed: Device or resource busy

LibreELEC:/ $ dmesg -c
[  562.109408] meson8b-dwmac c9410000.ethernet eth0: PHY [0.2009087f:00] driver [RTL8211F Gigabit Ethernet]
[  562.109498] meson8b-dwmac c9410000.ethernet eth0: phy: setting supported 00,00000000,000062ff advertising 00,00000000,000062ff
[  562.224926] meson8b-dwmac c9410000.ethernet: Failed to reset the dma
[  562.225000] meson8b-dwmac c9410000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
[  562.225053] meson8b-dwmac c9410000.ethernet eth0: stmmac_open: Hw setup failed

LibreELEC:/ # ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: Network is unreachable

### well-done

similar here when going from mainline 5.3.1 to mainline 5.4.0
following appears on VIM2 serial console during boot for 5.4.0
(I run gentoo)

meson8b-dwmac c9410000.ethernet: Failed to reset the dma
meson8b-dwmac c9410000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed
meson8b-dwmac c9410000.ethernet eth0: stmmac_open: Hw setup failed

in .config I notice CONFIG_ARCH_HAS_DMA_MMAP_PGPROT disappeared from mainline 5.3.1 to mainline 5.4.0 and CONFIG_DMABUF_SELFTESTS appeared.

@hyphop : did you find a solution?

tnx for remind! i just forget publish it

this patch for any kernel 5.3.x or 5.4.x

just rebuild dtb

PS: u was a first who ask about this :wink:

1 Like

I don’t see this error on my current 5.4.x branch, but then I have backports from 5.5 added to the base upstream branch which may be the reason. Here’s my dmesg:

VIM2:~ # dmesg | grep dwmac
[    0.131651] meson8b-dwmac c9410000.ethernet: IRQ eth_wake_irq not found
[    0.132682] meson8b-dwmac c9410000.ethernet: IRQ eth_lpi not found
[    0.138856] meson8b-dwmac c9410000.ethernet: PTP uses main clock
[    0.138863] meson8b-dwmac c9410000.ethernet: no reset control found
[    0.139337] meson8b-dwmac c9410000.ethernet: User ID: 0x11, Synopsys ID: 0x37
[    0.139346] meson8b-dwmac c9410000.ethernet: 	DWMAC1000
[    0.139351] meson8b-dwmac c9410000.ethernet: DMA HW capability register supported
[    0.139355] meson8b-dwmac c9410000.ethernet: RX Checksum Offload Engine supported
[    0.139359] meson8b-dwmac c9410000.ethernet: COE Type 2
[    0.139362] meson8b-dwmac c9410000.ethernet: TX Checksum insertion supported
[    0.139366] meson8b-dwmac c9410000.ethernet: Wake-Up On Lan supported
[    0.139392] meson8b-dwmac c9410000.ethernet: Normal descriptors
[    0.139396] meson8b-dwmac c9410000.ethernet: Ring mode enabled
[    0.139400] meson8b-dwmac c9410000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    0.139406] meson8b-dwmac c9410000.ethernet: device MAC address 92:c7:b4:58:da:ba
[    5.644383] meson8b-dwmac c9410000.ethernet eth0: PHY [0.2009087f:00] driver [RTL8211F Gigabit Ethernet]
[    5.671721] meson8b-dwmac c9410000.ethernet eth0: No Safety Features support found
[    5.671748] meson8b-dwmac c9410000.ethernet eth0: PTP not supported by HW
[    5.671757] meson8b-dwmac c9410000.ethernet eth0: configuring for phy/rgmii link mode
[    9.284217] meson8b-dwmac c9410000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off

Current WIP branch is here: https://github.com/chewitt/linux/commits/amlogic-5.4-integ and defconfig is here: https://github.com/chewitt/LibreELEC.tv/blob/amlogic-master/projects/Amlogic/linux/linux.aarch64.conf

plz run ifconfig eth0 down ; ifconfig eth0 up before show dmesg

Ahh, okay. Now I see the same error. Has this been reported to any mailing lists? … if not, why not?

yes ! sure reported! but i have found solution only 2-3 weeks ago!

everybody was noticed about this problem! @narmstrong , @chewitt , @numbqq
but nobody check it :wink: 3 month already ! :wink:

if u can push this patch for mainline plz do it
tnx for response

If you feel that patch is the solution you should submit it to the linux-amlogic mailing list so that it can be reviewed and, if accepted, included in the kernel (maybe even backported as a fix). Sending small patches like this upstream is not hard (I’m proof that even non-coding ‘developers’ can do it) and all developers on the Khadas staff need to learn the habit. Upstream contribution is good for the Khadas brand and reputation. Expecting others to do your work for you is not so positive.

3 Likes

thanks, I will try this evening and report result here.

@hyphop
Congratulations (and thanks again): your patch works
(for gentoo network scripts in my case).
I wonder though why mainline broke this in between 5.3 and 5.4
Is this a kernel regression or a day-1 dtb issue? And, is it vim2 specific?
Clearly some (different) eth related DMA code in between 5.3 and 5.4 gets (not) called.
I have a s905 minimx-g which has similar dtb section and will check if your patch is needed there as well.

DTS in mainline kernel - have many wrong or missed parts for VIM2 VIM3 VIM3L devices - we will try to push fixes to mainline

2 Likes

^ that’s the best words I heard from Khadas in some time :slight_smile:

@chewitt looks like u very kind man :wink:

u must understand mainline is mainline - sometimes difficult to control changes!

@chewitt i ready to bet your codes same have some bugs error and problems

1 Like

@hyphop

FYI: s905 minimx-g meson-gxbb-p200 needs your patch too

So I kind of wonder if some change in kernel affects all amlogic and/or if some gentoo specific aspects happen to help reveal something related.

Personally I feel kernel should not have broken working ethernet from 5.3 to 5.4

Have a nice day

This series from Marting Blumenstingl is the one that changed ethernet reset behaviour: https://patchwork.kernel.org/cover/10997069/

Kernel maintainers will never knowingly break support for devices, but the kernel makes the assumption people are engaged in the open/public kernel development process. If people are not engaged; testing the proposed changes and providing feedback, the chance of a breaking or problem change being merged is higher. Khadas can help avoid future issues by subscribing to the linux-amlogic mailing list and becominig a proactive participant (and hopefully contributor).

@hyphop I guarantee there are bugs and mistakes in my code :slight_smile:

1 Like

big tnx @chewitt u can be very usefull !

very funny details! why somebody change something without testing !? and somebody accepted :wink:

this patch VIM2 https://patchwork.kernel.org/patch/10997079/
have wrong parts for VIM2

Reviewed-by: Neil Armstrong
Signed-off-by: Martin Blumenstingl

PS: Neil have been informed about this errors several times !!! but looks like very busy

PSS: ok i will goto subscribe :wink: