From 8cae215d4d92e21744445e2de5ca8370fab42f60 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 23 May 2023 14:08:09 +0200 Subject: [PATCH] kernel: qca-ssdk: add kernel 6.1 support 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 --- .../0015-SSDK-config-add-kernel-6.1.patch | 55 +++++++++++++++++++ ...0016-SSDK-qca808x-use-get_random_u32.patch | 27 +++++++++ 2 files changed, 82 insertions(+) create mode 100644 package/kernel/qca-ssdk/patches/0015-SSDK-config-add-kernel-6.1.patch create mode 100644 package/kernel/qca-ssdk/patches/0016-SSDK-qca808x-use-get_random_u32.patch 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 index 0000000000..77c54979a9 --- /dev/null +++ b/package/kernel/qca-ssdk/patches/0015-SSDK-config-add-kernel-6.1.patch @@ -0,0 +1,55 @@ +From 1f9eb43f118b86c0b68e9d82bfae77471d6c3921 Mon Sep 17 00:00:00 2001 +From: Robert Marko +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 +--- + 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 index 0000000000..d8cd89b744 --- /dev/null +++ b/package/kernel/qca-ssdk/patches/0016-SSDK-qca808x-use-get_random_u32.patch @@ -0,0 +1,27 @@ +From 55ea8c9b278aafe3211f7250986b1f9d9a06cd21 Mon Sep 17 00:00:00 2001 +From: Robert Marko +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 +--- + 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); -- 2.30.2