Skip to content

Commit 0181f8c

Browse files
committed
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull virtio updates from Michael Tsirkin: "Several new features here: - virtio-balloon supports new stats - vdpa supports setting mac address - vdpa/mlx5 suspend/resume as well as MKEY ops are now faster - virtio_fs supports new sysfs entries for queue info - virtio/vsock performance has been improved And fixes, cleanups all over the place" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (34 commits) vsock/virtio: avoid queuing packets when intermediate queue is empty vsock/virtio: refactor virtio_transport_send_pkt_work fw_cfg: Constify struct kobj_type vdpa/mlx5: Postpone MR deletion vdpa/mlx5: Introduce init/destroy for MR resources vdpa/mlx5: Rename mr_mtx -> lock vdpa/mlx5: Extract mr members in own resource struct vdpa/mlx5: Rename function vdpa/mlx5: Delete direct MKEYs in parallel vdpa/mlx5: Create direct MKEYs in parallel MAINTAINERS: add virtio-vsock driver in the VIRTIO CORE section virtio_fs: add sysfs entries for queue information virtio_fs: introduce virtio_fs_put_locked helper vdpa: Remove unused declarations vdpa/mlx5: Parallelize VQ suspend/resume for CVQ MQ command vdpa/mlx5: Small improvement for change_num_qps() vdpa/mlx5: Keep notifiers during suspend but ignore vdpa/mlx5: Parallelize device resume vdpa/mlx5: Parallelize device suspend vdpa/mlx5: Use async API for vq modify commands ...
2 parents 11a299a + efcd71a commit 0181f8c

File tree

20 files changed

+1092
-294
lines changed

20 files changed

+1092
-294
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24464,6 +24464,7 @@ F: include/linux/vdpa.h
2446424464
F: include/linux/virtio*.h
2446524465
F: include/linux/vringh.h
2446624466
F: include/uapi/linux/virtio_*.h
24467+
F: net/vmw_vsock/virtio*
2446724468
F: tools/virtio/
2446824469
F: tools/testing/selftests/drivers/net/virtio_net/
2446924470

drivers/firmware/qemu_fw_cfg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ static void fw_cfg_sysfs_release_entry(struct kobject *kobj)
452452
}
453453

454454
/* kobj_type: ties together all properties required to register an entry */
455-
static struct kobj_type fw_cfg_sysfs_entry_ktype = {
455+
static const struct kobj_type fw_cfg_sysfs_entry_ktype = {
456456
.default_groups = fw_cfg_sysfs_entry_groups,
457457
.sysfs_ops = &fw_cfg_sysfs_attr_ops,
458458
.release = fw_cfg_sysfs_release_entry,

drivers/net/ethernet/mellanox/mlx5/core/cmd.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,10 +1887,12 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
18871887

18881888
throttle_op = mlx5_cmd_is_throttle_opcode(opcode);
18891889
if (throttle_op) {
1890-
/* atomic context may not sleep */
1891-
if (callback)
1892-
return -EINVAL;
1893-
down(&dev->cmd.vars.throttle_sem);
1890+
if (callback) {
1891+
if (down_trylock(&dev->cmd.vars.throttle_sem))
1892+
return -EBUSY;
1893+
} else {
1894+
down(&dev->cmd.vars.throttle_sem);
1895+
}
18941896
}
18951897

18961898
pages_queue = is_manage_pages(in);
@@ -2096,10 +2098,19 @@ static void mlx5_cmd_exec_cb_handler(int status, void *_work)
20962098
{
20972099
struct mlx5_async_work *work = _work;
20982100
struct mlx5_async_ctx *ctx;
2101+
struct mlx5_core_dev *dev;
2102+
u16 opcode;
20992103

21002104
ctx = work->ctx;
2101-
status = cmd_status_err(ctx->dev, status, work->opcode, work->op_mod, work->out);
2105+
dev = ctx->dev;
2106+
opcode = work->opcode;
2107+
status = cmd_status_err(dev, status, work->opcode, work->op_mod, work->out);
21022108
work->user_callback(status, work);
2109+
/* Can't access "work" from this point on. It could have been freed in
2110+
* the callback.
2111+
*/
2112+
if (mlx5_cmd_is_throttle_opcode(opcode))
2113+
up(&dev->cmd.vars.throttle_sem);
21032114
if (atomic_dec_and_test(&ctx->num_inflight))
21042115
complete(&ctx->inflight_done);
21052116
}

drivers/nvdimm/nd_virtio.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ static int virtio_pmem_flush(struct nd_region *nd_region)
4444
unsigned long flags;
4545
int err, err1;
4646

47+
/*
48+
* Don't bother to submit the request to the device if the device is
49+
* not activated.
50+
*/
51+
if (vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_NEEDS_RESET) {
52+
dev_info(&vdev->dev, "virtio pmem device needs a reset\n");
53+
return -EIO;
54+
}
55+
4756
might_sleep();
4857
req_data = kmalloc(sizeof(*req_data), GFP_KERNEL);
4958
if (!req_data)

drivers/vdpa/ifcvf/ifcvf_base.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,12 @@ void ifcvf_write_dev_config(struct ifcvf_hw *hw, u64 offset,
112112
const void *src, int length);
113113
u8 ifcvf_get_status(struct ifcvf_hw *hw);
114114
void ifcvf_set_status(struct ifcvf_hw *hw, u8 status);
115-
void io_write64_twopart(u64 val, u32 *lo, u32 *hi);
116115
void ifcvf_reset(struct ifcvf_hw *hw);
117116
u64 ifcvf_get_dev_features(struct ifcvf_hw *hw);
118117
u64 ifcvf_get_hw_features(struct ifcvf_hw *hw);
119118
int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features);
120119
u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid);
121120
int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u16 num);
122-
struct ifcvf_adapter *vf_to_adapter(struct ifcvf_hw *hw);
123-
int ifcvf_probed_virtio_net(struct ifcvf_hw *hw);
124121
u32 ifcvf_get_config_size(struct ifcvf_hw *hw);
125122
u16 ifcvf_set_vq_vector(struct ifcvf_hw *hw, u16 qid, int vector);
126123
u16 ifcvf_set_config_vector(struct ifcvf_hw *hw, int vector);

