Message ID | 1519634466-93056-3-git-send-email-liuyixian@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Hi Yixian, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v4.16-rc3 next-20180226] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Yixian-Liu/Support-rq-and-cq-record-doorbell/20180226-184438 reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) drivers/infiniband/hw/hns/hns_roce_hw_v2.c:482:37: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __be32 @@ got restricted __be32 @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:482:37: expected restricted __be32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:482:37: got restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:577:37: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __be32 @@ got restricted __be32 @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:577:37: expected restricted __be32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:577:37: got restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:805:18: sparse: restricted __le16 degrades to integer drivers/infiniband/hw/hns/hns_roce_hw_v2.c:822:34: sparse: incorrect type in assignment (different base types) @@ expected unsigned short desc_ret @@ got short desc_ret @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:822:34: expected unsigned short desc_ret drivers/infiniband/hw/hns/hns_roce_hw_v2.c:822:34: got restricted __le16 retval drivers/infiniband/hw/hns/hns_roce_hw_v2.c:861:26: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:861:26: sparse: cast from restricted __le16 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:862:29: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:862:29: sparse: cast from restricted __le16 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1223:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1223:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1223:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1223:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1223:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1223:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1225:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1225:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1225:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1225:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1225:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1225:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1227:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1227:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1227:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1227:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1227:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1227:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1229:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1229:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1229:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1229:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1229:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1229:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1232:22: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1232:22: expected unsigned long val drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1232:22: got restricted __le64 <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1233:22: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long val @@ got restunsigned long val @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1233:22: expected unsigned long val drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1233:22: got restricted __le64 <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1238:22: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1238:22: expected unsigned int val drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1238:22: got restricted __le32 <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1239:22: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int val @@ got restrunsigned int val @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1239:22: expected unsigned int val drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1239:22: got restricted __le32 <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1309:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1309:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1309:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1309:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1309:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1309:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1330:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1330:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1330:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1330:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1330:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1330:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1361:39: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1375:39: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1379:36: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1396:38: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1422:36: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1433:38: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1480:33: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1604:38: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1609:38: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 cqe_cur_blk_addr @@ got unsignrestricted __le32 cqe_cur_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1609:38: expected restricted __le32 cqe_cur_blk_addr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1609:38: got unsigned int <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1611:33: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1613:9: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1622:38: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 cqe_nxt_blk_addr @@ got unsignrestricted __le32 cqe_nxt_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1622:38: expected restricted __le32 cqe_nxt_blk_addr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1622:38: got unsigned int <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1623:9: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1636:28: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 cqe_ba @@ got unsignrestricted __le32 cqe_ba @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1636:28: expected restricted __le32 cqe_ba drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1636:28: got unsigned int <noident> >> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1649:36: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 db_record_addr @@ got __le32 db_record_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1649:36: expected restricted __le32 db_record_addr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1649:36: got unsigned long long drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1677:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1677:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1677:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1677:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1677:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1677:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1679:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1679:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1679:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1679:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1679:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1679:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1681:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1681:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1681:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1681:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1681:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1681:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1684:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1684:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1684:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1684:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1684:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1684:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1686:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1686:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1686:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1686:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1686:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1686:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1689:28: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __be32 @@ got 2 @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1689:28: expected restricted __be32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1689:28: got unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2283:36: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 qkey_xrcd @@ got unsigned intrestricted __le32 qkey_xrcd @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2283:36: expected restricted __le32 qkey_xrcd drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2283:36: got unsigned int const qkey drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2302:36: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 rq_db_record_addr @@ got __le32 rq_db_record_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2302:36: expected restricted __le32 rq_db_record_addr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2302:36: got unsigned long long drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2614:36: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 qkey_xrcd @@ got unsigned intrestricted __le32 qkey_xrcd @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2614:36: expected restricted __le32 qkey_xrcd drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2614:36: got unsigned int const qkey drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2688:29: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 wqe_sge_ba @@ got unsignrestricted __le32 wqe_sge_ba @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2688:29: expected restricted __le32 wqe_sge_ba drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2688:29: got unsigned int <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2751:34: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 rq_cur_blk_addr @@ got unsignrestricted __le32 rq_cur_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2751:34: expected restricted __le32 rq_cur_blk_addr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2751:34: got unsigned int <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2764:34: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 rq_nxt_blk_addr @@ got unsignrestricted __le32 rq_nxt_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2764:34: expected restricted __le32 rq_nxt_blk_addr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2764:34: got unsigned int <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2788:26: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 trrl_ba @@ got unsignrestricted __le32 trrl_ba @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2788:26: expected restricted __le32 trrl_ba drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2788:26: got unsigned int <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2796:26: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 irrl_ba @@ got unsignrestricted __le32 irrl_ba @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2796:26: expected restricted __le32 irrl_ba drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2796:26: got unsigned int <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2807:9: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2975:34: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 sq_cur_blk_addr @@ got unsignrestricted __le32 sq_cur_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2975:34: expected restricted __le32 sq_cur_blk_addr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2975:34: got unsigned int <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2986:38: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 sq_cur_sge_blk_addr @@ got sq_cur_sge_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2986:38: expected restricted __le32 sq_cur_sge_blk_addr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2986:38: got unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3001:37: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 rx_sq_cur_blk_addr @@ got unsignrestricted __le32 rx_sq_cur_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3001:37: expected restricted __le32 rx_sq_cur_blk_addr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3001:37: got unsigned int <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3401:28: sparse: incorrect type in assignment (different base types) @@ expected unsigned char rnr_retry @@ got d char rnr_retry @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3401:28: expected unsigned char rnr_retry drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3401:28: got restricted __le32 rq_rnr_timer drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3558:17: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3558:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3558:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3558:17: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3558:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3558:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3564:17: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3564:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3564:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3564:17: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3564:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3564:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3567:17: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3567:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3567:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3567:17: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3567:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3567:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3574:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3574:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3574:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3574:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3574:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3574:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3578:28: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __be32 @@ got 2 @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3578:28: expected restricted __be32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3578:28: got unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3589:20: sparse: cast to restricted __le32 vim +1649 drivers/infiniband/hw/hns/hns_roce_hw_v2.c 1585 1586 static void hns_roce_v2_write_cqc(struct hns_roce_dev *hr_dev, 1587 struct hns_roce_cq *hr_cq, void *mb_buf, 1588 u64 *mtts, dma_addr_t dma_handle, int nent, 1589 u32 vector) 1590 { 1591 struct hns_roce_v2_cq_context *cq_context; 1592 1593 cq_context = mb_buf; 1594 memset(cq_context, 0, sizeof(*cq_context)); 1595 1596 roce_set_field(cq_context->byte_4_pg_ceqn, V2_CQC_BYTE_4_CQ_ST_M, 1597 V2_CQC_BYTE_4_CQ_ST_S, V2_CQ_STATE_VALID); 1598 roce_set_field(cq_context->byte_4_pg_ceqn, V2_CQC_BYTE_4_ARM_ST_M, 1599 V2_CQC_BYTE_4_ARM_ST_S, REG_NXT_CEQE); 1600 roce_set_field(cq_context->byte_4_pg_ceqn, V2_CQC_BYTE_4_SHIFT_M, 1601 V2_CQC_BYTE_4_SHIFT_S, ilog2((unsigned int)nent)); 1602 roce_set_field(cq_context->byte_4_pg_ceqn, V2_CQC_BYTE_4_CEQN_M, 1603 V2_CQC_BYTE_4_CEQN_S, vector); 1604 cq_context->byte_4_pg_ceqn = cpu_to_le32(cq_context->byte_4_pg_ceqn); 1605 1606 roce_set_field(cq_context->byte_8_cqn, V2_CQC_BYTE_8_CQN_M, 1607 V2_CQC_BYTE_8_CQN_S, hr_cq->cqn); 1608 1609 cq_context->cqe_cur_blk_addr = (u32)(mtts[0] >> PAGE_ADDR_SHIFT); 1610 cq_context->cqe_cur_blk_addr = > 1611 cpu_to_le32(cq_context->cqe_cur_blk_addr); 1612 1613 roce_set_field(cq_context->byte_16_hop_addr, 1614 V2_CQC_BYTE_16_CQE_CUR_BLK_ADDR_M, 1615 V2_CQC_BYTE_16_CQE_CUR_BLK_ADDR_S, 1616 cpu_to_le32((mtts[0]) >> (32 + PAGE_ADDR_SHIFT))); 1617 roce_set_field(cq_context->byte_16_hop_addr, 1618 V2_CQC_BYTE_16_CQE_HOP_NUM_M, 1619 V2_CQC_BYTE_16_CQE_HOP_NUM_S, hr_dev->caps.cqe_hop_num == 1620 HNS_ROCE_HOP_NUM_0 ? 0 : hr_dev->caps.cqe_hop_num); 1621 1622 cq_context->cqe_nxt_blk_addr = (u32)(mtts[1] >> PAGE_ADDR_SHIFT); 1623 roce_set_field(cq_context->byte_24_pgsz_addr, 1624 V2_CQC_BYTE_24_CQE_NXT_BLK_ADDR_M, 1625 V2_CQC_BYTE_24_CQE_NXT_BLK_ADDR_S, 1626 cpu_to_le32((mtts[1]) >> (32 + PAGE_ADDR_SHIFT))); 1627 roce_set_field(cq_context->byte_24_pgsz_addr, 1628 V2_CQC_BYTE_24_CQE_BA_PG_SZ_M, 1629 V2_CQC_BYTE_24_CQE_BA_PG_SZ_S, 1630 hr_dev->caps.cqe_ba_pg_sz); 1631 roce_set_field(cq_context->byte_24_pgsz_addr, 1632 V2_CQC_BYTE_24_CQE_BUF_PG_SZ_M, 1633 V2_CQC_BYTE_24_CQE_BUF_PG_SZ_S, 1634 hr_dev->caps.cqe_buf_pg_sz); 1635 1636 cq_context->cqe_ba = (u32)(dma_handle >> 3); 1637 1638 roce_set_field(cq_context->byte_40_cqe_ba, V2_CQC_BYTE_40_CQE_BA_M, 1639 V2_CQC_BYTE_40_CQE_BA_S, (dma_handle >> (32 + 3))); 1640 1641 if (hr_cq->db_en) 1642 roce_set_bit(cq_context->byte_44_db_record, 1643 V2_CQC_BYTE_44_DB_RECORD_EN_S, 1); 1644 1645 roce_set_field(cq_context->byte_44_db_record, 1646 V2_CQC_BYTE_44_DB_RECORD_ADDR_M, 1647 V2_CQC_BYTE_44_DB_RECORD_ADDR_S, 1648 ((u32)hr_cq->db.dma) >> 1); > 1649 cq_context->db_record_addr = hr_cq->db.dma >> 32; 1650 1651 roce_set_field(cq_context->byte_56_cqe_period_maxcnt, 1652 V2_CQC_BYTE_56_CQ_MAX_CNT_M, 1653 V2_CQC_BYTE_56_CQ_MAX_CNT_S, 1654 HNS_ROCE_V2_CQ_DEFAULT_BURST_NUM); 1655 roce_set_field(cq_context->byte_56_cqe_period_maxcnt, 1656 V2_CQC_BYTE_56_CQ_PERIOD_M, 1657 V2_CQC_BYTE_56_CQ_PERIOD_S, 1658 HNS_ROCE_V2_CQ_DEFAULT_INTERVAL); 1659 } 1660 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c index bccc9b5..8226f19 100644 --- a/drivers/infiniband/hw/hns/hns_roce_cq.c +++ b/drivers/infiniband/hw/hns/hns_roce_cq.c @@ -315,6 +315,7 @@ struct ib_cq *hns_roce_ib_create_cq(struct ib_device *ib_dev, struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev); struct device *dev = hr_dev->dev; struct hns_roce_ib_create_cq ucmd; + struct hns_roce_ib_create_cq_resp resp; struct hns_roce_cq *hr_cq = NULL; struct hns_roce_uar *uar = NULL; int vector = attr->comp_vector; @@ -378,6 +379,16 @@ struct ib_cq *hns_roce_ib_create_cq(struct ib_device *ib_dev, goto err_mtt; } + if (context && (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) && + (udata->outlen == sizeof(resp))) { + ret = hns_roce_db_map_user(to_hr_ucontext(context), + ucmd.db_addr, &hr_cq->db); + if (ret) { + dev_err(dev, "cq record doorbell map failed!\n"); + goto err_cqc; + } + } + /* * For the QP created by kernel space, tptr value should be initialized * to zero; For the QP created by user space, it will cause synchronous @@ -393,14 +404,27 @@ struct ib_cq *hns_roce_ib_create_cq(struct ib_device *ib_dev, hr_cq->cq_depth = cq_entries; if (context) { - if (ib_copy_to_udata(udata, &hr_cq->cqn, sizeof(u64))) { - ret = -EFAULT; - goto err_cqc; - } + if ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) && + (udata->outlen == sizeof(resp))) { + hr_cq->db_en = 1; + resp.cqn = hr_cq->cqn; + resp.cap_flags |= HNS_ROCE_SUPPORT_CQ_RECORD_DB; + ret = ib_copy_to_udata(udata, &resp, sizeof(resp)); + } else + ret = ib_copy_to_udata(udata, &hr_cq->cqn, sizeof(u64)); + + if (ret) + goto err_dbmap; } return &hr_cq->ib_cq; +err_dbmap: + if (context && (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_RECORD_DB) && + (udata->outlen == sizeof(resp))) + hns_roce_db_unmap_user(to_hr_ucontext(context), + &hr_cq->db); + err_cqc: hns_roce_free_cq(hr_dev, hr_cq); @@ -430,12 +454,18 @@ int hns_roce_ib_destroy_cq(struct ib_cq *ib_cq) hns_roce_free_cq(hr_dev, hr_cq); hns_roce_mtt_cleanup(hr_dev, &hr_cq->hr_buf.hr_mtt); - if (ib_cq->uobject) + if (ib_cq->uobject) { ib_umem_release(hr_cq->umem); - else + + if (hr_cq->db_en == 1) + hns_roce_db_unmap_user( + to_hr_ucontext(ib_cq->uobject->context), + &hr_cq->db); + } else { /* Free the buff of stored cq */ hns_roce_ib_free_cq_buf(hr_dev, &hr_cq->hr_buf, ib_cq->cqe); + } kfree(hr_cq); } diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h index a6f01a1..7db4d98 100644 --- a/drivers/infiniband/hw/hns/hns_roce_device.h +++ b/drivers/infiniband/hw/hns/hns_roce_device.h @@ -109,6 +109,10 @@ enum { HNS_ROCE_SUPPORT_RQ_RECORD_DB = 1 << 0, }; +enum { + HNS_ROCE_SUPPORT_CQ_RECORD_DB = 1 << 0, +}; + enum hns_roce_qp_state { HNS_ROCE_QP_STATE_RST, HNS_ROCE_QP_STATE_INIT, @@ -381,6 +385,8 @@ struct hns_roce_cq_buf { struct hns_roce_cq { struct ib_cq ib_cq; struct hns_roce_cq_buf hr_buf; + struct hns_roce_db db; + u8 db_en; spinlock_t lock; struct ib_umem *umem; void (*comp)(struct hns_roce_cq *cq); diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 2157591..bc0a2b7 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -1638,6 +1638,16 @@ static void hns_roce_v2_write_cqc(struct hns_roce_dev *hr_dev, roce_set_field(cq_context->byte_40_cqe_ba, V2_CQC_BYTE_40_CQE_BA_M, V2_CQC_BYTE_40_CQE_BA_S, (dma_handle >> (32 + 3))); + if (hr_cq->db_en) + roce_set_bit(cq_context->byte_44_db_record, + V2_CQC_BYTE_44_DB_RECORD_EN_S, 1); + + roce_set_field(cq_context->byte_44_db_record, + V2_CQC_BYTE_44_DB_RECORD_ADDR_M, + V2_CQC_BYTE_44_DB_RECORD_ADDR_S, + ((u32)hr_cq->db.dma) >> 1); + cq_context->db_record_addr = hr_cq->db.dma >> 32; + roce_set_field(cq_context->byte_56_cqe_period_maxcnt, V2_CQC_BYTE_56_CQ_MAX_CNT_M, V2_CQC_BYTE_56_CQ_MAX_CNT_S, diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h index 2bf8a47..182b672 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h @@ -299,6 +299,9 @@ struct hns_roce_v2_cq_context { #define V2_CQC_BYTE_44_DB_RECORD_EN_S 0 +#define V2_CQC_BYTE_44_DB_RECORD_ADDR_S 1 +#define V2_CQC_BYTE_44_DB_RECORD_ADDR_M GENMASK(31, 1) + #define V2_CQC_BYTE_52_CQE_CNT_S 0 #define V2_CQC_BYTE_52_CQE_CNT_M GENMASK(23, 0) diff --git a/include/uapi/rdma/hns-abi.h b/include/uapi/rdma/hns-abi.h index 6150c19..38e8f19 100644 --- a/include/uapi/rdma/hns-abi.h +++ b/include/uapi/rdma/hns-abi.h @@ -38,6 +38,13 @@ struct hns_roce_ib_create_cq { __u64 buf_addr; + __u64 db_addr; +}; + +struct hns_roce_ib_create_cq_resp { + __u32 cqn; + __u32 reserved; + __u64 cap_flags; }; struct hns_roce_ib_create_qp {