Skip to content

Commit 91aa6c4

Browse files
committed
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull virtio fixes from Michael Tsirkin: "Just a bunch of bugfixes all over the place" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (26 commits) virtio-mem: check if the config changed before fake offlining memory virtio-mem: keep retrying on offline_and_remove_memory() errors in Sub Block Mode (SBM) virtio-mem: convert most offline_and_remove_memory() errors to -EBUSY virtio-mem: remove unsafe unplug in Big Block Mode (BBM) pds_vdpa: fix up debugfs feature bit printing pds_vdpa: alloc irq vectors on DRIVER_OK pds_vdpa: clean and reset vqs entries pds_vdpa: always allow offering VIRTIO_NET_F_MAC pds_vdpa: reset to vdpa specified mac virtio-net: Zero max_tx_vq field for VIRTIO_NET_CTRL_MQ_HASH_CONFIG case vdpa/mlx5: Fix crash on shutdown for when no ndev exists vdpa/mlx5: Delete control vq iotlb in destroy_mr only when necessary vdpa/mlx5: Fix mr->initialized semantics vdpa/mlx5: Correct default number of queues when MQ is on virtio-vdpa: Fix cpumask memory leak in virtio_vdpa_find_vqs() vduse: Use proper spinlock for IRQ injection vdpa: Enable strict validation for netlinks ops vdpa: Add max vqp attr to vdpa_nl_policy for nlattr length check vdpa: Add queue index attr to vdpa_nl_policy for nlattr length check vdpa: Add features attr to vdpa_nl_policy for nlattr length check ...
2 parents 2ccdd1b + f55484f commit 91aa6c4

File tree

17 files changed

+515
-204
lines changed

17 files changed

+515
-204
lines changed

MAINTAINERS

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22474,7 +22474,6 @@ L: virtualization@lists.linux-foundation.org
2247422474
S: Maintained
2247522475
F: drivers/block/virtio_blk.c
2247622476
F: drivers/scsi/virtio_scsi.c
22477-
F: drivers/vhost/scsi.c
2247822477
F: include/uapi/linux/virtio_blk.h
2247922478
F: include/uapi/linux/virtio_scsi.h
2248022479

@@ -22573,6 +22572,16 @@ F: include/linux/vhost_iotlb.h
2257322572
F: include/uapi/linux/vhost.h
2257422573
F: kernel/vhost_task.c
2257522574

22575+
VIRTIO HOST (VHOST-SCSI)
22576+
M: "Michael S. Tsirkin" <mst@redhat.com>
22577+
M: Jason Wang <jasowang@redhat.com>
22578+
M: Mike Christie <michael.christie@oracle.com>
22579+
R: Paolo Bonzini <pbonzini@redhat.com>
22580+
R: Stefan Hajnoczi <stefanha@redhat.com>
22581+
L: virtualization@lists.linux-foundation.org
22582+
S: Maintained
22583+
F: drivers/vhost/scsi.c
22584+
2257622585
VIRTIO I2C DRIVER
2257722586
M: Conghui Chen <conghui.chen@intel.com>
2257822587
M: Viresh Kumar <viresh.kumar@linaro.org>

drivers/net/virtio_net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2761,7 +2761,7 @@ static void virtnet_init_default_rss(struct virtnet_info *vi)
27612761
vi->ctrl->rss.indirection_table[i] = indir_val;
27622762
}
27632763

2764-
vi->ctrl->rss.max_tx_vq = vi->curr_queue_pairs;
2764+
vi->ctrl->rss.max_tx_vq = vi->has_rss ? vi->curr_queue_pairs : 0;
27652765
vi->ctrl->rss.hash_key_length = vi->rss_key_size;
27662766

27672767
netdev_rss_key_fill(vi->ctrl->rss.key, vi->rss_key_size);

drivers/vdpa/mlx5/core/mlx5_vdpa.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct mlx5_vdpa_mr {
3131
struct list_head head;
3232
unsigned long num_directs;
3333
unsigned long num_klms;
34+
/* state of dvq mr */
3435
bool initialized;
3536

3637
/* serialize mkey creation and destruction */
@@ -121,6 +122,7 @@ int mlx5_vdpa_handle_set_map(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *io
121122
int mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb,
122123
unsigned int asid);
123124
void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev);
125+
void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid);
124126

125127
#define mlx5_vdpa_warn(__dev, format, ...) \
126128
dev_warn((__dev)->mdev->device, "%s:%d:(pid %d) warning: " format, __func__, __LINE__, \

drivers/vdpa/mlx5/core/mr.c

Lines changed: 70 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -489,60 +489,103 @@ static void destroy_user_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_mr *mr
489489
}
490490
}
491491

492-
void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev)
492+
static void _mlx5_vdpa_destroy_cvq_mr(struct mlx5_vdpa_dev *mvdev, unsigned int asid)
493+
{
494+
if (mvdev->group2asid[MLX5_VDPA_CVQ_GROUP] != asid)
495+
return;
496+
497+
prune_iotlb(mvdev);
498+
}
499+
500+
static void _mlx5_vdpa_destroy_dvq_mr(struct mlx5_vdpa_dev *mvdev, unsigned int asid)
493501
{
494502
struct mlx5_vdpa_mr *mr = &mvdev->mr;
495503

496-
mutex_lock(&mr->mkey_mtx);
504+
if (mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP] != asid)
505+
return;
506+
497507
if (!mr->initialized)
498-
goto out;
508+
return;
499509

500-
prune_iotlb(mvdev);
501510
if (mr->user_mr)
502511
destroy_user_mr(mvdev, mr);
503512
else
504513
destroy_dma_mr(mvdev, mr);
505514

506515
mr->initialized = false;
507-
out:
516+
}
517+
518+
void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid)
519+
{
520+
struct mlx5_vdpa_mr *mr = &mvdev->mr;
521+
522+
mutex_lock(&mr->mkey_mtx);
523+
524+
_mlx5_vdpa_destroy_dvq_mr(mvdev, asid);
525+
_mlx5_vdpa_destroy_cvq_mr(mvdev, asid);
526+
508527
mutex_unlock(&mr->mkey_mtx);
509528
}
510529

511-
static int _mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev,
512-
struct vhost_iotlb *iotlb, unsigned int asid)
530+
void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev)
531+
{
532+
mlx5_vdpa_destroy_mr_asid(mvdev, mvdev->group2asid[MLX5_VDPA_CVQ_GROUP]);
533+
mlx5_vdpa_destroy_mr_asid(mvdev, mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]);
534+
}
535+
536+
static int _mlx5_vdpa_create_cvq_mr(struct mlx5_vdpa_dev *mvdev,
537+
struct vhost_iotlb *iotlb,
538+
unsigned int asid)
539+
{
540+
if (mvdev->group2asid[MLX5_VDPA_CVQ_GROUP] != asid)
541+
return 0;
542+
543+
return dup_iotlb(mvdev, iotlb);
544+
}
545+
546+
static int _mlx5_vdpa_create_dvq_mr(struct mlx5_vdpa_dev *mvdev,
547+
struct vhost_iotlb *iotlb,
548+
unsigned int asid)
513549
{
514550
struct mlx5_vdpa_mr *mr = &mvdev->mr;
515551
int err;
516552

517-
if (mr->initialized)
553+
if (mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP] != asid)
518554
return 0;
519555

520-
if (mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP] == asid) {
521-
if (iotlb)
522-
err = create_user_mr(mvdev, iotlb);
523-
else
524-
err = create_dma_mr(mvdev, mr);
556+
if (mr->initialized)
557+
return 0;
525558

526-
if (err)
527-
return err;
528-
}
559+
if (iotlb)
560+
err = create_user_mr(mvdev, iotlb);
561+
else
562+
err = create_dma_mr(mvdev, mr);
529563

530-
if (mvdev->group2asid[MLX5_VDPA_CVQ_GROUP] == asid) {
531-
err = dup_iotlb(mvdev, iotlb);
532-
if (err)
533-
goto out_err;
534-
}
564+
if (err)
565+
return err;
535566

536567
mr->initialized = true;
568+
569+
return 0;
570+
}
571+
572+
static int _mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev,
573+
struct vhost_iotlb *iotlb, unsigned int asid)
574+
{
575+
int err;
576+
577+
err = _mlx5_vdpa_create_dvq_mr(mvdev, iotlb, asid);
578+
if (err)
579+
return err;
580+
581+
err = _mlx5_vdpa_create_cvq_mr(mvdev, iotlb, asid);
582+
if (err)
583+
goto out_err;
584+
537585
return 0;
538586

539587
out_err:
540-
if (mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP] == asid) {
541-
if (iotlb)
542-
destroy_user_mr(mvdev, mr);
543-
else
544-
destroy_dma_mr(mvdev, mr);
545-
}
588+
_mlx5_vdpa_destroy_dvq_mr(mvdev, asid);
546589

547590
return err;
548591
}

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,7 +2517,15 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features)
25172517
else
25182518
ndev->rqt_size = 1;
25192519

2520-
ndev->cur_num_vqs = 2 * ndev->rqt_size;
2520+
/* Device must start with 1 queue pair, as per VIRTIO v1.2 spec, section
2521+
* 5.1.6.5.5 "Device operation in multiqueue mode":
2522+
*
2523+
* Multiqueue is disabled by default.
2524+
* The driver enables multiqueue by sending a command using class
2525+
* VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue
2526+
* operation, as follows: ...
2527+
*/
2528+
ndev->cur_num_vqs = 2;
25212529

