diff mbox

[for-next,1/4] RDMA/hns: Add TSQ link table support

Message ID 1530587412-17866-2-git-send-email-oulijun@huawei.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Lijun Ou July 3, 2018, 3:10 a.m. UTC
In hip08, TSQ(Transport Service Queue) should be extended
to host memory to store the doorbells. This patch adds the
support of creating TSQ, and then configured to the hardware.

Signed-off-by: Yixian Liu <liuyixian@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_device.h |   2 +
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c  | 217 +++++++++++++++++++++++++++-
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h  |  85 ++++++++++-
 3 files changed, 297 insertions(+), 7 deletions(-)

Comments

kernel test robot July 3, 2018, 10:52 a.m. UTC | #1
Hi Lijun,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rdma/for-next]
[also build test WARNING on v4.18-rc3 next-20180702]
[cannot apply to linus/master linux-sof-driver/master]
[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/Lijun-Ou/Four-cmd-queues-support-for-hip08/20180703-104144
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
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:522:37: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __be32 [usertype] *val @@    got restricted __be32 [usertype] *val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:522:37:    expected restricted __be32 [usertype] *val
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:522:37:    got restricted __le32 [usertype] *<noident>
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:843:18: sparse: restricted __le16 degrades to integer
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [usertype] desc_ret @@    got  short [unsigned] [usertype] desc_ret @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34:    expected unsigned short [unsigned] [usertype] desc_ret
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34:    got restricted __le16 [usertype] retval
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:899:26: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:899:26: sparse: cast from restricted __le16
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:900:29: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:900:29: sparse: cast from restricted __le16
>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1272:44: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] base_addr_l @@    got __le32 [usertype] base_addr_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1272:44:    expected restricted __le32 [usertype] base_addr_l
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1272:44:    got unsigned long long
>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1273:44: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] base_addr_h @@    got __le32 [usertype] base_addr_h @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1273:44:    expected restricted __le32 [usertype] base_addr_h
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1273:44:    got unsigned long long
>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1283:42: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] head_ba_l @@    got unsignrestricted __le32 [usertype] head_ba_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1283:42:    expected restricted __le32 [usertype] head_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1283:42:    got unsigned int [unsigned] [usertype] blk_ba0
>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1284:49: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] head_ba_h_nxtptr @@    got unsignrestricted __le32 [usertype] head_ba_h_nxtptr @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1284:49:    expected restricted __le32 [usertype] head_ba_h_nxtptr
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1284:49:    got unsigned int [unsigned] [usertype] blk_ba1_nxt_ptr
>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1289:42: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] tail_ba_l @@    got unsignrestricted __le32 [usertype] tail_ba_l @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1289:42:    expected restricted __le32 [usertype] tail_ba_l
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1289:42:    got unsigned int [unsigned] [usertype] blk_ba0
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1335:18: sparse: expression using sizeof(void)
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1335:18: sparse: expression using sizeof(void)
   include/linux/slab.h:631:13: sparse: undefined identifier '__builtin_mul_overflow'
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1465:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1465:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1467:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1467:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1469:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1469:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1471:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1471:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1551:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1551:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1572:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1572:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1604:39: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1618:39: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1624:36: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1641:38: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1667:36: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1679:38: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1726:33: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1833:38: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1838:38: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cqe_cur_blk_addr @@    got unsignrestricted __le32 [usertype] cqe_cur_blk_addr @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1840:33: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1842:9: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1851:38: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cqe_nxt_blk_addr @@    got unsignrestricted __le32 [usertype] cqe_nxt_blk_addr @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1852:9: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1865:28: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cqe_ba @@    got unsignrestricted __le32 [usertype] cqe_ba @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1878:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] db_record_addr @@    got __le32 [usertype] db_record_addr @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1906:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1906:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1908:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1908:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1910:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1910:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1913:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1913:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1915:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1915:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1918:28: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __be32 [usertype] *val @@    got 2 [usertype] *val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1942:24: sparse: expression using sizeof(void)
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1942:24: sparse: expression using sizeof(void)
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2513:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qkey_xrcd @@    got unsigned intrestricted __le32 [usertype] qkey_xrcd @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2532:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rq_db_record_addr @@    got __le32 [usertype] rq_db_record_addr @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2845:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qkey_xrcd @@    got unsigned intrestricted __le32 [usertype] qkey_xrcd @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2920:29: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] wqe_sge_ba @@    got unsignrestricted __le32 [usertype] wqe_sge_ba @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2983:34: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rq_cur_blk_addr @@    got unsignrestricted __le32 [usertype] rq_cur_blk_addr @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2996:34: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rq_nxt_blk_addr @@    got unsignrestricted __le32 [usertype] rq_nxt_blk_addr @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3020:26: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] trrl_ba @@    got unsignrestricted __le32 [usertype] trrl_ba @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3028:26: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] irrl_ba @@    got unsignrestricted __le32 [usertype] irrl_ba @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3039:9: sparse: cast from restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3207:34: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] sq_cur_blk_addr @@    got unsignrestricted __le32 [usertype] sq_cur_blk_addr @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3218:38: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] sq_cur_sge_blk_addr @@    got  [usertype] sq_cur_sge_blk_addr @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3233:37: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rx_sq_cur_blk_addr @@    got unsignrestricted __le32 [usertype] rx_sq_cur_blk_addr @@
   include/linux/slab.h:631:13: sparse: not a function <noident>
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3634:28: sparse: incorrect type in assignment (different base types) @@    expected unsigned char [unsigned] [usertype] rnr_retry @@    got d char [unsigned] [usertype] rnr_retry @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3634:28:    expected unsigned char [unsigned] [usertype] rnr_retry
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3634:28:    got restricted __le32 [usertype] rq_rnr_timer
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9: sparse: invalid assignment: |=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    right side has type restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3813:28: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __be32 [usertype] *val @@    got 2 [usertype] *val @@
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3813:28:    expected restricted __be32 [usertype] *val
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3813:28:    got unsigned int *<noident>
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3824:20: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3855:20: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3892:15: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3926:15: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3982:17: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4001:30: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4100:20: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4119:23: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4167:13: sparse: cast to restricted __le32
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4170:17: sparse: invalid assignment: &=
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4170:17:    left side has type unsigned int
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4170:17:    right side has type restricted __le32

vim +1272 drivers/infiniband/hw/hns/hns_roce_hw_v2.c

  1233	
  1234	static int hns_roce_config_link_table(struct hns_roce_dev *hr_dev,
  1235					      enum hns_roce_link_table_type type)
  1236	{
  1237		struct hns_roce_cmq_desc desc[2];
  1238		struct hns_roce_cfg_llm_a *req_a =
  1239					(struct hns_roce_cfg_llm_a *)desc[0].data;
  1240		struct hns_roce_cfg_llm_b *req_b =
  1241					(struct hns_roce_cfg_llm_b *)desc[1].data;
  1242		struct hns_roce_v2_priv *priv = hr_dev->priv;
  1243		struct hns_roce_link_table *link_tbl;
  1244		struct hns_roce_link_table_entry *entry;
  1245		enum hns_roce_opcode_type opcode;
  1246		u32 page_num;
  1247		int i;
  1248	
  1249		switch (type) {
  1250		case TSQ_LINK_TABLE:
  1251			link_tbl = &priv->tsq;
  1252			opcode = HNS_ROCE_OPC_CFG_EXT_LLM;
  1253			break;
  1254		default:
  1255			return -EINVAL;
  1256		}
  1257	
  1258		page_num = link_tbl->npages;
  1259		entry = link_tbl->table.buf;
  1260		memset(req_a, 0, sizeof(*req_a));
  1261		memset(req_b, 0, sizeof(*req_b));
  1262	
  1263		for (i = 0; i < 2; i++) {
  1264			hns_roce_cmq_setup_basic_desc(&desc[i], opcode, false);
  1265	
  1266			if (i == 0)
  1267				desc[i].flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
  1268			else
  1269				desc[i].flag &= ~cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
  1270	
  1271			if (i == 0) {
> 1272				req_a->base_addr_l = link_tbl->table.map & 0xffffffff;
> 1273				req_a->base_addr_h = (link_tbl->table.map >> 32) &
  1274						     0xffffffff;
  1275				roce_set_field(req_a->depth_pgsz_init_en,
  1276					       CFG_LLM_QUE_DEPTH_M,
  1277					       CFG_LLM_QUE_DEPTH_S,
  1278					       link_tbl->npages);
  1279				roce_set_field(req_a->depth_pgsz_init_en,
  1280					       CFG_LLM_QUE_PGSZ_M,
  1281					       CFG_LLM_QUE_PGSZ_S,
  1282					       link_tbl->pg_sz);
> 1283				req_a->head_ba_l = entry[0].blk_ba0;
> 1284				req_a->head_ba_h_nxtptr = entry[0].blk_ba1_nxt_ptr;
  1285				roce_set_field(req_a->head_ptr,
  1286					       CFG_LLM_HEAD_PTR_M,
  1287					       CFG_LLM_HEAD_PTR_S, 0);
  1288			} else {
> 1289				req_b->tail_ba_l = entry[page_num - 1].blk_ba0;
  1290				roce_set_field(req_b->tail_ba_h,
  1291					       CFG_LLM_TAIL_BA_H_M,
  1292					       CFG_LLM_TAIL_BA_H_S,
  1293					       entry[page_num - 1].blk_ba1_nxt_ptr &
  1294					       HNS_ROCE_LINK_TABLE_BA1_M);
  1295				roce_set_field(req_b->tail_ptr,
  1296					       CFG_LLM_TAIL_PTR_M,
  1297					       CFG_LLM_TAIL_PTR_S,
  1298					       (entry[page_num - 2].blk_ba1_nxt_ptr &
  1299					       HNS_ROCE_LINK_TABLE_NXT_PTR_M) >>
  1300					       HNS_ROCE_LINK_TABLE_NXT_PTR_S);
  1301			}
  1302		}
  1303		roce_set_field(req_a->depth_pgsz_init_en,
  1304			       CFG_LLM_INIT_EN_M, CFG_LLM_INIT_EN_S, 1);
  1305	
  1306		return hns_roce_cmq_send(hr_dev, desc, 2);
  1307	}
  1308	

---
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
Jason Gunthorpe July 3, 2018, 9:49 p.m. UTC | #2
Lijun,

I thought you already sent a sparse cleanup for this driver? It
certainly looks wrong to bitshit and mask a le marked value.

I think you'll need to resend this series with the sparse warnings
fixed.

Thanks,
Jason

