diff mbox series

vhost: initializing iotlb memory only when IOMMU feature is enabled DPDK 17.11 introduced the IOMMU feature which caused additional DPDK memory requirement per vhostuser device as part of iotlb_init(). Today this is done unconditionally (from DPDK 17.11 o

Message ID 1530726799-11100-2-git-send-email-nitin.katiyar@ericsson.com (mailing list archive)
State Not Applicable, archived
Delegated to: Maxime Coquelin
Headers show
Series vhost: initializing iotlb memory only when IOMMU feature is enabled DPDK 17.11 introduced the IOMMU feature which caused additional DPDK memory requirement per vhostuser device as part of iotlb_init(). Today this is done unconditionally (from DPDK 17.11 o | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Nitin Katiyar July 4, 2018, 5:53 p.m. UTC
This patch is to do iotlb_init only if IOMMU feature is enabled on device.

Signed-off-by: Nitin Katiyar <nitin.katiyar@ericsson.com>
---
 lib/librte_vhost/iotlb.c      | 7 +++++++
 lib/librte_vhost/vhost_user.c | 7 +++++++
 2 files changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/lib/librte_vhost/iotlb.c b/lib/librte_vhost/iotlb.c
index c11ebca..0d7c820 100644
--- a/lib/librte_vhost/iotlb.c
+++ b/lib/librte_vhost/iotlb.c
@@ -310,6 +310,13 @@  struct vhost_iotlb_entry {
 	struct vhost_virtqueue *vq = dev->virtqueue[vq_index];
 	int socket = 0;
 
+	if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)) {
+		RTE_LOG(ERR, VHOST_CONFIG,
+			"IOMMU feature is not enabled for this dev(%s)\n",
+			dev->ifname);
+		return -1;
+	}
+
 	if (vq->iotlb_pool) {
 		/*
 		 * The cache has already been initialized,
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 26cfebe..ca787f3 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -1274,6 +1274,13 @@ 
 	uint16_t i;
 	uint64_t vva, len;
 
+	if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)) {
+		RTE_LOG(ERR, VHOST_CONFIG,
+			"IOMMU feature is not enabled for this dev(%s)\n",
+			dev->ifname);
+		return -1;
+	}
+
 	switch (imsg->type) {
 	case VHOST_IOTLB_UPDATE:
 		len = imsg->size;