R7500v2 kernel 4.19 test

This is a learning exercise for myself, but in the event this is of interest to others....

In short: after a few edits, it seems to mostly work (ipv6, ath10k-ct, 2.4 and 5 GHz wifi, guest networks, strongswan, a few firewall rules for a custom etherwake server wol script).

root@OpenWrt:~# uname -a
Linux OpenWrt 4.19.52 #0 SMP Thu Jun 20 11:23:37 2019 armv7l GNU/Linux
root@OpenWrt:~# uptime
 21:09:10 up  5:07,  load average: 0.00, 0.03, 0.00
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.5M      3.5M         0 100% /rom
tmpfs                   233.1M      1.1M    232.0M   0% /tmp
/dev/ubi0_1              78.7M     19.7M     55.0M  26% /overlay
overlayfs:/overlay       78.7M     19.7M     55.0M  26% /
tmpfs                   512.0K         0    512.0K   0% /dev

I started with master and cherry picked the ipq806x kernel 4.19 commit from here. This commit does not (yet) have the changes to qcom-ipq8064-r7500v2.dts to expand the overlay (see PR 1922). I made the overlay expansion change to the 4.19 dts file since I want to upgrade/downgrade via sysupgrade from luci.

In the absence of other knowledge about usb and kernel 4.19 on the r7500v2, I edited the qcom-ipq8064.dtsi and qcom-ipq8064-r7500v2.dts (only the usb entries) following the discussion about usb on r7800 and 4.19 (see this response) from @Ansuel.

After some help from @Ansuel (see posts below), USB is now working.

There are a few "failures" in dmesg that don't show up in 4.14 related to cpu idle and temperature sensors (see below - collectd-mod-thermal does not display temperatures).

After make distclean, make menuconfig (I made no changes to my usual custom .config), make defconfig, and make kernel_menuconfig, i ran into this error applying a 4.19 kernel patch. Following @slh's advice in the next post of this thread and directly editing the patch to match that in 4.14 (I only needed to change a few lines) resolved the issue and I was able to build and sysupgrade the image without any trouble.

Helpful instructions (r7800) for tty serial tftp booting initramfs images for testing (i.e. avoid flashing) here. See this post below for a worked example on the r7500v2. For reference, the generic serial flashing guide. Example for the ipq8064 based NEC Aterm WG2600HP).

Does the switch usb driver show up in the kernel log?

I was just looking...

(I'll post a full dmesg shortly as there are other unrelated errors there that might be of interest)

kernel 4.14

dmesg | grep USB
[    4.789653] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.167060] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    5.299651] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    5.321695] hub 1-0:1.0: USB hub found
[    5.334846] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[    5.340068] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0  SuperSpeed
[    5.354662] hub 2-0:1.0: USB hub found
[    5.370194] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 3
[    5.392920] hub 3-0:1.0: USB hub found
[    5.406374] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 4
[    5.411598] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0  SuperSpeed
[    5.426159] hub 4-0:1.0: USB hub found

kernel 4.19

root@OpenWrt:~/local# dmesg | grep USB
[    5.277645] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.313939] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

this kind of feels like I did something silly and didn't enable some option or left an option configured that I should not have...

full kernel 4.19 dmesg here.

the unrelated errors (not seen on 4.14):

[    2.387338] qcom-tsens 900000.thermal-sensor: tsens init failed
[    2.407946] CPUidle arm: CPU 0 failed to init idle CPU ops
[    2.420694] CPUidle arm: CPU 1 failed to init idle CPU ops

collected mod thermal does not work but that's an issue for another day.

check in menuconfig on the kernel section if you have dwc3-qcom selected

also past the dtsi and the modified dts (from kernel 4.14 and kernel 4.19)

(p372.ob) [11] $ cat .config | grep dwc3
CONFIG_DEFAULT_kmod-usb-dwc3-of-simple=y
CONFIG_DEFAULT_kmod-usb-phy-qcom-dwc3=y
CONFIG_PACKAGE_kmod-usb-dwc3=y
CONFIG_PACKAGE_kmod-usb-dwc3-qcom=m

dwc3-qcom is an external package and hence I don't think I have it loaded, I'll load it...

I'll post the dts/dtsi files in a bit

remove usb phy qcom dwc3 and dwc3 of simple and install dwc3 qcom

yea, the router is unhappy if I just try to load dwc3-qcom on top of the others. I did make an attempt at rmmod but its not clear to me what phy-qcom-dwc3 and dwc3-of-simple provide from lsmod...

if you think the 4.19 moded dts/dtsi files look ok (here), I'll try to build again from a diffconfig without dwc3-of-simple and phy-qcom-dwc3.

Also kernel sources were updated so I'll likely fetch/rebase my repo

the dts looks ok... i think you should try with only dwc-qcom without phy and dwc-of-simple

1 Like

@Ansuel thank you very much, USB seems to be working (see below).

I'll poke around with USB a bit more after I sleep but I'm happy it works.

I'll leave this thread open for the duration that I'm testing and report back periodically.

For the benefit of others newish users who might run into this, make menuconfig and make defconfig both select kmod-usb-dwc3-of-simple and kmod-usb-phy-qcom-dwc3 due to makefile dependencies. They don't show up for me in menuconfig but I can see references to them if I explicitly search for them (using "/").

I had to edit the .config file by hand and ignore the warnings about an out of sync configuration when building. @slh suggested checking target/linux/ipq806x/Makefile and DEFAULT_PACKAGES to remove the dependencies.

"Build Box:"
(p372.ob) [118] $ cat .config | grep dwc3
# CONFIG_DEFAULT_kmod-usb-dwc3-of-simple is not set
# CONFIG_DEFAULT_kmod-usb-phy-qcom-dwc3 is not set
CONFIG_PACKAGE_kmod-usb-dwc3=y
CONFIG_PACKAGE_kmod-usb-dwc3-qcom=y

r7500v2:
root@OpenWrt:~# uname -a
Linux OpenWrt 4.19.53 #0 SMP Fri Jun 21 22:00:47 2019 armv7l GNU/Linux
root@OpenWrt:~# uptime
 21:45:06 up 9 min,  load average: 0.02, 0.16, 0.12
root@OpenWrt:~# dmesg | grep USB
[    5.173167] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    5.206383] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    5.333263] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    5.355592] hub 1-0:1.0: USB hub found
[    5.368144] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[    5.373520] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0  SuperSpeed
[    5.388004] hub 2-0:1.0: USB hub found
[    5.403631] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 3
[    5.426374] hub 3-0:1.0: USB hub found
[    5.439584] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 4
[    5.444960] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0  SuperSpeed
[    5.459447] hub 4-0:1.0: USB hub found
[  153.641381] usb 3-1: new high-speed USB device number 2 using xhci-hcd
[  153.911047] usb-storage 3-1:1.0: USB Mass Storage device detected
[  231.422619] usb 2-1: new SuperSpeed Gen 1 USB device number 2 using xhci-hcd
[  231.459106] usb-storage 2-1:1.0: USB Mass Storage device
root@OpenWrt:~# lsusb
Bus 003 Device 002: ID 058f:6387 Alcor Micro Corp. Flash Drive
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 0781:5597 SanDisk Corp. 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.5M      3.5M         0 100% /rom
tmpfs                   233.1M      1.0M    232.1M   0% /tmp
/dev/ubi0_1              78.7M     19.7M     55.0M  26% /overlay
overlayfs:/overlay       78.7M     19.7M     55.0M  26% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda2                 2.4M      2.4M     14.0K  99% /mnt/sda2
/dev/sdb1               231.4G     42.2G    189.2G  18% /mnt/sdb1
1 Like

yes think you should modify the makefile for ip806x for the specific target (r7500v2) to use dwc3-qcom instead of dwc3-of-simple

i'm a month that i'm testing kernel 4.19 and i can't see any problem with it. @chunkeey should start push changes to master

and get to be the scapegoat again for usb3 corruptions? Nah.

1 Like

if its your decision to make (i honestly don't know), then do so when you think its ready. I appreciate the effort and hope this thread doesn't cause grief to those who are making contributions.

Well we can at least push it as kernel testing.. by keeping it there we will never discover if we actually have problems with it. IMHO we need more tester. I'm not forcing you but mvebu and others target are already at 4.19 so... Anyway sorry if I caused you trouble.

average of 3 usb (buffered) disk reads via hdparm -tT /dev/sdx

Ubuntu 18.04.2 LTS (using a usb3 express card adapter), average of 3
average: 92.20 MB/s; stdev: 0.10;

r7500v2, 4.19.53
root@OpenWrt:~# uptime
11:04:03 up 1 day, 13:28, load average: 0.01, 0.02, 0.00
average: 88.69 MB/s; stdev: 0.89;

almost 4% slower which for me is not signifcant

well 4% from a x86 system is not that bad

I thought I'd take a look at the cpuidle and thermal sensor errors. My gut says these are not too important, perhaps already resolved, but something I can learn from.

This forum thread looks helpful regarding the thermal sensors - I'm still chewing through that.

EDIT: I'm still working through understanding cpuidle...

about cpu idle i just think that from kernel 4.14 to 4.19 they changed some struct that cpuidle custom driver use... the strange part is that it does compile without any complain... sooooooo ????

ty for responding.

I suppose it would be more beneficial to the community if I posted about the thermal sensors. I just suspect the fix for that is likely already known or easily adapted from previous efforts.

Searching around indicates the cpuidle error turns up elsewhere but I've not (yet) seen anyone talk much about it; hence, I suspect its not that important.

I was really looking for methods to track changes in the kernel tree so I could spot what changed a little more quickly. I suppose cloning the kernel tree via git and then using git log is better. @hnyman has good skills... This is only educational for myself and likely does not have much benefit to others. For the moment, I've fallen back into old habits, download 4.14 and 4.19 source, made some etags files, did some light source code reading and this also helped.

looking at the kernel files.... i notice that the config flag ARM_QCOM_CPUIDLE doesn't point to anything and does only selects arm-cpuidle...

the actually driver is not present the cpuidle driver dirs

this is the most recent patch i found of the actual qcom-cpuidle driver

https://patchwork.kernel.org/patch/5389101/

will try to compile with this