From: Eli Cohen <eli@mellanox.com>
To: mst@redhat.com, jasowang@redhat.com,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Cc: shahafs@mellanox.com, saeedm@mellanox.com, parav@mellanox.com
Subject: [PATCH V2 vhost next 01/10] vhost-vdpa: support batch updating
Date: Mon, 20 Jul 2020 10:14:07 +0300 [thread overview]
Message-ID: <20200720071416.32112-2-eli@mellanox.com> (raw)
In-Reply-To: <20200720071416.32112-1-eli@mellanox.com>
From: Jason Wang <jasowang@redhat.com>
Change-Id: Ifd7139cfbd122dc22493f4bb93fa884f8edbddb6
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/vdpa.c | 23 +++++++++++++++++------
include/uapi/linux/vhost_types.h | 2 ++
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index a54b60d6623f..8827ae31f96d 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -73,6 +73,7 @@ struct vhost_vdpa {
int virtio_id;
int minor;
struct eventfd_ctx *config_ctx;
+ bool in_batch;
};
static DEFINE_IDA(vhost_vdpa_ida);
@@ -521,9 +522,9 @@ static int vhost_vdpa_map(struct vhost_vdpa *v,
if (ops->dma_map)
r = ops->dma_map(vdpa, iova, size, pa, perm);
- else if (ops->set_map)
- r = ops->set_map(vdpa, dev->iotlb);
- else
+ else if (ops->set_map) {
+
+ } else
r = iommu_map(v->domain, iova, pa, size,
perm_to_iommu_flags(perm));
@@ -540,9 +541,8 @@ static void vhost_vdpa_unmap(struct vhost_vdpa *v, u64 iova, u64 size)
if (ops->dma_map)
ops->dma_unmap(vdpa, iova, size);
- else if (ops->set_map)
- ops->set_map(vdpa, dev->iotlb);
- else
+ else if (ops->set_map) {
+ } else
iommu_unmap(v->domain, iova, size);
}
@@ -636,6 +636,8 @@ static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev,
struct vhost_iotlb_msg *msg)
{
struct vhost_vdpa *v = container_of(dev, struct vhost_vdpa, vdev);
+ struct vdpa_device *vdpa = v->vdpa;
+ const struct vdpa_config_ops *ops = vdpa->config;
int r = 0;
r = vhost_dev_check_owner(dev);
@@ -649,6 +651,15 @@ static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev,
case VHOST_IOTLB_INVALIDATE:
vhost_vdpa_unmap(v, msg->iova, msg->size);
break;
+ case VHOST_IOTLB_BATCH_BEGIN:
+ v->in_batch = true;
+ break;
+ case VHOST_IOTLB_BATCH_END:
+ if (v->in_batch && ops->set_map) {
+ ops->set_map(vdpa, dev->iotlb);
+ }
+ v->in_batch = false;
+ break;
default:
r = -EINVAL;
break;
diff --git a/include/uapi/linux/vhost_types.h b/include/uapi/linux/vhost_types.h
index 669457ce5c48..7f52245f8d5d 100644
--- a/include/uapi/linux/vhost_types.h
+++ b/include/uapi/linux/vhost_types.h
@@ -60,6 +60,8 @@ struct vhost_iotlb_msg {
#define VHOST_IOTLB_UPDATE 2
#define VHOST_IOTLB_INVALIDATE 3
#define VHOST_IOTLB_ACCESS_FAIL 4
+#define VHOST_IOTLB_BATCH_BEGIN 5
+#define VHOST_IOTLB_BATCH_END 6
__u8 type;
};
--
2.26.0
next prev parent reply other threads:[~2020-07-20 7:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-20 7:14 [PATCH V2 vhost next 00/10] VDPA support for Mellanox ConnectX devices Eli Cohen
2020-07-20 7:14 ` Eli Cohen [this message]
2020-07-20 7:14 ` [PATCH V2 vhost next 02/10] vdpa_sim: use the batching API Eli Cohen
2020-07-20 7:14 ` [PATCH V2 vhost next 03/10] vdpa: remove hard coded virtq num Eli Cohen
2020-07-20 7:14 ` [PATCH V2 vhost next 04/10] net/vdpa: Use struct for set/get vq state Eli Cohen
2020-07-20 7:14 ` [PATCH V2 vhost next 05/10] vhost: Fix documentation Eli Cohen
2020-07-21 5:35 ` Jason Wang
2020-07-20 7:14 ` [PATCH V2 vhost next 06/10] vdpa: Modify get_vq_state() to return error code Eli Cohen
2020-07-21 5:34 ` Jason Wang
2020-07-20 7:14 ` [PATCH V2 vhost next 07/10] vdpa/mlx5: Add hardware descriptive header file Eli Cohen
2020-07-20 7:14 ` [PATCH V2 vhost next 08/10] vdpa/mlx5: Add support library for mlx5 VDPA implementation Eli Cohen
2020-07-20 7:14 ` [PATCH V2 vhost next 09/10] vdpa/mlx5: Add shared memory registration code Eli Cohen
2020-07-20 7:14 ` [PATCH V2 vhost next 10/10] vdpa/mlx5: Add VDPA driver for supported mlx5 devices Eli Cohen
2020-07-20 12:55 ` kernel test robot
2020-07-22 7:46 ` Eli Cohen
2020-07-21 3:30 ` kernel test robot
2020-07-21 5:51 ` Jason Wang
-- strict thread matches above, loose matches on Subject: below --
2020-07-20 6:54 [PATCH V2 vhost next 00/10] VDPA support for Mellanox ConnectX devices Eli Cohen
2020-07-20 6:54 ` [PATCH V2 vhost next 01/10] vhost-vdpa: support batch updating Eli Cohen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200720071416.32112-2-eli@mellanox.com \
--to=eli@mellanox.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=parav@mellanox.com \
--cc=saeedm@mellanox.com \
--cc=shahafs@mellanox.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).