25222530
update_cvq_info(mvdev);
25232531
return err;
@@ -2636,7 +2644,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev,
26362644
goto err_mr;
26372645

26382646
teardown_driver(ndev);
2639-
mlx5_vdpa_destroy_mr(mvdev);
2647+
mlx5_vdpa_destroy_mr_asid(mvdev, asid);
26402648
err = mlx5_vdpa_create_mr(mvdev, iotlb, asid);
26412649
if (err)
26422650
goto err_mr;
@@ -2652,7 +2660,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev,
26522660
return 0;
26532661

26542662
err_setup:
2655-
mlx5_vdpa_destroy_mr(mvdev);
2663+
mlx5_vdpa_destroy_mr_asid(mvdev, asid);
26562664
err_mr:
26572665
return err;
26582666
}
@@ -3548,17 +3556,6 @@ static void mlx5v_remove(struct auxiliary_device *adev)
35483556
kfree(mgtdev);
35493557
}
35503558

3551-
static void mlx5v_shutdown(struct auxiliary_device *auxdev)
3552-
{
3553-
struct mlx5_vdpa_mgmtdev *mgtdev;
3554-
struct mlx5_vdpa_net *ndev;
3555-
3556-
mgtdev = auxiliary_get_drvdata(auxdev);
3557-
ndev = mgtdev->ndev;
3558-
3559-
free_irqs(ndev);
3560-
}
3561-
35623559
static const struct auxiliary_device_id mlx5v_id_table[] = {
35633560
{ .name = MLX5_ADEV_NAME ".vnet", },
35643561
{},
@@ -3570,7 +3567,6 @@ static struct auxiliary_driver mlx5v_driver = {
35703567
.name = "vnet",
35713568
.probe = mlx5v_probe,
35723569
.remove = mlx5v_remove,
3573-
.shutdown = mlx5v_shutdown,
35743570
.id_table = mlx5v_id_table,
35753571
};
35763572

drivers/vdpa/pds/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ obj-$(CONFIG_PDS_VDPA) := pds_vdpa.o
55

66
pds_vdpa-y := aux_drv.o \
77
cmds.o \
8+
debugfs.o \
89
vdpa_dev.o
9-
10-
pds_vdpa-$(CONFIG_DEBUG_FS) += debugfs.o

drivers/vdpa/pds/debugfs.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,17 @@ static int identity_show(struct seq_file *seq, void *v)
176176
{
177177
struct pds_vdpa_aux *vdpa_aux = seq->private;
178178
struct vdpa_mgmt_dev *mgmt;
179+
u64 hw_features;
179180

180181
seq_printf(seq, "aux_dev: %s\n",
181182
dev_name(&vdpa_aux->padev->aux_dev.dev));
182183

183184
mgmt = &vdpa_aux->vdpa_mdev;
184185
seq_printf(seq, "max_vqs: %d\n", mgmt->max_supported_vqs);
185186
seq_printf(seq, "config_attr_mask: %#llx\n", mgmt->config_attr_mask);
186-
seq_printf(seq, "supported_features: %#llx\n", mgmt->supported_features);
187-
print_feature_bits_all(seq, mgmt->supported_features);
187+
hw_features = le64_to_cpu(vdpa_aux->ident.hw_features);
188+
seq_printf(seq, "hw_features: %#llx\n", hw_features);
189+
print_feature_bits_all(seq, hw_features);
188190

189191
return 0;
190192
}
@@ -200,7 +202,6 @@ static int config_show(struct seq_file *seq, void *v)
200202
{
201203
struct pds_vdpa_device *pdsv = seq->private;
202204
struct virtio_net_config vc;
203-
u64 driver_features;
204205
u8 status;
205206

206207
memcpy_fromio(&vc, pdsv->vdpa_aux->vd_mdev.device,
@@ -223,12 +224,8 @@ static int config_show(struct seq_file *seq, void *v)
223224
status = vp_modern_get_status(&pdsv->vdpa_aux->vd_mdev);
224225
seq_printf(seq, "dev_status: %#x\n", status);
225226
print_status_bits(seq, status);
226-
227-
seq_printf(seq, "req_features: %#llx\n", pdsv->req_features);
228-
print_feature_bits_all(seq, pdsv->req_features);
229-
driver_features = vp_modern_get_driver_features(&pdsv->vdpa_aux->vd_mdev);
230-
seq_printf(seq, "driver_features: %#llx\n", driver_features);
231-
print_feature_bits_all(seq, driver_features);
227+
seq_printf(seq, "negotiated_features: %#llx\n", pdsv->negotiated_features);
228+
print_feature_bits_all(seq, pdsv->negotiated_features);
232229
seq_printf(seq, "vdpa_index: %d\n", pdsv->vdpa_index);
233230
seq_printf(seq, "num_vqs: %d\n", pdsv->num_vqs);
234231

0 commit comments

Comments
 (0)