On Tue, Jul 03, 2018 at 06:52:39PM +0800, kbuild test robot wrote:
> Hi Lijun,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on rdma/for-next]
> [also build test WARNING on v4.18-rc3 next-20180702]
> [cannot apply to linus/master linux-sof-driver/master]
> [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/Lijun-Ou/Four-cmd-queues-support-for-hip08/20180703-104144
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
> 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:522:37: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __be32 [usertype] *val @@    got restricted __be32 [usertype] *val @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:522:37:    expected restricted __be32 [usertype] *val
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:522:37:    got restricted __le32 [usertype] *<noident>
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:843:18: sparse: restricted __le16 degrades to integer
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [usertype] desc_ret @@    got  short [unsigned] [usertype] desc_ret @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34:    expected unsigned short [unsigned] [usertype] desc_ret
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34:    got restricted __le16 [usertype] retval
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:899:26: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:899:26: sparse: cast from restricted __le16
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:900:29: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:900:29: sparse: cast from restricted __le16
> >> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1272:44: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] base_addr_l @@    got __le32 [usertype] base_addr_l @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1272:44:    expected restricted __le32 [usertype] base_addr_l
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1272:44:    got unsigned long long
> >> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1273:44: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] base_addr_h @@    got __le32 [usertype] base_addr_h @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1273:44:    expected restricted __le32 [usertype] base_addr_h
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1273:44:    got unsigned long long
> >> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1283:42: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] head_ba_l @@    got unsignrestricted __le32 [usertype] head_ba_l @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1283:42:    expected restricted __le32 [usertype] head_ba_l
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1283:42:    got unsigned int [unsigned] [usertype] blk_ba0
> >> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1284:49: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] head_ba_h_nxtptr @@    got unsignrestricted __le32 [usertype] head_ba_h_nxtptr @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1284:49:    expected restricted __le32 [usertype] head_ba_h_nxtptr
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1284:49:    got unsigned int [unsigned] [usertype] blk_ba1_nxt_ptr
> >> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1289:42: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] tail_ba_l @@    got unsignrestricted __le32 [usertype] tail_ba_l @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1289:42:    expected restricted __le32 [usertype] tail_ba_l
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1289:42:    got unsigned int [unsigned] [usertype] blk_ba0
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1335:18: sparse: expression using sizeof(void)
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1335:18: sparse: expression using sizeof(void)
>    include/linux/slab.h:631:13: sparse: undefined identifier '__builtin_mul_overflow'
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1465:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1465:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1467:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1467:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1469:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1469:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1471:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1471:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1551:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1551:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1572:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1572:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1604:39: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1618:39: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1624:36: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1641:38: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1667:36: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1679:38: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1726:33: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1833:38: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1838:38: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cqe_cur_blk_addr @@    got unsignrestricted __le32 [usertype] cqe_cur_blk_addr @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1840:33: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1842:9: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1851:38: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cqe_nxt_blk_addr @@    got unsignrestricted __le32 [usertype] cqe_nxt_blk_addr @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1852:9: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1865:28: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cqe_ba @@    got unsignrestricted __le32 [usertype] cqe_ba @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1878:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] db_record_addr @@    got __le32 [usertype] db_record_addr @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1906:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1906:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1908:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1908:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1910:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1910:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1913:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1913:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1915:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1915:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1918:28: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __be32 [usertype] *val @@    got 2 [usertype] *val @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1942:24: sparse: expression using sizeof(void)
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1942:24: sparse: expression using sizeof(void)
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2513:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qkey_xrcd @@    got unsigned intrestricted __le32 [usertype] qkey_xrcd @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2532:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rq_db_record_addr @@    got __le32 [usertype] rq_db_record_addr @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2845:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qkey_xrcd @@    got unsigned intrestricted __le32 [usertype] qkey_xrcd @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2920:29: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] wqe_sge_ba @@    got unsignrestricted __le32 [usertype] wqe_sge_ba @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2983:34: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rq_cur_blk_addr @@    got unsignrestricted __le32 [usertype] rq_cur_blk_addr @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2996:34: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rq_nxt_blk_addr @@    got unsignrestricted __le32 [usertype] rq_nxt_blk_addr @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3020:26: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] trrl_ba @@    got unsignrestricted __le32 [usertype] trrl_ba @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3028:26: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] irrl_ba @@    got unsignrestricted __le32 [usertype] irrl_ba @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3039:9: sparse: cast from restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3207:34: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] sq_cur_blk_addr @@    got unsignrestricted __le32 [usertype] sq_cur_blk_addr @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3218:38: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] sq_cur_sge_blk_addr @@    got  [usertype] sq_cur_sge_blk_addr @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3233:37: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rx_sq_cur_blk_addr @@    got unsignrestricted __le32 [usertype] rx_sq_cur_blk_addr @@
>    include/linux/slab.h:631:13: sparse: not a function <noident>
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3634:28: sparse: incorrect type in assignment (different base types) @@    expected unsigned char [unsigned] [usertype] rnr_retry @@    got d char [unsigned] [usertype] rnr_retry @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3634:28:    expected unsigned char [unsigned] [usertype] rnr_retry
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3634:28:    got restricted __le32 [usertype] rq_rnr_timer
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    left side has type unsigned int
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    right side has type restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    left side has type unsigned int
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    right side has type restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    left side has type unsigned int
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    right side has type restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    left side has type unsigned int
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    right side has type restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    left side has type unsigned int
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    right side has type restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    left side has type unsigned int
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    right side has type restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    left side has type unsigned int
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    right side has type restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9: sparse: invalid assignment: |=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    left side has type unsigned int
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    right side has type restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3813:28: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __be32 [usertype] *val @@    got 2 [usertype] *val @@
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3813:28:    expected restricted __be32 [usertype] *val
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3813:28:    got unsigned int *<noident>
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3824:20: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3855:20: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3892:15: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3926:15: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3982:17: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4001:30: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4100:20: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4119:23: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4167:13: sparse: cast to restricted __le32
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4170:17: sparse: invalid assignment: &=
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4170:17:    left side has type unsigned int
>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4170:17:    right side has type restricted __le32
> 
> vim +1272 drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> 
>   1233	
>   1234	static int hns_roce_config_link_table(struct hns_roce_dev *hr_dev,
>   1235					      enum hns_roce_link_table_type type)
>   1236	{
>   1237		struct hns_roce_cmq_desc desc[2];
>   1238		struct hns_roce_cfg_llm_a *req_a =
>   1239					(struct hns_roce_cfg_llm_a *)desc[0].data;
>   1240		struct hns_roce_cfg_llm_b *req_b =
>   1241					(struct hns_roce_cfg_llm_b *)desc[1].data;
>   1242		struct hns_roce_v2_priv *priv = hr_dev->priv;
>   1243		struct hns_roce_link_table *link_tbl;
>   1244		struct hns_roce_link_table_entry *entry;
>   1245		enum hns_roce_opcode_type opcode;
>   1246		u32 page_num;
>   1247		int i;
>   1248	
>   1249		switch (type) {
>   1250		case TSQ_LINK_TABLE:
>   1251			link_tbl = &priv->tsq;
>   1252			opcode = HNS_ROCE_OPC_CFG_EXT_LLM;
>   1253			break;
>   1254		default:
>   1255			return -EINVAL;
>   1256		}
>   1257	
>   1258		page_num = link_tbl->npages;
>   1259		entry = link_tbl->table.buf;
>   1260		memset(req_a, 0, sizeof(*req_a));
>   1261		memset(req_b, 0, sizeof(*req_b));
>   1262	
>   1263		for (i = 0; i < 2; i++) {
>   1264			hns_roce_cmq_setup_basic_desc(&desc[i], opcode, false);
>   1265	
>   1266			if (i == 0)
>   1267				desc[i].flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
>   1268			else
>   1269				desc[i].flag &= ~cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
>   1270	
>   1271			if (i == 0) {
> > 1272				req_a->base_addr_l = link_tbl->table.map & 0xffffffff;
> > 1273				req_a->base_addr_h = (link_tbl->table.map >> 32) &
>   1274						     0xffffffff;
>   1275				roce_set_field(req_a->depth_pgsz_init_en,
>   1276					       CFG_LLM_QUE_DEPTH_M,
>   1277					       CFG_LLM_QUE_DEPTH_S,
>   1278					       link_tbl->npages);
>   1279				roce_set_field(req_a->depth_pgsz_init_en,
>   1280					       CFG_LLM_QUE_PGSZ_M,
>   1281					       CFG_LLM_QUE_PGSZ_S,
>   1282					       link_tbl->pg_sz);
> > 1283				req_a->head_ba_l = entry[0].blk_ba0;
> > 1284				req_a->head_ba_h_nxtptr = entry[0].blk_ba1_nxt_ptr;
>   1285				roce_set_field(req_a->head_ptr,
>   1286					       CFG_LLM_HEAD_PTR_M,
>   1287					       CFG_LLM_HEAD_PTR_S, 0);
>   1288			} else {
> > 1289				req_b->tail_ba_l = entry[page_num - 1].blk_ba0;
>   1290				roce_set_field(req_b->tail_ba_h,
>   1291					       CFG_LLM_TAIL_BA_H_M,
>   1292					       CFG_LLM_TAIL_BA_H_S,
>   1293					       entry[page_num - 1].blk_ba1_nxt_ptr &
>   1294					       HNS_ROCE_LINK_TABLE_BA1_M);
>   1295				roce_set_field(req_b->tail_ptr,
>   1296					       CFG_LLM_TAIL_PTR_M,
>   1297					       CFG_LLM_TAIL_PTR_S,
>   1298					       (entry[page_num - 2].blk_ba1_nxt_ptr &
>   1299					       HNS_ROCE_LINK_TABLE_NXT_PTR_M) >>
>   1300					       HNS_ROCE_LINK_TABLE_NXT_PTR_S);
>   1301			}
>   1302		}
>   1303		roce_set_field(req_a->depth_pgsz_init_en,
>   1304			       CFG_LLM_INIT_EN_M, CFG_LLM_INIT_EN_S, 1);
>   1305	
>   1306		return hns_roce_cmq_send(hr_dev, desc, 2);
>   1307	}
>   1308	
> 
> 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
Lijun Ou July 4, 2018, 3:03 a.m. UTC | #3
在 2018/7/4 5:49, Jason Gunthorpe 写道:
> Lijun,
> 
> I thought you already sent a sparse cleanup for this driver? It
> certainly looks wrong to bitshit and mask a le marked value.
> 
> I think you'll need to resend this series with the sparse warnings
> fixed.
> 
> Thanks,
> Jason
> 
OK, Maybe our private branch miss the check。 I will do it and must check by sparse in our private branch after this。
> On Tue, Jul 03, 2018 at 06:52:39PM +0800, kbuild test robot wrote:
>> Hi Lijun,
>>
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on rdma/for-next]
>> [also build test WARNING on v4.18-rc3 next-20180702]
>> [cannot apply to linus/master linux-sof-driver/master]
>> [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/Lijun-Ou/Four-cmd-queues-support-for-hip08/20180703-104144
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
>> 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:522:37: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __be32 [usertype] *val @@    got restricted __be32 [usertype] *val @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:522:37:    expected restricted __be32 [usertype] *val
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:522:37:    got restricted __le32 [usertype] *<noident>
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:843:18: sparse: restricted __le16 degrades to integer
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34: sparse: incorrect type in assignment (different base types) @@    expected unsigned short [unsigned] [usertype] desc_ret @@    got  short [unsigned] [usertype] desc_ret @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34:    expected unsigned short [unsigned] [usertype] desc_ret
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34:    got restricted __le16 [usertype] retval
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:899:26: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:899:26: sparse: cast from restricted __le16
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:900:29: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:900:29: sparse: cast from restricted __le16
>>>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1272:44: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] base_addr_l @@    got __le32 [usertype] base_addr_l @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1272:44:    expected restricted __le32 [usertype] base_addr_l
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1272:44:    got unsigned long long
>>>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1273:44: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] base_addr_h @@    got __le32 [usertype] base_addr_h @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1273:44:    expected restricted __le32 [usertype] base_addr_h
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1273:44:    got unsigned long long
>>>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1283:42: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] head_ba_l @@    got unsignrestricted __le32 [usertype] head_ba_l @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1283:42:    expected restricted __le32 [usertype] head_ba_l
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1283:42:    got unsigned int [unsigned] [usertype] blk_ba0
>>>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1284:49: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] head_ba_h_nxtptr @@    got unsignrestricted __le32 [usertype] head_ba_h_nxtptr @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1284:49:    expected restricted __le32 [usertype] head_ba_h_nxtptr
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1284:49:    got unsigned int [unsigned] [usertype] blk_ba1_nxt_ptr
>>>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1289:42: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] tail_ba_l @@    got unsignrestricted __le32 [usertype] tail_ba_l @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1289:42:    expected restricted __le32 [usertype] tail_ba_l
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1289:42:    got unsigned int [unsigned] [usertype] blk_ba0
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1335:18: sparse: expression using sizeof(void)
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1335:18: sparse: expression using sizeof(void)
>>    include/linux/slab.h:631:13: sparse: undefined identifier '__builtin_mul_overflow'
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1465:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1465:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1467:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1467:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1469:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1469:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1471:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1471:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1551:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1551:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1572:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1572:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1604:39: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1618:39: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1624:36: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1641:38: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1667:36: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1679:38: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1726:33: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1833:38: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1838:38: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cqe_cur_blk_addr @@    got unsignrestricted __le32 [usertype] cqe_cur_blk_addr @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1840:33: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1842:9: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1851:38: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cqe_nxt_blk_addr @@    got unsignrestricted __le32 [usertype] cqe_nxt_blk_addr @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1852:9: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1865:28: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] cqe_ba @@    got unsignrestricted __le32 [usertype] cqe_ba @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1878:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] db_record_addr @@    got __le32 [usertype] db_record_addr @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1906:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1906:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1908:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1908:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1910:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1910:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1913:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1913:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1915:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1915:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1918:28: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __be32 [usertype] *val @@    got 2 [usertype] *val @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1942:24: sparse: expression using sizeof(void)
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1942:24: sparse: expression using sizeof(void)
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2513:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qkey_xrcd @@    got unsigned intrestricted __le32 [usertype] qkey_xrcd @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2532:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rq_db_record_addr @@    got __le32 [usertype] rq_db_record_addr @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2845:36: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] qkey_xrcd @@    got unsigned intrestricted __le32 [usertype] qkey_xrcd @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2920:29: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] wqe_sge_ba @@    got unsignrestricted __le32 [usertype] wqe_sge_ba @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2983:34: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rq_cur_blk_addr @@    got unsignrestricted __le32 [usertype] rq_cur_blk_addr @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2996:34: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rq_nxt_blk_addr @@    got unsignrestricted __le32 [usertype] rq_nxt_blk_addr @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3020:26: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] trrl_ba @@    got unsignrestricted __le32 [usertype] trrl_ba @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3028:26: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] irrl_ba @@    got unsignrestricted __le32 [usertype] irrl_ba @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3039:9: sparse: cast from restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3207:34: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] sq_cur_blk_addr @@    got unsignrestricted __le32 [usertype] sq_cur_blk_addr @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3218:38: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] sq_cur_sge_blk_addr @@    got  [usertype] sq_cur_sge_blk_addr @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3233:37: sparse: incorrect type in assignment (different base types) @@    expected restricted __le32 [usertype] rx_sq_cur_blk_addr @@    got unsignrestricted __le32 [usertype] rx_sq_cur_blk_addr @@
>>    include/linux/slab.h:631:13: sparse: not a function <noident>
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3634:28: sparse: incorrect type in assignment (different base types) @@    expected unsigned char [unsigned] [usertype] rnr_retry @@    got d char [unsigned] [usertype] rnr_retry @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3634:28:    expected unsigned char [unsigned] [usertype] rnr_retry
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3634:28:    got restricted __le32 [usertype] rq_rnr_timer
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    left side has type unsigned int
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    right side has type restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    left side has type unsigned int
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3793:17:    right side has type restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    left side has type unsigned int
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    right side has type restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    left side has type unsigned int
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3799:17:    right side has type restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    left side has type unsigned int
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    right side has type restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    left side has type unsigned int
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3802:17:    right side has type restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    left side has type unsigned int
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    right side has type restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9: sparse: invalid assignment: |=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    left side has type unsigned int
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3809:9:    right side has type restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3813:28: sparse: incorrect type in argument 1 (different base types) @@    expected restricted __be32 [usertype] *val @@    got 2 [usertype] *val @@
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3813:28:    expected restricted __be32 [usertype] *val
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3813:28:    got unsigned int *<noident>
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3824:20: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3855:20: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3892:15: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3926:15: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3982:17: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4001:30: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4100:20: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4119:23: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4167:13: sparse: cast to restricted __le32
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4170:17: sparse: invalid assignment: &=
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4170:17:    left side has type unsigned int
>>    drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4170:17:    right side has type restricted __le32
>>
>> vim +1272 drivers/infiniband/hw/hns/hns_roce_hw_v2.c
>>
>>   1233	
>>   1234	static int hns_roce_config_link_table(struct hns_roce_dev *hr_dev,
>>   1235					      enum hns_roce_link_table_type type)
>>   1236	{
>>   1237		struct hns_roce_cmq_desc desc[2];
>>   1238		struct hns_roce_cfg_llm_a *req_a =
>>   1239					(struct hns_roce_cfg_llm_a *)desc[0].data;
>>   1240		struct hns_roce_cfg_llm_b *req_b =
>>   1241					(struct hns_roce_cfg_llm_b *)desc[1].data;
>>   1242		struct hns_roce_v2_priv *priv = hr_dev->priv;
>>   1243		struct hns_roce_link_table *link_tbl;
>>   1244		struct hns_roce_link_table_entry *entry;
>>   1245		enum hns_roce_opcode_type opcode;
>>   1246		u32 page_num;
>>   1247		int i;
>>   1248	
>>   1249		switch (type) {
>>   1250		case TSQ_LINK_TABLE:
>>   1251			link_tbl = &priv->tsq;
>>   1252			opcode = HNS_ROCE_OPC_CFG_EXT_LLM;
>>   1253			break;
>>   1254		default:
>>   1255			return -EINVAL;
>>   1256		}
>>   1257	
>>   1258		page_num = link_tbl->npages;
>>   1259		entry = link_tbl->table.buf;
>>   1260		memset(req_a, 0, sizeof(*req_a));
>>   1261		memset(req_b, 0, sizeof(*req_b));
>>   1262	
>>   1263		for (i = 0; i < 2; i++) {
>>   1264			hns_roce_cmq_setup_basic_desc(&desc[i], opcode, false);
>>   1265	
>>   1266			if (i == 0)
>>   1267				desc[i].flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
>>   1268			else
>>   1269				desc[i].flag &= ~cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
>>   1270	
>>   1271			if (i == 0) {
>>> 1272				req_a->base_addr_l = link_tbl->table.map & 0xffffffff;
>>> 1273				req_a->base_addr_h = (link_tbl->table.map >> 32) &
>>   1274						     0xffffffff;
>>   1275				roce_set_field(req_a->depth_pgsz_init_en,
>>   1276					       CFG_LLM_QUE_DEPTH_M,
>>   1277					       CFG_LLM_QUE_DEPTH_S,
>>   1278					       link_tbl->npages);
>>   1279				roce_set_field(req_a->depth_pgsz_init_en,
>>   1280					       CFG_LLM_QUE_PGSZ_M,
>>   1281					       CFG_LLM_QUE_PGSZ_S,
>>   1282					       link_tbl->pg_sz);
>>> 1283				req_a->head_ba_l = entry[0].blk_ba0;
>>> 1284				req_a->head_ba_h_nxtptr = entry[0].blk_ba1_nxt_ptr;
>>   1285				roce_set_field(req_a->head_ptr,
>>   1286					       CFG_LLM_HEAD_PTR_M,
>>   1287					       CFG_LLM_HEAD_PTR_S, 0);
>>   1288			} else {
>>> 1289				req_b->tail_ba_l = entry[page_num - 1].blk_ba0;
>>   1290				roce_set_field(req_b->tail_ba_h,
>>   1291					       CFG_LLM_TAIL_BA_H_M,
>>   1292					       CFG_LLM_TAIL_BA_H_S,
>>   1293					       entry[page_num - 1].blk_ba1_nxt_ptr &
>>   1294					       HNS_ROCE_LINK_TABLE_BA1_M);
>>   1295				roce_set_field(req_b->tail_ptr,
>>   1296					       CFG_LLM_TAIL_PTR_M,
>>   1297					       CFG_LLM_TAIL_PTR_S,
>>   1298					       (entry[page_num - 2].blk_ba1_nxt_ptr &
>>   1299					       HNS_ROCE_LINK_TABLE_NXT_PTR_M) >>
>>   1300					       HNS_ROCE_LINK_TABLE_NXT_PTR_S);
>>   1301			}
>>   1302		}
>>   1303		roce_set_field(req_a->depth_pgsz_init_en,
>>   1304			       CFG_LLM_INIT_EN_M, CFG_LLM_INIT_EN_S, 1);
>>   1305	
>>   1306		return hns_roce_cmq_send(hr_dev, desc, 2);
>>   1307	}
>>   1308	
>>
>> 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
> 
> .
> 


--
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 mbox

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 65f7b68..d34ed42 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -720,6 +720,8 @@  struct hns_roce_caps {
 	u32		eqe_ba_pg_sz;
 	u32		eqe_buf_pg_sz;
 	u32		eqe_hop_num;
+	u32		sl_num;
+	u32		tsq_buf_pg_sz;
 	u32		chunk_sz;	/* chunk size in non multihop mode*/
 	u64		flags;
 };
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 454d391..c189626 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -925,7 +925,8 @@  static int hns_roce_config_global_param(struct hns_roce_dev *hr_dev)
 static int hns_roce_query_pf_resource(struct hns_roce_dev *hr_dev)
 {
 	struct hns_roce_cmq_desc desc[2];
-	struct hns_roce_pf_res *res;
+	struct hns_roce_pf_res_a *req_a;
+	struct hns_roce_pf_res_b *req_b;
 	int ret;
 	int i;
 
@@ -943,21 +944,26 @@  static int hns_roce_query_pf_resource(struct hns_roce_dev *hr_dev)
 	if (ret)
 		return ret;
 
-	res = (struct hns_roce_pf_res *)desc[0].data;
+	req_a = (struct hns_roce_pf_res_a *)desc[0].data;
+	req_b = (struct hns_roce_pf_res_b *)desc[1].data;
 
-	hr_dev->caps.qpc_bt_num = roce_get_field(res->qpc_bt_idx_num,
+	hr_dev->caps.qpc_bt_num = roce_get_field(req_a->qpc_bt_idx_num,
 						 PF_RES_DATA_1_PF_QPC_BT_NUM_M,
 						 PF_RES_DATA_1_PF_QPC_BT_NUM_S);
-	hr_dev->caps.srqc_bt_num = roce_get_field(res->srqc_bt_idx_num,
+	hr_dev->caps.srqc_bt_num = roce_get_field(req_a->srqc_bt_idx_num,
 						PF_RES_DATA_2_PF_SRQC_BT_NUM_M,
 						PF_RES_DATA_2_PF_SRQC_BT_NUM_S);
-	hr_dev->caps.cqc_bt_num = roce_get_field(res->cqc_bt_idx_num,
+	hr_dev->caps.cqc_bt_num = roce_get_field(req_a->cqc_bt_idx_num,
 						 PF_RES_DATA_3_PF_CQC_BT_NUM_M,
 						 PF_RES_DATA_3_PF_CQC_BT_NUM_S);
-	hr_dev->caps.mpt_bt_num = roce_get_field(res->mpt_bt_idx_num,
+	hr_dev->caps.mpt_bt_num = roce_get_field(req_a->mpt_bt_idx_num,
 						 PF_RES_DATA_4_PF_MPT_BT_NUM_M,
 						 PF_RES_DATA_4_PF_MPT_BT_NUM_S);
 
+	hr_dev->caps.sl_num = roce_get_field(req_b->qid_idx_sl_num,
+					     PF_RES_DATA_3_PF_SL_NUM_M,
+					     PF_RES_DATA_3_PF_SL_NUM_S);
+
 	return 0;
 }
 
@@ -1203,6 +1209,7 @@  static int hns_roce_v2_profile(struct hns_roce_dev *hr_dev)
 	caps->eqe_ba_pg_sz	= 0;
 	caps->eqe_buf_pg_sz	= 0;
 	caps->eqe_hop_num	= HNS_ROCE_EQE_HOP_NUM;
+	caps->tsq_buf_pg_sz	= 0;
 	caps->chunk_sz		= HNS_ROCE_V2_TABLE_CHUNK_SIZE;
 
 	caps->flags		= HNS_ROCE_CAP_FLAG_REREG_MR |
@@ -1224,6 +1231,202 @@  static int hns_roce_v2_profile(struct hns_roce_dev *hr_dev)
 	return ret;
 }
 
+static int hns_roce_config_link_table(struct hns_roce_dev *hr_dev,
+				      enum hns_roce_link_table_type type)
+{
+	struct hns_roce_cmq_desc desc[2];
+	struct hns_roce_cfg_llm_a *req_a =
+				(struct hns_roce_cfg_llm_a *)desc[0].data;
+	struct hns_roce_cfg_llm_b *req_b =
+				(struct hns_roce_cfg_llm_b *)desc[1].data;
+	struct hns_roce_v2_priv *priv = hr_dev->priv;
+	struct hns_roce_link_table *link_tbl;
+	struct hns_roce_link_table_entry *entry;
+	enum hns_roce_opcode_type opcode;
+	u32 page_num;
+	int i;
+
+	switch (type) {
+	case TSQ_LINK_TABLE:
+		link_tbl = &priv->tsq;
+		opcode = HNS_ROCE_OPC_CFG_EXT_LLM;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	page_num = link_tbl->npages;
+	entry = link_tbl->table.buf;
+	memset(req_a, 0, sizeof(*req_a));
+	memset(req_b, 0, sizeof(*req_b));
+
+	for (i = 0; i < 2; i++) {
+		hns_roce_cmq_setup_basic_desc(&desc[i], opcode, false);
+
+		if (i == 0)
+			desc[i].flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
+		else
+			desc[i].flag &= ~cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
+
+		if (i == 0) {
+			req_a->base_addr_l = link_tbl->table.map & 0xffffffff;
+			req_a->base_addr_h = (link_tbl->table.map >> 32) &
+					     0xffffffff;
+			roce_set_field(req_a->depth_pgsz_init_en,
+				       CFG_LLM_QUE_DEPTH_M,
+				       CFG_LLM_QUE_DEPTH_S,
+				       link_tbl->npages);
+			roce_set_field(req_a->depth_pgsz_init_en,
+				       CFG_LLM_QUE_PGSZ_M,
+				       CFG_LLM_QUE_PGSZ_S,
+				       link_tbl->pg_sz);
+			req_a->head_ba_l = entry[0].blk_ba0;
+			req_a->head_ba_h_nxtptr = entry[0].blk_ba1_nxt_ptr;
+			roce_set_field(req_a->head_ptr,
+				       CFG_LLM_HEAD_PTR_M,
+				       CFG_LLM_HEAD_PTR_S, 0);
+		} else {
+			req_b->tail_ba_l = entry[page_num - 1].blk_ba0;
+			roce_set_field(req_b->tail_ba_h,
+				       CFG_LLM_TAIL_BA_H_M,
+				       CFG_LLM_TAIL_BA_H_S,
+				       entry[page_num - 1].blk_ba1_nxt_ptr &
+				       HNS_ROCE_LINK_TABLE_BA1_M);
+			roce_set_field(req_b->tail_ptr,
+				       CFG_LLM_TAIL_PTR_M,
+				       CFG_LLM_TAIL_PTR_S,
+				       (entry[page_num - 2].blk_ba1_nxt_ptr &
+				       HNS_ROCE_LINK_TABLE_NXT_PTR_M) >>
+				       HNS_ROCE_LINK_TABLE_NXT_PTR_S);
+		}
+	}
+	roce_set_field(req_a->depth_pgsz_init_en,
+		       CFG_LLM_INIT_EN_M, CFG_LLM_INIT_EN_S, 1);
+
+	return hns_roce_cmq_send(hr_dev, desc, 2);
+}
+
+static int hns_roce_init_link_table(struct hns_roce_dev *hr_dev,
+				    enum hns_roce_link_table_type type)
+{
+	struct hns_roce_v2_priv *priv = hr_dev->priv;
+	struct hns_roce_link_table *link_tbl;
+	struct hns_roce_link_table_entry *entry;
+	struct device *dev = hr_dev->dev;
+	u32 buf_chk_sz;
+	dma_addr_t t;
+	int pg_num_a;
+	int pg_num_b;
+	int pg_num;
+	int size;
+	int i;
+
+	switch (type) {
+	case TSQ_LINK_TABLE:
+		link_tbl = &priv->tsq;
+		buf_chk_sz = 1 << (hr_dev->caps.tsq_buf_pg_sz + PAGE_SHIFT);
+		pg_num_a = hr_dev->caps.num_qps * 8 / buf_chk_sz;
+		pg_num_b = hr_dev->caps.sl_num * 4 + 2;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	pg_num = max(pg_num_a, pg_num_b);
+	size = pg_num * sizeof(struct hns_roce_link_table_entry);
+
+	link_tbl->table.buf = dma_alloc_coherent(dev, size,
+						 &link_tbl->table.map,
+						 GFP_KERNEL);
+	if (!link_tbl->table.buf)
+		goto out;
+
+	link_tbl->pg_list = kcalloc(pg_num, sizeof(*link_tbl->pg_list),
+				    GFP_KERNEL);
+	if (!link_tbl->pg_list)
+		goto err_kcalloc_failed;
+
+	entry = link_tbl->table.buf;
+	for (i = 0; i < pg_num; ++i) {
+		link_tbl->pg_list[i].buf = dma_alloc_coherent(dev, buf_chk_sz,
+							      &t, GFP_KERNEL);
+		if (!link_tbl->pg_list[i].buf)
+			goto err_alloc_buf_failed;
+
+		link_tbl->pg_list[i].map = t;
+		memset(link_tbl->pg_list[i].buf, 0, buf_chk_sz);
+
+		entry[i].blk_ba0 = (t >> 12) & 0xffffffff;
+		roce_set_field(entry[i].blk_ba1_nxt_ptr,
+			       HNS_ROCE_LINK_TABLE_BA1_M,
+			       HNS_ROCE_LINK_TABLE_BA1_S,
+			       t >> 44);
+
+		if (i < (pg_num - 1))
+			roce_set_field(entry[i].blk_ba1_nxt_ptr,
+				       HNS_ROCE_LINK_TABLE_NXT_PTR_M,
+				       HNS_ROCE_LINK_TABLE_NXT_PTR_S,
+				       i + 1);
+	}
+	link_tbl->npages = pg_num;
+	link_tbl->pg_sz = buf_chk_sz;
+
+	return hns_roce_config_link_table(hr_dev, type);
+
+err_alloc_buf_failed:
+	for (i -= 1; i >= 0; i--)
+		dma_free_coherent(dev, buf_chk_sz,
+				  link_tbl->pg_list[i].buf,
+				  link_tbl->pg_list[i].map);
+	kfree(link_tbl->pg_list);
+
+err_kcalloc_failed:
+	dma_free_coherent(dev, size, link_tbl->table.buf,
+			  link_tbl->table.map);
+
+out:
+	return -ENOMEM;
+}
+
+static void hns_roce_free_link_table(struct hns_roce_dev *hr_dev,
+				     struct hns_roce_link_table *link_tbl)
+{
+	struct device *dev = hr_dev->dev;
+	int size;
+	int i;
+
+	size = link_tbl->npages * sizeof(struct hns_roce_link_table_entry);
+
+	for (i = 0; i < link_tbl->npages; ++i)
+		if (link_tbl->pg_list[i].buf)
+			dma_free_coherent(dev, link_tbl->pg_sz,
+					  link_tbl->pg_list[i].buf,
+					  link_tbl->pg_list[i].map);
+	kfree(link_tbl->pg_list);
+
+	dma_free_coherent(dev, size, link_tbl->table.buf,
+			  link_tbl->table.map);
+}
+
+static int hns_roce_v2_init(struct hns_roce_dev *hr_dev)
+{
+	int ret;
+
+	/* TSQ includes SQ doorbell and ack doorbell */
+	ret = hns_roce_init_link_table(hr_dev, TSQ_LINK_TABLE);
+	if (ret)
+		dev_err(hr_dev->dev, "TSQ init failed, ret = %d.\n", ret);
+
+	return ret;
+}
+
+static void hns_roce_v2_exit(struct hns_roce_dev *hr_dev)
+{
+	struct hns_roce_v2_priv *priv = hr_dev->priv;
+
+	hns_roce_free_link_table(hr_dev, &priv->tsq);
+}
+
 static int hns_roce_v2_cmd_pending(struct hns_roce_dev *hr_dev)
 {
 	u32 status = readl(hr_dev->reg_base + ROCEE_VF_MB_STATUS_REG);
@@ -4725,6 +4928,8 @@  static void hns_roce_v2_cleanup_eq_table(struct hns_roce_dev *hr_dev)
 	.cmq_init = hns_roce_v2_cmq_init,
 	.cmq_exit = hns_roce_v2_cmq_exit,
 	.hw_profile = hns_roce_v2_profile,
+	.hw_init = hns_roce_v2_init,
+	.hw_exit = hns_roce_v2_exit,
 	.post_mbox = hns_roce_v2_post_mbox,
 	.chk_mbox = hns_roce_v2_chk_mbox,
 	.set_gid = hns_roce_v2_set_gid,
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
index d47675f..18626d3 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h
@@ -203,6 +203,7 @@  enum hns_roce_opcode_type {
 	HNS_ROCE_OPC_ALLOC_PF_RES			= 0x8004,
 	HNS_ROCE_OPC_QUERY_PF_RES			= 0x8400,
 	HNS_ROCE_OPC_ALLOC_VF_RES			= 0x8401,
+	HNS_ROCE_OPC_CFG_EXT_LLM			= 0x8403,
 	HNS_ROCE_OPC_CFG_BT_ATTR			= 0x8506,
 };
 
@@ -1061,6 +1062,40 @@  struct hns_roce_query_version {
 	__le32 rsv[5];
 };
 
+struct hns_roce_cfg_llm_a {
+	__le32 base_addr_l;
+	__le32 base_addr_h;
+	__le32 depth_pgsz_init_en;
+	__le32 head_ba_l;
+	__le32 head_ba_h_nxtptr;
+	__le32 head_ptr;
+};
+
+#define CFG_LLM_QUE_DEPTH_S 0
+#define CFG_LLM_QUE_DEPTH_M GENMASK(12, 0)
+
+#define CFG_LLM_QUE_PGSZ_S 16
+#define CFG_LLM_QUE_PGSZ_M GENMASK(19, 16)
+
+#define CFG_LLM_INIT_EN_S 20
+#define CFG_LLM_INIT_EN_M GENMASK(20, 20)
+
+#define CFG_LLM_HEAD_PTR_S 0
+#define CFG_LLM_HEAD_PTR_M GENMASK(11, 0)
+
+struct hns_roce_cfg_llm_b {
+	__le32 tail_ba_l;
+	__le32 tail_ba_h;
+	__le32 tail_ptr;
+	__le32 rsv[3];
+};
+
+#define CFG_LLM_TAIL_BA_H_S 0
+#define CFG_LLM_TAIL_BA_H_M GENMASK(19, 0)
+
+#define CFG_LLM_TAIL_PTR_S 0
+#define CFG_LLM_TAIL_PTR_M GENMASK(11, 0)
+
 struct hns_roce_cfg_global_param {
 	__le32 time_cfg_udp_port;
 	__le32 rsv[5];
@@ -1072,7 +1107,7 @@  struct hns_roce_cfg_global_param {
 #define CFG_GLOBAL_PARAM_DATA_0_ROCEE_UDP_PORT_S 16
 #define CFG_GLOBAL_PARAM_DATA_0_ROCEE_UDP_PORT_M GENMASK(31, 16)
 
-struct hns_roce_pf_res {
+struct hns_roce_pf_res_a {
 	__le32	rsv;
 	__le32	qpc_bt_idx_num;
 	__le32	srqc_bt_idx_num;
@@ -1111,6 +1146,32 @@  struct hns_roce_pf_res {
 #define PF_RES_DATA_5_PF_EQC_BT_NUM_S 16
 #define PF_RES_DATA_5_PF_EQC_BT_NUM_M GENMASK(25, 16)
 
+struct hns_roce_pf_res_b {
+	__le32	rsv0;
+	__le32	smac_idx_num;
+	__le32	sgid_idx_num;
+	__le32	qid_idx_sl_num;
+	__le32	rsv[2];
+};
+
+#define PF_RES_DATA_1_PF_SMAC_IDX_S 0
+#define PF_RES_DATA_1_PF_SMAC_IDX_M GENMASK(7, 0)
+
+#define PF_RES_DATA_1_PF_SMAC_NUM_S 8
+#define PF_RES_DATA_1_PF_SMAC_NUM_M GENMASK(16, 8)
+
+#define PF_RES_DATA_2_PF_SGID_IDX_S 0
+#define PF_RES_DATA_2_PF_SGID_IDX_M GENMASK(7, 0)
+
+#define PF_RES_DATA_2_PF_SGID_NUM_S 8
+#define PF_RES_DATA_2_PF_SGID_NUM_M GENMASK(16, 8)
+
+#define PF_RES_DATA_3_PF_QID_IDX_S 0
+#define PF_RES_DATA_3_PF_QID_IDX_M GENMASK(9, 0)
+
+#define PF_RES_DATA_3_PF_SL_NUM_S 16
+#define PF_RES_DATA_3_PF_SL_NUM_M GENMASK(26, 16)
+
 struct hns_roce_vf_res_a {
 	__le32 vf_id;
 	__le32 vf_qpc_bt_idx_num;
@@ -1276,8 +1337,30 @@  struct hns_roce_v2_cmq {
 	u16 last_status;
 };
 
+enum hns_roce_link_table_type {
+	TSQ_LINK_TABLE,
+};
+
+struct hns_roce_link_table {
+	struct hns_roce_buf_list table;
+	struct hns_roce_buf_list *pg_list;
+	u32 npages;
+	u32 pg_sz;
+};
+
+struct hns_roce_link_table_entry {
+	u32 blk_ba0;
+	u32 blk_ba1_nxt_ptr;
+};
+#define HNS_ROCE_LINK_TABLE_BA1_S 0
+#define HNS_ROCE_LINK_TABLE_BA1_M GENMASK(19, 0)
+
+#define HNS_ROCE_LINK_TABLE_NXT_PTR_S 20
+#define HNS_ROCE_LINK_TABLE_NXT_PTR_M GENMASK(31, 20)
+
 struct hns_roce_v2_priv {
 	struct hns_roce_v2_cmq cmq;
+	struct hns_roce_link_table tsq;
 };
 
 struct hns_roce_eq_context {