[PATCH] ntb: intel: Fix using link status DB's

From: Nikita Shubin via B4 Relay
Date: Thu Jun 06 2024 - 04:15:38 EST


From: Nikita Shubin <n.shubin@xxxxxxxxx>

Make sure we are not using DB's which were remapped for link status.

Fixes: f6e51c354b60 ("ntb: intel: split out the gen3 code")
Signed-off-by: Nikita Shubin <n.shubin@xxxxxxxxx>
---
Hello Dave, sending a patch as planned.

Thank you for looking into this!

Link: https://lore.kernel.org/all/686c55cc658564e8f37147e0d6d5ab62bb8372af.camel@xxxxxxxxxxx/
---
drivers/ntb/hw/intel/ntb_hw_gen3.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/ntb/hw/intel/ntb_hw_gen3.c b/drivers/ntb/hw/intel/ntb_hw_gen3.c
index ffcfc3e02c35..a5aa96a31f4a 100644
--- a/drivers/ntb/hw/intel/ntb_hw_gen3.c
+++ b/drivers/ntb/hw/intel/ntb_hw_gen3.c
@@ -215,6 +215,9 @@ static int gen3_init_ntb(struct intel_ntb_dev *ndev)
}

ndev->db_valid_mask = BIT_ULL(ndev->db_count) - 1;
+ /* Make sure we are not using DB's used for link status */
+ if (ndev->hwerr_flags & NTB_HWERR_MSIX_VECTOR32_BAD)
+ ndev->db_valid_mask &= ~ndev->db_link_mask;

ndev->reg->db_iowrite(ndev->db_valid_mask,
ndev->self_mmio +

---
base-commit: 2df0193e62cf887f373995fb8a91068562784adc
change-id: 20240606-ntb_intel_db_fix-036299fabc48

Best regards,
--
Nikita Shubin <n.shubin@xxxxxxxxx>