Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
Summary: Infiniband HCA Driver
Name: %{_name}-signed
Version: 25.07
Release: 8%{release_suffix}%{?dist}
Release: 9%{release_suffix}%{?dist}
License: GPLv2
Url: http://www.mellanox.com/
Group: System Environment/Base
Expand Down Expand Up @@ -237,6 +237,10 @@ fi
%license %{_datadir}/licenses/%{_name}/copyright

%changelog
* Tue May 26 2026 Zheyu Shen <zheyushen@microsoft.com> - 25.07-9_6.12.57.1.6
- Bump release to repackage signed modules against the GPL-export rebuild
of mlnx-ofa_kernel-hwe-25.07-9.

* Fri Apr 10 2026 Mykhailo Bykhovtsev <mbykhovtsev@microsoft.com> - 25.07-8_6.12.57.1.6
- Tweak specs to use dynamic versioning for kernel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
Summary: Infiniband HCA Driver
Name: %{_name}-signed
Version: 25.07
Release: 2%{release_suffix}%{?dist}
Release: 3%{release_suffix}%{?dist}
License: GPLv2
Url: http://www.mellanox.com/
Group: System Environment/Base
Expand Down Expand Up @@ -198,6 +198,10 @@ fi
%license %{_datadir}/licenses/%{_name}/copyright

%changelog
* Tue May 26 2026 Zheyu Shen <zheyushen@microsoft.com> - 25.07-3
- Bump release to repackage signed modules against the GPL-export rebuild
of mlnx-ofa_kernel-25.07-3.

* Fri Apr 10 2026 Mykhailo Bykhovtsev <mbykhovtsev@microsoft.com> - 25.07-2
- Tweak specs to use dynamic versioning for kernel versions.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zheyu Shen <zheyushen@microsoft.com>
Date: Tue, 26 May 2026 00:00:00 +0000
Subject: [PATCH] peer_mem: export IB peer memory API as GPL-only symbols

The IB peer-memory API in drivers/infiniband/core/peer_mem.c was
historically exported with EXPORT_SYMBOL. That dates back to a time when
the consumer was the NVIDIA closed-source GPU driver, which could not
link against EXPORT_SYMBOL_GPL symbols.

Today the consumers are GPL kernel modules (AMDGPU, NVIDIA open-source
driver). Exposing the peer-memory client registration API as
EXPORT_SYMBOL_GPL more accurately reflects the GPL licensing of
mlnx-ofa_kernel and matches the kernel's modern expectations around
in-kernel API surfaces.

In addition, switching to EXPORT_SYMBOL_GPL allows out-of-tree drivers
(AMDGPU, NVIDIA open-source GPU driver) to discover the peer-memory
client API via module symbol resolution at runtime instead of having
to hard-link against the mlnx-ofa_kernel build, which is required to
break the diamond build-time dependency between an OOT GPU driver and
multiple OOT NIC drivers that all consume the same API, which is the
situation we are facing with AMD GPU (MI300X works with Mellanox while
MI455X comes with Vulcano NIC, and we would like the same kmod to be
able to work with both hardware).

Signed-off-by: Zheyu Shen <zheyushen@microsoft.com>
---
drivers/infiniband/core/peer_mem.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/core/peer_mem.c b/drivers/infiniband/core/peer_mem.c
--- a/drivers/infiniband/core/peer_mem.c
+++ b/drivers/infiniband/core/peer_mem.c
@@ -86,7 +86,7 @@ void *ib_register_peer_memory_client(const struct peer_memory_client *peer_clien
mutex_unlock(&peer_memory_mutex);
return ib_peer_client;
}
-EXPORT_SYMBOL(ib_register_peer_memory_client);
+EXPORT_SYMBOL_GPL(ib_register_peer_memory_client);

void ib_unregister_peer_memory_client(void *reg_handle)
{
@@ -107,7 +107,7 @@ void ib_unregister_peer_memory_client(void *reg_handle)

kobject_put(&ib_peer_client->kobj);
}
-EXPORT_SYMBOL(ib_unregister_peer_memory_client);
+EXPORT_SYMBOL_GPL(ib_unregister_peer_memory_client);

