From 26225f8629a60f4805b650d2f5237a425a141580 Mon Sep 17 00:00:00 2001 From: Ran Zhou Date: Fri, 8 Dec 2023 09:59:30 +0800 Subject: [PATCH] Fix missing DB when compiler does not support SVE Currently, if compiler does not support SVE, hns_roce_sve_write512() will be a empty function, which means that this doorbell will be missed when HNS_ROCE_QP_CAP_SVE_DIRECT_WQE is set in qp flag. This patch ensures that driver will at least generate the DB regardless of whether SVE DWQE is supported or not. Signed-off-by: Chengchang Tang (cherry picked from commit e5fcbc2552eda0d654e55ae0758280d6e51804ea) --- ...ng-DB-when-compiler-does-not-support.patch | 83 +++++++++++++++++++ rdma-core.spec | 9 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 0081-libhns-Fix-missing-DB-when-compiler-does-not-support.patch diff --git a/0081-libhns-Fix-missing-DB-when-compiler-does-not-support.patch b/0081-libhns-Fix-missing-DB-when-compiler-does-not-support.patch new file mode 100644 index 0000000..0438df1 --- /dev/null +++ b/0081-libhns-Fix-missing-DB-when-compiler-does-not-support.patch @@ -0,0 +1,83 @@ +From cad30f3d98525d14796094b2905de222c894464f Mon Sep 17 00:00:00 2001 +From: Chengchang Tang +Date: Fri, 8 Dec 2023 09:49:42 +0800 +Subject: [PATCH] libhns: Fix missing DB when compiler does not support SVE + +driver inclusion +category: bugfix +bugzilla: https://gitee.com/openeuler/kernel/issues/I8MPTX + +---------------------------------------------------------------------- + +Currently, if compiler does not support SVE, hns_roce_sve_write512() will +be a empty function, which means that this doorbell will be missed when +HNS_ROCE_QP_CAP_SVE_DIRECT_WQE is set in qp flag. + +This patch ensures that driver will at least generate the DB regardless +of whether SVE DWQE is supported or not. + +Fixes: 7b1f5c5654c2 ("libhns: Add support for SVE Direct WQE function") +Signed-off-by: Chengchang Tang +Signed-off-by: Ran Zhou +--- + providers/hns/hns_roce_u_hw_v2.c | 33 +++++++++++++------------------- + 1 file changed, 13 insertions(+), 20 deletions(-) + +diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c +index acbc854..be4c9f3 100644 +--- a/providers/hns/hns_roce_u_hw_v2.c ++++ b/providers/hns/hns_roce_u_hw_v2.c +@@ -318,26 +318,22 @@ static void hns_roce_update_sq_db(struct hns_roce_context *ctx, + hns_roce_write64(ctx, qp->sq.db_reg, (__le32 *)&sq_db); + } + +-static void hns_roce_write512(uint64_t *dest, uint64_t *val) ++static void hns_roce_qp_write512(struct hns_roce_qp *qp, uint64_t *val) + { +- mmio_memcpy_x64(dest, val, sizeof(struct hns_roce_rc_sq_wqe)); +-} ++ uint64_t *dest = qp->sq.db_reg; + + #if defined(HNS_SVE) +-static void hns_roce_sve_write512(uint64_t *dest, uint64_t *val) +-{ +- asm volatile( +- "ldr z0, [%0]\n" +- "str z0, [%1]\n" +- ::"r" (val), "r"(dest):"cc", "memory" +- ); +-} +-#else +-static void hns_roce_sve_write512(uint64_t *dest, uint64_t *val) +-{ +- return; +-} ++ if (qp->flags & HNS_ROCE_QP_CAP_SVE_DIRECT_WQE) { ++ asm volatile( ++ "ldr z0, [%0]\n" ++ "str z0, [%1]\n" ++ ::"r" (val), "r"(dest):"cc", "memory" ++ ); ++ return; ++ } + #endif ++ mmio_memcpy_x64(dest, val, sizeof(struct hns_roce_rc_sq_wqe)); ++} + + static void hns_roce_write_dwqe(struct hns_roce_qp *qp, void *wqe) + { +@@ -355,10 +351,7 @@ static void hns_roce_write_dwqe(struct hns_roce_qp *qp, void *wqe) + hr_reg_write(rc_sq_wqe, RCWQE_DB_SL_H, qp->sl >> HNS_ROCE_SL_SHIFT); + hr_reg_write(rc_sq_wqe, RCWQE_WQE_IDX, qp->sq.head); + +- if (qp->flags & HNS_ROCE_QP_CAP_SVE_DIRECT_WQE) +- hns_roce_sve_write512(qp->sq.db_reg, wqe); +- else +- hns_roce_write512(qp->sq.db_reg, wqe); ++ hns_roce_qp_write512(qp, wqe); + } + + static void update_cq_db(struct hns_roce_context *ctx, struct hns_roce_cq *cq) +-- +2.25.1 + diff --git a/rdma-core.spec b/rdma-core.spec index d1e9126..d8980bc 100644 --- a/rdma-core.spec +++ b/rdma-core.spec @@ -1,6 +1,6 @@ Name: rdma-core Version: 41.0 -Release: 23 +Release: 24 Summary: RDMA core userspace libraries and daemons License: GPLv2 or BSD Url: https://github.com/linux-rdma/rdma-core @@ -86,6 +86,7 @@ patch77: 0077-libhns-Fix-parent-domain-unsupported-comp-mask.patch patch78: 0078-libhns-Add-pthread_spin_destroy-pthread_mutex_destro.patch patch79: 0079-libhns-Removes-a-repeated-initialization-of-a-spinlo.patch patch80: 0080-libhns-Fix-owner-bit-when-SQ-wraps-around-in-new-IO.patch +patch81: 0081-libhns-Fix-missing-DB-when-compiler-does-not-support.patch BuildRequires: binutils cmake >= 2.8.11 gcc libudev-devel pkgconfig pkgconfig(libnl-3.0) BuildRequires: pkgconfig(libnl-route-3.0) valgrind-devel systemd systemd-devel @@ -333,6 +334,12 @@ fi %{_mandir}/* %changelog +* Fri Dec 8 2023 Ran Zhou - 41.0-24 +- Type: bugfix +- ID: NA +- SUG: NA +- DESC: Fix missing DB when compiler does not support SVE + * Thu Dec 7 2023 Ran Zhou - 41.0-23 - Type: bugfix - ID: NA -- Gitee