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,RFC] generic: Add support for 6.6 kernel version #14751

Merged
merged 35 commits into from Mar 11, 2024

Conversation

hackpascal
Copy link
Contributor

@hackpascal hackpascal commented Feb 29, 2024

Add support for 6.6 kernel version:

  • Based on newest main branch (2024-02-29)
  • All patches are refreshed
  • Dropped patches merged upstream
  • Fix any regression with kernel modules
  • Tested on LoongArch64 platform (target: add support for Loongson LoongArch64 (kernel 6.6) #14357)
  • Wireless drivers are now able to be successfully built (mac80211/mt76/ath10k-ct/rtl8812au-ct)
  • Tested with qca9880(ath10k/ath10k-ct), ar9287(ath9k), rtl8192c(rtl8192ce)

@1715173329
Copy link
Member

for the last commit, we have backports-6.6 now: fb45887

@github-actions github-actions bot added build/scripts/tools pull request/issues for build, scripts and tools related changes kernel pull request/issue with Linux kernel related changes core packages pull request/issue for core (in-tree) packages labels Feb 29, 2024
@hackpascal
Copy link
Contributor Author

for the last commit, we have backports-6.6 now: fb45887

That's great. I didn't notice that. lol

@dangowrt
Copy link
Member

dangowrt commented Mar 1, 2024

Make some more generic fixes and added tons missing symbols on top of this:
hackpascal#1

@robimarko
Copy link
Contributor

Great, it was about time for 6.6 as 5.15 and 6.1 are so annoying to work with.

@namiltd
Copy link
Contributor

namiltd commented Mar 1, 2024

I just created a 6.6 kernel support patch for the ralink mt7620 chipset: #14774 based on your PR.

@robimarko
Copy link
Contributor

@hackpascal I made a PR to fix the GPIO button driver:
hackpascal#2

@dangowrt
Copy link
Member

dangowrt commented Mar 1, 2024

Not sure if this is the right place to discuss this, but I want to open this debate:
Previously we decided to only add support for Linux 6.1 after branching of for openwrt-23.05. The argument was that once Linux 6.1 is supported nobody will care about 5.15 any more and that would hurt the release. In practice this resulted in additional workload for many people and in the end nobody can be "forced" to deal with the previous stable kernel if they don't want to.

So I suggest to not repeat this mistake and merge support for Linux 6.6 asap and for a short time keep all 3 kernel version (5.15, 6.1, 6.6) in tree. Keeping 5.15 makes sense to ease backports to the current stable openwrt-23.05 branch. And moving the targets which are already on 6.1 now to 6.6 should not be too difficult, so we can drop Linux 6.1 again once this was done.

@robimarko
Copy link
Contributor

@dangowrt I am all for adding 6.6 ASAP as having to deal with backporting more and more is just constantly increasing the workload.

Not to mention that 5.15 really needs to go away, its just too old at this point and if we ever want to have a new release its time to push for all targets to move to 6.1 ASAP.

@Borromini
Copy link

Borromini commented Mar 1, 2024

Looks like CONFIG_INGENIC_CGU_JZ4755 is another symbol that needs to be added to the generic config:

# CONFIG_INGENIC_CGU_JZ4755 is not set

I'm also seeing this, triggered by target/linux/generic/pending-6.6/205-backtrace_module_info.patch. Seems fallout of torvalds/linux@ac3b432:

lib/vsprintf.c: In function 'symbol_string':
lib/vsprintf.c:1013:40: error: 'struct module' has no member named 'core_layout'
 1013 |                          mod->name, mod->core_layout.base,
      |                                        ^~
lib/vsprintf.c:1014:29: error: 'struct module' has no member named 'core_layout'
 1014 |                          mod->core_layout.size);
      |                             ^~
make[8]: *** [scripts/Makefile.build:243: lib/vsprintf.o] Error 1
make[7]: *** [scripts/Makefile.build:480: lib] Error 2

@robimarko
Copy link
Contributor

There will be plenty of symbols to disable with the various target combos we have

@@ -128,6 +129,7 @@ $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compil
$(curdir)/sdcc/compile := $(curdir)/bison/compile
$(curdir)/squashfs3-lzma/compile := $(curdir)/lzma-old/compile
$(curdir)/squashfs4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile
$(curdir)/util-linux/compile := $(curdir)/bison/compile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious if it makes more sense to build with meson.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious if it makes more sense to build with meson.

I used meson at first, but it turns out that some components can't be disabled by meson and it finally lead to a build failure in buildbot container.

@dangowrt
Copy link
Member

dangowrt commented Mar 2, 2024

I was wondering why my port of mediatek target wouldn't boot and thought it might be smart to try armsr before, just to be sure that Aarch64 kernel in general boots fine on OpenWrt-patched Linux 6.6. Turns out it doesn't:

EFI stub: Booting Linux Kernel...
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services...
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.6.18 (daniel@box) (aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 12.3.0 r0+25396-b4c4d501fd) 12.3.0, GNU ld (GNU Binutils) 2.40.0) #0 SMP Fri Mar  1 14:03:22 2024
[    0.000000] random: crng init done
[    0.000000] Machine model: linux,dummy-virt
[    0.000000] efi: EFI v2.10 by Das U-Boot
[    0.000000] efi: RTPROP=0x7dd98040 SMBIOS=0x7dd94000 RNG=0x6cf6c040 MEMRESERVE=0x6cf6b040 
[    0.000000] earlycon: pl11 at MMIO 0x0000000009000000 (options '')
[    0.000000] printk: bootconsole [pl11] enabled
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x000000007fffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000007dd93fff]
[    0.000000]   node   0: [mem 0x000000007dd94000-0x000000007dd94fff]
[    0.000000]   node   0: [mem 0x000000007dd95000-0x000000007dd97fff]
[    0.000000]   node   0: [mem 0x000000007dd98000-0x000000007dd98fff]
[    0.000000]   node   0: [mem 0x000000007dd99000-0x000000007dd99fff]
[    0.000000]   node   0: [mem 0x000000007dd9a000-0x000000007dd9ffff]
[    0.000000]   node   0: [mem 0x000000007dda0000-0x000000007feeffff]
[    0.000000]   node   0: [mem 0x000000007fef0000-0x000000007fefffff]
[    0.000000]   node   0: [mem 0x000000007ff00000-0x000000007fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000007fffffff]
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] psci: SMC Calling Convention v1.0
[    0.000000] percpu: Embedded 17 pages/cpu s30888 r8192 d30552 u69632
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] alternatives: applying boot alternatives
[    0.000000] Kernel command line: BOOT_IMAGE=/efi/openwrt/vmlinux root=PARTUUID=1c5ba0b8-ab0b-d164-8e4f-98ce1603d002 rootwait earlycon noinitrd
[    0.000000] Unknown kernel command line parameters "BOOT_IMAGE=/efi/openwrt/vmlinux", will be passed to user space.
[    0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 258048
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: area num 1.
[    0.000000] software IO TLB: mapped [mem 0x0000000079cdc000-0x000000007dcdc000] (64MB)
[    0.000000] Memory: 949288K/1048576K available (7744K kernel code, 904K rwdata, 2072K rodata, 448K init, 375K bss, 99288K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=1.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] ------------[ cut here ]------------
[    0.000000] kernel BUG at kernel/kallsyms.c:340!
[    0.000000] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.6.18 #0
[    0.000000] Hardware name: linux,dummy-virt (DT)
[    0.000000] pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    0.000000] ------------[ cut here ]------------
[    0.000000] kernel BUG at kernel/kallsyms.c:340!

I will continue to look into this tomorrow, just posting now to share what I already found.
This is line 340 of kernel/kallsyms.c:

        BUG_ON(!kallsyms_offsets);

So this must be caused by one of our downstream hacks as, of course, it doesn't happen on vanilla Linux.

In order to get armsr (armv8) to build I had to add some more new module dependencies:

diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk
index dd17d868fa..67dbac7662 100644
--- a/package/kernel/linux/modules/crypto.mk
+++ b/package/kernel/linux/modules/crypto.mk
@@ -44,7 +44,7 @@ define KernelPackage/crypto-aead
          $(LINUX_DIR)/crypto/aead.ko \
          $(LINUX_DIR)/crypto/geniv.ko
   AUTOLOAD:=$(call AutoLoad,09,aead,1)
-  $(call AddDepends/crypto, +kmod-crypto-null)
+  $(call AddDepends/crypto, +kmod-crypto-null +kmod-crypto-rng)
 endef
 
 $(eval $(call KernelPackage,crypto-aead))
diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk
index 72504d8de7..2ba59f40d2 100644
--- a/package/kernel/linux/modules/netdevices.mk
+++ b/package/kernel/linux/modules/netdevices.mk
@@ -1573,7 +1573,7 @@ $(eval $(call KernelPackage,pcs-xpcs))
 define KernelPackage/stmmac-core
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Synopsis Ethernet Controller core (NXP,STMMicro,others)
-  DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8 +kmod-pcs-xpcs +kmod-ptp
+  DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8 +kmod-pcs-xpcs +LINUX_6_6:kmod-of-mdio +kmod-ptp
   KCONFIG:=CONFIG_STMMAC_ETH \
     CONFIG_STMMAC_SELFTESTS=n \
     CONFIG_STMMAC_PLATFORM \

Strangly when making kmod-crypto-aead's dependency on kmod-crypto-rng conditional on LINUX_6_6 that leads to scripts/package-metadata.pl eat 50 GiB of RAM within a short time and get killed by OOM-killer... Also that I did not yet get into in detail.

@hackpascal
Copy link
Contributor Author

This is line 340 of kernel/kallsyms.c:

        BUG_ON(!kallsyms_offsets);

So this must be caused by one of our downstream hacks as, of course, it doesn't happen on vanilla Linux.

Is this related to hackpascal#3 ?

@dangowrt
Copy link
Member

dangowrt commented Mar 2, 2024

Is this related to hackpascal#3 ?

Oh yes, that very obviously looks like the same problem.

Got most things working now:
https://github.com/dangowrt/openwrt/tree/mediatek-6.6

@hackpascal
Copy link
Contributor Author

I'm also seeing this, triggered by target/linux/generic/pending-6.6/205-backtrace_module_info.patch. Seems fallout of torvalds/linux@ac3b432:

replace mod->core_layout with mod->mem[MOD_TEXT] can solve this

@oliv3r
Copy link
Contributor

oliv3r commented Mar 2, 2024

@hackpascal thanks for the ping.

I've created #14713 last week, maybe the script is useful to do the bumping so that we can keep kernel history.

@robimarko wdyt?

@robimarko
Copy link
Contributor

@oliv3r I tested in on the ath25 bump and it seemed to work just fine

@oliv3r
Copy link
Contributor

oliv3r commented Mar 2, 2024 via email

@robimarko
Copy link
Contributor

Well, I seem to have got ipq807x working, but WLAN isnt working as PHY detection seems to be broken as I now have 4 PHY-s instead of 2

@nasbdh9
Copy link
Contributor

nasbdh9 commented Mar 2, 2024

In 6.6 kernel, the mpi.ko that the kmod-crypto-rsa module depends on is located at $(LINUX_DIR)/lib/crypto/mpi/mpi.ko. How should the makefile adapt to this directory change?

There are changes caused by this commit that are also worth investigating
torvalds/linux@ba51738

hackpascal and others added 23 commits March 11, 2024 20:17
Sort generic config for 6.6.

The sort commands:
$ ./scripts/kconfig.pl '+' target/linux/generic/config-6.6 /dev/null > target/linux/generic/config-6.6-new
$ mv target/linux/generic/config-6.6-new target/linux/generic/config-6.6

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Update fitblk driver which has previously been backported to Linux 6.1
so it can build and work with Linux 6.6.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Currently, the existing uncompressed kallsym support is causing qualcommax
boards to hang on boot, and only after earlycon and verbose BUG() prints
are enabled the trace is visible:
[    0.000000] ------------[ cut here ]------------
[    0.000000] kernel BUG at kernel/kallsyms.c:340!
[    0.000000] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP

Felix has fixed up the uncompressed kallsyms support so modify the current
patch with the fix.
All credits for the code go to Felix.

Signed-off-by: Robert Marko <robimarko@gmail.com>
Avoid crashing the kernel when trying to detect early versions of
RealTek RTL8221B 2.5G Ethernet PHY.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Adapt iio kmods for building under kernel 6.6:
* kmod-iio-lsm6dsx depends on kmod-kmod-industrialio-triggered-buffer
from 6.2

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Adapt input kmods for building under kernel 6.6:
* kmod-input-touchscreen-edt-ft5x06 depends on kmod-regmap-i2c
from 6.3 as it starts to use regmap to access registers
* CONFIG_HID_SUPPORT needs to be set in addition to CONFIG_HID.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Adapt netsupport kmods for building under kernel 6.6:
* common part of mqprio was split into a new Kconfig since 6.3.
Add new kmod-sched-mqprio-common as dependency for kmod-sched-mqprio.

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Adapt netdevices kmods for building under kernel 6.6:
* Add missing module dependency for kmod-stmmac-core on kmod-of-mdio.
* Invert criteria to allow Airoha EN8811H PHY driver to build with
  Linux 6.1 as well as Linux 6.6.
