[mst-vhost:vhost 30/44] drivers/vdpa/mlx5/net/mlx5_vnet.c:1247:23: sparse: sparse: cast to restricted __le16
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-...@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 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); 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-...@lists.01.org ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
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-...@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 > > > 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 > 1233static int create_rqt(struct mlx5_vdpa_net *ndev) > 1234{ > 1235__be32 *list; > 1236int max_rqt; > 1237void *rqtc; > 1238int inlen; > 1239void *in; > 1240int i, j; > 1241int err; > 1242int num; > 1243 > 1244if (!(ndev->mvdev.actual_features & > BIT_ULL(VIRTIO_NET_F_MQ))) > 1245num = 1; > 1246else > > 1247num = > > le16_to_cpu(ndev->config.max_virtqueue_pairs); What is the correct thing to do here? mlx5vdpa16_to_cpu? > 1248 > 1249max_rqt = min_t(int, roundup_pow_of_two(num), > 12501 << MLX5_CAP_GEN(ndev->mvdev.mdev, > log_max_rqt_size)); > 1251if (max_rqt < 1) > 1252return -EOPNOTSUPP; > 1253 > 1254inlen = MLX5_ST_SZ_BYTES(create_rqt_in) + max_rqt * > MLX5_ST_SZ_BYTES(rq_num); > 1255in = kzalloc(inlen, GFP_KERNEL); > 1256if (!in) > 1257return -ENOMEM; > 1258 > 1259MLX5_SET(create_rqt_in, in, uid, ndev->mvdev.res.uid); > 1260rqtc = MLX5_ADDR_OF(create_rqt_in, in, rqt_context); > 1261 > 1262MLX5_SET(rqtc, rqtc, list_q_type, > MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q); > 1263MLX5_SET(rqtc, rqtc, rqt_max_size, max_rqt); > 1264list = MLX5_ADDR_OF(rqtc, rqtc, rq_num[0]); > 1265for (i = 0, j = 0; i < max_rqt; i++, j += 2) > 1266list[i] = cpu_to_be32(ndev->vqs[j % (2 * > num)].virtq_id); > 1267 > 1268MLX5_SET(rqtc, rqtc, rqt_actual_size, max_rqt); > 1269err = mlx5_vdpa_create_rqt(&ndev->mvdev, in, inlen, > &ndev->res.rqtn); > 1270kfree(in); > 1271if (err) > 1272return err; > 1273 > 1274return 0; > 1275} > 1276 > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
[PATCH] vdpa/mlx5: fix endian-ness for max vqs
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 > 1247 num = le16_to_cpu(ndev->config.max_virtqueue_pairs); Address this using the appropriate wrapper. Fixes: 7620d51af29a ("vdpa/mlx5: Support configuring max data virtqueue") Cc: "Eli Cohen" Reported-by: kernel test robot Signed-off-by: Michael S. Tsirkin --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 84b1919015ce..d1ff65065fb1 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1242,7 +1242,8 @@ static int create_rqt(struct mlx5_vdpa_net *ndev) if (!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_NET_F_MQ))) num = 1; else - num = le16_to_cpu(ndev->config.max_virtqueue_pairs); + num = mlx5vdpa16_to_cpu(&ndev->mvdev, + ndev->config.max_virtqueue_pairs); max_rqt = min_t(int, roundup_pow_of_two(num), 1 << MLX5_CAP_GEN(ndev->mvdev.mdev, log_max_rqt_size)); -- MST ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization