Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 77fa2fb

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: "vhost,virtio,vdpa: features, fixes, cleanups. vdpa/mlx5: - VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK - new maintainer vdpa: - support for vq descriptor mappings - decouple reset of iotlb mapping from device reset and fixes, cleanups all over the place" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (34 commits) vdpa_sim: implement .reset_map support vdpa/mlx5: implement .reset_map driver op vhost-vdpa: clean iotlb map during reset for older userspace vdpa: introduce .compat_reset operation callback vhost-vdpa: introduce IOTLB_PERSIST backend feature bit vhost-vdpa: reset vendor specific mapping to initial state in .release vdpa: introduce .reset_map operation callback virtio_pci: add check for common cfg size virtio-blk: fix implicit overflow on virtio_max_dma_size virtio_pci: add build offset check for the new common cfg items virtio: add definition of VIRTIO_F_NOTIF_CONFIG_DATA feature bit vduse: make vduse_class constant vhost-scsi: Spelling s/preceeding/preceding/g virtio: kdoc for struct virtio_pci_modern_device vdpa: Update sysfs ABI documentation MAINTAINERS: Add myself as mlx5_vdpa driver virtio-balloon: correct the comment of virtballoon_migratepage() mlx5_vdpa: offer VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK vdpa/mlx5: Update cvq iotlb mapping on ASID change vdpa/mlx5: Make iotlb helper functions more generic ...
2 parents 1cfb751 + 86f6c22 commit 77fa2fb

File tree

22 files changed

+544
-184
lines changed

22 files changed

+544
-184
lines changed

Documentation/ABI/testing/sysfs-bus-vdpa

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
What: /sys/bus/vdpa/driver_autoprobe
1+
What: /sys/bus/vdpa/drivers_autoprobe
22
Date: March 2020
33
44
Description:
@@ -17,7 +17,7 @@ Description:
1717
Writing a device name to this file will cause the kernel binds
1818
devices to a compatible driver.
1919

20-
This can be useful when /sys/bus/vdpa/driver_autoprobe is
20+
This can be useful when /sys/bus/vdpa/drivers_autoprobe is
2121
disabled.
2222

2323
What: /sys/bus/vdpa/drivers/.../bind

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13790,6 +13790,12 @@ F: drivers/infiniband/hw/mlx5/
1379013790
F: include/linux/mlx5/
1379113791
F: include/uapi/rdma/mlx5-abi.h
1379213792

13793+
MELLANOX MLX5 VDPA DRIVER
13794+
M: Dragos Tatulea <[email protected]>
13795+
13796+
S: Supported
13797+
F: drivers/vdpa/mlx5/
13798+
1379313799
MELLANOX MLXCPLD I2C AND MUX DRIVER
1379413800
M: Vadim Pasternak <[email protected]>
1379513801
M: Michael Shych <[email protected]>

drivers/block/virtio_blk.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,7 @@ static int virtblk_probe(struct virtio_device *vdev)
13111311
u16 min_io_size;
13121312
u8 physical_block_exp, alignment_offset;
13131313
unsigned int queue_depth;
1314+
size_t max_dma_size;
13141315

13151316
if (!vdev->config->get) {
13161317
dev_err(&vdev->dev, "%s failure: config access disabled\n",
@@ -1409,7 +1410,8 @@ static int virtblk_probe(struct virtio_device *vdev)
14091410
/* No real sector limit. */
14101411
blk_queue_max_hw_sectors(q, UINT_MAX);
14111412

1412-
max_size = virtio_max_dma_size(vdev);
1413+
max_dma_size = virtio_max_dma_size(vdev);
1414+
max_size = max_dma_size > U32_MAX ? U32_MAX : max_dma_size;
14131415

14141416
/* Host can optionally specify maximum segment size and number of
14151417
* segments. */

drivers/vdpa/mlx5/core/mlx5_vdpa.h

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@ struct mlx5_vdpa_mr {
3131
struct list_head head;
3232
unsigned long num_directs;
3333
unsigned long num_klms;
34-
/* state of dvq mr */
35-
bool initialized;
3634

37-
/* serialize mkey creation and destruction */
38-
struct mutex mkey_mtx;
35+
struct vhost_iotlb *iotlb;
36+
3937
bool user_mr;
4038
};
4139

@@ -74,11 +72,12 @@ struct mlx5_vdpa_wq_ent {
7472
enum {
7573
MLX5_VDPA_DATAVQ_GROUP,
7674
MLX5_VDPA_CVQ_GROUP,
75+
MLX5_VDPA_DATAVQ_DESC_GROUP,
7776
MLX5_VDPA_NUMVQ_GROUPS
7877
};
7978

8079
enum {
81-
MLX5_VDPA_NUM_AS = MLX5_VDPA_NUMVQ_GROUPS
80+
MLX5_VDPA_NUM_AS = 2
8281
};
8382

8483
struct mlx5_vdpa_dev {
@@ -93,7 +92,9 @@ struct mlx5_vdpa_dev {
9392
u16 max_idx;
9493
u32 generation;
9594

96-
struct mlx5_vdpa_mr mr;
95+
struct mlx5_vdpa_mr *mr[MLX5_VDPA_NUM_AS];
96+
/* serialize mr access */
97+
struct mutex mr_mtx;
9798
struct mlx5_control_vq cvq;
9899
struct workqueue_struct *wq;
99100
unsigned int group2asid[MLX5_VDPA_NUMVQ_GROUPS];
@@ -114,12 +115,19 @@ void mlx5_vdpa_free_resources(struct mlx5_vdpa_dev *mvdev);
114115
int mlx5_vdpa_create_mkey(struct mlx5_vdpa_dev *mvdev, u32 *mkey, u32 *in,
115116
int inlen);
116117
int mlx5_vdpa_destroy_mkey(struct mlx5_vdpa_dev *mvdev, u32 mkey);
117-
int mlx5_vdpa_handle_set_map(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb,
118-
bool *change_map, unsigned int asid);
119-
int mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb,
120-
unsigned int asid);
121-
void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev);
122-
void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid);
118+
struct mlx5_vdpa_mr *mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev,
119+
struct vhost_iotlb *iotlb);
120+
void mlx5_vdpa_destroy_mr_resources(struct mlx5_vdpa_dev *mvdev);
121+
void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev,
122+
struct mlx5_vdpa_mr *mr);
123+
void mlx5_vdpa_update_mr(struct mlx5_vdpa_dev *mvdev,
124+
struct mlx5_vdpa_mr *mr,
125+
unsigned int asid);
126+
int mlx5_vdpa_update_cvq_iotlb(struct mlx5_vdpa_dev *mvdev,
127+
struct vhost_iotlb *iotlb,
128+
unsigned int asid);
129+
int mlx5_vdpa_create_dma_mr(struct mlx5_vdpa_dev *mvdev);
130+
int mlx5_vdpa_reset_mr(struct mlx5_vdpa_dev *mvdev, unsigned int asid);
123131

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

0 commit comments

Comments
 (0)