static struct ib_peer_memory_client *
ib_get_peer_client(unsigned long addr, size_t size,
@@ -317,7 +317,7 @@ void ib_umem_activate_invalidation_notifier(struct ib_umem *umem,

/* At this point func can be called asynchronously */
}
-EXPORT_SYMBOL(ib_umem_activate_invalidation_notifier);
+EXPORT_SYMBOL_GPL(ib_umem_activate_invalidation_notifier);

/*
* Caller has blocked DMA and will no longer be able to handle invalidate
@@ -358,7 +358,7 @@ void ib_umem_stop_invalidation_notifier(struct ib_umem *umem)
ib_unmap_peer_client(umem_p, cur_state, UMEM_PEER_UNMAPPED);

}
-EXPORT_SYMBOL(ib_umem_stop_invalidation_notifier);
+EXPORT_SYMBOL_GPL(ib_umem_stop_invalidation_notifier);

static void fix_peer_sgls(struct ib_umem_peer *umem_p,
unsigned long peer_page_size)
--
2.43.0
16 changes: 15 additions & 1 deletion SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
Summary: Infiniband HCA Driver
Name: mlnx-ofa_kernel-hwe
Version: 25.07
Release: 8%{release_suffix}%{?dist}
Release: 9%{release_suffix}%{?dist}
License: GPLv2
Url: http://www.mellanox.com/
Group: System Environment/Base
Expand All @@ -111,6 +111,14 @@ Group: System Environment/Base
# https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz
Source0: %{_distro_sources_url}/mlnx-ofa_kernel-%{_version}.tgz

# Re-export the IB peer-memory client API as GPL-only symbols so that
# GPL out-of-tree drivers (amdgpu, NVIDIA open-source GPU driver, ...)
# can consume them at runtime via symbol resolution instead of needing
# a build-time dependency on mlnx-ofa_kernel-hwe. This breaks the diamond
# build-time dependency between an OOT GPU driver and multiple OOT NIC
# drivers that all consume the same peermem API.
Patch0: 0001-peer_mem-export-symbols-as-GPL.patch

BuildRoot: /var/tmp/%{name}-%{version}-build
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand Down Expand Up @@ -283,6 +291,7 @@ The driver sources are located at: http://www.mellanox.com/downloads/ofed/

%prep
%setup -n mlnx-ofa_kernel-%{_version}
%patch 0 -p1

set -- *
mkdir source
Expand Down Expand Up @@ -449,6 +458,11 @@ update-alternatives --remove \
%{_prefix}/src/ofa_kernel/%{_arch}/[0-9]*

%changelog
* Tue May 26 2026 Zheyu Shen <zheyushen@microsoft.com> - 25.07-9_6.12.57.1.6
- Re-export IB peer-memory client API as EXPORT_SYMBOL_GPL to allow OOT
GPU drivers (amdgpu, NVIDIA open-source) to resolve peermem symbols at
module load time, removing the build-time dependency on mlnx-ofa_kernel-hwe.

* Fri Apr 10 2026 Mykhailo Bykhovtsev <mbykhovtsev@microsoft.com> - 25.07-8_6.12.57.1.6
- Tweak specs to use dynamic versioning for kernel

Expand Down
72 changes: 72 additions & 0 deletions SPECS/mlnx-ofa_kernel/0001-peer_mem-export-symbols-as-GPL.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zheyu Shen <zheyushen@microsoft.com>
Date: Tue, 26 May 2026 00:00:00 +0000
Subject: [PATCH] peer_mem: export IB peer memory API as GPL-only symbols

The IB peer-memory API in drivers/infiniband/core/peer_mem.c was
historically exported with EXPORT_SYMBOL. That dates back to a time when
the consumer was the NVIDIA closed-source GPU driver, which could not
link against EXPORT_SYMBOL_GPL symbols.

Today the consumers are GPL kernel modules (AMDGPU, NVIDIA open-source
driver). Exposing the peer-memory client registration API as
EXPORT_SYMBOL_GPL more accurately reflects the GPL licensing of
mlnx-ofa_kernel and matches the kernel's modern expectations around
in-kernel API surfaces.

In addition, switching to EXPORT_SYMBOL_GPL allows out-of-tree drivers
(AMDGPU, NVIDIA open-source GPU driver) to discover the peer-memory
client API via module symbol resolution at runtime instead of having
to hard-link against the mlnx-ofa_kernel build, which is required to
break the diamond build-time dependency between an OOT GPU driver and
multiple OOT NIC drivers that all consume the same API, which is the
situation we are facing with AMD GPU (MI300X works with Mellanox while
MI455X comes with Vulcano NIC, and we would like the same kmod to be
able to work with both hardware).

Signed-off-by: Zheyu Shen <zheyushen@microsoft.com>
---
drivers/infiniband/core/peer_mem.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/core/peer_mem.c b/drivers/infiniband/core/peer_mem.c
--- a/drivers/infiniband/core/peer_mem.c
+++ b/drivers/infiniband/core/peer_mem.c
@@ -86,7 +86,7 @@ void *ib_register_peer_memory_client(const struct peer_memory_client *peer_clien
mutex_unlock(&peer_memory_mutex);
return ib_peer_client;
}
-EXPORT_SYMBOL(ib_register_peer_memory_client);
+EXPORT_SYMBOL_GPL(ib_register_peer_memory_client);

void ib_unregister_peer_memory_client(void *reg_handle)
{
@@ -107,7 +107,7 @@ void ib_unregister_peer_memory_client(void *reg_handle)

kobject_put(&ib_peer_client->kobj);
}
-EXPORT_SYMBOL(ib_unregister_peer_memory_client);
+EXPORT_SYMBOL_GPL(ib_unregister_peer_memory_client);

static struct ib_peer_memory_client *
ib_get_peer_client(unsigned long addr, size_t size,
@@ -317,7 +317,7 @@ void ib_umem_activate_invalidation_notifier(struct ib_umem *umem,

/* At this point func can be called asynchronously */
}
-EXPORT_SYMBOL(ib_umem_activate_invalidation_notifier);
+EXPORT_SYMBOL_GPL(ib_umem_activate_invalidation_notifier);

