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 fixes, cleanups all over the place Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmVCUMYPHG1zdEByZWRo YXQuY29tAAoJECgfDbjSjVRp4L0H/RKcnNXPRqzhhBI1XVQ11Z8CO8WjovcmJalu ADHNEGmvuWnY79fp9eLiZ4iVaTx1qbzqIB5Q500DJ65jh71W7UQ8ww6CGjNUoRGs Zoe4G09WoOf4bvDZZzVV7ml/AzMdsHWSZK8pxY3QI9CsC9Zfp9hg20QYxPylCqYx SIJx7w2MkoojfmtOHRx1WUxaQz99yfU4Z0C5PxtRE1HGN6/a1aY0P0CAl5jq8uCK U5sCRsfCmP7VKlspeEddMiPA35ADbCiysSobCbwGVQEs5cHpMUX7KWa+oV0tF/PY 9uyJb2rJy6zG3tXmL4XNib665ZR86HX6qiWRfm2nBQQStuHaJyg= =mXgo -----END PGP SIGNATURE----- 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 ...
This commit is contained in:
commit
77fa2fbe87
22 changed files with 546 additions and 186 deletions
|
|
@ -1232,7 +1232,13 @@ struct mlx5_ifc_virtio_emulation_cap_bits {
|
|||
u8 max_emulated_devices[0x8];
|
||||
u8 max_num_virtio_queues[0x18];
|
||||
|
||||
u8 reserved_at_a0[0x60];
|
||||
u8 reserved_at_a0[0x20];
|
||||
|
||||
u8 reserved_at_c0[0x13];
|
||||
u8 desc_group_mkey_supported[0x1];
|
||||
u8 reserved_at_d4[0xc];
|
||||
|
||||
u8 reserved_at_e0[0x20];
|
||||
|
||||
u8 umem_1_buffer_param_a[0x20];
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,11 @@ struct mlx5_ifc_virtio_q_bits {
|
|||
u8 reserved_at_320[0x8];
|
||||
u8 pd[0x18];
|
||||
|
||||
u8 reserved_at_340[0xc0];
|
||||
u8 reserved_at_340[0x20];
|
||||
|
||||
u8 desc_group_mkey[0x20];
|
||||
|
||||
u8 reserved_at_380[0x80];
|
||||
};
|
||||
|
||||
struct mlx5_ifc_virtio_net_q_object_bits {
|
||||
|
|
@ -141,6 +145,7 @@ enum {
|
|||
MLX5_VIRTQ_MODIFY_MASK_STATE = (u64)1 << 0,
|
||||
MLX5_VIRTQ_MODIFY_MASK_DIRTY_BITMAP_PARAMS = (u64)1 << 3,
|
||||
MLX5_VIRTQ_MODIFY_MASK_DIRTY_BITMAP_DUMP_ENABLE = (u64)1 << 4,
|
||||
MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
|||
|
|
@ -204,6 +204,16 @@ struct vdpa_map_file {
|
|||
* @vdev: vdpa device
|
||||
* @idx: virtqueue index
|
||||
* Returns u32: group id for this virtqueue
|
||||
* @get_vq_desc_group: Get the group id for the descriptor table of
|
||||
* a specific virtqueue (optional)
|
||||
* @vdev: vdpa device
|
||||
* @idx: virtqueue index
|
||||
* Returns u32: group id for the descriptor table
|
||||
* portion of this virtqueue. Could be different
|
||||
* than the one from @get_vq_group, in which case
|
||||
* the access to the descriptor table can be
|
||||
* confined to a separate asid, isolating from
|
||||
* the virtqueue's buffer address access.
|
||||
* @get_device_features: Get virtio features supported by the device
|
||||
* @vdev: vdpa device
|
||||
* Returns the virtio features support by the
|
||||
|
|
@ -242,6 +252,17 @@ struct vdpa_map_file {
|
|||
* @reset: Reset device
|
||||
* @vdev: vdpa device
|
||||
* Returns integer: success (0) or error (< 0)
|
||||
* @compat_reset: Reset device with compatibility quirks to
|
||||
* accommodate older userspace. Only needed by
|
||||
* parent driver which used to have bogus reset
|
||||
* behaviour, and has to maintain such behaviour
|
||||
* for compatibility with older userspace.
|
||||
* Historically compliant driver only has to
|
||||
* implement .reset, Historically non-compliant
|
||||
* driver should implement both.
|
||||
* @vdev: vdpa device
|
||||
* @flags: compatibility quirks for reset
|
||||
* Returns integer: success (0) or error (< 0)
|
||||
* @suspend: Suspend the device (optional)
|
||||
* @vdev: vdpa device
|
||||
* Returns integer: success (0) or error (< 0)
|
||||
|
|
@ -317,6 +338,15 @@ struct vdpa_map_file {
|
|||
* @iova: iova to be unmapped
|
||||
* @size: size of the area
|
||||
* Returns integer: success (0) or error (< 0)
|
||||
* @reset_map: Reset device memory mapping to the default
|
||||
* state (optional)
|
||||
* Needed for devices that are using device
|
||||
* specific DMA translation and prefer mapping
|
||||
* to be decoupled from the virtio life cycle,
|
||||
* i.e. device .reset op does not reset mapping
|
||||
* @vdev: vdpa device
|
||||
* @asid: address space identifier
|
||||
* Returns integer: success (0) or error (< 0)
|
||||
* @get_vq_dma_dev: Get the dma device for a specific
|
||||
* virtqueue (optional)
|
||||
* @vdev: vdpa device
|
||||
|
|
@ -360,6 +390,7 @@ struct vdpa_config_ops {
|
|||
/* Device ops */
|
||||
u32 (*get_vq_align)(struct vdpa_device *vdev);
|
||||
u32 (*get_vq_group)(struct vdpa_device *vdev, u16 idx);
|
||||
u32 (*get_vq_desc_group)(struct vdpa_device *vdev, u16 idx);
|
||||
u64 (*get_device_features)(struct vdpa_device *vdev);
|
||||
u64 (*get_backend_features)(const struct vdpa_device *vdev);
|
||||
int (*set_driver_features)(struct vdpa_device *vdev, u64 features);
|
||||
|
|
@ -373,6 +404,8 @@ struct vdpa_config_ops {
|
|||
u8 (*get_status)(struct vdpa_device *vdev);
|
||||
void (*set_status)(struct vdpa_device *vdev, u8 status);
|
||||
int (*reset)(struct vdpa_device *vdev);
|
||||
int (*compat_reset)(struct vdpa_device *vdev, u32 flags);
|
||||
#define VDPA_RESET_F_CLEAN_MAP 1
|
||||
int (*suspend)(struct vdpa_device *vdev);
|
||||
int (*resume)(struct vdpa_device *vdev);
|
||||
size_t (*get_config_size)(struct vdpa_device *vdev);
|
||||
|
|
@ -394,6 +427,7 @@ struct vdpa_config_ops {
|
|||
u64 iova, u64 size, u64 pa, u32 perm, void *opaque);
|
||||
int (*dma_unmap)(struct vdpa_device *vdev, unsigned int asid,
|
||||
u64 iova, u64 size);
|
||||
int (*reset_map)(struct vdpa_device *vdev, unsigned int asid);
|
||||
int (*set_group_asid)(struct vdpa_device *vdev, unsigned int group,
|
||||
unsigned int asid);
|
||||
struct device *(*get_vq_dma_dev)(struct vdpa_device *vdev, u16 idx);
|
||||
|
|
@ -485,14 +519,17 @@ static inline struct device *vdpa_get_dma_dev(struct vdpa_device *vdev)
|
|||
return vdev->dma_dev;
|
||||
}
|
||||
|
||||
static inline int vdpa_reset(struct vdpa_device *vdev)
|
||||
static inline int vdpa_reset(struct vdpa_device *vdev, u32 flags)
|
||||
{
|
||||
const struct vdpa_config_ops *ops = vdev->config;
|
||||
int ret;
|
||||
|
||||
down_write(&vdev->cf_lock);
|
||||
vdev->features_valid = false;
|
||||
ret = ops->reset(vdev);
|
||||
if (ops->compat_reset && flags)
|
||||
ret = ops->compat_reset(vdev, flags);
|
||||
else
|
||||
ret = ops->reset(vdev);
|
||||
up_write(&vdev->cf_lock);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,37 +12,48 @@ struct virtio_pci_modern_common_cfg {
|
|||
__le16 queue_reset; /* read-write */
|
||||
};
|
||||
|
||||
/**
|
||||
* struct virtio_pci_modern_device - info for modern PCI virtio
|
||||
* @pci_dev: Ptr to the PCI device struct
|
||||
* @common: Position of the common capability in the PCI config
|
||||
* @device: Device-specific data (non-legacy mode)
|
||||
* @notify_base: Base of vq notifications (non-legacy mode)
|
||||
* @notify_pa: Physical base of vq notifications
|
||||
* @isr: Where to read and clear interrupt
|
||||
* @notify_len: So we can sanity-check accesses
|
||||
* @device_len: So we can sanity-check accesses
|
||||
* @notify_map_cap: Capability for when we need to map notifications per-vq
|
||||
* @notify_offset_multiplier: Multiply queue_notify_off by this value
|
||||
* (non-legacy mode).
|
||||
* @modern_bars: Bitmask of BARs
|
||||
* @id: Device and vendor id
|
||||
* @device_id_check: Callback defined before vp_modern_probe() to be used to
|
||||
* verify the PCI device is a vendor's expected device rather
|
||||
* than the standard virtio PCI device
|
||||
* Returns the found device id or ERRNO
|
||||
* @dma_mask: Optional mask instead of the traditional DMA_BIT_MASK(64),
|
||||
* for vendor devices with DMA space address limitations
|
||||
*/
|
||||
struct virtio_pci_modern_device {
|
||||
struct pci_dev *pci_dev;
|
||||
|
||||
struct virtio_pci_common_cfg __iomem *common;
|
||||
/* Device-specific data (non-legacy mode) */
|
||||
void __iomem *device;
|
||||
/* Base of vq notifications (non-legacy mode). */
|
||||
void __iomem *notify_base;
|
||||
/* Physical base of vq notifications */
|
||||
resource_size_t notify_pa;
|
||||
/* Where to read and clear interrupt */
|
||||
u8 __iomem *isr;
|
||||
|
||||
/* So we can sanity-check accesses. */
|
||||
size_t notify_len;
|
||||
size_t device_len;
|
||||
size_t common_len;
|
||||
|
||||
/* Capability for when we need to map notifications per-vq. */
|
||||
int notify_map_cap;
|
||||
|
||||
/* Multiply queue_notify_off by this value. (non-legacy mode). */
|
||||
u32 notify_offset_multiplier;
|
||||
|
||||
int modern_bars;
|
||||
|
||||
struct virtio_device_id id;
|
||||
|
||||
/* optional check for vendor virtio device, returns dev_id or -ERRNO */
|
||||
int (*device_id_check)(struct pci_dev *pdev);
|
||||
|
||||
/* optional mask for devices with limited DMA space */
|
||||
u64 dma_mask;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue