Skip to contentSkip to conversation

RDMA/hns: Clear extended doorbell info before using

PATCH Superseded Weihang Li 2 participants 5 messages Jun 10, 2021 – Jun 11, 2021

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Weihang Li

author
#0 lore raw

PATCH v2 1/1 RDMA/hns: Clear extended doorbell info before using

From: Xi Wang <[email protected]>

Both of HIP08 and HIP09 require the extended doorbell information to be cleared before being used.

Fixes 6b63597d3540 ("RDMA/hns: Add TSQ link table support")

---
Changes since v1:
- Add fixes tag.
- Add check for return value of hns_roce_clear_extdb_list_info().
- Link: https://patchwork.kernel.org/project/linux-rdma/patch/[email protected]/

 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 21 +++++++++++++++++++++
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h |  1 +
 2 files changed, 22 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +21 -0
index fbc45b9..d24ac5c 100644
@@ -1572,6 +1572,22 @@ static void hns_roce_function_clear(struct hns_roce_dev *hr_dev)
 	}
 }
 
+static int hns_roce_clear_extdb_list_info(struct hns_roce_dev *hr_dev)
+{
+	struct hns_roce_cmq_desc desc;
+	int ret;
+
+	hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO,
+				      false);
+	ret = hns_roce_cmq_send(hr_dev, &desc, 1);
+	if (ret)
+		ibdev_err(&hr_dev->ib_dev,
+			  "failed to clear extended doorbell info, ret = %d.\n",
+			  ret);
+
+	return ret;
+}
+
 static int hns_roce_query_fw_ver(struct hns_roce_dev *hr_dev)
 {
 	struct hns_roce_query_fw_info *resp;
@@ -2684,6 +2700,11 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)
 	if (ret)
 		return ret;
 
+	/* The hns ROCEE requires the extdb info to be cleared before using */
+	ret = hns_roce_clear_extdb_list_info(hr_dev);
+	if (ret)
+		return ret;
+
 	if (hr_dev->is_vf)
 		return 0;
 
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +1 -0
index cd361c0..073e835 100644
@@ -250,6 +250,7 @@ enum hns_roce_opcode_type {
 	HNS_ROCE_OPC_CLR_SCCC				= 0x8509,
 	HNS_ROCE_OPC_QUERY_SCCC				= 0x850a,
 	HNS_ROCE_OPC_RESET_SCCC				= 0x850b,
+	HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO		= 0x850d,
 	HNS_ROCE_OPC_QUERY_VF_RES			= 0x850e,
 	HNS_ROCE_OPC_CFG_GMV_TBL			= 0x850f,
 	HNS_ROCE_OPC_CFG_GMV_BT				= 0x8510,
Signature · 1 line
2.7.4
#1 lore raw
Quoted 46 lines · Weihang Li

From: Xi Wang <[email protected]>

Both of HIP08 and HIP09 require the extended doorbell information to be cleared before being used.

Fixes 6b63597d3540 ("RDMA/hns: Add TSQ link table support")

---
Changes since v1:
- Add fixes tag.
- Add check for return value of hns_roce_clear_extdb_list_info().
- Link: https://patchwork.kernel.org/project/linux-rdma/patch/[email protected]/

 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 21 +++++++++++++++++++++
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h |  1 +
 2 files changed, 22 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +16 -0
index fbc45b9..d24ac5c 100644
@@ -1572,6 +1572,22 @@ static void hns_roce_function_clear(struct hns_roce_dev *hr_dev)
 	}
 }
 
+static int hns_roce_clear_extdb_list_info(struct hns_roce_dev *hr_dev)
+{
+	struct hns_roce_cmq_desc desc;
+	int ret;
+
+	hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO,
+				      false);
+	ret = hns_roce_cmq_send(hr_dev, &desc, 1);
+	if (ret)
+		ibdev_err(&hr_dev->ib_dev,
+			  "failed to clear extended doorbell info, ret = %d.\n",
+			  ret);
+
+	return ret;
+}
+
 static int hns_roce_query_fw_ver(struct hns_roce_dev *hr_dev)
 {
 	struct hns_roce_query_fw_info *resp;

drivers/infiniband/hw/hns/hns_roce_hw_v2.c static int hns_roce_v2_init(struct hns_roce_dev *hr_dev) · line 2706

Quoted 7 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +4 -0
@@ -2684,6 +2700,11 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)
 	if (ret)
 		return ret;
 
+	/* The hns ROCEE requires the extdb info to be cleared before using */
+	ret = hns_roce_clear_extdb_list_info(hr_dev);
+	if (ret)
+		return ret;

You forgot to call to put_hem_table(hr_dev).

Thanks

Quoted 19 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -0
+
 	if (hr_dev->is_vf)
 		return 0;
 
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +1 -0
index cd361c0..073e835 100644
@@ -250,6 +250,7 @@ enum hns_roce_opcode_type {
 	HNS_ROCE_OPC_CLR_SCCC				= 0x8509,
 	HNS_ROCE_OPC_QUERY_SCCC				= 0x850a,
 	HNS_ROCE_OPC_RESET_SCCC				= 0x850b,
+	HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO		= 0x850d,
 	HNS_ROCE_OPC_QUERY_VF_RES			= 0x850e,
 	HNS_ROCE_OPC_CFG_GMV_TBL			= 0x850f,
 	HNS_ROCE_OPC_CFG_GMV_BT				= 0x8510,
Signature · 1 line
2.7.4
author
#2 lore raw
Quoted 50 lines · Leon Romanovsky
Quoted 49 lines · Weihang Li

From: Xi Wang <[email protected]>

Both of HIP08 and HIP09 require the extended doorbell information to be cleared before being used.

Fixes 6b63597d3540 ("RDMA/hns: Add TSQ link table support")

---
Changes since v1:
- Add fixes tag.
- Add check for return value of hns_roce_clear_extdb_list_info().
- Link: https://patchwork.kernel.org/project/linux-rdma/patch/[email protected]/

 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 21 +++++++++++++++++++++
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h |  1 +
 2 files changed, 22 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +16 -0
index fbc45b9..d24ac5c 100644
@@ -1572,6 +1572,22 @@ static void hns_roce_function_clear(struct hns_roce_dev *hr_dev)
 	}
 }
 
+static int hns_roce_clear_extdb_list_info(struct hns_roce_dev *hr_dev)
+{
+	struct hns_roce_cmq_desc desc;
+	int ret;
+
+	hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO,
+				      false);
+	ret = hns_roce_cmq_send(hr_dev, &desc, 1);
+	if (ret)
+		ibdev_err(&hr_dev->ib_dev,
+			  "failed to clear extended doorbell info, ret = %d.\n",
+			  ret);
+
+	return ret;
+}
+
 static int hns_roce_query_fw_ver(struct hns_roce_dev *hr_dev)
 {
 	struct hns_roce_query_fw_info *resp;
@@ -2684,6 +2700,11 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)
 	if (ret)
 		return ret;
 
Quoted 9 lines

drivers/infiniband/hw/hns/hns_roce_hw_v2.c static int hns_roce_v2_init(struct hns_roce_dev *hr_dev) · line 2706

Quoted 4 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +4 -0
+	/* The hns ROCEE requires the extdb info to be cleared before using */
+	ret = hns_roce_clear_extdb_list_info(hr_dev);
+	if (ret)
+		return ret;

You forgot to call to put_hem_table(hr_dev).

Thanks

Hi Leon,

This operation is to tell the firmware to clear the on-chip resources configuration before initialization, the HEM table is not involved.

Thanks
Weihang

Quoted 20 lines
Quoted 19 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -0
+
 	if (hr_dev->is_vf)
 		return 0;
 
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +1 -0
index cd361c0..073e835 100644
@@ -250,6 +250,7 @@ enum hns_roce_opcode_type {
 	HNS_ROCE_OPC_CLR_SCCC				= 0x8509,
 	HNS_ROCE_OPC_QUERY_SCCC				= 0x850a,
 	HNS_ROCE_OPC_RESET_SCCC				= 0x850b,
+	HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO		= 0x850d,
 	HNS_ROCE_OPC_QUERY_VF_RES			= 0x850e,
 	HNS_ROCE_OPC_CFG_GMV_TBL			= 0x850f,
 	HNS_ROCE_OPC_CFG_GMV_BT				= 0x8510,
Signature · 1 line
2.7.4
#3 lore raw
Quoted 58 lines · liweihang
Quoted 57 lines · Leon Romanovsky
Quoted 46 lines · Weihang Li

From: Xi Wang <[email protected]>

Both of HIP08 and HIP09 require the extended doorbell information to be cleared before being used.

Fixes 6b63597d3540 ("RDMA/hns: Add TSQ link table support")

---
Changes since v1:
- Add fixes tag.
- Add check for return value of hns_roce_clear_extdb_list_info().
- Link: https://patchwork.kernel.org/project/linux-rdma/patch/[email protected]/

 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 21 +++++++++++++++++++++
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h |  1 +
 2 files changed, 22 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +16 -0
index fbc45b9..d24ac5c 100644
@@ -1572,6 +1572,22 @@ static void hns_roce_function_clear(struct hns_roce_dev *hr_dev)
 	}
 }
 
+static int hns_roce_clear_extdb_list_info(struct hns_roce_dev *hr_dev)
+{
+	struct hns_roce_cmq_desc desc;
+	int ret;
+
+	hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO,
+				      false);
+	ret = hns_roce_cmq_send(hr_dev, &desc, 1);
+	if (ret)
+		ibdev_err(&hr_dev->ib_dev,
+			  "failed to clear extended doorbell info, ret = %d.\n",
+			  ret);
+
+	return ret;
+}
+
 static int hns_roce_query_fw_ver(struct hns_roce_dev *hr_dev)
 {
 	struct hns_roce_query_fw_info *resp;

drivers/infiniband/hw/hns/hns_roce_hw_v2.c static int hns_roce_v2_init(struct hns_roce_dev *hr_dev) · line 2706

Quoted 7 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +4 -0
@@ -2684,6 +2700,11 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)
 	if (ret)
 		return ret;
 
+	/* The hns ROCEE requires the extdb info to be cleared before using */
+	ret = hns_roce_clear_extdb_list_info(hr_dev);
+	if (ret)
+		return ret;

You forgot to call to put_hem_table(hr_dev).

Quoted 7 lines
Quoted 2 lines

Thanks

Hi Leon,

This operation is to tell the firmware to clear the on-chip resources configuration before initialization, the HEM table is not involved.

Please check your hns_roce_v2_init() implementation.

You called to get_hem_table() 6 lines above, in case of error in hns_roce_clear_extdb_list_info(), you need to return the hem_table back.

You did it in 4 lines below.

Thanks

Quoted 26 lines

Thanks
Weihang

Quoted 20 lines
Quoted 19 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -0
+
 	if (hr_dev->is_vf)
 		return 0;
 
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +1 -0
index cd361c0..073e835 100644
@@ -250,6 +250,7 @@ enum hns_roce_opcode_type {
 	HNS_ROCE_OPC_CLR_SCCC				= 0x8509,
 	HNS_ROCE_OPC_QUERY_SCCC				= 0x850a,
 	HNS_ROCE_OPC_RESET_SCCC				= 0x850b,
+	HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO		= 0x850d,
 	HNS_ROCE_OPC_QUERY_VF_RES			= 0x850e,
 	HNS_ROCE_OPC_CFG_GMV_TBL			= 0x850f,
 	HNS_ROCE_OPC_CFG_GMV_BT				= 0x8510,
Signature · 1 line
2.7.4
author
#4 lore raw
Quoted 67 lines · Leon Romanovsky
Quoted 58 lines · liweihang
Quoted 57 lines · Leon Romanovsky
Quoted 46 lines · Weihang Li

From: Xi Wang <[email protected]>

Both of HIP08 and HIP09 require the extended doorbell information to be cleared before being used.

Fixes 6b63597d3540 ("RDMA/hns: Add TSQ link table support")

---
Changes since v1:
- Add fixes tag.
- Add check for return value of hns_roce_clear_extdb_list_info().
- Link: https://patchwork.kernel.org/project/linux-rdma/patch/[email protected]/

 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 21 +++++++++++++++++++++
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h |  1 +
 2 files changed, 22 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +16 -0
index fbc45b9..d24ac5c 100644
@@ -1572,6 +1572,22 @@ static void hns_roce_function_clear(struct hns_roce_dev *hr_dev)
 	}
 }
 
+static int hns_roce_clear_extdb_list_info(struct hns_roce_dev *hr_dev)
+{
+	struct hns_roce_cmq_desc desc;
+	int ret;
+
+	hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO,
+				      false);
+	ret = hns_roce_cmq_send(hr_dev, &desc, 1);
+	if (ret)
+		ibdev_err(&hr_dev->ib_dev,
+			  "failed to clear extended doorbell info, ret = %d.\n",
+			  ret);
+
+	return ret;
+}
+
 static int hns_roce_query_fw_ver(struct hns_roce_dev *hr_dev)
 {
 	struct hns_roce_query_fw_info *resp;

drivers/infiniband/hw/hns/hns_roce_hw_v2.c static int hns_roce_v2_init(struct hns_roce_dev *hr_dev) · line 2706

Quoted 7 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +4 -0
@@ -2684,6 +2700,11 @@ static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)
 	if (ret)
 		return ret;
 
+	/* The hns ROCEE requires the extdb info to be cleared before using */
+	ret = hns_roce_clear_extdb_list_info(hr_dev);
+	if (ret)
+		return ret;

You forgot to call to put_hem_table(hr_dev).

Quoted 7 lines
Quoted 2 lines

Thanks

Hi Leon,

This operation is to tell the firmware to clear the on-chip resources configuration before initialization, the HEM table is not involved.

Quoted 9 lines

Please check your hns_roce_v2_init() implementation.

You called to get_hem_table() 6 lines above, in case of error in hns_roce_clear_extdb_list_info(), you need to return the hem_table back.

You did it in 4 lines below.

Thanks

Oh, I made a mistake, thank you :)

Weihang

Quoted 27 lines
Quoted 26 lines

Thanks
Weihang

Quoted 20 lines
Quoted 19 lines
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -0
+
 	if (hr_dev->is_vf)
 		return 0;
 
drivers/infiniband/hw/hns/hns_roce_hw_v2.h +1 -0
index cd361c0..073e835 100644
@@ -250,6 +250,7 @@ enum hns_roce_opcode_type {
 	HNS_ROCE_OPC_CLR_SCCC				= 0x8509,
 	HNS_ROCE_OPC_QUERY_SCCC				= 0x850a,
 	HNS_ROCE_OPC_RESET_SCCC				= 0x850b,
+	HNS_ROCE_OPC_CLEAR_EXTDB_LIST_INFO		= 0x850d,
 	HNS_ROCE_OPC_QUERY_VF_RES			= 0x850e,
 	HNS_ROCE_OPC_CFG_GMV_TBL			= 0x850f,
 	HNS_ROCE_OPC_CFG_GMV_BT				= 0x8510,
Signature · 1 line
2.7.4