* Mellanox mlx5 driver started exposing thermal sensors and now it requires
  hwmon

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Adapt usb kmods for building under kernel 6.6:
* Add kmod-phylink as dependency for usb-net-asix
* Add kmod-net-selftests as dependency for usb-net-smsc95xx
* Add kmod-iio-core as dependency for usb-hid-mcp2221 as ADC/DAC
support was added since 6.2 which requires IIO.

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Adapt fs kmods for building under kernel 6.6:
* Add kmod-fs-netfs as dependency for kmod-fs-9p
* Add kmod-fs-netfs as dependency for fs-smbfs-common as netfs is
required for cifs since 6.3
* Add new kmod-nls-ucs2-utils as dependency for smbfs/jfs as UCS2
support was split as new module since 6.6.
* Add kmod-lib-zlib-deflate and kmod-lib-zlib-inflate as
dependencies for kmod-pstore due to crypto API compression was
replaced with zlib_deflate library calls since 6.6
* Remove nfs_ssc.ko from kmod-fs-nfs-common. The nfs_ssc was no
longer a kernel module described by NFS_V4_2_SSC_HELPER since 5.13 [1]

Link:
[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/fs/Kconfig?id=d9092b4bb2109502eb8972021a3f74febc931a63

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Adapt block kmods for building under kernel 6.6:
* To build scsi_transport_iscsi.ko, change CONFIG_SCSI_ISCSI_ATTRS
from =y to =m as this config is always tristate since 2.6.

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Adapt video kmods for building under kernel 6.6:
* Add drm_exec.ko and drm_suballoc_helper.ko for kmod-drm as they
are added since 6.6 and 6.4
* Add uvc.ko for kmod-video-uvc as related contents was split as a
new module since 6.3

Signed-off-by: Tan Zien <nabsdh9@gmail.com>
Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Adapt crypto kmods for building under kernel 6.6:
* mpi.ko moved from lib/mpi/mpi.ko to lib/crypto/mpi/mpi.ko
* jitterentropy_rng requires SHA3 support for kernel 6.6

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Tan Zien <nabsdh9@gmail.com>
Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Adapt hwmon kmods for building under kernel 6.6:
* ad7418 now requires regmap
* Invert criteria to allow adt7410 be built with Linux 6.1 as well
  as Linux 6.6.

Signed-off-by: Tan Zien <nabsdh9@gmail.com>
In kernel 6.5 geniv was split from AEAD config symbol, in order to manage
its dependencies on other code.

So, lets do the same in OpenWrt and split it from aead module so others
can depend on geniv directly.

Signed-off-by: Robert Marko <robimarko@gmail.com>
geniv was separated intentionally from aead in kernel 6.5, and since
we now have it packaged separately as well remove it from kmod-aead
in 6.6.

Signed-off-by: Robert Marko <robimarko@gmail.com>
…se it

Now that geniv is packaged separately for kernel 6.6, we need to add it
as a dependency to kmod-crypto-seqiv and kmod-crypto-echainiv that require
it under kernel 6.6.

Signed-off-by: Robert Marko <robimarko@gmail.com>
devm_gpiod_get_from_of_node() was removed since linux 6.2.
devm_fwnode_gpiod_get() is the recommended replacement.

Link:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/gpio/gpiolib-devres.c?id=650f2dc970539b3344a98c4bd18efa309e66623b

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Fix build failure with linux kernel 6.6

Related kernel commits:

20b0b53aca43 (genetlink: introduce split op representation)

bffcc6882a1b (genetlink: remove userhdr from struct genl_info)

e9a688bcb193 (random: use rejection sampling for uniform bounded
random integers)

3c202d14a9d7 (prandom: remove prandom_u32_max())

3d2f20ad46f8 (wifi: iwlwifi: Use generic thermal_zone_get_trip()
function)

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
A commit introduced in kernel 6.6 has splitted page_pool.h into
several headers. Thus the included header must be modified for a
successful build.

Ref: a9ca9f9ceff3 (page_pool: split types and declarations from
page_pool.h)

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Use the correct return status code to avoid incompatible type error

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Fix a build error caused by fortify checking memcpy data range.

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
Allow building fitblk with Linux 6.6 by depending on !LINUX_5_15
instead of LINUX_6_1.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
@openwrt-bot openwrt-bot merged commit b72a7bf into openwrt:main Mar 11, 2024
6 checks passed
@robimarko
Copy link
Contributor

Lets not delay this any further, we can always fixup stuff in main as well

@hackpascal
Copy link
Contributor Author

@guidosarducci

I'm referring to the host build of util-linux which you added in 4ee298a, and which is probably overkill for building just one host utility (hexdump) already widely available.

Then I have one question: how to ensure host-build of util-linux always being built before compiling linux kernel

Also, will you amend your commit 98164b8 to include the generic config update I mentioned? It probably belongs in that commit, but I can PR a separate change if you prefer.

You have to send another PR now XD

@namiltd namiltd mentioned this pull request Mar 12, 2024
42 tasks
@hackpascal hackpascal deleted the linux-v6.6 branch March 14, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build/scripts/tools pull request/issues for build, scripts and tools related changes core packages pull request/issue for core (in-tree) packages kernel pull request/issue with Linux kernel related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet