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

RK3588: edge: Bump kernel from v6.11 to v6.12-rc #7372

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f474d41
rk3588: edge: Copy kernel config from 6.11 to 6.12
ColorfulRhino Oct 13, 2024
1370ecc
rk3588: edge: Copy kernel patches from 6.11 to 6.12
ColorfulRhino Oct 13, 2024
b7e9509
rk3588: edge: Adapt kernel patches for 6.12
ColorfulRhino Oct 13, 2024
d687cfb
rk3588: Add note to hwrng patch about its reliabilty
ColorfulRhino Oct 13, 2024
1729ce2
rk3588: edge: Bump `edge` kernel from 6.11 to 6.12
ColorfulRhino Oct 13, 2024
fa9b0d4
rk3588: current: Rename OPi 5 patch to prevent duplicate number
ColorfulRhino Oct 13, 2024
2724aaf
rk3588: edge: Rename OPi 5 patch to prevent duplicate number
ColorfulRhino Oct 13, 2024
49bc671
kernel: mainline: Bump v6.12-rc2 to v6.12-rc3
ColorfulRhino Oct 14, 2024
78bcfde
rk3588: edge: Rewrite kernel config against v6.12-rc3
ColorfulRhino Oct 14, 2024
ad99f69
rk3588: edge: Enable newly added `CONFIG_RTW89_8852BT`
ColorfulRhino Oct 14, 2024
f9b3aa0
rk3588: edge: Enable newly added `CONFIG_VIDEO_HANTRO_HEVC_RFC`
ColorfulRhino Oct 14, 2024
2baccd6
board: cm3588-nas: Add HDMI support for `edge` kernel 6.12
ColorfulRhino Oct 14, 2024
5ebec11
rk3588: edge: Add new v10 patch for basic HDMI out support
ColorfulRhino Oct 18, 2024
b4fefa3
rk3588: edge: Enable new HDMI output driver in kernel config
ColorfulRhino Oct 18, 2024
c7f6f89
rk3588: edge: Enable kernel config option `CONFIG_NETKIT`
ColorfulRhino Oct 18, 2024
d5ed3de
rk3588: edge: Rewrite kernel patches against 6.12-rc3
ColorfulRhino Oct 18, 2024
71aef28
rk3588: edge: Update patch `Add HDMI0 node` to latest submitted
ColorfulRhino Oct 20, 2024
c868bc1
kernel: mainline: Bump v6.12-rc3 to v6.12-rc4
ColorfulRhino Oct 21, 2024
496233e
rk3588: edge: Rewrite kernel config against v6.12-rc4
ColorfulRhino Oct 21, 2024
696fb55
board: nanopc-t6: Add USB3 power supply and pwm fan to DTS
ColorfulRhino Oct 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11,138 changes: 11,138 additions & 0 deletions config/kernel/linux-rockchip-rk3588-6.12.config

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/sources/families/rockchip-rk3588.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ case $BRANCH in
edge)
# Branch based on the latest kernel release including RC releases, to benefit from the latest RK3588 mainline advancements. Might be unstable!
LINUXFAMILY=rockchip-rk3588
KERNEL_MAJOR_MINOR="6.11" # Major and minor versions of this kernel.
KERNEL_MAJOR_MINOR="6.12" # Major and minor versions of this kernel.
LINUXCONFIG="linux-rockchip-rk3588-${KERNEL_MAJOR_MINOR}" # Attention: not -${BRANCH} (edge/current/legacy), but -${KERNEL_MAJOR_MINOR} thus 6.8 / 6.10 etc
# No need to set KERNELPATCHDIR, since default is: KERNELPATCHDIR='archive/rockchip-rk3588-${KERNEL_MAJOR_MINOR}'
;;
Expand Down
2 changes: 1 addition & 1 deletion config/sources/mainline-kernel.conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
function mainline_kernel_decide_version__upstream_release_candidate_number() {
[[ -n "${KERNELBRANCH}" ]] && return 0 # if already set, don't touch it; that way other hooks can run in any order
if [[ "${KERNEL_MAJOR_MINOR}" == "6.12" ]]; then # @TODO: roll over to next MAJOR.MINOR and MAJOR.MINOR-rc1 when it is released
declare -g KERNELBRANCH="tag:v6.12-rc2"
declare -g KERNELBRANCH="tag:v6.12-rc4"
display_alert "mainline-kernel: upstream release candidate" "Using KERNELBRANCH='${KERNELBRANCH}' for KERNEL_MAJOR_MINOR='${KERNEL_MAJOR_MINOR}'" "info"
fi
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ From: Muhammed Efe Cetin <[email protected]>
Date: Thu, 16 Nov 2023 17:49:42 +0300
Subject: hwrng: rockchip: Add support for Rockchip HW RNG

Note by ColorfulRhino:
The driver 'drivers/char/hw_random/rockchip-rng.c' is already
implemented in mainline, but only for RK3568 as of kernel v6.12.
The hardware RNG in the RK3566 outputs very low entropy, see:
https://lore.kernel.org/linux-rockchip/[email protected]/

TODO: Check reliability and quality of entropy for this patched
HW RNG driver on RK3588. If it's bad like in the RK3566 case,
drop this patch.

---
drivers/char/hw_random/Kconfig | 13 +
drivers/char/hw_random/Makefile | 1 +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
config: # This is file 'patch/kernel/rockchip-rk3588-edge/0000.patching_config.yaml'

# PATCH NUMBERING INFO
#
# Patches should be ordered in such a way that general kernel patches are applied first, then SoC-related patches and at last board-specific patches
#
# Patch numbers in this folder are sorted by category:
#
# 00** for general patches
# 01** for GPU/HDMI related patches
# 08** for wireless patches
# 1*** for board specific patches:
# 101* for Rock-5B, 102* for Rock-5A and so on

# Just some info stuff; not used by the patching scripts
name: rockchip-rk3588-edge
kind: kernel
type: mainline # or: vendor
branch: linux-6.12.y
last-known-good-tag: v6.12.0
maintainers:
- { github: rpardini, name: Ricardo Pardini, email: [email protected], armbian-forum: rpardini }

# .dts files in these directories will be copied as-is to the build tree; later ones overwrite earlier ones.
# This is meant to provide a way to "add a board DTS" without having to null-patch them in.
dts-directories:
- { source: "dt", target: "arch/arm64/boot/dts/rockchip" }

# every file in these directories will be copied as-is to the build tree; later ones overwrite earlier ones
# This is meant as a way to have overlays, bare, in a directory, without having to null-patch them in.
# @TODO need a solution to auto-Makefile the overlays as well
overlay-directories:
- { source: "overlay", target: "arch/arm64/boot/dts/rockchip/overlay" }

# the Makefile in each of these directories will be magically patched to include the dts files copied
# or patched-in; overlay subdir will be included "-y" if it exists.
# No more Makefile patching needed, yay!
auto-patch-dt-makefile:
- { directory: "arch/arm64/boot/dts/rockchip", config-var: "CONFIG_ARCH_ROCKCHIP" }

# configuration for when applying patches to git / auto-rewriting patches (development cycle helpers)
patches-to-git:
do-not-commit-files:
- "MAINTAINERS" # constant churn, drop them. sorry.
- "Documentation/devicetree/bindings/arm/rockchip.yaml" # constant churn, conflicts on every bump, drop it. sorry.
do-not-commit-regexes: # Python-style regexes
- "^arch/([a-zA-Z0-9]+)/boot/dts/([a-zA-Z0-9]+)/Makefile$" # ignore DT Makefile patches, we've an auto-patcher now
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paolo Sabatino <[email protected]>
Date: Wed, 2 Oct 2024 19:30:34 +0300
Subject: compile .scr and install overlays in right path

---
scripts/Makefile.dtbinst | 13 +++++++++-
scripts/Makefile.dtbs | 8 +++++-
2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
index 111111111111..222222222222 100644
--- a/scripts/Makefile.dtbinst
+++ b/scripts/Makefile.dtbinst
@@ -33,7 +33,18 @@ endef

$(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d))))

-dtbs := $(notdir $(dtbs))
+# Very convoluted way to flatten all the device tree
+# directories, but keep the "/overlay/" directory
+
+# topmost directory (ie: from rockchip/overlay/rk322x-emmc.dtbo extracts rockchip)
+topmost_dir = $(firstword $(subst /, ,$(dtbs)))
+# collect dtbs entries which starts with "$topmost_dir/overlay/", then remove "$topmost_dir"
+dtbs_overlays = $(subst $(topmost_dir)/,,$(filter $(topmost_dir)/overlay/%, $(dtbs)))
+# collect the non-overlay dtbs
+dtbs_regular = $(filter-out $(topmost_dir)/overlay/%, $(dtbs))
+# compose the dtbs variable flattening all the non-overlays entries
+# and appending the overlays entries
+dtbs := $(notdir $(dtbs_regular)) $(dtbs_overlays)

endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL

diff --git a/scripts/Makefile.dtbs b/scripts/Makefile.dtbs
index 111111111111..222222222222 100644
--- a/scripts/Makefile.dtbs
+++ b/scripts/Makefile.dtbs
@@ -122,17 +122,23 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
quiet_cmd_dtc = DTC $(quiet_dtb_check_tag) $@
cmd_dtc = \
$(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
- $(DTC) -o $@ -b 0 $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) \
+ $(DTC) -@ -o $@ -b 0 $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) \
$(DTC_FLAGS) -d $(depfile).dtc.tmp $(dtc-tmp) ; \
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) \
$(cmd_dtb_check)

+quiet_cmd_scr = MKIMAGE $@
+cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@
+
$(obj)/%.dtb: $(obj)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
$(call if_changed_dep,dtc)

$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
$(call if_changed_dep,dtc)

+$(obj)/%.scr: $(src)/%.scr-cmd FORCE
+ $(call if_changed,scr)
+
# targets
# ---------------------------------------------------------------------------

--
Armbian

Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sebastian Reichel <[email protected]>
Date: Tue, 24 Oct 2023 16:09:35 +0200
Subject: math.h: add DIV_ROUND_UP_NO_OVERFLOW

Add a new DIV_ROUND_UP helper, which cannot overflow when
big numbers are being used.

Signed-off-by: Sebastian Reichel <[email protected]>
---
include/linux/math.h | 11 ++++++++++
1 file changed, 11 insertions(+)

diff --git a/include/linux/math.h b/include/linux/math.h
index 111111111111..222222222222 100644
--- a/include/linux/math.h
+++ b/include/linux/math.h
@@ -36,6 +36,17 @@

#define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP

+/**
+ * DIV_ROUND_UP_NO_OVERFLOW - divide two numbers and always round up
+ * @n: numerator / dividend
+ * @d: denominator / divisor
+ *
+ * This functions does the same as DIV_ROUND_UP, but internally uses a
+ * division and a modulo operation instead of math tricks. This way it
+ * avoids overflowing when handling big numbers.
+ */
+#define DIV_ROUND_UP_NO_OVERFLOW(n, d) (((n) / (d)) + !!((n) % (d)))
+
#define DIV_ROUND_DOWN_ULL(ll, d) \
({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; })

--
Armbian

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sebastian Reichel <[email protected]>
Date: Tue, 24 Oct 2023 16:13:50 +0200
Subject: clk: divider: Fix divisor masking on 64 bit platforms

The clock framework handles clock rates as "unsigned long", so u32 on
32-bit architectures and u64 on 64-bit architectures.

The current code casts the dividend to u64 on 32-bit to avoid a
potential overflow. For example DIV_ROUND_UP(3000000000, 1500000000)
= (3.0G + 1.5G - 1) / 1.5G = = OVERFLOW / 1.5G, which has been
introduced in commit 9556f9dad8f5 ("clk: divider: handle integer overflow
when dividing large clock rates").

On 64 bit platforms this masks the divisor, so that only the lower
32 bit are used. Thus requesting a frequency >= 4.3GHz results
in incorrect values. For example requesting 4300000000 (4.3 GHz) will
effectively request ca. 5 MHz. Requesting clk_round_rate(clk, ULONG_MAX)
is a bit of a special case, since that still returns correct values as
long as the parent clock is below 8.5 GHz.

Fix this by switching to DIV_ROUND_UP_NO_OVERFLOW, which cannot
overflow. This avoids any requirements on the arguments (except
that divisor should not be 0 obviously).

Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/clk/clk-divider.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index 111111111111..222222222222 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -220,7 +220,7 @@ static int _div_round_up(const struct clk_div_table *table,
unsigned long parent_rate, unsigned long rate,
unsigned long flags)
{
- int div = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
+ int div = DIV_ROUND_UP_NO_OVERFLOW(parent_rate, rate);

if (flags & CLK_DIVIDER_POWER_OF_TWO)
div = __roundup_pow_of_two(div);
@@ -237,7 +237,7 @@ static int _div_round_closest(const struct clk_div_table *table,
int up, down;
unsigned long up_rate, down_rate;

- up = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
+ up = DIV_ROUND_UP_NO_OVERFLOW(parent_rate, rate);
down = parent_rate / rate;

if (flags & CLK_DIVIDER_POWER_OF_TWO) {
@@ -473,7 +473,7 @@ int divider_get_val(unsigned long rate, unsigned long parent_rate,
{
unsigned int div, value;

- div = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
+ div = DIV_ROUND_UP_NO_OVERFLOW(parent_rate, rate);

if (!_is_valid_div(table, div, flags))
return -EINVAL;
--
Armbian

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sebastian Reichel <[email protected]>
Date: Tue, 24 Oct 2023 18:09:57 +0200
Subject: clk: composite: replace open-coded abs_diff()

Replace the open coded abs_diff() with the existing helper function.

Suggested-by: Andy Shevchenko <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
---
drivers/clk/clk-composite.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index 111111111111..222222222222 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -6,6 +6,7 @@
#include <linux/clk-provider.h>
#include <linux/device.h>
#include <linux/err.h>
+#include <linux/math.h>
#include <linux/slab.h>

static u8 clk_composite_get_parent(struct clk_hw *hw)
@@ -119,10 +120,7 @@ static int clk_composite_determine_rate(struct clk_hw *hw,
if (ret)
continue;

- if (req->rate >= tmp_req.rate)
- rate_diff = req->rate - tmp_req.rate;
- else
- rate_diff = tmp_req.rate - req->rate;
+ rate_diff = abs_diff(req->rate, tmp_req.rate);

if (!rate_diff || !req->best_parent_hw
|| best_rate_diff > rate_diff) {
--
Armbian

Loading