From: Long Li longli@microsoft.com
[ Upstream commit e0fca6f2cebff539e9317a15a37dcf432e3b851a ]
MANA supports RDMA in PF mode. The driver should record the doorbell physical address when in PF mode.
The doorbell physical address is used by the RDMA driver to map doorbell pages of the device to user-mode applications through RDMA verbs interface. In the past, they have been mapped to user-mode while the device is in VF mode. With the support for PF mode implemented, also expose those pages in PF mode.
Support for PF mode is implemented in 290e5d3c49f6 ("net: mana: Add support for Multi Vports on Bare metal")
Signed-off-by: Long Li longli@microsoft.com Reviewed-by: Simon Horman horms@kernel.org Link: https://patch.msgid.link/1750210606-12167-1-git-send-email-longli@linuxonhyp... Signed-off-by: Jakub Kicinski kuba@kernel.org Signed-off-by: Sasha Levin sashal@kernel.org ---
**YES**
This commit should be backported to stable kernel trees. Here's my detailed analysis:
## Critical Functionality Fix
The commit fixes a missing functionality that prevents RDMA from working properly in PF (Physical Function) mode. Looking at the code changes:
1. **The Problem**: In `mana_gd_init_pf_regs()`, the driver was not recording `gc->phys_db_page_base`, while the VF initialization function `mana_gd_init_vf_regs()` does record it (lines 50-51 in the existing code).
2. **The Impact**: The RDMA driver critically depends on `phys_db_page_base` in its `mana_ib_mmap()` function (drivers/infiniband/hw/mana/main.c:535-537): ```c pfn = (gc->phys_db_page_base + gc->db_page_size * mana_ucontext->doorbell) >> PAGE_SHIFT; ``` This physical address is used to map doorbell pages to user-space applications through `rdma_user_mmap_io()`, which is essential for RDMA functionality.
3. **User Impact**: Without this fix, RDMA operations would fail in PF mode (bare metal deployments), making the RDMA feature completely unusable for those users.
## Meets Stable Criteria
- **Small and contained**: The fix adds only 3 lines of code - **Fixes a real bug**: RDMA functionality is broken in PF mode without this - **No architectural changes**: Simply records an address that's already being recorded in VF mode - **Low regression risk**: The change is isolated to PF initialization path - **Similar to previous stable fixes**: Commits #3 and #4 in the historical examples were both doorbell-related RDMA fixes that were backported
The commit essentially brings parity between VF and PF modes for doorbell physical address recording, which is necessary for proper RDMA operation. This is a clear functional bug that affects users running MANA in PF mode with RDMA requirements.
drivers/net/ethernet/microsoft/mana/gdma_main.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c index 9ed965d61e355..d3c9a3020fbf6 100644 --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c @@ -28,6 +28,9 @@ static void mana_gd_init_pf_regs(struct pci_dev *pdev) gc->db_page_base = gc->bar0_va + mana_gd_r64(gc, GDMA_PF_REG_DB_PAGE_OFF);
+ gc->phys_db_page_base = gc->bar0_pa + + mana_gd_r64(gc, GDMA_PF_REG_DB_PAGE_OFF); + sriov_base_off = mana_gd_r64(gc, GDMA_SRIOV_REG_CFG_BASE_OFF);
sriov_base_va = gc->bar0_va + sriov_base_off;