/*
* Caller has blocked DMA and will no longer be able to handle invalidate
@@ -358,7 +358,7 @@ void ib_umem_stop_invalidation_notifier(struct ib_umem *umem)
ib_unmap_peer_client(umem_p, cur_state, UMEM_PEER_UNMAPPED);

}
-EXPORT_SYMBOL(ib_umem_stop_invalidation_notifier);
+EXPORT_SYMBOL_GPL(ib_umem_stop_invalidation_notifier);

static void fix_peer_sgls(struct ib_umem_peer *umem_p,
unsigned long peer_page_size)
--
2.43.0
16 changes: 15 additions & 1 deletion SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
Summary: Infiniband HCA Driver
Name: mlnx-ofa_kernel
Version: 25.07
Release: 2%{release_suffix}%{?dist}
Release: 3%{release_suffix}%{?dist}
License: GPLv2
Url: http://www.mellanox.com/
Group: System Environment/Base
Expand All @@ -115,6 +115,14 @@ Group: System Environment/Base
# https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz
Source0: %{_distro_sources_url}/%{_name}-%{version}.tgz

# Re-export the IB peer-memory client API as GPL-only symbols so that
# GPL out-of-tree drivers (amdgpu, NVIDIA open-source GPU driver, ...)
# can consume them at runtime via symbol resolution instead of needing
# a build-time dependency on mlnx-ofa_kernel. This breaks the diamond
# build-time dependency between an OOT GPU driver and multiple OOT NIC
# drivers that all consume the same peermem API.
Patch0: 0001-peer_mem-export-symbols-as-GPL.patch

BuildRoot: /var/tmp/%{name}-%{version}-build
Vendor: Microsoft Corporation
Distribution: Azure Linux
Expand Down Expand Up @@ -302,6 +310,7 @@ drivers against it.

%prep
%setup -n %{_name}-%{version}
%patch 0 -p1
set -- *
mkdir source
mv "$@" source/
Expand Down Expand Up @@ -765,6 +774,11 @@ update-alternatives --remove \
%{_prefix}/src/mlnx-ofa_kernel-%version

%changelog
* Tue May 26 2026 Zheyu Shen <zheyushen@microsoft.com> - 25.07-3
- Re-export IB peer-memory client API as EXPORT_SYMBOL_GPL to allow OOT
GPU drivers (amdgpu, NVIDIA open-source) to resolve peermem symbols at
module load time, removing the build-time dependency on mlnx-ofa_kernel.

* Fri Apr 10 2026 Mykhailo Bykhovtsev <mbykhovtsev@microsoft.com> - 25.07-2
- Tweak specs to use dynamic versioning for kernel.

Expand Down
Loading