drivers/vdpa/mlx5/core/mlx5_vdpa.h

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,28 @@ enum {
8383
MLX5_VDPA_NUM_AS = 2
8484
};
8585

86+
struct mlx5_vdpa_mr_resources {
87+
struct mlx5_vdpa_mr *mr[MLX5_VDPA_NUM_AS];
88+
unsigned int group2asid[MLX5_VDPA_NUMVQ_GROUPS];
89+
90+
/* Pre-deletion mr list */
91+
struct list_head mr_list_head;
92+
93+
/* Deferred mr list */
94+
struct list_head mr_gc_list_head;
95+
struct workqueue_struct *wq_gc;
96+
struct delayed_work gc_dwork_ent;
97+
98+
struct mutex lock;
99+
100+
atomic_t shutdown;
101+
};
102+
86103
struct mlx5_vdpa_dev {
87104
struct vdpa_device vdev;
88105
struct mlx5_core_dev *mdev;
89106
struct mlx5_vdpa_resources res;
107+
struct mlx5_vdpa_mr_resources mres;
90108

91109
u64 mlx_features;
92110
u64 actual_features;
@@ -95,14 +113,23 @@ struct mlx5_vdpa_dev {
95113
u16 max_idx;
96114
u32 generation;
97115

98-
struct mlx5_vdpa_mr *mr[MLX5_VDPA_NUM_AS];
99-
struct list_head mr_list_head;
100-
/* serialize mr access */
101-
struct mutex mr_mtx;
102116
struct mlx5_control_vq cvq;
103117
struct workqueue_struct *wq;
104-
unsigned int group2asid[MLX5_VDPA_NUMVQ_GROUPS];
105118
bool suspended;
119+
120+
struct mlx5_async_ctx async_ctx;
121+
};
122+
123+
struct mlx5_vdpa_async_cmd {
124+
int err;
125+
struct mlx5_async_work cb_work;
126+
struct completion cmd_done;
127+
128+
void *in;
129+
size_t inlen;
130+
131+
void *out;
132+
size_t outlen;
106133
};
107134

108135
int mlx5_vdpa_create_tis(struct mlx5_vdpa_dev *mvdev, void *in, u32 *tisn);
@@ -121,7 +148,9 @@ int mlx5_vdpa_create_mkey(struct mlx5_vdpa_dev *mvdev, u32 *mkey, u32 *in,
121148
int mlx5_vdpa_destroy_mkey(struct mlx5_vdpa_dev *mvdev, u32 mkey);
122149
struct mlx5_vdpa_mr *mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev,
123150
struct vhost_iotlb *iotlb);
151+
int mlx5_vdpa_init_mr_resources(struct mlx5_vdpa_dev *mvdev);
124152
void mlx5_vdpa_destroy_mr_resources(struct mlx5_vdpa_dev *mvdev);
153+
void mlx5_vdpa_clean_mrs(struct mlx5_vdpa_dev *mvdev);
125154
void mlx5_vdpa_get_mr(struct mlx5_vdpa_dev *mvdev,
126155
struct mlx5_vdpa_mr *mr);
127156
void mlx5_vdpa_put_mr(struct mlx5_vdpa_dev *mvdev,
@@ -134,6 +163,14 @@ int mlx5_vdpa_update_cvq_iotlb(struct mlx5_vdpa_dev *mvdev,
134163
unsigned int asid);
135164
int mlx5_vdpa_create_dma_mr(struct mlx5_vdpa_dev *mvdev);
136165
int mlx5_vdpa_reset_mr(struct mlx5_vdpa_dev *mvdev, unsigned int asid);
166+
int mlx5_vdpa_exec_async_cmds(struct mlx5_vdpa_dev *mvdev,
167+
struct mlx5_vdpa_async_cmd *cmds,
168+
int num_cmds);
169+
170+
#define mlx5_vdpa_err(__dev, format, ...) \
171+
dev_err((__dev)->mdev->device, "%s:%d:(pid %d) error: " format, __func__, __LINE__, \
172+
current->pid, ##__VA_ARGS__)
173+
137174

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

0 commit comments

Comments
 (0)