From a1818997f70fbe971f36b797aebab55ffea71b60 Mon Sep 17 00:00:00 2001 From: binujp Date: Thu, 23 Jan 2025 15:00:17 -0800 Subject: [PATCH] Add patch to mlnx-ofa_kernel module for IBT compatibility (#12045) Co-authored-by: Binu Jose Philip --- .../001-fix-module-init-for-ibt.patch | 20 +++++++++++++++++++ SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 SPECS/mlnx-ofa_kernel/001-fix-module-init-for-ibt.patch diff --git a/SPECS/mlnx-ofa_kernel/001-fix-module-init-for-ibt.patch b/SPECS/mlnx-ofa_kernel/001-fix-module-init-for-ibt.patch new file mode 100644 index 00000000000..3914f862473 --- /dev/null +++ b/SPECS/mlnx-ofa_kernel/001-fix-module-init-for-ibt.patch @@ -0,0 +1,20 @@ +# This patch is based on +# https://opendev.org/starlingx/kernel/raw/commit/b6f8503866c3cae009d5b2e8e8db17149c917d9c/kernel-modules/mlnx-ofa_kernel/debian/patches/0003-Fix-the-obsolete-module-init.patch +# modified to apply cleanly with no change in logic. + +--- a/include/linux/compat-2.6.h ++++ b/include/linux/compat-2.6.h +@@ -31,9 +31,11 @@ + #define module_init(initfn) \ + static int __init __init_backport(void) \ + { \ +- mlx_backport_dependency_symbol(); \ ++ mlx_backport_dependency_symbol(); \ + return initfn(); \ + } \ +- int init_module(void) __copy(initfn) __attribute__((alias("__init_backport"))); ++ int init_module(void) __copy(initfn) \ ++ __attribute__((alias("__init_backport"))); \ ++ ___ADDRESSABLE(init_module, __initdata); + + #endif /* LINUX_26_COMPAT_H */ diff --git a/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec b/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec index d9ced2b6297..a4f00a5e845 100644 --- a/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec +++ b/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec @@ -103,7 +103,9 @@ Release: 1%{?dist} License: GPLv2 Url: http://www.mellanox.com/ Group: System Environment/Base -Source0: https://linux.mellanox.com/public/repo/mlnx_ofed/24.10-0.7.0.0/SRPMS/mlnx-ofa_kernel-24.10.tgz#/%{_name}-%{_version}.tgz +Source0: https://linux.mellanox.com/public/repo/mlnx_ofed/24.10-0.7.0.0/SRPMS/mlnx-ofa_kernel-24.10.tgz#/%{_name}-%{_version}.tgz +Patch0: 001-fix-module-init-for-ibt.patch + BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -289,6 +291,7 @@ drivers against it. %prep %setup -n %{_name}-%{_version} +%patch 0 -p1 set -- * mkdir source mv "$@" source/