Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFT] bcm63xx: add testing support for kernel 5.4 #2887

Closed
wants to merge 11 commits into from

Conversation

adschm
Copy link
Member

@adschm adschm commented Apr 3, 2020

This adds testing support for kernel 5.4.

This has been compile-tested for all devices (selected by default) on generic subtarget.
*** This has not been run-tested since I own no bcm63xx device. ***

This is my first kernel bump, I mainly did it to learn how to do.
Consequently, review with care, particularly the Kernel config; with the patches, I don't expect major issues.

@KanjiMonster @Noltari

@adschm adschm added target/bcm63xx pull request/issue for bcm63xx target RFT pull request ready for testing labels Apr 3, 2020
@adschm adschm self-assigned this Apr 3, 2020
@Noltari
Copy link
Member

Noltari commented Apr 6, 2020

LGTM, but @KanjiMonster had already started working on it:
https://git.openwrt.org/?p=openwrt/staging/jogo.git;a=shortlog;h=refs/heads/brcm63xx-next

Tested on Comtrend AR-5387un:

[    0.000000] Linux version 5.4.28 (noltari@skynet) (gcc version 8.4.0 (OpenWrt GCC 8.4.0 r12787-af5ccfbac7)) #0 SMP Mon Apr 6 15:12:33 2020
[    0.000000] Detected Broadcom 0x6328 CPU revision b0
[    0.000000] CPU frequency is 320 MHz
[    0.000000] 64MB of RAM installed
[    0.000000] board_bcm963xx: Boot address 0xb8000000
[    0.000000] board_bcm963xx: CFE version: 1.0.37-110.11-2
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0002a075 (Broadcom BMIPS4350)
[    0.000000] board: board name: 96328A-1441N1
[    0.000000] MIPS: machine is Comtrend AR-5387un
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 16 bytes.
[    0.000000] Primary data cache 32kB, 2-way, VIPT, cache aliases, linesize 16 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000]   Normal zone: 144 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] percpu: Embedded 14 pages/cpu s26032 r8192 d23120 u57344
[    0.000000] pcpu-alloc: s26032 r8192 d23120 u57344 alloc=14*4096
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240
[    0.000000] Kernel command line: rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 56944K/65536K available (5059K kernel code, 206K rwdata, 1112K rodata, 1296K init, 201K bss, 8592K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=16, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 256
[    0.000000] random: get_random_bytes called from start_kernel+0x338/0x568 with crng_init=0
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 11945377789 ns
[    0.000020] sched_clock: 32 bits at 160MHz, resolution 6ns, wraps every 13421772796ns
[    0.008160] Calibrating delay loop... 318.46 BogoMIPS (lpj=636928)
[    0.050579] pid_max: default: 32768 minimum: 301
[    0.055757] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.063360] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.078245] rcu: Hierarchical SRCU implementation.
[    0.084579] smp: Bringing up secondary CPUs ...
[    0.089313] smp: Brought up 1 node, 1 CPU
[    0.103094] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.113241] futex hash table entries: 256 (order: 0, 4096 bytes, linear)
[    0.120476] pinctrl core: initialized pinctrl subsystem
[    0.127226] NET: Registered protocol family 16
[    0.377875] registering PCI controller with io_map_base unset
[    0.474319] PCI host bridge to bus 0000:00
[    0.478591] pci_bus 0000:00: root bus resource [mem 0x10f00000-0x10ffffff]
[    0.485678] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.492672] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.499663] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.507878] pci 0000:00:00.0: [14e4:6328] type 01 class 0x060400
[    0.514228] pci 0000:00:00.0: PME# supported from D0 D3hot
[    0.521442] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.530086] pci 0000:01:00.0: [14e4:a8d8] type 00 class 0x028000
[    0.536391] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00003fff 64bit]
[    0.543459] pci 0000:01:00.0: enabling Extended Tags
[    0.548733] pci 0000:01:00.0: supports D1 D2
[    0.554652] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.561521] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01
[    0.568369] pci 0000:00:00.0: BAR 8: assigned [mem 0x10f00000-0x10ffffff]
[    0.575383] pci 0000:01:00.0: BAR 0: assigned [mem 0x10f00000-0x10f03fff 64bit]
[    0.582938] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.588052] pci 0000:00:00.0:   bridge window [mem 0x10f00000-0x10ffffff]
[    0.607550] clocksource: Switched to clocksource MIPS
[    0.616305] NET: Registered protocol family 2
[    0.622707] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.631525] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.639523] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.646944] TCP: Hash tables configured (established 1024 bind 1024)
[    0.654098] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.661032] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.668959] NET: Registered protocol family 1
[    0.673665] PCI: CLS 0 bytes, default 16
[    0.692171] workingset: timestamp_bits=14 max_order=14 bucket_order=0
[    0.717582] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.723657] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.785157] bcm6328-pinctrl 10000080.pin-controller: registered at mmio (ptrval)
[    0.794422] pcieport 0000:00:00.0: enabling device (0000 -> 0002)
[    0.801956] 10000100.serial: ttyS0 at MMIO 0x10000100 (irq = 36, base_baud = 1562500) is a bcm63xx_uart
[    0.811741] printk: console [ttyS0] enabled
[    0.820355] printk: bootconsole [early0] disabled
[    0.851990] spi-nor spi1.0: mx25l12805d (16384 Kbytes)
[    0.858408] 3 fixed-partitions partitions found on MTD device spi1.0
[    0.865098] Creating 3 MTD partitions on "spi1.0":
[    0.870075] 0x000000000000-0x000000010000 : "cfe"
[    0.877325] 0x000000010000-0x000000ff0000 : "linux"
[    0.891188] parser_imagetag: rootfs: CFE image tag found at 0x0 with version 6, board type 96328A-1441N1
[    0.901057] parser_imagetag: Partition 0 is kernel offset 100 and length 203720
[    0.908603] parser_imagetag: Partition 1 is rootfs offset 203820 and length ddc7e0
[    0.916398] parser_imagetag: Spare partition is offset 3c0004 and length c1fffc
[    0.924010] 2 bcm963xx-imagetag partitions found on MTD device linux
[    0.930605] Creating 2 MTD partitions on "linux":
[    0.935467] 0x000000000100-0x000000203820 : "kernel"
[    0.943204] 0x000000203820-0x000000fe0000 : "rootfs"
[    0.950620] mtd: device 3 (rootfs) set to be root filesystem
[    0.962568] 1 squashfs-split partitions found on MTD device rootfs
[    0.969119] 0x0000003c0000-0x000000fe0000 : "rootfs_data"
[    0.977154] 0x000000ff0000-0x000001000000 : "nvram"
[    0.987042] libphy: Fixed MDIO Bus: probed
[    0.991953] bcm63xx_enetsw bcm63xx_enetsw.0: IRQ index 1 not found
[    1.040314] b53_common: found switch: BCM63xx, rev 0
[    1.046170] bcm63xx-wdt bcm63xx-wdt:  started, timer margin: 30 sec
[    1.055373] leds-gpio leds-gpio.0: Skipping unavailable LED gpio 0 ((null))
[    1.062613] leds-gpio leds-gpio.0: Skipping unavailable LED gpio 0 ((null))
[    1.069809] leds-gpio leds-gpio.0: Skipping unavailable LED gpio 0 ((null))
[    1.077001] leds-gpio leds-gpio.0: Skipping unavailable LED gpio 0 ((null))
[    1.084194] leds-gpio leds-gpio.0: Skipping unavailable LED gpio 0 ((null))
[    1.091772] bcma-pci-bridge 0000:01:00.0: enabling device (0000 -> 0002)
[    1.098794] bcma-pci-bridge 0000:01:00.0: bus0: Found chip with id 43225, rev 0x01 and package 0x0A
[    1.108204] bcma-pci-bridge 0000:01:00.0: bus0: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x22, class 0x0)
[    1.119211] bcma-pci-bridge 0000:01:00.0: bus0: Core 1 found: IEEE 802.11 (manuf 0x4BF, id 0x812, rev 0x17, class 0x0)
[    1.130326] bcma-pci-bridge 0000:01:00.0: bus0: Core 2 found: PCIe (manuf 0x4BF, id 0x820, rev 0x0F, class 0x0)
[    1.194849] random: fast init done
[    1.269426] bcma-pci-bridge 0000:01:00.0: bus0: Invalid SPROM read from the PCIe card, trying to use fallback SPROM
[    1.299629] bcma-pci-bridge 0000:01:00.0: bus0: Bus registered
[    1.308725] NET: Registered protocol family 10
[    1.323410] Segment Routing with IPv6
[    1.327477] NET: Registered protocol family 17
[    1.332195] 8021q: 802.1Q VLAN Support v1.8
[    1.348654] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    1.374004] Freeing unused kernel memory: 1296K
[    1.378709] This architecture does not have kernel memory protection.
[    1.385332] Run /sbin/init as init process
[    2.619725] init: Console is alive
[    2.623837] init: - watchdog -
[    3.188232] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.325021] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.343529] init: - preinit -
[    5.089664] random: jshn: uninitialized urandom read (4 bytes read)
[    5.181231] random: jshn: uninitialized urandom read (4 bytes read)
[    5.459850] random: jshn: uninitialized urandom read (4 bytes read)
[    6.395361] bcm63xx_enetsw bcm63xx_enetsw.0: link UP on Port 3, 100Mbps, full-duplex
[    6.405692] IPv6: ADDRCONF(NETDEV_CHANGE): eth0.1: link becomes ready
[    6.551511] urandom_read: 2 callbacks suppressed
[    6.551529] random: procd: uninitialized urandom read (4 bytes read)
[    7.390901] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   11.169805] jffs2: notice: (444) jffs2_build_xattr_subsystem: complete building xattr subsystem, 6 of xdatum (0 unchecked, 1 orphan) and 7 of xref (1 dead, 0 orphan) found.
[   11.192547] mount_root: switching to jffs2 overlay
[   11.249892] overlayfs: upper fs does not support tmpfile.
[   11.278230] urandom-seed: Seeding with /etc/urandom.seed
[   11.564708] procd: - early -
[   11.568044] procd: - watchdog -
[   12.329760] procd: - watchdog -
[   12.333717] procd: - ubus -
[   12.490711] random: ubusd: uninitialized urandom read (4 bytes read)
[   12.622001] random: ubusd: uninitialized urandom read (4 bytes read)
[   12.629888] random: ubusd: uninitialized urandom read (4 bytes read)
[   12.639651] procd: - init -
[   12.890943] random: crng init done
[   12.894397] random: 1 urandom warning(s) missed due to ratelimiting
[   14.121379] kmodloader: loading kernel modules from /etc/modules.d/*
[   14.556405] xt_time: kernel timezone is -0000
[   14.657898] PPP generic driver version 2.4.2
[   14.681229] NET: Registered protocol family 24
[   14.751511] kmodloader: done loading kernel modules from /etc/modules.d/*
[   14.971787] urngd: v1.0.2 started.
[   33.135369] bcm63xx_enetsw bcm63xx_enetsw.0: link UP on Port 3, 100Mbps, full-duplex
[   33.288681] br-lan: port 1(eth0.1) entered blocking state
[   33.294356] br-lan: port 1(eth0.1) entered disabled state
[   33.300660] device eth0.1 entered promiscuous mode
[   33.305646] device eth0 entered promiscuous mode
[   33.383369] br-lan: port 1(eth0.1) entered blocking state
[   33.388994] br-lan: port 1(eth0.1) entered forwarding state
[   34.143836] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready

@adschm
Copy link
Member Author

adschm commented Apr 8, 2020

Thanks @Noltari , can I add a Tested-by to the "bcm63xx: use kernel 5.4 as testing kernel " patch? (Mentioning the device...)

If there is no further response, I'd actually consider merging this during Easter weekend. If some config options are wrong, they should be easy to adjust later.

adschm added 11 commits April 9, 2020 01:11
Since kernel 4.15, init_timer is not available anymore, and has been
replaced by timer_setup. The fixes compilation of wl_linuc.c, which
returned the following errors beforehand (line-wrapped manually):

.../broadcom-wl-5.10.56.27.3/driver/wl_linux.c: In function 'wl_init_timer':
.../broadcom-wl-5.10.56.27.3/driver/wl_linux.c:2576:2: error: implicit
	declaration of function 'init_timer'; did you mean 'init_timers'?
	[-Werror=implicit-function-declaration]
  init_timer(&t->timer);
  ^~~~~~~~~~
  init_timers
.../broadcom-wl-5.10.56.27.3/driver/wl_linux.c:2577:10: error:
	'struct timer_list' has no member named 'data'
  t->timer.data = (ulong) t;
          ^
.../broadcom-wl-5.10.56.27.3/driver/wl_linux.c:2578:20: error: assignment
	to 'void (*)(struct timer_list *)' from incompatible pointer type
	'void (*)(ulong)' {aka 'void (*)(long unsigned int)'}
	[-Werror=incompatible-pointer-types]
  t->timer.function = wl_timer;

This should fix build of several devices on bcm63xx with testing
kernel (4.19).

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

---

This is only build-tested!
Copy config and patches to kernel 5.4.
make kernel_oldconfig has been run on 4.19 beforehand.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Refresh patches to make them apply to kernel 5.4.

The removed patches have been merged upstream.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Update config with make kernel_oldconfig.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This uses 5.4 as testing kernel. Since 4.19 has not seen broad
testing yet, just keep 4.14 as stable kernel until 5.4 is ready.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This patch follows the other patches that added the watchdog
core to various (armvirt, malta, ath79, ...) targets that
have been hit by the following build error:

Package kmod-hwmon-sch5627 is missing dependencies for the following libraries:
watchdog.ko

In theory, we could have just added the CONFIG_WATCHDOG_CORE=y
to the Kconfig variable of kmod-hwmon-sch5627's package definition.
This would have forced the watchdog core to be builtin and less
architectures would need to be updated. But we might as well follow
through here.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This adds two fixes for compilation with kernel 5.4:

1. dev_open from include/linux/netdevice.h needs a second parameter
   since kernel 5.0:
   00f54e68924e ("net: core: dev: Add extack argument to dev_open()")
2. get_ds() macro definition has been dropped since kernel 5.1:
   736706bee329 ("get rid of legacy 'get_ds()' function")
   Since get_ds() has been just a macro before, replace it in
   the driver instead of creating a version switch.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
In kernel 5.4 -Werror=implicit-fallthrough is treated as error:

arch/mips/bcm63xx/cpu.c: In function 'detect_cpu_clock':
arch/mips/bcm63xx/cpu.c:158:2: error: this statement may fall through [-Werror=implicit-fallthrough=]
  {
  ^
arch/mips/bcm63xx/cpu.c:179:2: note: here
  case BCM6328_CPU_ID:
  ^~~~
cc1: all warnings being treated as errors

This can be fixed by adding "Fall through" as a comment where intended,
and has to be fixed by returning a proper default otherwise.

In case of the default clock frequency for BCM6318 we fixed this by
returning the default value taken from BCM6328 and BCM6362.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
The helper syscon_regmap_lookup_by_pdevname has been removed in kernel patch
29d14b668d2f ("mfd: Remove unused helper syscon_regmap_lookup_by_pdevname")
due to lack of users.

However, we use this function in our local pinctrl drivers for BCM6358 and
BCM6368. Thus, we have to add it locally.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
In kernel patch 92ce7e83b4e5 ("driver_find_device: Unify the match
function with class_find_device()") the arguments of functions used
with driver_find_device are adjusted. Do the same for our local
user.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Since stable kernel for this target is still 4.14, kernel 4.19
has never been used much (and actually was broken for some devices).

So, since we bump testing kernel to 5.4, there is no real need to
keep 4.19 and have an additional version to care about.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
@adschm
Copy link
Member Author

adschm commented Apr 8, 2020

(Trivial) refresh due to kernel bump to 5.4.31.

@adschm
Copy link
Member Author

adschm commented Apr 12, 2020

Merged.

@adschm adschm closed this Apr 12, 2020
@Noltari
Copy link
Member

Noltari commented Apr 12, 2020

Thanks @adrianschmutzler,

I'm now testing kernel 5.4 on my HG556a as an AP on my network.
If I see no regressions I think we can move bcm63xx to linux 5.4.

BTW, I've also pushed 4e535d8 from @KanjiMonster, which disables devices with < 8MiB Flash or < 64MiB RAM.

@adschm
Copy link
Member Author

adschm commented Apr 12, 2020

If I see no regressions I think we can move bcm63xx to linux 5.4.

To be honest, for me this was mostly a code-play, I cannot really judge whether the target is ready for 5.4 or not. But I obviously won't stop you for the very same reason :-)

@adschm adschm deleted the bcm63kernel branch April 21, 2020 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFT pull request ready for testing target/bcm63xx pull request/issue for bcm63xx target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants