From 3ce9a5bc6c4840b00308993c37da48ff352bd029 Mon Sep 17 00:00:00 2001 From: Jiping Ma Date: Wed, 14 May 2025 05:47:38 +0000 Subject: [PATCH] mlnx-ofa_kernel:add the missed two patches We missed the two patches during the mlnx-ofa_kernel driver upgradtion. We encouter the following error during load the module mlx_compat when IBT(Indirect Branch Tracking) feature is enabled for CPU and CONFIG_X86_KERNEL_IBT is enable by the kernel config file. "Missing ENDBR: __init_backport+0x0/0xff0 [mlx_compat]" Verification: * An ISO image can be built with this commit applied to a repo project of StarlingX's kernel 6.12.18 branch. * The ISO image can be installed to a R760 server without "Missing ENDBR: __init_backport+0x0/0xff0 [mlx_compat]" in dmesg log. The issue can be repduced in the lab without the fix. Closes-Bug: 2110611 Change-Id: I017ee18055368614d404f10ad5d4d05a6b842ad0 Signed-off-by: Jiping Ma --- .../0001-Enable-mlx5-onboard-udev-name.patch | 62 +++++++++++++++++++ .../0002-Fix-the-obsolete-module-init.patch | 34 ++++++++++ .../mlnx-ofa_kernel/debian/patches/series | 2 + 3 files changed, 98 insertions(+) create mode 100644 kernel-modules/mlnx-ofa_kernel/debian/patches/0001-Enable-mlx5-onboard-udev-name.patch create mode 100644 kernel-modules/mlnx-ofa_kernel/debian/patches/0002-Fix-the-obsolete-module-init.patch create mode 100644 kernel-modules/mlnx-ofa_kernel/debian/patches/series diff --git a/kernel-modules/mlnx-ofa_kernel/debian/patches/0001-Enable-mlx5-onboard-udev-name.patch b/kernel-modules/mlnx-ofa_kernel/debian/patches/0001-Enable-mlx5-onboard-udev-name.patch new file mode 100644 index 00000000..0c9498ed --- /dev/null +++ b/kernel-modules/mlnx-ofa_kernel/debian/patches/0001-Enable-mlx5-onboard-udev-name.patch @@ -0,0 +1,62 @@ +From c6a43833d3b9bf97049e373d20a6eb7daff91c36 Mon Sep 17 00:00:00 2001 +From: Steven Webster +Date: Thu, 11 Aug 2022 12:32:48 -0400 +Subject: [PATCH] Enable mlx5 onboard udev name + +This patch prioritizes the udev renaming rule for mlx5 controlled +devices to take the onboard name over the slot/path name. + +This is consistent with the 70-persistent-net.rules file written +by the StarlingX installer. + +It is also consistent with the naming order in the 99-default.link +file. + +Without this patch, there could be an inconsistency with the +70-persistent-net.rules first re-naming the device to its +slot/path name, and then being overridden by the Mellanox specific +82-net-setup-link.rules. + +Signed-off-by: Steven Webster +[jm: Adapted the patch for context change] +Signed-off-by: Jiping Ma +--- + ofed_scripts/vf-net-link-name.sh | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/ofed_scripts/vf-net-link-name.sh b/ofed_scripts/vf-net-link-name.sh +index e22ae76..1134629 100755 +--- a/ofed_scripts/vf-net-link-name.sh ++++ b/ofed_scripts/vf-net-link-name.sh +@@ -93,7 +93,9 @@ function test_if_pf() { + } + + if [ "$skip" == "0" ]; then +- if [ -n "$ID_NET_NAME_SLOT" ]; then ++ if [ -n "$ID_NET_NAME_ONBOARD" ]; then ++ NAME="${ID_NET_NAME_ONBOARD%%np[[:digit:]]}" ++ elif [ -n "$ID_NET_NAME_SLOT" ]; then + NAME="${ID_NET_NAME_SLOT%%np[[:digit:]]}" + elif [ -n "$ID_NET_NAME_PATH" ]; then + NAME="${ID_NET_NAME_PATH%%np[[:digit:]]}" +@@ -226,11 +228,14 @@ for cnt in {1..2}; do + continue + fi + +- parent_path=`get_pci_name $pci ID_NET_NAME_SLOT` ++ parent_path=`get_pci_name $pci ID_NET_NAME_ONBOARD` + if [ -z "$parent_path" ]; then +- parent_path=`get_pci_name $pci ID_NET_NAME_PATH` ++ parent_path=`get_pci_name $pci ID_NET_NAME_SLOT` + if [ -z "$parent_path" ]; then +- continue ++ parent_path=`get_pci_name $pci ID_NET_NAME_PATH` ++ if [ -z "$parent_path" ]; then ++ continue ++ fi + fi + fi + echo "NAME=${parent_path}_$PORT" +-- +2.43.0 + diff --git a/kernel-modules/mlnx-ofa_kernel/debian/patches/0002-Fix-the-obsolete-module-init.patch b/kernel-modules/mlnx-ofa_kernel/debian/patches/0002-Fix-the-obsolete-module-init.patch new file mode 100644 index 00000000..87c4db6d --- /dev/null +++ b/kernel-modules/mlnx-ofa_kernel/debian/patches/0002-Fix-the-obsolete-module-init.patch @@ -0,0 +1,34 @@ +From 1cab15ad11f0711f4b44fcecdf950a100a6c6bb3 Mon Sep 17 00:00:00 2001 +From: Jiping Ma +Date: Tue, 25 Jun 2024 02:58:29 +0000 +Subject: [PATCH 2/2] Fix the obsolete module init + +Update module init call to use kernel provided macros, such +that they gain correct IBT attributes. + +We encouter the following error during load the module mlx_compat. +"Missing ENDBR: __init_backport+0x0/0xff0 [mlx_compat]" + +Reported-by: Guilherme Batista Leite +Signed-off-by: Jiping Ma +--- + include/linux/compat-2.6.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/linux/compat-2.6.h b/include/linux/compat-2.6.h +index e8b63ed..f264ffe 100644 +--- a/include/linux/compat-2.6.h ++++ b/include/linux/compat-2.6.h +@@ -34,6 +34,8 @@ void mlx_backport_dependency_symbol(void); + 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 */ +-- +2.47.1 + diff --git a/kernel-modules/mlnx-ofa_kernel/debian/patches/series b/kernel-modules/mlnx-ofa_kernel/debian/patches/series new file mode 100644 index 00000000..5978b6ad --- /dev/null +++ b/kernel-modules/mlnx-ofa_kernel/debian/patches/series @@ -0,0 +1,2 @@ +0001-Enable-mlx5-onboard-udev-name.patch +0002-Fix-the-obsolete-module-init.patch