kernel: qca-ssdk: add kernel 6.1 support
authorRobert Marko <robimarko@gmail.com>
Tue, 23 May 2023 12:08:09 +0000 (14:08 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Sun, 28 May 2023 06:57:08 +0000 (08:57 +0200)
Add kernel 6.1 support to SSDK, it was just a case of adding the kernel
version identification and fixing up get_random_u32.

Signed-off-by: Robert Marko <robimarko@gmail.com>
package/kernel/qca-ssdk/patches/0015-SSDK-config-add-kernel-6.1.patch [new file with mode: 0644]
package/kernel/qca-ssdk/patches/0016-SSDK-qca808x-use-get_random_u32.patch [new file with mode: 0644]

diff --git a/package/kernel/qca-ssdk/patches/0015-SSDK-config-add-kernel-6.1.patch b/package/kernel/qca-ssdk/patches/0015-SSDK-config-add-kernel-6.1.patch
new file mode 100644 (file)
index 0000000..77c5497
--- /dev/null
@@ -0,0 +1,55 @@
+From 1f9eb43f118b86c0b68e9d82bfae77471d6c3921 Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko@gmail.com>
+Date: Thu, 29 Sep 2022 09:59:20 +0200
+Subject: [PATCH] SSDK: config: add kernel 6.1
+
+Allow kernel 6.1 to be recognized and compiled under it.
+
+Signed-off-by: Robert Marko <robimarko@gmail.com>
+---
+ config            | 6 +++++-
+ make/linux_opt.mk | 4 ++--
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+--- a/config
++++ b/config
+@@ -28,6 +28,10 @@ ifeq ($(KVER),$(filter 5.15%,$(KVER)))
+ OS_VER=5_15
+ endif
++ifeq ($(KVER),$(filter 6.1%,$(KVER)))
++OS_VER=6_1
++endif
++
+ ifeq ($(KVER), 3.4.0)
+       OS_VER=3_4
+ endif
+@@ -136,7 +140,7 @@ ifeq ($(ARCH), arm)
+ endif
+ ifeq ($(ARCH), arm64)
+-      ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.15%,$(KVER)))
++      ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.15% 6.1%,$(KVER)))
+               CPU_CFLAG=  -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
+       endif
+ endif
+--- a/make/linux_opt.mk
++++ b/make/linux_opt.mk
+@@ -437,7 +437,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
+       KASAN_SHADOW_SCALE_SHIFT := 3
+   endif
+-  ifeq (5_4 5_15, $(OS_VER))
++  ifeq (5_4 5_15 6_1, $(OS_VER))
+       ifeq ($(ARCH), arm64)
+           KASAN_OPTION += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
+        endif
+@@ -468,7 +468,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
+   endif
+-  ifeq ($(OS_VER),$(filter 4_4 5_4 5_15, $(OS_VER)))
++  ifeq ($(OS_VER),$(filter 4_4 5_4 5_15 6_1, $(OS_VER)))
+                 MODULE_CFLAG += -DKVER34
+                 MODULE_CFLAG += -DKVER32
+             MODULE_CFLAG += -DLNX26_22
diff --git a/package/kernel/qca-ssdk/patches/0016-SSDK-qca808x-use-get_random_u32.patch b/package/kernel/qca-ssdk/patches/0016-SSDK-qca808x-use-get_random_u32.patch
new file mode 100644 (file)
index 0000000..d8cd89b
--- /dev/null
@@ -0,0 +1,27 @@
+From 55ea8c9b278aafe3211f7250986b1f9d9a06cd21 Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko@gmail.com>
+Date: Fri, 21 Oct 2022 13:40:15 +0200
+Subject: [PATCH] SSDK: qca808x: use get_random_u32
+
+prandom has been removed from the kernel in 6.1-rc1, so use get_random_u32
+instead as its the drop-in replacement.
+
+Signed-off-by: Robert Marko <robimarko@gmail.com>
+---
+ src/hsl/phy/qca808x_phy.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/src/hsl/phy/qca808x_phy.c
++++ b/src/hsl/phy/qca808x_phy.c
+@@ -299,7 +299,11 @@ qca808x_phy_ms_random_seed_set(a_uint32_
+       phy_data = qca808x_phy_debug_read(dev_id, phy_id,
+               QCA808X_DEBUG_LOCAL_SEED);
+       phy_data &= ~(QCA808X_MASTER_SLAVE_SEED_CFG);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
+       phy_data |= (prandom_u32()%QCA808X_MASTER_SLAVE_SEED_RANGE) << 2;
++#else
++      phy_data |= (get_random_u32()%QCA808X_MASTER_SLAVE_SEED_RANGE) << 2;
++#endif
+       SSDK_DEBUG("QCA808X_DEBUG_LOCAL_SEED:%x\n", phy_data);
+       rv = qca808x_phy_debug_write(dev_id, phy_id,
+               QCA808X_DEBUG_LOCAL_SEED, phy_data);