[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220108123934-mutt-send-email-mst@kernel.org>
Date: Sat, 8 Jan 2022 12:41:57 -0500
From: "Michael S. Tsirkin" <mst@...hat.com>
To: kernel test robot <lkp@...el.com>
Cc: Eli Cohen <elic@...dia.com>, kbuild-all@...ts.01.org,
kvm@...r.kernel.org, virtualization@...ts.linux-foundation.org,
netdev@...r.kernel.org
Subject: Re: [mst-vhost:vhost 30/44]
drivers/vdpa/mlx5/net/mlx5_vnet.c:1247:23: sparse: sparse: cast to
restricted __le16
On Sat, Jan 08, 2022 at 10:48:34PM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost
> head: 008842b2060c14544ff452483ffd2241d145c7b2
> commit: 7620d51af29aa1c5d32150db2ac4b6187ef8af3a [30/44] vdpa/mlx5: Support configuring max data virtqueue
> config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20220108/202201082258.aKRHnaJX-lkp@intel.com/config)
> compiler: powerpc-linux-gcc (GCC) 11.2.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # apt-get install sparse
> # sparse version: v0.6.4-dirty
> # https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git/commit/?id=7620d51af29aa1c5d32150db2ac4b6187ef8af3a
> git remote add mst-vhost https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git
> git fetch --no-tags mst-vhost vhost
> git checkout 7620d51af29aa1c5d32150db2ac4b6187ef8af3a
> # save the config file to linux build tree
> mkdir build_dir
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/vdpa/mlx5/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@...el.com>
>
>
> sparse warnings: (new ones prefixed by >>)
> >> drivers/vdpa/mlx5/net/mlx5_vnet.c:1247:23: sparse: sparse: cast to restricted __le16
> >> drivers/vdpa/mlx5/net/mlx5_vnet.c:1247:23: sparse: sparse: cast from restricted __virtio16
>
> vim +1247 drivers/vdpa/mlx5/net/mlx5_vnet.c
>
> 1232
> 1233 static int create_rqt(struct mlx5_vdpa_net *ndev)
> 1234 {
> 1235 __be32 *list;
> 1236 int max_rqt;
> 1237 void *rqtc;
> 1238 int inlen;
> 1239 void *in;
> 1240 int i, j;
> 1241 int err;
> 1242 int num;
> 1243
> 1244 if (!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_NET_F_MQ)))
> 1245 num = 1;
> 1246 else
> > 1247 num = le16_to_cpu(ndev->config.max_virtqueue_pairs);
What is the correct thing to do here? mlx5vdpa16_to_cpu?
> 1248
> 1249 max_rqt = min_t(int, roundup_pow_of_two(num),
> 1250 1 << MLX5_CAP_GEN(ndev->mvdev.mdev, log_max_rqt_size));
> 1251 if (max_rqt < 1)
> 1252 return -EOPNOTSUPP;
> 1253
> 1254 inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + max_rqt * MLX5_ST_SZ_BYTES(rq_num);
> 1255 in = kzalloc(inlen, GFP_KERNEL);
> 1256 if (!in)
> 1257 return -ENOMEM;
> 1258
> 1259 MLX5_SET(create_rqt_in, in, uid, ndev->mvdev.res.uid);
> 1260 rqtc = MLX5_ADDR_OF(create_rqt_in, in, rqt_context);
> 1261
> 1262 MLX5_SET(rqtc, rqtc, list_q_type, MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q);
> 1263 MLX5_SET(rqtc, rqtc, rqt_max_size, max_rqt);
> 1264 list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]);
> 1265 for (i = 0, j = 0; i < max_rqt; i++, j += 2)
> 1266 list[i] = cpu_to_be32(ndev->vqs[j % (2 * num)].virtq_id);
> 1267
> 1268 MLX5_SET(rqtc, rqtc, rqt_actual_size, max_rqt);
> 1269 err = mlx5_vdpa_create_rqt(&ndev->mvdev, in, inlen, &ndev->res.rqtn);
> 1270 kfree(in);
> 1271 if (err)
> 1272 return err;
> 1273
> 1274 return 0;
> 1275 }
> 1276
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists