summaryrefslogtreecommitdiffstats
path: root/drivers/virtio/virtio_pci_common.h
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2024-07-16 13:35:51 +0200
committerMichael S. Tsirkin <mst@redhat.com>2024-07-17 11:43:21 +0200
commit4c3b54af907e709609d3d8beca92d65e2f0cfd83 (patch)
tree65bb3e6643a56a0d09c41abe27adbbd568ab1afe /drivers/virtio/virtio_pci_common.h
parentvirtio_pci_modern: pass cmd as an identification token (diff)
downloadlinux-4c3b54af907e709609d3d8beca92d65e2f0cfd83.tar.xz
linux-4c3b54af907e709609d3d8beca92d65e2f0cfd83.zip
virtio_pci_modern: use completion instead of busy loop to wait on admin cmd result
Currently, the code waits in a busy loop on every admin virtqueue issued command to get a reply. That prevents callers from issuing multiple commands in parallel. To overcome this limitation, introduce a virtqueue event callback for admin virtqueue. For every issued command, use completion mechanism to wait on a reply. In the event callback, trigger the completion is done for every incoming reply. Alongside with that, introduce a spin lock to protect the admin virtqueue operations. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Message-Id: <20240716113552.80599-13-jiri@resnulli.us> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio/virtio_pci_common.h')
-rw-r--r--drivers/virtio/virtio_pci_common.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_pci_common.h b/drivers/virtio/virtio_pci_common.h
index de59bb06ec3c..90df381fbbcf 100644
--- a/drivers/virtio/virtio_pci_common.h
+++ b/drivers/virtio/virtio_pci_common.h
@@ -47,6 +47,8 @@ struct virtio_pci_admin_vq {
struct virtio_pci_vq_info *info;
/* serializing admin commands execution. */
struct mutex cmd_lock;
+ /* Protects virtqueue access. */
+ spinlock_t lock;
u64 supported_cmds;
/* Name of the admin queue: avq.$vq_index. */
char name[10];
@@ -178,6 +180,7 @@ struct virtio_device *virtio_pci_vf_get_pf_dev(struct pci_dev *pdev);
#define VIRTIO_ADMIN_CMD_BITMAP 0
#endif
+void vp_modern_avq_done(struct virtqueue *vq);
int vp_modern_admin_cmd_exec(struct virtio_device *vdev,
struct virtio_admin_cmd *cmd);