[PATCH v8 21/23] RDMA/mlx5: Declare to P2PDMA that ATS is selected per memory key
From: Leon Romanovsky
Date: Mon Sep 28 2026 - 07:38:51 EST
From: Leon Romanovsky <leonro@xxxxxxxxxx>
An mlx5 function issues Translated Requests only through memory keys
created with ATS. Enabling ATS in its PCIe configuration therefore does
not make it translate every address it is handed.
Declare that where the function's P2PDMA state is set up, before P2PDMA
starts treating clients with ATS enabled as translating everything.
Without the declaration, mlx5 would lose bus addressing for peer-to-peer
DMA whenever the IOMMU enables its ATS.
Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
---
drivers/infiniband/hw/mlx5/main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 373ee1f42d4a..dcf659beaba0 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4561,6 +4561,8 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev)
if (err && err != -EOPNOTSUPP)
goto err_dd;
+ pcim_p2pdma_set_ats_per_mapping(mdev->pdev);
+
mlx5_cmd_init_async_ctx(mdev, &dev->async_ctx);
return 0;
--
2.55.0