DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration
@ 2019-06-25 10:44 Hemant Agrawal
  2019-06-25 10:44 ` [dpdk-dev] [PATCH 2/5] bus/fslmc: enhance error handling for dev parsing Hemant Agrawal
                   ` (5 more replies)
  0 siblings, 6 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-25 10:44 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Shreyansh Jain <shreyansh.jain@nxp.com>

Recent (18.11+), devargs structure was changed and so was DPDK port
usage in applications like OVS. Applications are now allowed to
plug/unplug ports (eth) using APIs (hotplug) based on device
arguments.

This patch enables the plug/unplug function (which are dummy for
FSLMC) and the iterator function for rte_dev_probe() and similar
API support.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 132 +++++++++++++++++++++++++++++-----
 1 file changed, 116 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index f6e66d22c..35103d224 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -230,34 +230,70 @@ rte_fslmc_parse(const char *name, void *addr)
 {
 	uint16_t dev_id;
 	char *t_ptr;
+	char *sep = NULL;
+	uint8_t sep_exists = 0;
 
-	/* 'name' is expected to contain name of device, for example, dpio.1,
-	 * dpni.2, etc.
+	DPAA2_BUS_DEBUG("Parsing dev=(%s)", name);
+
+	/* There are multiple ways this can be called, with bus:dev, name=dev
+	 * or just dev. In all cases, the 'addr' is actually a string.
+	 */
+	sep = strchr(name, ':');
+	if (!sep) {
+		/* check for '=' */
+		sep = strchr(name, '=');
+		if (!sep)
+			sep_exists = 0;
+		else
+			sep_exists = 1;
+	} else
+		sep_exists = 1;
+
+	/* Check if starting part if either of 'fslmc:' or 'name=', separator
+	 * exists.
 	 */
-	if (strncmp("dpni", name, 4) &&
-	    strncmp("dpseci", name, 6) &&
-	    strncmp("dpcon", name, 5) &&
-	    strncmp("dpbp", name, 4) &&
-	    strncmp("dpio", name, 4) &&
-	    strncmp("dpci", name, 4) &&
-	    strncmp("dpmcp", name, 5) &&
-	    strncmp("dpdmai", name, 6) &&
-	    strncmp("dpdmux", name, 6)) {
-		DPAA2_BUS_DEBUG("Unknown or unsupported device (%s)", name);
+	if (sep_exists) {
+		/* If either of "fslmc" or "name" are starting part */
+		if (!strncmp(name, RTE_STR(FSLMC_BUS_NAME),
+			     strlen(RTE_STR(FSLMC_BUS_NAME))) ||
+		   (!strncmp(name, "name", strlen("name")))) {
+			goto jump_out;
+		} else {
+			DPAA2_BUS_DEBUG("Invalid device for matching (%s).",
+					name);
+			goto err_out;
+		}
+	} else
+		sep = strdup(name);
+
+jump_out:
+	/* Validate device name */
+	if (strncmp("dpni", sep, 4) &&
+	    strncmp("dpseci", sep, 6) &&
+	    strncmp("dpcon", sep, 5) &&
+	    strncmp("dpbp", sep, 4) &&
+	    strncmp("dpio", sep, 4) &&
+	    strncmp("dpci", sep, 4) &&
+	    strncmp("dpmcp", sep, 5) &&
+	    strncmp("dpdmai", sep, 6) &&
+	    strncmp("dpdmux", sep, 6)) {
+		DPAA2_BUS_DEBUG("Unknown or unsupported device (%s)", sep);
 		goto err_out;
 	}
 
-	t_ptr = strchr(name, '.');
+	t_ptr = strchr(sep, '.');
 	if (!t_ptr || sscanf(t_ptr + 1, "%hu", &dev_id) != 1) {
-		DPAA2_BUS_ERR("Missing device id in device name (%s)", name);
+		DPAA2_BUS_ERR("Missing device id in device name (%s)", sep);
 		goto err_out;
 	}
 
 	if (addr)
-		strcpy(addr, name);
+		strcpy(addr, sep);
 
 	return 0;
 err_out:
+	if (sep)
+		free(sep);
 	return -EINVAL;
 }
 
@@ -430,6 +466,13 @@ rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
 	const struct rte_dpaa2_device *dstart;
 	struct rte_dpaa2_device *dev;
 
+	DPAA2_BUS_DEBUG("Finding a device named %s\n", (const char *)data);
+
+	/* find_device is always called with an opaque object which should be
+	 * passed along to the 'cmp' function iterating over all device obj
+	 * on the bus.
+	 */
+
 	if (start != NULL) {
 		dstart = RTE_DEV_TO_FSLMC_CONST(start);
 		dev = TAILQ_NEXT(dstart, next);
@@ -437,8 +480,11 @@ rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
 		dev = TAILQ_FIRST(&rte_fslmc_bus.device_list);
 	}
 	while (dev != NULL) {
-		if (cmp(&dev->device, data) == 0)
+		if (cmp(&dev->device, data) == 0) {
+			DPAA2_BUS_DEBUG("Found device (%s)\n",
+					dev->device.name);
 			return &dev->device;
+		}
 		dev = TAILQ_NEXT(dev, next);
 	}
 
@@ -527,6 +573,57 @@ rte_dpaa2_get_iommu_class(void)
 	return RTE_IOVA_PA;
 }
 
+static int
+fslmc_bus_plug(struct rte_device *dev __rte_unused)
+{
+	/* No operation is performed while plugging the device */
+	return 0;
+}
+
+static int
+fslmc_bus_unplug(struct rte_device *dev __rte_unused)
+{
+	/* No operation is performed while unplugging the device */
+	return 0;
+}
+
+static void *
+fslmc_bus_dev_iterate(const void *start, const char *str,
+		      const struct rte_dev_iterator *it __rte_unused)
+{
+	const struct rte_dpaa2_device *dstart;
+	struct rte_dpaa2_device *dev;
+	char *dup, *dev_name = NULL;
+
+	/* Expectation is that device would be name=device_name */
+	if (strncmp(str, "name=", 5) != 0) {
+		DPAA2_BUS_ERR("Invalid device string (%s)\n", str);
+		return NULL;
+	}
+
+	/* Now that name=device_name format is available, split */
+	dup = strdup(str);
+	dev_name = dup + strlen("name=");
+
+	if (start != NULL) {
+		dstart = RTE_DEV_TO_FSLMC_CONST(start);
+		dev = TAILQ_NEXT(dstart, next);
+	} else {
+		dev = TAILQ_FIRST(&rte_fslmc_bus.device_list);
+	}
+
+	while (dev != NULL) {
+		if (strcmp(dev->device.name, dev_name) == 0) {
+			free(dup);
+			return &dev->device;
+		}
+		dev = TAILQ_NEXT(dev, next);
+	}
+
+	free(dup);
+	return NULL;
+}
+
 struct rte_fslmc_bus rte_fslmc_bus = {
 	.bus = {
 		.scan = rte_fslmc_scan,
@@ -534,6 +631,9 @@ struct rte_fslmc_bus rte_fslmc_bus = {
 		.parse = rte_fslmc_parse,
 		.find_device = rte_fslmc_find_device,
 		.get_iommu_class = rte_dpaa2_get_iommu_class,
+		.plug = fslmc_bus_plug,
+		.unplug = fslmc_bus_unplug,
+		.dev_iterate = fslmc_bus_dev_iterate,
 	},
 	.device_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.device_list),
 	.driver_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.driver_list),
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH 2/5] bus/fslmc: enhance error handling for dev parsing
  2019-06-25 10:44 [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Hemant Agrawal
@ 2019-06-25 10:44 ` Hemant Agrawal
  2019-06-25 10:44 ` [dpdk-dev] [PATCH 3/5] bus/fslmc: dynamic iommu mode detection Hemant Agrawal
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-25 10:44 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Shreyansh Jain <shreyansh.jain@nxp.com>

In case an incorrect device is found, it was quiting further search
rather than skipping it.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 35103d224..a2ed3bcc9 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -33,7 +33,7 @@ uint8_t dpaa2_virt_mode;
 uint32_t
 rte_fslmc_get_device_count(enum rte_dpaa2_dev_type device_type)
 {
-	if (device_type > DPAA2_DEVTYPE_MAX)
+	if (device_type >= DPAA2_DEVTYPE_MAX)
 		return 0;
 	return rte_fslmc_bus.device_count[device_type];
 }
@@ -135,10 +135,11 @@ static int
 scan_one_fslmc_device(char *dev_name)
 {
 	char *dup_dev_name, *t_ptr;
-	struct rte_dpaa2_device *dev;
+	struct rte_dpaa2_device *dev = NULL;
+	int ret = -1;
 
 	if (!dev_name)
-		return -1;
+		return ret;
 
 	/* Ignore the Container name itself */
 	if (!strncmp("dprc", dev_name, 4))
@@ -168,7 +169,8 @@ scan_one_fslmc_device(char *dev_name)
 	/* Parse the device name and ID */
 	t_ptr = strtok(dup_dev_name, ".");
 	if (!t_ptr) {
-		DPAA2_BUS_ERR("Incorrect device name observed");
+		DPAA2_BUS_ERR("Invalid device found: (%s)", dup_dev_name);
+		ret = -EINVAL;
 		goto cleanup;
 	}
 	if (!strncmp("dpni", t_ptr, 4))
@@ -192,12 +194,10 @@ scan_one_fslmc_device(char *dev_name)
 	else
 		dev->dev_type = DPAA2_UNKNOWN;
 
-	/* Update the device found into the device_count table */
-	rte_fslmc_bus.device_count[dev->dev_type]++;
-
 	t_ptr = strtok(NULL, ".");
 	if (!t_ptr) {
-		DPAA2_BUS_ERR("Incorrect device string observed (null)");
+		DPAA2_BUS_ERR("Skipping invalid device (%s)", dup_dev_name);
+		ret = 0;
 		goto cleanup;
 	}
 
@@ -205,10 +205,14 @@ scan_one_fslmc_device(char *dev_name)
 	dev->device.name = strdup(dev_name);
 	if (!dev->device.name) {
 		DPAA2_BUS_ERR("Unable to clone device name. Out of memory");
+		ret = -ENOMEM;
 		goto cleanup;
 	}
 	dev->device.devargs = fslmc_devargs_lookup(dev);
 
+	/* Update the device found into the device_count table */
+	rte_fslmc_bus.device_count[dev->dev_type]++;
+
 	/* Add device in the fslmc device list */
 	insert_in_device_list(dev);
 
@@ -222,7 +226,7 @@ scan_one_fslmc_device(char *dev_name)
 		free(dup_dev_name);
 	if (dev)
 		free(dev);
-	return -1;
+	return ret;
 }
 
 static int
@@ -353,7 +357,7 @@ rte_fslmc_scan(void)
 	/* Remove all devices in the list */
 	cleanup_fslmc_device_list();
 scan_fail:
-	DPAA2_BUS_DEBUG("FSLMC Bus Not Available. Skipping");
+	DPAA2_BUS_DEBUG("FSLMC Bus Not Available. Skipping (%d)", ret);
 	/* Irrespective of failure, scan only return success */
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH 3/5] bus/fslmc: dynamic iommu mode detection
  2019-06-25 10:44 [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Hemant Agrawal
  2019-06-25 10:44 ` [dpdk-dev] [PATCH 2/5] bus/fslmc: enhance error handling for dev parsing Hemant Agrawal
@ 2019-06-25 10:44 ` Hemant Agrawal
  2019-06-25 10:44 ` [dpdk-dev] [PATCH 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform Hemant Agrawal
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-25 10:44 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Shreyansh Jain <shreyansh.jain@nxp.com>

This patch adds following:
1. 'g_container' variable name is not right way to represent the
FSLMC container. Renaming it to fslmc_container.
2. dynamic selection of IOMMU mode based on run environment

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 38 +++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 1aae56fa9..711780e74 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2018 NXP
+ *   Copyright 2016-2019 NXP
  *
  */
 
@@ -49,7 +49,8 @@
 static struct fslmc_vfio_group vfio_group;
 static struct fslmc_vfio_container vfio_container;
 static int container_device_fd;
-static char *g_container;
+static char *fslmc_container;
+static int fslmc_iommu_type;
 static uint32_t *msi_intr_vaddr;
 void *(*rte_mcp_ptr_list);
 
@@ -71,7 +72,7 @@ fslmc_get_container_group(int *groupid)
 	int ret;
 	char *container;
 
-	if (!g_container) {
+	if (!fslmc_container) {
 		container = getenv("DPRC");
 		if (container == NULL) {
 			DPAA2_BUS_DEBUG("DPAA2: DPRC not available");
@@ -83,23 +84,26 @@ fslmc_get_container_group(int *groupid)
 			return -1;
 		}
 
-		g_container = strdup(container);
-		if (!g_container) {
+		fslmc_container = strdup(container);
+		if (!fslmc_container) {
 			DPAA2_BUS_ERR("Mem alloc failure; Container name");
 			return -ENOMEM;
 		}
 	}
 
+	fslmc_iommu_type = (rte_vfio_noiommu_is_enabled() == 1) ?
+		RTE_VFIO_NOIOMMU : VFIO_TYPE1_IOMMU;
+
 	/* get group number */
 	ret = rte_vfio_get_group_num(SYSFS_FSL_MC_DEVICES,
-				     g_container, groupid);
+				     fslmc_container, groupid);
 	if (ret <= 0) {
-		DPAA2_BUS_ERR("Unable to find %s IOMMU group", g_container);
+		DPAA2_BUS_ERR("Unable to find %s IOMMU group", fslmc_container);
 		return -1;
 	}
 
 	DPAA2_BUS_DEBUG("Container: %s has VFIO iommu group id = %d",
-			g_container, *groupid);
+			fslmc_container, *groupid);
 
 	return 0;
 }
@@ -132,7 +136,7 @@ vfio_connect_container(void)
 	}
 
 	/* Check whether support for SMMU type IOMMU present or not */
-	if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU)) {
+	if (ioctl(fd, VFIO_CHECK_EXTENSION, fslmc_iommu_type)) {
 		/* Connect group to container */
 		ret = ioctl(vfio_group.fd, VFIO_GROUP_SET_CONTAINER, &fd);
 		if (ret) {
@@ -141,7 +145,7 @@ vfio_connect_container(void)
 			return -errno;
 		}
 
-		ret = ioctl(fd, VFIO_SET_IOMMU, VFIO_TYPE1_IOMMU);
+		ret = ioctl(fd, VFIO_SET_IOMMU, fslmc_iommu_type);
 		if (ret) {
 			DPAA2_BUS_ERR("Failed to setup VFIO iommu");
 			close(fd);
@@ -261,6 +265,11 @@ fslmc_map_dma(uint64_t vaddr, rte_iova_t iovaddr __rte_unused, size_t len)
 	};
 	int ret;
 
+	if (fslmc_iommu_type == RTE_VFIO_NOIOMMU) {
+		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
+		return 0;
+	}
+
 	dma_map.size = len;
 	dma_map.vaddr = vaddr;
 
@@ -300,6 +309,11 @@ fslmc_unmap_dma(uint64_t vaddr, uint64_t iovaddr __rte_unused, size_t len)
 	};
 	int ret;
 
+	if (fslmc_iommu_type == RTE_VFIO_NOIOMMU) {
+		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
+		return 0;
+	}
+
 	dma_unmap.size = len;
 	dma_unmap.iova = vaddr;
 
@@ -821,10 +835,10 @@ fslmc_vfio_setup_group(void)
 	}
 
 	/* Get Device information */
-	ret = ioctl(vfio_group.fd, VFIO_GROUP_GET_DEVICE_FD, g_container);
+	ret = ioctl(vfio_group.fd, VFIO_GROUP_GET_DEVICE_FD, fslmc_container);
 	if (ret < 0) {
 		DPAA2_BUS_ERR("Error getting device %s fd from group %d",
-			      g_container, vfio_group.groupid);
+			      fslmc_container, vfio_group.groupid);
 		close(vfio_group.fd);
 		rte_vfio_clear_group(vfio_group.fd);
 		return ret;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform
  2019-06-25 10:44 [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Hemant Agrawal
  2019-06-25 10:44 ` [dpdk-dev] [PATCH 2/5] bus/fslmc: enhance error handling for dev parsing Hemant Agrawal
  2019-06-25 10:44 ` [dpdk-dev] [PATCH 3/5] bus/fslmc: dynamic iommu mode detection Hemant Agrawal
@ 2019-06-25 10:44 ` Hemant Agrawal
  2019-06-25 10:44 ` [dpdk-dev] [PATCH 5/5] mempool/dpaa2: vfio dmamap for user allocated memory Hemant Agrawal
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-25 10:44 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Nipun Gupta <nipun.gupta@nxp.com>

LS1088 platform CENA operation are causing issues
at high load. CINH (cache inhibited) mode is working
fine with minor performance impact.

This patch enables CINH mode selectively on LS1088 platform

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h      |   2 -
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h       |   5 -
 .../fslmc/qbman/include/fsl_qbman_portal.h    |   9 +
 drivers/bus/fslmc/qbman/qbman_portal.c        | 278 +++++++++++++++++-
 drivers/bus/fslmc/qbman/qbman_sys.h           |  22 +-
 5 files changed, 303 insertions(+), 13 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
index 17e7e4fad..c68495eaf 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
@@ -28,8 +28,6 @@ RTE_DECLARE_PER_LCORE(struct dpaa2_io_portal_t, _dpaa2_io);
 #define DPAA2_PER_LCORE_ETHRX_DPIO RTE_PER_LCORE(_dpaa2_io).ethrx_dpio_dev
 #define DPAA2_PER_LCORE_ETHRX_PORTAL DPAA2_PER_LCORE_ETHRX_DPIO->sw_portal
 
-/* Variable to store DPAA2 platform type */
-extern uint32_t dpaa2_svr_family;
 /* Variable to store DPAA2 DQRR size */
 extern uint8_t dpaa2_dqrr_size;
 /* Variable to store DPAA2 EQCR size */
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 0cbde8a9b..92fc76211 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -23,11 +23,6 @@
 #define lower_32_bits(x) ((uint32_t)(x))
 #define upper_32_bits(x) ((uint32_t)(((x) >> 16) >> 16))
 
-#define SVR_LS1080A             0x87030000
-#define SVR_LS2080A             0x87010000
-#define SVR_LS2088A             0x87090000
-#define SVR_LX2160A             0x87360000
-
 #ifndef VLAN_TAG_SIZE
 #define VLAN_TAG_SIZE   4 /** < Vlan Header Length */
 #endif
diff --git a/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h b/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
index 07b8a4372..107850d37 100644
--- a/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
+++ b/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ * Copyright 2015-2019 NXP
  *
  */
 #ifndef _FSL_QBMAN_PORTAL_H
@@ -8,6 +9,14 @@
 
 #include <fsl_qbman_base.h>
 
+#define SVR_LS1080A	0x87030000
+#define SVR_LS2080A	0x87010000
+#define SVR_LS2088A	0x87090000
+#define SVR_LX2160A	0x87360000
+
+/* Variable to store DPAA2 platform type */
+extern uint32_t dpaa2_svr_family;
+
 /**
  * DOC - QBMan portal APIs to implement the following functions:
  * - Initialize and destroy Software portal object.
diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 20da8b921..e6066ce35 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -76,6 +76,10 @@ qbman_swp_enqueue_ring_mode_direct(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd);
 static int
+qbman_swp_enqueue_ring_mode_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd);
+static int
 qbman_swp_enqueue_ring_mode_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd);
@@ -87,6 +91,12 @@ qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
 		uint32_t *flags,
 		int num_frames);
 static int
+qbman_swp_enqueue_multiple_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		uint32_t *flags,
+		int num_frames);
+static int
 qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd,
@@ -99,7 +109,12 @@ qbman_swp_enqueue_multiple_fd_direct(struct qbman_swp *s,
 		struct qbman_fd **fd,
 		uint32_t *flags,
 		int num_frames);
-
+static int
+qbman_swp_enqueue_multiple_fd_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		struct qbman_fd **fd,
+		uint32_t *flags,
+		int num_frames);
 static int
 qbman_swp_enqueue_multiple_fd_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
@@ -113,6 +128,11 @@ qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s,
 		const struct qbman_fd *fd,
 		int num_frames);
 static int
+qbman_swp_enqueue_multiple_desc_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		int num_frames);
+static int
 qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd,
@@ -273,6 +293,17 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d)
 		qbman_swp_release_ptr = qbman_swp_release_mem_back;
 	}
 
+	if (dpaa2_svr_family == SVR_LS1080A) {
+		qbman_swp_enqueue_ring_mode_ptr =
+				qbman_swp_enqueue_ring_mode_cinh_direct;
+		qbman_swp_enqueue_multiple_ptr =
+				qbman_swp_enqueue_multiple_cinh_direct;
+		qbman_swp_enqueue_multiple_fd_ptr =
+				qbman_swp_enqueue_multiple_fd_cinh_direct;
+		qbman_swp_enqueue_multiple_desc_ptr =
+				qbman_swp_enqueue_multiple_desc_cinh_direct;
+	}
+
 	for (mask_size = p->eqcr.pi_ring_size; mask_size > 0; mask_size >>= 1)
 		p->eqcr.pi_ci_mask = (p->eqcr.pi_ci_mask<<1) + 1;
 	eqcr_pi = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI);
@@ -700,6 +731,46 @@ static int qbman_swp_enqueue_ring_mode_direct(struct qbman_swp *s,
 	return 0;
 }
 
+static int qbman_swp_enqueue_ring_mode_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd)
+{
+	uint32_t *p;
+	const uint32_t *cl = qb_cl(d);
+	uint32_t eqcr_ci, full_mask, half_mask;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+				eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return -EBUSY;
+	}
+
+	p = qbman_cena_write_start_wo_shadow(&s->sys,
+			QBMAN_CENA_SWP_EQCR(s->eqcr.pi & half_mask));
+	memcpy(&p[1], &cl[1], 28);
+	memcpy(&p[8], fd, sizeof(*fd));
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	p[0] = cl[0] | s->eqcr.pi_vb;
+	qbman_cena_write_complete_wo_shadow(&s->sys,
+			QBMAN_CENA_SWP_EQCR(s->eqcr.pi & half_mask));
+	s->eqcr.pi++;
+	s->eqcr.pi &= full_mask;
+	s->eqcr.available--;
+	if (!(s->eqcr.pi & half_mask))
+		s->eqcr.pi_vb ^= QB_VALID_BIT;
+
+	return 0;
+}
+
 static int qbman_swp_enqueue_ring_mode_mem_back(struct qbman_swp *s,
 						const struct qbman_eq_desc *d,
 						const struct qbman_fd *fd)
@@ -823,6 +894,76 @@ static int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
 	return num_enqueued;
 }
 
+static int qbman_swp_enqueue_multiple_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		uint32_t *flags,
+		int num_frames)
+{
+	uint32_t *p = NULL;
+	const uint32_t *cl = qb_cl(d);
+	uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
+	int i, num_enqueued = 0;
+	uint64_t addr_cena;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+				eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return 0;
+	}
+
+	eqcr_pi = s->eqcr.pi;
+	num_enqueued = (s->eqcr.available < num_frames) ?
+			s->eqcr.available : num_frames;
+	s->eqcr.available -= num_enqueued;
+	/* Fill in the EQCR ring */
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		memcpy(&p[1], &cl[1], 28);
+		memcpy(&p[8], &fd[i], sizeof(*fd));
+		eqcr_pi++;
+	}
+
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	eqcr_pi = s->eqcr.pi;
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		p[0] = cl[0] | s->eqcr.pi_vb;
+		if (flags && (flags[i] & QBMAN_ENQUEUE_FLAG_DCA)) {
+			struct qbman_eq_desc *d = (struct qbman_eq_desc *)p;
+
+			d->eq.dca = (1 << QB_ENQUEUE_CMD_DCA_EN_SHIFT) |
+				((flags[i]) & QBMAN_EQCR_DCA_IDXMASK);
+		}
+		eqcr_pi++;
+		if (!(eqcr_pi & half_mask))
+			s->eqcr.pi_vb ^= QB_VALID_BIT;
+	}
+
+	/* Flush all the cacheline without load/store in between */
+	eqcr_pi = s->eqcr.pi;
+	addr_cena = (size_t)s->sys.addr_cena;
+	for (i = 0; i < num_enqueued; i++) {
+		dcbf(addr_cena +
+			QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		eqcr_pi++;
+	}
+	s->eqcr.pi = eqcr_pi & full_mask;
+
+	return num_enqueued;
+}
+
 static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 					       const struct qbman_eq_desc *d,
 					       const struct qbman_fd *fd,
@@ -954,6 +1095,76 @@ static int qbman_swp_enqueue_multiple_fd_direct(struct qbman_swp *s,
 	return num_enqueued;
 }
 
+static int qbman_swp_enqueue_multiple_fd_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		struct qbman_fd **fd,
+		uint32_t *flags,
+		int num_frames)
+{
+	uint32_t *p = NULL;
+	const uint32_t *cl = qb_cl(d);
+	uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
+	int i, num_enqueued = 0;
+	uint64_t addr_cena;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+				eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return 0;
+	}
+
+	eqcr_pi = s->eqcr.pi;
+	num_enqueued = (s->eqcr.available < num_frames) ?
+			s->eqcr.available : num_frames;
+	s->eqcr.available -= num_enqueued;
+	/* Fill in the EQCR ring */
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		memcpy(&p[1], &cl[1], 28);
+		memcpy(&p[8], fd[i], sizeof(struct qbman_fd));
+		eqcr_pi++;
+	}
+
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	eqcr_pi = s->eqcr.pi;
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		p[0] = cl[0] | s->eqcr.pi_vb;
+		if (flags && (flags[i] & QBMAN_ENQUEUE_FLAG_DCA)) {
+			struct qbman_eq_desc *d = (struct qbman_eq_desc *)p;
+
+			d->eq.dca = (1 << QB_ENQUEUE_CMD_DCA_EN_SHIFT) |
+				((flags[i]) & QBMAN_EQCR_DCA_IDXMASK);
+		}
+		eqcr_pi++;
+		if (!(eqcr_pi & half_mask))
+			s->eqcr.pi_vb ^= QB_VALID_BIT;
+	}
+
+	/* Flush all the cacheline without load/store in between */
+	eqcr_pi = s->eqcr.pi;
+	addr_cena = (size_t)s->sys.addr_cena;
+	for (i = 0; i < num_enqueued; i++) {
+		dcbf(addr_cena +
+			QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		eqcr_pi++;
+	}
+	s->eqcr.pi = eqcr_pi & full_mask;
+
+	return num_enqueued;
+}
+
 static int qbman_swp_enqueue_multiple_fd_mem_back(struct qbman_swp *s,
 						  const struct qbman_eq_desc *d,
 						  struct qbman_fd **fd,
@@ -1087,6 +1298,71 @@ static int qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s,
 	return num_enqueued;
 }
 
+static int qbman_swp_enqueue_multiple_desc_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		int num_frames)
+{
+	uint32_t *p;
+	const uint32_t *cl;
+	uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
+	int i, num_enqueued = 0;
+	uint64_t addr_cena;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+					eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return 0;
+	}
+
+	eqcr_pi = s->eqcr.pi;
+	num_enqueued = (s->eqcr.available < num_frames) ?
+			s->eqcr.available : num_frames;
+	s->eqcr.available -= num_enqueued;
+	/* Fill in the EQCR ring */
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		cl = qb_cl(&d[i]);
+		memcpy(&p[1], &cl[1], 28);
+		memcpy(&p[8], &fd[i], sizeof(*fd));
+		eqcr_pi++;
+	}
+
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	eqcr_pi = s->eqcr.pi;
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		cl = qb_cl(&d[i]);
+		p[0] = cl[0] | s->eqcr.pi_vb;
+		eqcr_pi++;
+		if (!(eqcr_pi & half_mask))
+			s->eqcr.pi_vb ^= QB_VALID_BIT;
+	}
+
+	/* Flush all the cacheline without load/store in between */
+	eqcr_pi = s->eqcr.pi;
+	addr_cena = (size_t)s->sys.addr_cena;
+	for (i = 0; i < num_enqueued; i++) {
+		dcbf(addr_cena +
+			QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		eqcr_pi++;
+	}
+	s->eqcr.pi = eqcr_pi & full_mask;
+
+	return num_enqueued;
+}
+
 static int qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s,
 					const struct qbman_eq_desc *d,
 					const struct qbman_fd *fd,
diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h b/drivers/bus/fslmc/qbman/qbman_sys.h
index 71f7a6782..e59fcfd54 100644
--- a/drivers/bus/fslmc/qbman/qbman_sys.h
+++ b/drivers/bus/fslmc/qbman/qbman_sys.h
@@ -381,6 +381,14 @@ static inline uint32_t qbman_set_swp_cfg(uint8_t max_fill, uint8_t wn,
 #define QMAN_REV_5000	0x05000000
 #define QMAN_REV_MASK	0xffff0000
 
+#define SVR_LS1080A	0x87030000
+#define SVR_LS2080A	0x87010000
+#define SVR_LS2088A	0x87090000
+#define SVR_LX2160A	0x87360000
+
+/* Variable to store DPAA2 platform type */
+extern uint32_t dpaa2_svr_family;
+
 static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 				     const struct qbman_swp_desc *d,
 				     uint8_t dqrr_size)
@@ -388,16 +396,17 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 	uint32_t reg;
 	int i;
 	int cena_region_size = 4*1024;
-
-	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
-			&& (d->cena_access_mode == qman_cena_fastest_access))
-		cena_region_size = 64*1024;
+	uint8_t est = 1;
 #ifdef RTE_ARCH_64
 	uint8_t wn = CENA_WRITE_ENABLE;
 #else
 	uint8_t wn = CINH_WRITE_ENABLE;
 #endif
 
+
+	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
+			&& (d->cena_access_mode == qman_cena_fastest_access))
+		cena_region_size = 64*1024;
 	s->addr_cena = d->cena_bar;
 	s->addr_cinh = d->cinh_bar;
 	s->idx = (uint32_t)d->idx;
@@ -428,6 +437,9 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 			dccivac(s->addr_cena + i);
 	}
 
+	if (dpaa2_svr_family == SVR_LS1080A)
+		est = 0;
+
 	if (s->eqcr_mode == qman_eqcr_vb_array) {
 		reg = qbman_set_swp_cfg(dqrr_size, wn,
 					0, 3, 2, 3, 1, 1, 1, 1, 1, 1);
@@ -438,7 +450,7 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 						1, 3, 2, 0, 1, 1, 1, 1, 1, 1);
 		else
 			reg = qbman_set_swp_cfg(dqrr_size, wn,
-						1, 3, 2, 2, 1, 1, 1, 1, 1, 1);
+						est, 3, 2, 2, 1, 1, 1, 1, 1, 1);
 	}
 
 	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH 5/5] mempool/dpaa2: vfio dmamap for user allocated memory
  2019-06-25 10:44 [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Hemant Agrawal
                   ` (2 preceding siblings ...)
  2019-06-25 10:44 ` [dpdk-dev] [PATCH 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform Hemant Agrawal
@ 2019-06-25 10:44 ` Hemant Agrawal
  2019-06-26 21:50 ` [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Thomas Monjalon
  2019-06-27  9:33 ` [dpdk-dev] [PATCH v2 0/5] FSLMC bus enchancements Hemant Agrawal
  5 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-25 10:44 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Sachin Saxena <sachin.saxena@nxp.com>

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c              | 39 +++++++++++++++++++++
 drivers/bus/fslmc/fslmc_vfio.h              |  4 ++-
 drivers/bus/fslmc/rte_bus_fslmc_version.map |  6 ++++
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c    | 13 +++++++
 4 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 711780e74..e44bd31b9 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -358,6 +358,45 @@ fslmc_dmamap_seg(const struct rte_memseg_list *msl __rte_unused,
 	return ret;
 }
 
+__rte_experimental
+int rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size)
+{
+	int ret;
+	struct fslmc_vfio_group *group;
+	struct vfio_iommu_type1_dma_map dma_map = {
+		.argsz = sizeof(struct vfio_iommu_type1_dma_map),
+		.flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE,
+	};
+
+	if (fslmc_iommu_type == RTE_VFIO_NOIOMMU) {
+		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
+		return 0;
+	}
+
+	/* SET DMA MAP for IOMMU */
+	group = &vfio_group;
+	if (!group->container) {
+		DPAA2_BUS_ERR("Container is not connected");
+		return -1;
+	}
+
+	dma_map.size = size;
+	dma_map.vaddr = vaddr;
+	dma_map.iova = iova;
+
+	DPAA2_BUS_DEBUG("VFIO dmamap 0x%llx:0x%llx, size 0x%llx\n",
+			dma_map.vaddr, dma_map.iova, dma_map.size);
+	ret = ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA,
+		    &dma_map);
+	if (ret) {
+		printf("Unable to map DMA address (errno = %d)\n",
+			errno);
+		return ret;
+	}
+
+	return 0;
+}
+
 int rte_fslmc_vfio_dmamap(void)
 {
 	int i = 0, ret;
diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h
index 9e2c4feef..e877255ea 100644
--- a/drivers/bus/fslmc/fslmc_vfio.h
+++ b/drivers/bus/fslmc/fslmc_vfio.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016 NXP
+ *   Copyright 2016,2019 NXP
  *
  */
 
@@ -50,5 +50,7 @@ int fslmc_vfio_process_group(void);
 char *fslmc_get_container(void);
 int fslmc_get_container_group(int *gropuid);
 int rte_fslmc_vfio_dmamap(void);
+__rte_experimental
+int rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size);
 
 #endif /* _FSLMC_VFIO_H_ */
diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map
index e86007384..4da787236 100644
--- a/drivers/bus/fslmc/rte_bus_fslmc_version.map
+++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map
@@ -141,3 +141,9 @@ DPDK_19.05 {
 	qbman_result_eqresp_set_rspid;
 	qbman_swp_enqueue_multiple_fd;
 } DPDK_18.11;
+
+EXPERIMENTAL {
+	global:
+
+	rte_fslmc_vfio_mem_dmamap;
+};
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index da66577cc..f26c30b00 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -23,6 +23,7 @@
 #include <rte_dev.h>
 #include "rte_dpaa2_mempool.h"
 
+#include "fslmc_vfio.h"
 #include <fslmc_logs.h>
 #include <mc/fsl_dpbp.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -405,6 +406,18 @@ dpaa2_populate(struct rte_mempool *mp, unsigned int max_objs,
 	      void *vaddr, rte_iova_t paddr, size_t len,
 	      rte_mempool_populate_obj_cb_t *obj_cb, void *obj_cb_arg)
 {
+	struct rte_memseg_list *msl;
+	/* The memsegment list exists incase the memory is not external.
+	 * So, DMA-Map is required only when memory is provided by user,
+	 * i.e. External.
+	 */
+	msl = rte_mem_virt2memseg_list(vaddr);
+
+	if (!msl) {
+		DPAA2_MEMPOOL_DEBUG("Memsegment is External.\n");
+		rte_fslmc_vfio_mem_dmamap((size_t)vaddr,
+				(size_t)paddr, (size_t)len);
+	}
 	/* Insert entry into the PA->VA Table */
 	dpaax_iova_table_update(paddr, vaddr, len);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration
  2019-06-25 10:44 [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Hemant Agrawal
                   ` (3 preceding siblings ...)
  2019-06-25 10:44 ` [dpdk-dev] [PATCH 5/5] mempool/dpaa2: vfio dmamap for user allocated memory Hemant Agrawal
@ 2019-06-26 21:50 ` Thomas Monjalon
  2019-06-27  9:20   ` Hemant Agrawal
  2019-06-27  9:33 ` [dpdk-dev] [PATCH v2 0/5] FSLMC bus enchancements Hemant Agrawal
  5 siblings, 1 reply; 26+ messages in thread
From: Thomas Monjalon @ 2019-06-26 21:50 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev, ferruh.yigit

Hi Hemant,

Your series may deserve a cover letter to explain the general idea.

I'm embarassed also because these patches are sent late in 19.08 cycle.




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration
  2019-06-26 21:50 ` [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Thomas Monjalon
@ 2019-06-27  9:20   ` Hemant Agrawal
  0 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-27  9:20 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, ferruh.yigit

Hi Thomas,

     Apologies for late in the cycle. We will take care of it next time.

I will be re-sending series with cover letter.


Regards,

Hemant

On 27-Jun-19 3:20 AM, Thomas Monjalon wrote:
> Hi Hemant,
>
> Your series may deserve a cover letter to explain the general idea.
>
> I'm embarassed also because these patches are sent late in 19.08 cycle.
>
>
>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v2 0/5] FSLMC bus enchancements
  2019-06-25 10:44 [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Hemant Agrawal
                   ` (4 preceding siblings ...)
  2019-06-26 21:50 ` [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Thomas Monjalon
@ 2019-06-27  9:33 ` Hemant Agrawal
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 1/5] bus/fslmc: support device iteration Hemant Agrawal
                     ` (4 more replies)
  5 siblings, 5 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-27  9:33 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

This patch series makes few enhancements w.r.t functionality
and usabilty of FSLMC bus.

1. Applications like OVS has mandated the use of hotplug of
dpdk ports. The fslmc bus shall support hotplug now to
support dpaa2 ports with OVS.

2. DPAA2 usages it hw based mempool. So, if applications like VPP
are using external memory to configure buffer pool, it shall
be provisition in FSLMC bus VFIO as well. 

3. Performance improvement for LS1088 to avoid few corruption issues
with cache enabled mode for Tx FQ EQCR.


Nipun Gupta (1):
  bus/fslmc: use cinh read for eqcr ci on ls1088 platform

Sachin Saxena (1):
  mempool/dpaa2: vfio dmamap for user allocated memory

Shreyansh Jain (3):
  bus/fslmc: support device iteration
  bus/fslmc: enhance error handling for dev parsing
  bus/fslmc: dynamic iommu mode detection

 drivers/bus/fslmc/fslmc_bus.c                 | 156 ++++++++--
 drivers/bus/fslmc/fslmc_vfio.c                |  77 ++++-
 drivers/bus/fslmc/fslmc_vfio.h                |   4 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h      |   2 -
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h       |   5 -
 .../fslmc/qbman/include/fsl_qbman_portal.h    |   9 +
 drivers/bus/fslmc/qbman/qbman_portal.c        | 278 +++++++++++++++++-
 drivers/bus/fslmc/qbman/qbman_sys.h           |  22 +-
 drivers/bus/fslmc/rte_bus_fslmc_version.map   |   6 +
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  13 +
 10 files changed, 520 insertions(+), 52 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v2 1/5] bus/fslmc: support device iteration
  2019-06-27  9:33 ` [dpdk-dev] [PATCH v2 0/5] FSLMC bus enchancements Hemant Agrawal
@ 2019-06-27  9:33   ` Hemant Agrawal
  2019-07-15  8:44     ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Hemant Agrawal
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 2/5] bus/fslmc: enhance error handling for dev parsing Hemant Agrawal
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-27  9:33 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Shreyansh Jain <shreyansh.jain@nxp.com>

Recent (18.11+), devargs structure was changed and so was DPDK port
usage in applications like OVS. Applications are now allowed to
plug/unplug ports (eth) using APIs (hotplug) based on device
arguments.

This patch enables the plug/unplug function (which are dummy for
FSLMC) and the iterator function for rte_dev_probe() and similar
API support.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 132 +++++++++++++++++++++++++++++-----
 1 file changed, 116 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index f6e66d22c..35103d224 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -230,34 +230,70 @@ rte_fslmc_parse(const char *name, void *addr)
 {
 	uint16_t dev_id;
 	char *t_ptr;
+	char *sep = NULL;
+	uint8_t sep_exists = 0;
 
-	/* 'name' is expected to contain name of device, for example, dpio.1,
-	 * dpni.2, etc.
+	DPAA2_BUS_DEBUG("Parsing dev=(%s)", name);
+
+	/* There are multiple ways this can be called, with bus:dev, name=dev
+	 * or just dev. In all cases, the 'addr' is actually a string.
+	 */
+	sep = strchr(name, ':');
+	if (!sep) {
+		/* check for '=' */
+		sep = strchr(name, '=');
+		if (!sep)
+			sep_exists = 0;
+		else
+			sep_exists = 1;
+	} else
+		sep_exists = 1;
+
+	/* Check if starting part if either of 'fslmc:' or 'name=', separator
+	 * exists.
 	 */
-	if (strncmp("dpni", name, 4) &&
-	    strncmp("dpseci", name, 6) &&
-	    strncmp("dpcon", name, 5) &&
-	    strncmp("dpbp", name, 4) &&
-	    strncmp("dpio", name, 4) &&
-	    strncmp("dpci", name, 4) &&
-	    strncmp("dpmcp", name, 5) &&
-	    strncmp("dpdmai", name, 6) &&
-	    strncmp("dpdmux", name, 6)) {
-		DPAA2_BUS_DEBUG("Unknown or unsupported device (%s)", name);
+	if (sep_exists) {
+		/* If either of "fslmc" or "name" are starting part */
+		if (!strncmp(name, RTE_STR(FSLMC_BUS_NAME),
+			     strlen(RTE_STR(FSLMC_BUS_NAME))) ||
+		   (!strncmp(name, "name", strlen("name")))) {
+			goto jump_out;
+		} else {
+			DPAA2_BUS_DEBUG("Invalid device for matching (%s).",
+					name);
+			goto err_out;
+		}
+	} else
+		sep = strdup(name);
+
+jump_out:
+	/* Validate device name */
+	if (strncmp("dpni", sep, 4) &&
+	    strncmp("dpseci", sep, 6) &&
+	    strncmp("dpcon", sep, 5) &&
+	    strncmp("dpbp", sep, 4) &&
+	    strncmp("dpio", sep, 4) &&
+	    strncmp("dpci", sep, 4) &&
+	    strncmp("dpmcp", sep, 5) &&
+	    strncmp("dpdmai", sep, 6) &&
+	    strncmp("dpdmux", sep, 6)) {
+		DPAA2_BUS_DEBUG("Unknown or unsupported device (%s)", sep);
 		goto err_out;
 	}
 
-	t_ptr = strchr(name, '.');
+	t_ptr = strchr(sep, '.');
 	if (!t_ptr || sscanf(t_ptr + 1, "%hu", &dev_id) != 1) {
-		DPAA2_BUS_ERR("Missing device id in device name (%s)", name);
+		DPAA2_BUS_ERR("Missing device id in device name (%s)", sep);
 		goto err_out;
 	}
 
 	if (addr)
-		strcpy(addr, name);
+		strcpy(addr, sep);
 
 	return 0;
 err_out:
+	if (sep)
+		free(sep);
 	return -EINVAL;
 }
 
@@ -430,6 +466,13 @@ rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
 	const struct rte_dpaa2_device *dstart;
 	struct rte_dpaa2_device *dev;
 
+	DPAA2_BUS_DEBUG("Finding a device named %s\n", (const char *)data);
+
+	/* find_device is always called with an opaque object which should be
+	 * passed along to the 'cmp' function iterating over all device obj
+	 * on the bus.
+	 */
+
 	if (start != NULL) {
 		dstart = RTE_DEV_TO_FSLMC_CONST(start);
 		dev = TAILQ_NEXT(dstart, next);
@@ -437,8 +480,11 @@ rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
 		dev = TAILQ_FIRST(&rte_fslmc_bus.device_list);
 	}
 	while (dev != NULL) {
-		if (cmp(&dev->device, data) == 0)
+		if (cmp(&dev->device, data) == 0) {
+			DPAA2_BUS_DEBUG("Found device (%s)\n",
+					dev->device.name);
 			return &dev->device;
+		}
 		dev = TAILQ_NEXT(dev, next);
 	}
 
@@ -527,6 +573,57 @@ rte_dpaa2_get_iommu_class(void)
 	return RTE_IOVA_PA;
 }
 
+static int
+fslmc_bus_plug(struct rte_device *dev __rte_unused)
+{
+	/* No operation is performed while plugging the device */
+	return 0;
+}
+
+static int
+fslmc_bus_unplug(struct rte_device *dev __rte_unused)
+{
+	/* No operation is performed while unplugging the device */
+	return 0;
+}
+
+static void *
+fslmc_bus_dev_iterate(const void *start, const char *str,
+		      const struct rte_dev_iterator *it __rte_unused)
+{
+	const struct rte_dpaa2_device *dstart;
+	struct rte_dpaa2_device *dev;
+	char *dup, *dev_name = NULL;
+
+	/* Expectation is that device would be name=device_name */
+	if (strncmp(str, "name=", 5) != 0) {
+		DPAA2_BUS_ERR("Invalid device string (%s)\n", str);
+		return NULL;
+	}
+
+	/* Now that name=device_name format is available, split */
+	dup = strdup(str);
+	dev_name = dup + strlen("name=");
+
+	if (start != NULL) {
+		dstart = RTE_DEV_TO_FSLMC_CONST(start);
+		dev = TAILQ_NEXT(dstart, next);
+	} else {
+		dev = TAILQ_FIRST(&rte_fslmc_bus.device_list);
+	}
+
+	while (dev != NULL) {
+		if (strcmp(dev->device.name, dev_name) == 0) {
+			free(dup);
+			return &dev->device;
+		}
+		dev = TAILQ_NEXT(dev, next);
+	}
+
+	free(dup);
+	return NULL;
+}
+
 struct rte_fslmc_bus rte_fslmc_bus = {
 	.bus = {
 		.scan = rte_fslmc_scan,
@@ -534,6 +631,9 @@ struct rte_fslmc_bus rte_fslmc_bus = {
 		.parse = rte_fslmc_parse,
 		.find_device = rte_fslmc_find_device,
 		.get_iommu_class = rte_dpaa2_get_iommu_class,
+		.plug = fslmc_bus_plug,
+		.unplug = fslmc_bus_unplug,
+		.dev_iterate = fslmc_bus_dev_iterate,
 	},
 	.device_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.device_list),
 	.driver_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.driver_list),
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v2 2/5] bus/fslmc: enhance error handling for dev parsing
  2019-06-27  9:33 ` [dpdk-dev] [PATCH v2 0/5] FSLMC bus enchancements Hemant Agrawal
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 1/5] bus/fslmc: support device iteration Hemant Agrawal
@ 2019-06-27  9:33   ` Hemant Agrawal
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 3/5] bus/fslmc: dynamic iommu mode detection Hemant Agrawal
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-27  9:33 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Shreyansh Jain <shreyansh.jain@nxp.com>

In case an incorrect device is found, it was quiting further search
rather than skipping it.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 35103d224..a2ed3bcc9 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -33,7 +33,7 @@ uint8_t dpaa2_virt_mode;
 uint32_t
 rte_fslmc_get_device_count(enum rte_dpaa2_dev_type device_type)
 {
-	if (device_type > DPAA2_DEVTYPE_MAX)
+	if (device_type >= DPAA2_DEVTYPE_MAX)
 		return 0;
 	return rte_fslmc_bus.device_count[device_type];
 }
@@ -135,10 +135,11 @@ static int
 scan_one_fslmc_device(char *dev_name)
 {
 	char *dup_dev_name, *t_ptr;
-	struct rte_dpaa2_device *dev;
+	struct rte_dpaa2_device *dev = NULL;
+	int ret = -1;
 
 	if (!dev_name)
-		return -1;
+		return ret;
 
 	/* Ignore the Container name itself */
 	if (!strncmp("dprc", dev_name, 4))
@@ -168,7 +169,8 @@ scan_one_fslmc_device(char *dev_name)
 	/* Parse the device name and ID */
 	t_ptr = strtok(dup_dev_name, ".");
 	if (!t_ptr) {
-		DPAA2_BUS_ERR("Incorrect device name observed");
+		DPAA2_BUS_ERR("Invalid device found: (%s)", dup_dev_name);
+		ret = -EINVAL;
 		goto cleanup;
 	}
 	if (!strncmp("dpni", t_ptr, 4))
@@ -192,12 +194,10 @@ scan_one_fslmc_device(char *dev_name)
 	else
 		dev->dev_type = DPAA2_UNKNOWN;
 
-	/* Update the device found into the device_count table */
-	rte_fslmc_bus.device_count[dev->dev_type]++;
-
 	t_ptr = strtok(NULL, ".");
 	if (!t_ptr) {
-		DPAA2_BUS_ERR("Incorrect device string observed (null)");
+		DPAA2_BUS_ERR("Skipping invalid device (%s)", dup_dev_name);
+		ret = 0;
 		goto cleanup;
 	}
 
@@ -205,10 +205,14 @@ scan_one_fslmc_device(char *dev_name)
 	dev->device.name = strdup(dev_name);
 	if (!dev->device.name) {
 		DPAA2_BUS_ERR("Unable to clone device name. Out of memory");
+		ret = -ENOMEM;
 		goto cleanup;
 	}
 	dev->device.devargs = fslmc_devargs_lookup(dev);
 
+	/* Update the device found into the device_count table */
+	rte_fslmc_bus.device_count[dev->dev_type]++;
+
 	/* Add device in the fslmc device list */
 	insert_in_device_list(dev);
 
@@ -222,7 +226,7 @@ scan_one_fslmc_device(char *dev_name)
 		free(dup_dev_name);
 	if (dev)
 		free(dev);
-	return -1;
+	return ret;
 }
 
 static int
@@ -353,7 +357,7 @@ rte_fslmc_scan(void)
 	/* Remove all devices in the list */
 	cleanup_fslmc_device_list();
 scan_fail:
-	DPAA2_BUS_DEBUG("FSLMC Bus Not Available. Skipping");
+	DPAA2_BUS_DEBUG("FSLMC Bus Not Available. Skipping (%d)", ret);
 	/* Irrespective of failure, scan only return success */
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v2 3/5] bus/fslmc: dynamic iommu mode detection
  2019-06-27  9:33 ` [dpdk-dev] [PATCH v2 0/5] FSLMC bus enchancements Hemant Agrawal
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 1/5] bus/fslmc: support device iteration Hemant Agrawal
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 2/5] bus/fslmc: enhance error handling for dev parsing Hemant Agrawal
@ 2019-06-27  9:33   ` Hemant Agrawal
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform Hemant Agrawal
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 5/5] mempool/dpaa2: vfio dmamap for user allocated memory Hemant Agrawal
  4 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-27  9:33 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Shreyansh Jain <shreyansh.jain@nxp.com>

This patch adds following:
1. 'g_container' variable name is not right way to represent the
FSLMC container. Renaming it to fslmc_container.
2. dynamic selection of IOMMU mode based on run environment

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 38 +++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 1aae56fa9..711780e74 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2018 NXP
+ *   Copyright 2016-2019 NXP
  *
  */
 
@@ -49,7 +49,8 @@
 static struct fslmc_vfio_group vfio_group;
 static struct fslmc_vfio_container vfio_container;
 static int container_device_fd;
-static char *g_container;
+static char *fslmc_container;
+static int fslmc_iommu_type;
 static uint32_t *msi_intr_vaddr;
 void *(*rte_mcp_ptr_list);
 
@@ -71,7 +72,7 @@ fslmc_get_container_group(int *groupid)
 	int ret;
 	char *container;
 
-	if (!g_container) {
+	if (!fslmc_container) {
 		container = getenv("DPRC");
 		if (container == NULL) {
 			DPAA2_BUS_DEBUG("DPAA2: DPRC not available");
@@ -83,23 +84,26 @@ fslmc_get_container_group(int *groupid)
 			return -1;
 		}
 
-		g_container = strdup(container);
-		if (!g_container) {
+		fslmc_container = strdup(container);
+		if (!fslmc_container) {
 			DPAA2_BUS_ERR("Mem alloc failure; Container name");
 			return -ENOMEM;
 		}
 	}
 
+	fslmc_iommu_type = (rte_vfio_noiommu_is_enabled() == 1) ?
+		RTE_VFIO_NOIOMMU : VFIO_TYPE1_IOMMU;
+
 	/* get group number */
 	ret = rte_vfio_get_group_num(SYSFS_FSL_MC_DEVICES,
-				     g_container, groupid);
+				     fslmc_container, groupid);
 	if (ret <= 0) {
-		DPAA2_BUS_ERR("Unable to find %s IOMMU group", g_container);
+		DPAA2_BUS_ERR("Unable to find %s IOMMU group", fslmc_container);
 		return -1;
 	}
 
 	DPAA2_BUS_DEBUG("Container: %s has VFIO iommu group id = %d",
-			g_container, *groupid);
+			fslmc_container, *groupid);
 
 	return 0;
 }
@@ -132,7 +136,7 @@ vfio_connect_container(void)
 	}
 
 	/* Check whether support for SMMU type IOMMU present or not */
-	if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU)) {
+	if (ioctl(fd, VFIO_CHECK_EXTENSION, fslmc_iommu_type)) {
 		/* Connect group to container */
 		ret = ioctl(vfio_group.fd, VFIO_GROUP_SET_CONTAINER, &fd);
 		if (ret) {
@@ -141,7 +145,7 @@ vfio_connect_container(void)
 			return -errno;
 		}
 
-		ret = ioctl(fd, VFIO_SET_IOMMU, VFIO_TYPE1_IOMMU);
+		ret = ioctl(fd, VFIO_SET_IOMMU, fslmc_iommu_type);
 		if (ret) {
 			DPAA2_BUS_ERR("Failed to setup VFIO iommu");
 			close(fd);
@@ -261,6 +265,11 @@ fslmc_map_dma(uint64_t vaddr, rte_iova_t iovaddr __rte_unused, size_t len)
 	};
 	int ret;
 
+	if (fslmc_iommu_type == RTE_VFIO_NOIOMMU) {
+		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
+		return 0;
+	}
+
 	dma_map.size = len;
 	dma_map.vaddr = vaddr;
 
@@ -300,6 +309,11 @@ fslmc_unmap_dma(uint64_t vaddr, uint64_t iovaddr __rte_unused, size_t len)
 	};
 	int ret;
 
+	if (fslmc_iommu_type == RTE_VFIO_NOIOMMU) {
+		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
+		return 0;
+	}
+
 	dma_unmap.size = len;
 	dma_unmap.iova = vaddr;
 
@@ -821,10 +835,10 @@ fslmc_vfio_setup_group(void)
 	}
 
 	/* Get Device information */
-	ret = ioctl(vfio_group.fd, VFIO_GROUP_GET_DEVICE_FD, g_container);
+	ret = ioctl(vfio_group.fd, VFIO_GROUP_GET_DEVICE_FD, fslmc_container);
 	if (ret < 0) {
 		DPAA2_BUS_ERR("Error getting device %s fd from group %d",
-			      g_container, vfio_group.groupid);
+			      fslmc_container, vfio_group.groupid);
 		close(vfio_group.fd);
 		rte_vfio_clear_group(vfio_group.fd);
 		return ret;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v2 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform
  2019-06-27  9:33 ` [dpdk-dev] [PATCH v2 0/5] FSLMC bus enchancements Hemant Agrawal
                     ` (2 preceding siblings ...)
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 3/5] bus/fslmc: dynamic iommu mode detection Hemant Agrawal
@ 2019-06-27  9:33   ` Hemant Agrawal
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 5/5] mempool/dpaa2: vfio dmamap for user allocated memory Hemant Agrawal
  4 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-27  9:33 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Nipun Gupta <nipun.gupta@nxp.com>

LS1088 platform CENA operation are causing issues
at high load. CINH (cache inhibited) mode is working
fine with minor performance impact.

This patch enables CINH mode selectively on LS1088 platform

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h      |   2 -
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h       |   5 -
 .../fslmc/qbman/include/fsl_qbman_portal.h    |   9 +
 drivers/bus/fslmc/qbman/qbman_portal.c        | 278 +++++++++++++++++-
 drivers/bus/fslmc/qbman/qbman_sys.h           |  22 +-
 5 files changed, 303 insertions(+), 13 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
index 17e7e4fad..c68495eaf 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
@@ -28,8 +28,6 @@ RTE_DECLARE_PER_LCORE(struct dpaa2_io_portal_t, _dpaa2_io);
 #define DPAA2_PER_LCORE_ETHRX_DPIO RTE_PER_LCORE(_dpaa2_io).ethrx_dpio_dev
 #define DPAA2_PER_LCORE_ETHRX_PORTAL DPAA2_PER_LCORE_ETHRX_DPIO->sw_portal
 
-/* Variable to store DPAA2 platform type */
-extern uint32_t dpaa2_svr_family;
 /* Variable to store DPAA2 DQRR size */
 extern uint8_t dpaa2_dqrr_size;
 /* Variable to store DPAA2 EQCR size */
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 0cbde8a9b..92fc76211 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -23,11 +23,6 @@
 #define lower_32_bits(x) ((uint32_t)(x))
 #define upper_32_bits(x) ((uint32_t)(((x) >> 16) >> 16))
 
-#define SVR_LS1080A             0x87030000
-#define SVR_LS2080A             0x87010000
-#define SVR_LS2088A             0x87090000
-#define SVR_LX2160A             0x87360000
-
 #ifndef VLAN_TAG_SIZE
 #define VLAN_TAG_SIZE   4 /** < Vlan Header Length */
 #endif
diff --git a/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h b/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
index 07b8a4372..107850d37 100644
--- a/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
+++ b/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ * Copyright 2015-2019 NXP
  *
  */
 #ifndef _FSL_QBMAN_PORTAL_H
@@ -8,6 +9,14 @@
 
 #include <fsl_qbman_base.h>
 
+#define SVR_LS1080A	0x87030000
+#define SVR_LS2080A	0x87010000
+#define SVR_LS2088A	0x87090000
+#define SVR_LX2160A	0x87360000
+
+/* Variable to store DPAA2 platform type */
+extern uint32_t dpaa2_svr_family;
+
 /**
  * DOC - QBMan portal APIs to implement the following functions:
  * - Initialize and destroy Software portal object.
diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 20da8b921..e6066ce35 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -76,6 +76,10 @@ qbman_swp_enqueue_ring_mode_direct(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd);
 static int
+qbman_swp_enqueue_ring_mode_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd);
+static int
 qbman_swp_enqueue_ring_mode_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd);
@@ -87,6 +91,12 @@ qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
 		uint32_t *flags,
 		int num_frames);
 static int
+qbman_swp_enqueue_multiple_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		uint32_t *flags,
+		int num_frames);
+static int
 qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd,
@@ -99,7 +109,12 @@ qbman_swp_enqueue_multiple_fd_direct(struct qbman_swp *s,
 		struct qbman_fd **fd,
 		uint32_t *flags,
 		int num_frames);
-
+static int
+qbman_swp_enqueue_multiple_fd_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		struct qbman_fd **fd,
+		uint32_t *flags,
+		int num_frames);
 static int
 qbman_swp_enqueue_multiple_fd_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
@@ -113,6 +128,11 @@ qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s,
 		const struct qbman_fd *fd,
 		int num_frames);
 static int
+qbman_swp_enqueue_multiple_desc_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		int num_frames);
+static int
 qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd,
@@ -273,6 +293,17 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d)
 		qbman_swp_release_ptr = qbman_swp_release_mem_back;
 	}
 
+	if (dpaa2_svr_family == SVR_LS1080A) {
+		qbman_swp_enqueue_ring_mode_ptr =
+				qbman_swp_enqueue_ring_mode_cinh_direct;
+		qbman_swp_enqueue_multiple_ptr =
+				qbman_swp_enqueue_multiple_cinh_direct;
+		qbman_swp_enqueue_multiple_fd_ptr =
+				qbman_swp_enqueue_multiple_fd_cinh_direct;
+		qbman_swp_enqueue_multiple_desc_ptr =
+				qbman_swp_enqueue_multiple_desc_cinh_direct;
+	}
+
 	for (mask_size = p->eqcr.pi_ring_size; mask_size > 0; mask_size >>= 1)
 		p->eqcr.pi_ci_mask = (p->eqcr.pi_ci_mask<<1) + 1;
 	eqcr_pi = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI);
@@ -700,6 +731,46 @@ static int qbman_swp_enqueue_ring_mode_direct(struct qbman_swp *s,
 	return 0;
 }
 
+static int qbman_swp_enqueue_ring_mode_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd)
+{
+	uint32_t *p;
+	const uint32_t *cl = qb_cl(d);
+	uint32_t eqcr_ci, full_mask, half_mask;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+				eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return -EBUSY;
+	}
+
+	p = qbman_cena_write_start_wo_shadow(&s->sys,
+			QBMAN_CENA_SWP_EQCR(s->eqcr.pi & half_mask));
+	memcpy(&p[1], &cl[1], 28);
+	memcpy(&p[8], fd, sizeof(*fd));
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	p[0] = cl[0] | s->eqcr.pi_vb;
+	qbman_cena_write_complete_wo_shadow(&s->sys,
+			QBMAN_CENA_SWP_EQCR(s->eqcr.pi & half_mask));
+	s->eqcr.pi++;
+	s->eqcr.pi &= full_mask;
+	s->eqcr.available--;
+	if (!(s->eqcr.pi & half_mask))
+		s->eqcr.pi_vb ^= QB_VALID_BIT;
+
+	return 0;
+}
+
 static int qbman_swp_enqueue_ring_mode_mem_back(struct qbman_swp *s,
 						const struct qbman_eq_desc *d,
 						const struct qbman_fd *fd)
@@ -823,6 +894,76 @@ static int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
 	return num_enqueued;
 }
 
+static int qbman_swp_enqueue_multiple_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		uint32_t *flags,
+		int num_frames)
+{
+	uint32_t *p = NULL;
+	const uint32_t *cl = qb_cl(d);
+	uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
+	int i, num_enqueued = 0;
+	uint64_t addr_cena;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+				eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return 0;
+	}
+
+	eqcr_pi = s->eqcr.pi;
+	num_enqueued = (s->eqcr.available < num_frames) ?
+			s->eqcr.available : num_frames;
+	s->eqcr.available -= num_enqueued;
+	/* Fill in the EQCR ring */
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		memcpy(&p[1], &cl[1], 28);
+		memcpy(&p[8], &fd[i], sizeof(*fd));
+		eqcr_pi++;
+	}
+
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	eqcr_pi = s->eqcr.pi;
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		p[0] = cl[0] | s->eqcr.pi_vb;
+		if (flags && (flags[i] & QBMAN_ENQUEUE_FLAG_DCA)) {
+			struct qbman_eq_desc *d = (struct qbman_eq_desc *)p;
+
+			d->eq.dca = (1 << QB_ENQUEUE_CMD_DCA_EN_SHIFT) |
+				((flags[i]) & QBMAN_EQCR_DCA_IDXMASK);
+		}
+		eqcr_pi++;
+		if (!(eqcr_pi & half_mask))
+			s->eqcr.pi_vb ^= QB_VALID_BIT;
+	}
+
+	/* Flush all the cacheline without load/store in between */
+	eqcr_pi = s->eqcr.pi;
+	addr_cena = (size_t)s->sys.addr_cena;
+	for (i = 0; i < num_enqueued; i++) {
+		dcbf(addr_cena +
+			QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		eqcr_pi++;
+	}
+	s->eqcr.pi = eqcr_pi & full_mask;
+
+	return num_enqueued;
+}
+
 static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 					       const struct qbman_eq_desc *d,
 					       const struct qbman_fd *fd,
@@ -954,6 +1095,76 @@ static int qbman_swp_enqueue_multiple_fd_direct(struct qbman_swp *s,
 	return num_enqueued;
 }
 
+static int qbman_swp_enqueue_multiple_fd_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		struct qbman_fd **fd,
+		uint32_t *flags,
+		int num_frames)
+{
+	uint32_t *p = NULL;
+	const uint32_t *cl = qb_cl(d);
+	uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
+	int i, num_enqueued = 0;
+	uint64_t addr_cena;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+				eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return 0;
+	}
+
+	eqcr_pi = s->eqcr.pi;
+	num_enqueued = (s->eqcr.available < num_frames) ?
+			s->eqcr.available : num_frames;
+	s->eqcr.available -= num_enqueued;
+	/* Fill in the EQCR ring */
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		memcpy(&p[1], &cl[1], 28);
+		memcpy(&p[8], fd[i], sizeof(struct qbman_fd));
+		eqcr_pi++;
+	}
+
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	eqcr_pi = s->eqcr.pi;
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		p[0] = cl[0] | s->eqcr.pi_vb;
+		if (flags && (flags[i] & QBMAN_ENQUEUE_FLAG_DCA)) {
+			struct qbman_eq_desc *d = (struct qbman_eq_desc *)p;
+
+			d->eq.dca = (1 << QB_ENQUEUE_CMD_DCA_EN_SHIFT) |
+				((flags[i]) & QBMAN_EQCR_DCA_IDXMASK);
+		}
+		eqcr_pi++;
+		if (!(eqcr_pi & half_mask))
+			s->eqcr.pi_vb ^= QB_VALID_BIT;
+	}
+
+	/* Flush all the cacheline without load/store in between */
+	eqcr_pi = s->eqcr.pi;
+	addr_cena = (size_t)s->sys.addr_cena;
+	for (i = 0; i < num_enqueued; i++) {
+		dcbf(addr_cena +
+			QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		eqcr_pi++;
+	}
+	s->eqcr.pi = eqcr_pi & full_mask;
+
+	return num_enqueued;
+}
+
 static int qbman_swp_enqueue_multiple_fd_mem_back(struct qbman_swp *s,
 						  const struct qbman_eq_desc *d,
 						  struct qbman_fd **fd,
@@ -1087,6 +1298,71 @@ static int qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s,
 	return num_enqueued;
 }
 
+static int qbman_swp_enqueue_multiple_desc_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		int num_frames)
+{
+	uint32_t *p;
+	const uint32_t *cl;
+	uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
+	int i, num_enqueued = 0;
+	uint64_t addr_cena;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+					eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return 0;
+	}
+
+	eqcr_pi = s->eqcr.pi;
+	num_enqueued = (s->eqcr.available < num_frames) ?
+			s->eqcr.available : num_frames;
+	s->eqcr.available -= num_enqueued;
+	/* Fill in the EQCR ring */
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		cl = qb_cl(&d[i]);
+		memcpy(&p[1], &cl[1], 28);
+		memcpy(&p[8], &fd[i], sizeof(*fd));
+		eqcr_pi++;
+	}
+
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	eqcr_pi = s->eqcr.pi;
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		cl = qb_cl(&d[i]);
+		p[0] = cl[0] | s->eqcr.pi_vb;
+		eqcr_pi++;
+		if (!(eqcr_pi & half_mask))
+			s->eqcr.pi_vb ^= QB_VALID_BIT;
+	}
+
+	/* Flush all the cacheline without load/store in between */
+	eqcr_pi = s->eqcr.pi;
+	addr_cena = (size_t)s->sys.addr_cena;
+	for (i = 0; i < num_enqueued; i++) {
+		dcbf(addr_cena +
+			QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		eqcr_pi++;
+	}
+	s->eqcr.pi = eqcr_pi & full_mask;
+
+	return num_enqueued;
+}
+
 static int qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s,
 					const struct qbman_eq_desc *d,
 					const struct qbman_fd *fd,
diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h b/drivers/bus/fslmc/qbman/qbman_sys.h
index 71f7a6782..e59fcfd54 100644
--- a/drivers/bus/fslmc/qbman/qbman_sys.h
+++ b/drivers/bus/fslmc/qbman/qbman_sys.h
@@ -381,6 +381,14 @@ static inline uint32_t qbman_set_swp_cfg(uint8_t max_fill, uint8_t wn,
 #define QMAN_REV_5000	0x05000000
 #define QMAN_REV_MASK	0xffff0000
 
+#define SVR_LS1080A	0x87030000
+#define SVR_LS2080A	0x87010000
+#define SVR_LS2088A	0x87090000
+#define SVR_LX2160A	0x87360000
+
+/* Variable to store DPAA2 platform type */
+extern uint32_t dpaa2_svr_family;
+
 static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 				     const struct qbman_swp_desc *d,
 				     uint8_t dqrr_size)
@@ -388,16 +396,17 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 	uint32_t reg;
 	int i;
 	int cena_region_size = 4*1024;
-
-	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
-			&& (d->cena_access_mode == qman_cena_fastest_access))
-		cena_region_size = 64*1024;
+	uint8_t est = 1;
 #ifdef RTE_ARCH_64
 	uint8_t wn = CENA_WRITE_ENABLE;
 #else
 	uint8_t wn = CINH_WRITE_ENABLE;
 #endif
 
+
+	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
+			&& (d->cena_access_mode == qman_cena_fastest_access))
+		cena_region_size = 64*1024;
 	s->addr_cena = d->cena_bar;
 	s->addr_cinh = d->cinh_bar;
 	s->idx = (uint32_t)d->idx;
@@ -428,6 +437,9 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 			dccivac(s->addr_cena + i);
 	}
 
+	if (dpaa2_svr_family == SVR_LS1080A)
+		est = 0;
+
 	if (s->eqcr_mode == qman_eqcr_vb_array) {
 		reg = qbman_set_swp_cfg(dqrr_size, wn,
 					0, 3, 2, 3, 1, 1, 1, 1, 1, 1);
@@ -438,7 +450,7 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 						1, 3, 2, 0, 1, 1, 1, 1, 1, 1);
 		else
 			reg = qbman_set_swp_cfg(dqrr_size, wn,
-						1, 3, 2, 2, 1, 1, 1, 1, 1, 1);
+						est, 3, 2, 2, 1, 1, 1, 1, 1, 1);
 	}
 
 	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v2 5/5] mempool/dpaa2: vfio dmamap for user allocated memory
  2019-06-27  9:33 ` [dpdk-dev] [PATCH v2 0/5] FSLMC bus enchancements Hemant Agrawal
                     ` (3 preceding siblings ...)
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform Hemant Agrawal
@ 2019-06-27  9:33   ` Hemant Agrawal
  2019-07-07 19:55     ` Thomas Monjalon
  4 siblings, 1 reply; 26+ messages in thread
From: Hemant Agrawal @ 2019-06-27  9:33 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Sachin Saxena <sachin.saxena@nxp.com>

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c              | 39 +++++++++++++++++++++
 drivers/bus/fslmc/fslmc_vfio.h              |  4 ++-
 drivers/bus/fslmc/rte_bus_fslmc_version.map |  6 ++++
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c    | 13 +++++++
 4 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 711780e74..e44bd31b9 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -358,6 +358,45 @@ fslmc_dmamap_seg(const struct rte_memseg_list *msl __rte_unused,
 	return ret;
 }
 
+__rte_experimental
+int rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size)
+{
+	int ret;
+	struct fslmc_vfio_group *group;
+	struct vfio_iommu_type1_dma_map dma_map = {
+		.argsz = sizeof(struct vfio_iommu_type1_dma_map),
+		.flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE,
+	};
+
+	if (fslmc_iommu_type == RTE_VFIO_NOIOMMU) {
+		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
+		return 0;
+	}
+
+	/* SET DMA MAP for IOMMU */
+	group = &vfio_group;
+	if (!group->container) {
+		DPAA2_BUS_ERR("Container is not connected");
+		return -1;
+	}
+
+	dma_map.size = size;
+	dma_map.vaddr = vaddr;
+	dma_map.iova = iova;
+
+	DPAA2_BUS_DEBUG("VFIO dmamap 0x%llx:0x%llx, size 0x%llx\n",
+			dma_map.vaddr, dma_map.iova, dma_map.size);
+	ret = ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA,
+		    &dma_map);
+	if (ret) {
+		printf("Unable to map DMA address (errno = %d)\n",
+			errno);
+		return ret;
+	}
+
+	return 0;
+}
+
 int rte_fslmc_vfio_dmamap(void)
 {
 	int i = 0, ret;
diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h
index 9e2c4feef..e877255ea 100644
--- a/drivers/bus/fslmc/fslmc_vfio.h
+++ b/drivers/bus/fslmc/fslmc_vfio.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016 NXP
+ *   Copyright 2016,2019 NXP
  *
  */
 
@@ -50,5 +50,7 @@ int fslmc_vfio_process_group(void);
 char *fslmc_get_container(void);
 int fslmc_get_container_group(int *gropuid);
 int rte_fslmc_vfio_dmamap(void);
+__rte_experimental
+int rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size);
 
 #endif /* _FSLMC_VFIO_H_ */
diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map
index e86007384..4da787236 100644
--- a/drivers/bus/fslmc/rte_bus_fslmc_version.map
+++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map
@@ -141,3 +141,9 @@ DPDK_19.05 {
 	qbman_result_eqresp_set_rspid;
 	qbman_swp_enqueue_multiple_fd;
 } DPDK_18.11;
+
+EXPERIMENTAL {
+	global:
+
+	rte_fslmc_vfio_mem_dmamap;
+};
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index da66577cc..f26c30b00 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -23,6 +23,7 @@
 #include <rte_dev.h>
 #include "rte_dpaa2_mempool.h"
 
+#include "fslmc_vfio.h"
 #include <fslmc_logs.h>
 #include <mc/fsl_dpbp.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -405,6 +406,18 @@ dpaa2_populate(struct rte_mempool *mp, unsigned int max_objs,
 	      void *vaddr, rte_iova_t paddr, size_t len,
 	      rte_mempool_populate_obj_cb_t *obj_cb, void *obj_cb_arg)
 {
+	struct rte_memseg_list *msl;
+	/* The memsegment list exists incase the memory is not external.
+	 * So, DMA-Map is required only when memory is provided by user,
+	 * i.e. External.
+	 */
+	msl = rte_mem_virt2memseg_list(vaddr);
+
+	if (!msl) {
+		DPAA2_MEMPOOL_DEBUG("Memsegment is External.\n");
+		rte_fslmc_vfio_mem_dmamap((size_t)vaddr,
+				(size_t)paddr, (size_t)len);
+	}
 	/* Insert entry into the PA->VA Table */
 	dpaax_iova_table_update(paddr, vaddr, len);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v2 5/5] mempool/dpaa2: vfio dmamap for user allocated memory
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 5/5] mempool/dpaa2: vfio dmamap for user allocated memory Hemant Agrawal
@ 2019-07-07 19:55     ` Thomas Monjalon
  0 siblings, 0 replies; 26+ messages in thread
From: Thomas Monjalon @ 2019-07-07 19:55 UTC (permalink / raw)
  To: Hemant Agrawal, Sachin Saxena; +Cc: dev, ferruh.yigit

Hi, please see several comments about formatting below.

The title should start with a verb.
VFIO and DMA should be uppercase.

27/06/2019 11:33, Hemant Agrawal:
> From: Sachin Saxena <sachin.saxena@nxp.com>
> 
> Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>

There is no description in this patch.

> --- a/drivers/bus/fslmc/fslmc_vfio.c
> +++ b/drivers/bus/fslmc/fslmc_vfio.c
> +__rte_experimental
> +int rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size)

The new policy forbids __rte_experimental tag in .c file.
Per coding style, the return type should be on a separate line.




^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v3 0/5]  FSLMC bus enchancements
  2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 1/5] bus/fslmc: support device iteration Hemant Agrawal
@ 2019-07-15  8:44     ` Hemant Agrawal
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 1/5] bus/fslmc: support device iteration Hemant Agrawal
                         ` (5 more replies)
  0 siblings, 6 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-07-15  8:44 UTC (permalink / raw)
  To: dev; +Cc: thomas

Changes since v2: remove rte_experimental from c file

This patch series makes few enhancements w.r.t functionality and usabilty of FSLMC bus.

1. Applications like OVS has mandated the use of hotplug of dpdk ports. The fslmc bus shall support hotplug now to support dpaa2 ports with OVS.

2. DPAA2 usages it hw based mempool. So, if applications like VPP are using external memory to configure buffer pool, it shall be provisition in FSLMC bus VFIO as well. 

3. Performance improvement for LS1088 to avoid few corruption issues with cache enabled mode for Tx FQ EQCR.


Nipun Gupta (1):
  bus/fslmc: use cinh read for eqcr ci on ls1088 platform

Sachin Saxena (1):
  mempool/dpaa2: vfio dmamap for user allocated memory

Shreyansh Jain (3):
  bus/fslmc: support device iteration
  bus/fslmc: enhance error handling for dev parsing
  bus/fslmc: dynamic iommu mode detection

 drivers/bus/fslmc/fslmc_bus.c                 | 156 ++++++++--
 drivers/bus/fslmc/fslmc_vfio.c                |  77 ++++-
 drivers/bus/fslmc/fslmc_vfio.h                |   5 +-
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h      |   2 -
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h       |   5 -
 .../fslmc/qbman/include/fsl_qbman_portal.h    |   9 +
 drivers/bus/fslmc/qbman/qbman_portal.c        | 278 +++++++++++++++++-
 drivers/bus/fslmc/qbman/qbman_sys.h           |  22 +-
 drivers/bus/fslmc/rte_bus_fslmc_version.map   |   6 +
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c      |  13 +
 10 files changed, 521 insertions(+), 52 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v3 1/5] bus/fslmc: support device iteration
  2019-07-15  8:44     ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Hemant Agrawal
@ 2019-07-15  8:44       ` Hemant Agrawal
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 2/5] bus/fslmc: enhance error handling for dev parsing Hemant Agrawal
                         ` (4 subsequent siblings)
  5 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-07-15  8:44 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

From: Shreyansh Jain <shreyansh.jain@nxp.com>

Recent (18.11+), devargs structure was changed and so was DPDK port
usage in applications like OVS. Applications are now allowed to
plug/unplug ports (eth) using APIs (hotplug) based on device
arguments.

This patch enables the plug/unplug function (which are dummy for
FSLMC) and the iterator function for rte_dev_probe() and similar
API support.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 132 +++++++++++++++++++++++++++++-----
 1 file changed, 116 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index f6e66d22c..35103d224 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -230,34 +230,70 @@ rte_fslmc_parse(const char *name, void *addr)
 {
 	uint16_t dev_id;
 	char *t_ptr;
+	char *sep = NULL;
+	uint8_t sep_exists = 0;
 
-	/* 'name' is expected to contain name of device, for example, dpio.1,
-	 * dpni.2, etc.
+	DPAA2_BUS_DEBUG("Parsing dev=(%s)", name);
+
+	/* There are multiple ways this can be called, with bus:dev, name=dev
+	 * or just dev. In all cases, the 'addr' is actually a string.
+	 */
+	sep = strchr(name, ':');
+	if (!sep) {
+		/* check for '=' */
+		sep = strchr(name, '=');
+		if (!sep)
+			sep_exists = 0;
+		else
+			sep_exists = 1;
+	} else
+		sep_exists = 1;
+
+	/* Check if starting part if either of 'fslmc:' or 'name=', separator
+	 * exists.
 	 */
-	if (strncmp("dpni", name, 4) &&
-	    strncmp("dpseci", name, 6) &&
-	    strncmp("dpcon", name, 5) &&
-	    strncmp("dpbp", name, 4) &&
-	    strncmp("dpio", name, 4) &&
-	    strncmp("dpci", name, 4) &&
-	    strncmp("dpmcp", name, 5) &&
-	    strncmp("dpdmai", name, 6) &&
-	    strncmp("dpdmux", name, 6)) {
-		DPAA2_BUS_DEBUG("Unknown or unsupported device (%s)", name);
+	if (sep_exists) {
+		/* If either of "fslmc" or "name" are starting part */
+		if (!strncmp(name, RTE_STR(FSLMC_BUS_NAME),
+			     strlen(RTE_STR(FSLMC_BUS_NAME))) ||
+		   (!strncmp(name, "name", strlen("name")))) {
+			goto jump_out;
+		} else {
+			DPAA2_BUS_DEBUG("Invalid device for matching (%s).",
+					name);
+			goto err_out;
+		}
+	} else
+		sep = strdup(name);
+
+jump_out:
+	/* Validate device name */
+	if (strncmp("dpni", sep, 4) &&
+	    strncmp("dpseci", sep, 6) &&
+	    strncmp("dpcon", sep, 5) &&
+	    strncmp("dpbp", sep, 4) &&
+	    strncmp("dpio", sep, 4) &&
+	    strncmp("dpci", sep, 4) &&
+	    strncmp("dpmcp", sep, 5) &&
+	    strncmp("dpdmai", sep, 6) &&
+	    strncmp("dpdmux", sep, 6)) {
+		DPAA2_BUS_DEBUG("Unknown or unsupported device (%s)", sep);
 		goto err_out;
 	}
 
-	t_ptr = strchr(name, '.');
+	t_ptr = strchr(sep, '.');
 	if (!t_ptr || sscanf(t_ptr + 1, "%hu", &dev_id) != 1) {
-		DPAA2_BUS_ERR("Missing device id in device name (%s)", name);
+		DPAA2_BUS_ERR("Missing device id in device name (%s)", sep);
 		goto err_out;
 	}
 
 	if (addr)
-		strcpy(addr, name);
+		strcpy(addr, sep);
 
 	return 0;
 err_out:
+	if (sep)
+		free(sep);
 	return -EINVAL;
 }
 
@@ -430,6 +466,13 @@ rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
 	const struct rte_dpaa2_device *dstart;
 	struct rte_dpaa2_device *dev;
 
+	DPAA2_BUS_DEBUG("Finding a device named %s\n", (const char *)data);
+
+	/* find_device is always called with an opaque object which should be
+	 * passed along to the 'cmp' function iterating over all device obj
+	 * on the bus.
+	 */
+
 	if (start != NULL) {
 		dstart = RTE_DEV_TO_FSLMC_CONST(start);
 		dev = TAILQ_NEXT(dstart, next);
@@ -437,8 +480,11 @@ rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
 		dev = TAILQ_FIRST(&rte_fslmc_bus.device_list);
 	}
 	while (dev != NULL) {
-		if (cmp(&dev->device, data) == 0)
+		if (cmp(&dev->device, data) == 0) {
+			DPAA2_BUS_DEBUG("Found device (%s)\n",
+					dev->device.name);
 			return &dev->device;
+		}
 		dev = TAILQ_NEXT(dev, next);
 	}
 
@@ -527,6 +573,57 @@ rte_dpaa2_get_iommu_class(void)
 	return RTE_IOVA_PA;
 }
 
+static int
+fslmc_bus_plug(struct rte_device *dev __rte_unused)
+{
+	/* No operation is performed while plugging the device */
+	return 0;
+}
+
+static int
+fslmc_bus_unplug(struct rte_device *dev __rte_unused)
+{
+	/* No operation is performed while unplugging the device */
+	return 0;
+}
+
+static void *
+fslmc_bus_dev_iterate(const void *start, const char *str,
+		      const struct rte_dev_iterator *it __rte_unused)
+{
+	const struct rte_dpaa2_device *dstart;
+	struct rte_dpaa2_device *dev;
+	char *dup, *dev_name = NULL;
+
+	/* Expectation is that device would be name=device_name */
+	if (strncmp(str, "name=", 5) != 0) {
+		DPAA2_BUS_ERR("Invalid device string (%s)\n", str);
+		return NULL;
+	}
+
+	/* Now that name=device_name format is available, split */
+	dup = strdup(str);
+	dev_name = dup + strlen("name=");
+
+	if (start != NULL) {
+		dstart = RTE_DEV_TO_FSLMC_CONST(start);
+		dev = TAILQ_NEXT(dstart, next);
+	} else {
+		dev = TAILQ_FIRST(&rte_fslmc_bus.device_list);
+	}
+
+	while (dev != NULL) {
+		if (strcmp(dev->device.name, dev_name) == 0) {
+			free(dup);
+			return &dev->device;
+		}
+		dev = TAILQ_NEXT(dev, next);
+	}
+
+	free(dup);
+	return NULL;
+}
+
 struct rte_fslmc_bus rte_fslmc_bus = {
 	.bus = {
 		.scan = rte_fslmc_scan,
@@ -534,6 +631,9 @@ struct rte_fslmc_bus rte_fslmc_bus = {
 		.parse = rte_fslmc_parse,
 		.find_device = rte_fslmc_find_device,
 		.get_iommu_class = rte_dpaa2_get_iommu_class,
+		.plug = fslmc_bus_plug,
+		.unplug = fslmc_bus_unplug,
+		.dev_iterate = fslmc_bus_dev_iterate,
 	},
 	.device_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.device_list),
 	.driver_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.driver_list),
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v3 2/5] bus/fslmc: enhance error handling for dev parsing
  2019-07-15  8:44     ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Hemant Agrawal
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 1/5] bus/fslmc: support device iteration Hemant Agrawal
@ 2019-07-15  8:44       ` Hemant Agrawal
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 3/5] bus/fslmc: dynamic iommu mode detection Hemant Agrawal
                         ` (3 subsequent siblings)
  5 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-07-15  8:44 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

From: Shreyansh Jain <shreyansh.jain@nxp.com>

In case an incorrect device is found, it was quiting further search
rather than skipping it.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 35103d224..a2ed3bcc9 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -33,7 +33,7 @@ uint8_t dpaa2_virt_mode;
 uint32_t
 rte_fslmc_get_device_count(enum rte_dpaa2_dev_type device_type)
 {
-	if (device_type > DPAA2_DEVTYPE_MAX)
+	if (device_type >= DPAA2_DEVTYPE_MAX)
 		return 0;
 	return rte_fslmc_bus.device_count[device_type];
 }
@@ -135,10 +135,11 @@ static int
 scan_one_fslmc_device(char *dev_name)
 {
 	char *dup_dev_name, *t_ptr;
-	struct rte_dpaa2_device *dev;
+	struct rte_dpaa2_device *dev = NULL;
+	int ret = -1;
 
 	if (!dev_name)
-		return -1;
+		return ret;
 
 	/* Ignore the Container name itself */
 	if (!strncmp("dprc", dev_name, 4))
@@ -168,7 +169,8 @@ scan_one_fslmc_device(char *dev_name)
 	/* Parse the device name and ID */
 	t_ptr = strtok(dup_dev_name, ".");
 	if (!t_ptr) {
-		DPAA2_BUS_ERR("Incorrect device name observed");
+		DPAA2_BUS_ERR("Invalid device found: (%s)", dup_dev_name);
+		ret = -EINVAL;
 		goto cleanup;
 	}
 	if (!strncmp("dpni", t_ptr, 4))
@@ -192,12 +194,10 @@ scan_one_fslmc_device(char *dev_name)
 	else
 		dev->dev_type = DPAA2_UNKNOWN;
 
-	/* Update the device found into the device_count table */
-	rte_fslmc_bus.device_count[dev->dev_type]++;
-
 	t_ptr = strtok(NULL, ".");
 	if (!t_ptr) {
-		DPAA2_BUS_ERR("Incorrect device string observed (null)");
+		DPAA2_BUS_ERR("Skipping invalid device (%s)", dup_dev_name);
+		ret = 0;
 		goto cleanup;
 	}
 
@@ -205,10 +205,14 @@ scan_one_fslmc_device(char *dev_name)
 	dev->device.name = strdup(dev_name);
 	if (!dev->device.name) {
 		DPAA2_BUS_ERR("Unable to clone device name. Out of memory");
+		ret = -ENOMEM;
 		goto cleanup;
 	}
 	dev->device.devargs = fslmc_devargs_lookup(dev);
 
+	/* Update the device found into the device_count table */
+	rte_fslmc_bus.device_count[dev->dev_type]++;
+
 	/* Add device in the fslmc device list */
 	insert_in_device_list(dev);
 
@@ -222,7 +226,7 @@ scan_one_fslmc_device(char *dev_name)
 		free(dup_dev_name);
 	if (dev)
 		free(dev);
-	return -1;
+	return ret;
 }
 
 static int
@@ -353,7 +357,7 @@ rte_fslmc_scan(void)
 	/* Remove all devices in the list */
 	cleanup_fslmc_device_list();
 scan_fail:
-	DPAA2_BUS_DEBUG("FSLMC Bus Not Available. Skipping");
+	DPAA2_BUS_DEBUG("FSLMC Bus Not Available. Skipping (%d)", ret);
 	/* Irrespective of failure, scan only return success */
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v3 3/5] bus/fslmc: dynamic iommu mode detection
  2019-07-15  8:44     ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Hemant Agrawal
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 1/5] bus/fslmc: support device iteration Hemant Agrawal
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 2/5] bus/fslmc: enhance error handling for dev parsing Hemant Agrawal
@ 2019-07-15  8:44       ` Hemant Agrawal
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform Hemant Agrawal
                         ` (2 subsequent siblings)
  5 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-07-15  8:44 UTC (permalink / raw)
  To: dev; +Cc: thomas, Shreyansh Jain

From: Shreyansh Jain <shreyansh.jain@nxp.com>

This patch adds following:
1. 'g_container' variable name is not right way to represent the
FSLMC container. Renaming it to fslmc_container.
2. dynamic selection of IOMMU mode based on run environment

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 38 +++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 44e4fa6e2..1383af4f1 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2018 NXP
+ *   Copyright 2016-2019 NXP
  *
  */
 
@@ -49,7 +49,8 @@
 static struct fslmc_vfio_group vfio_group;
 static struct fslmc_vfio_container vfio_container;
 static int container_device_fd;
-static char *g_container;
+static char *fslmc_container;
+static int fslmc_iommu_type;
 static uint32_t *msi_intr_vaddr;
 void *(*rte_mcp_ptr_list);
 
@@ -71,7 +72,7 @@ fslmc_get_container_group(int *groupid)
 	int ret;
 	char *container;
 
-	if (!g_container) {
+	if (!fslmc_container) {
 		container = getenv("DPRC");
 		if (container == NULL) {
 			DPAA2_BUS_DEBUG("DPAA2: DPRC not available");
@@ -83,23 +84,26 @@ fslmc_get_container_group(int *groupid)
 			return -1;
 		}
 
-		g_container = strdup(container);
-		if (!g_container) {
+		fslmc_container = strdup(container);
+		if (!fslmc_container) {
 			DPAA2_BUS_ERR("Mem alloc failure; Container name");
 			return -ENOMEM;
 		}
 	}
 
+	fslmc_iommu_type = (rte_vfio_noiommu_is_enabled() == 1) ?
+		RTE_VFIO_NOIOMMU : VFIO_TYPE1_IOMMU;
+
 	/* get group number */
 	ret = rte_vfio_get_group_num(SYSFS_FSL_MC_DEVICES,
-				     g_container, groupid);
+				     fslmc_container, groupid);
 	if (ret <= 0) {
-		DPAA2_BUS_ERR("Unable to find %s IOMMU group", g_container);
+		DPAA2_BUS_ERR("Unable to find %s IOMMU group", fslmc_container);
 		return -1;
 	}
 
 	DPAA2_BUS_DEBUG("Container: %s has VFIO iommu group id = %d",
-			g_container, *groupid);
+			fslmc_container, *groupid);
 
 	return 0;
 }
@@ -132,7 +136,7 @@ vfio_connect_container(void)
 	}
 
 	/* Check whether support for SMMU type IOMMU present or not */
-	if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_TYPE1_IOMMU)) {
+	if (ioctl(fd, VFIO_CHECK_EXTENSION, fslmc_iommu_type)) {
 		/* Connect group to container */
 		ret = ioctl(vfio_group.fd, VFIO_GROUP_SET_CONTAINER, &fd);
 		if (ret) {
@@ -141,7 +145,7 @@ vfio_connect_container(void)
 			return -errno;
 		}
 
-		ret = ioctl(fd, VFIO_SET_IOMMU, VFIO_TYPE1_IOMMU);
+		ret = ioctl(fd, VFIO_SET_IOMMU, fslmc_iommu_type);
 		if (ret) {
 			DPAA2_BUS_ERR("Failed to setup VFIO iommu");
 			close(fd);
@@ -261,6 +265,11 @@ fslmc_map_dma(uint64_t vaddr, rte_iova_t iovaddr __rte_unused, size_t len)
 	};
 	int ret;
 
+	if (fslmc_iommu_type == RTE_VFIO_NOIOMMU) {
+		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
+		return 0;
+	}
+
 	dma_map.size = len;
 	dma_map.vaddr = vaddr;
 
@@ -300,6 +309,11 @@ fslmc_unmap_dma(uint64_t vaddr, uint64_t iovaddr __rte_unused, size_t len)
 	};
 	int ret;
 
+	if (fslmc_iommu_type == RTE_VFIO_NOIOMMU) {
+		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
+		return 0;
+	}
+
 	dma_unmap.size = len;
 	dma_unmap.iova = vaddr;
 
@@ -819,10 +833,10 @@ fslmc_vfio_setup_group(void)
 	}
 
 	/* Get Device information */
-	ret = ioctl(vfio_group.fd, VFIO_GROUP_GET_DEVICE_FD, g_container);
+	ret = ioctl(vfio_group.fd, VFIO_GROUP_GET_DEVICE_FD, fslmc_container);
 	if (ret < 0) {
 		DPAA2_BUS_ERR("Error getting device %s fd from group %d",
-			      g_container, vfio_group.groupid);
+			      fslmc_container, vfio_group.groupid);
 		close(vfio_group.fd);
 		rte_vfio_clear_group(vfio_group.fd);
 		return ret;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v3 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform
  2019-07-15  8:44     ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Hemant Agrawal
                         ` (2 preceding siblings ...)
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 3/5] bus/fslmc: dynamic iommu mode detection Hemant Agrawal
@ 2019-07-15  8:44       ` Hemant Agrawal
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 5/5] mempool/dpaa2: vfio dmamap for user allocated memory Hemant Agrawal
  2019-07-15 21:53       ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Thomas Monjalon
  5 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-07-15  8:44 UTC (permalink / raw)
  To: dev; +Cc: thomas, Nipun Gupta

From: Nipun Gupta <nipun.gupta@nxp.com>

LS1088 platform CENA operation are causing issues
at high load. CINH (cache inhibited) mode is working
fine with minor performance impact.

This patch enables CINH mode selectively on LS1088 platform

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.h      |   2 -
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h       |   5 -
 .../fslmc/qbman/include/fsl_qbman_portal.h    |   9 +
 drivers/bus/fslmc/qbman/qbman_portal.c        | 278 +++++++++++++++++-
 drivers/bus/fslmc/qbman/qbman_sys.h           |  22 +-
 5 files changed, 303 insertions(+), 13 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
index 17e7e4fad..c68495eaf 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.h
@@ -28,8 +28,6 @@ RTE_DECLARE_PER_LCORE(struct dpaa2_io_portal_t, _dpaa2_io);
 #define DPAA2_PER_LCORE_ETHRX_DPIO RTE_PER_LCORE(_dpaa2_io).ethrx_dpio_dev
 #define DPAA2_PER_LCORE_ETHRX_PORTAL DPAA2_PER_LCORE_ETHRX_DPIO->sw_portal
 
-/* Variable to store DPAA2 platform type */
-extern uint32_t dpaa2_svr_family;
 /* Variable to store DPAA2 DQRR size */
 extern uint8_t dpaa2_dqrr_size;
 /* Variable to store DPAA2 EQCR size */
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index 0cbde8a9b..92fc76211 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -23,11 +23,6 @@
 #define lower_32_bits(x) ((uint32_t)(x))
 #define upper_32_bits(x) ((uint32_t)(((x) >> 16) >> 16))
 
-#define SVR_LS1080A             0x87030000
-#define SVR_LS2080A             0x87010000
-#define SVR_LS2088A             0x87090000
-#define SVR_LX2160A             0x87360000
-
 #ifndef VLAN_TAG_SIZE
 #define VLAN_TAG_SIZE   4 /** < Vlan Header Length */
 #endif
diff --git a/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h b/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
index c35dafedb..88f0a9968 100644
--- a/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
+++ b/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ * Copyright 2015-2019 NXP
  *
  */
 #ifndef _FSL_QBMAN_PORTAL_H
@@ -8,6 +9,14 @@
 
 #include <fsl_qbman_base.h>
 
+#define SVR_LS1080A	0x87030000
+#define SVR_LS2080A	0x87010000
+#define SVR_LS2088A	0x87090000
+#define SVR_LX2160A	0x87360000
+
+/* Variable to store DPAA2 platform type */
+extern uint32_t dpaa2_svr_family;
+
 /**
  * DOC - QBMan portal APIs to implement the following functions:
  * - Initialize and destroy Software portal object.
diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 20da8b921..e6066ce35 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -76,6 +76,10 @@ qbman_swp_enqueue_ring_mode_direct(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd);
 static int
+qbman_swp_enqueue_ring_mode_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd);
+static int
 qbman_swp_enqueue_ring_mode_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd);
@@ -87,6 +91,12 @@ qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
 		uint32_t *flags,
 		int num_frames);
 static int
+qbman_swp_enqueue_multiple_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		uint32_t *flags,
+		int num_frames);
+static int
 qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd,
@@ -99,7 +109,12 @@ qbman_swp_enqueue_multiple_fd_direct(struct qbman_swp *s,
 		struct qbman_fd **fd,
 		uint32_t *flags,
 		int num_frames);
-
+static int
+qbman_swp_enqueue_multiple_fd_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		struct qbman_fd **fd,
+		uint32_t *flags,
+		int num_frames);
 static int
 qbman_swp_enqueue_multiple_fd_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
@@ -113,6 +128,11 @@ qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s,
 		const struct qbman_fd *fd,
 		int num_frames);
 static int
+qbman_swp_enqueue_multiple_desc_cinh_direct(struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		int num_frames);
+static int
 qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s,
 		const struct qbman_eq_desc *d,
 		const struct qbman_fd *fd,
@@ -273,6 +293,17 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d)
 		qbman_swp_release_ptr = qbman_swp_release_mem_back;
 	}
 
+	if (dpaa2_svr_family == SVR_LS1080A) {
+		qbman_swp_enqueue_ring_mode_ptr =
+				qbman_swp_enqueue_ring_mode_cinh_direct;
+		qbman_swp_enqueue_multiple_ptr =
+				qbman_swp_enqueue_multiple_cinh_direct;
+		qbman_swp_enqueue_multiple_fd_ptr =
+				qbman_swp_enqueue_multiple_fd_cinh_direct;
+		qbman_swp_enqueue_multiple_desc_ptr =
+				qbman_swp_enqueue_multiple_desc_cinh_direct;
+	}
+
 	for (mask_size = p->eqcr.pi_ring_size; mask_size > 0; mask_size >>= 1)
 		p->eqcr.pi_ci_mask = (p->eqcr.pi_ci_mask<<1) + 1;
 	eqcr_pi = qbman_cinh_read(&p->sys, QBMAN_CINH_SWP_EQCR_PI);
@@ -700,6 +731,46 @@ static int qbman_swp_enqueue_ring_mode_direct(struct qbman_swp *s,
 	return 0;
 }
 
+static int qbman_swp_enqueue_ring_mode_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd)
+{
+	uint32_t *p;
+	const uint32_t *cl = qb_cl(d);
+	uint32_t eqcr_ci, full_mask, half_mask;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+				eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return -EBUSY;
+	}
+
+	p = qbman_cena_write_start_wo_shadow(&s->sys,
+			QBMAN_CENA_SWP_EQCR(s->eqcr.pi & half_mask));
+	memcpy(&p[1], &cl[1], 28);
+	memcpy(&p[8], fd, sizeof(*fd));
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	p[0] = cl[0] | s->eqcr.pi_vb;
+	qbman_cena_write_complete_wo_shadow(&s->sys,
+			QBMAN_CENA_SWP_EQCR(s->eqcr.pi & half_mask));
+	s->eqcr.pi++;
+	s->eqcr.pi &= full_mask;
+	s->eqcr.available--;
+	if (!(s->eqcr.pi & half_mask))
+		s->eqcr.pi_vb ^= QB_VALID_BIT;
+
+	return 0;
+}
+
 static int qbman_swp_enqueue_ring_mode_mem_back(struct qbman_swp *s,
 						const struct qbman_eq_desc *d,
 						const struct qbman_fd *fd)
@@ -823,6 +894,76 @@ static int qbman_swp_enqueue_multiple_direct(struct qbman_swp *s,
 	return num_enqueued;
 }
 
+static int qbman_swp_enqueue_multiple_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		uint32_t *flags,
+		int num_frames)
+{
+	uint32_t *p = NULL;
+	const uint32_t *cl = qb_cl(d);
+	uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
+	int i, num_enqueued = 0;
+	uint64_t addr_cena;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+				eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return 0;
+	}
+
+	eqcr_pi = s->eqcr.pi;
+	num_enqueued = (s->eqcr.available < num_frames) ?
+			s->eqcr.available : num_frames;
+	s->eqcr.available -= num_enqueued;
+	/* Fill in the EQCR ring */
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		memcpy(&p[1], &cl[1], 28);
+		memcpy(&p[8], &fd[i], sizeof(*fd));
+		eqcr_pi++;
+	}
+
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	eqcr_pi = s->eqcr.pi;
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		p[0] = cl[0] | s->eqcr.pi_vb;
+		if (flags && (flags[i] & QBMAN_ENQUEUE_FLAG_DCA)) {
+			struct qbman_eq_desc *d = (struct qbman_eq_desc *)p;
+
+			d->eq.dca = (1 << QB_ENQUEUE_CMD_DCA_EN_SHIFT) |
+				((flags[i]) & QBMAN_EQCR_DCA_IDXMASK);
+		}
+		eqcr_pi++;
+		if (!(eqcr_pi & half_mask))
+			s->eqcr.pi_vb ^= QB_VALID_BIT;
+	}
+
+	/* Flush all the cacheline without load/store in between */
+	eqcr_pi = s->eqcr.pi;
+	addr_cena = (size_t)s->sys.addr_cena;
+	for (i = 0; i < num_enqueued; i++) {
+		dcbf(addr_cena +
+			QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		eqcr_pi++;
+	}
+	s->eqcr.pi = eqcr_pi & full_mask;
+
+	return num_enqueued;
+}
+
 static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 					       const struct qbman_eq_desc *d,
 					       const struct qbman_fd *fd,
@@ -954,6 +1095,76 @@ static int qbman_swp_enqueue_multiple_fd_direct(struct qbman_swp *s,
 	return num_enqueued;
 }
 
+static int qbman_swp_enqueue_multiple_fd_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		struct qbman_fd **fd,
+		uint32_t *flags,
+		int num_frames)
+{
+	uint32_t *p = NULL;
+	const uint32_t *cl = qb_cl(d);
+	uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
+	int i, num_enqueued = 0;
+	uint64_t addr_cena;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+				eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return 0;
+	}
+
+	eqcr_pi = s->eqcr.pi;
+	num_enqueued = (s->eqcr.available < num_frames) ?
+			s->eqcr.available : num_frames;
+	s->eqcr.available -= num_enqueued;
+	/* Fill in the EQCR ring */
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		memcpy(&p[1], &cl[1], 28);
+		memcpy(&p[8], fd[i], sizeof(struct qbman_fd));
+		eqcr_pi++;
+	}
+
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	eqcr_pi = s->eqcr.pi;
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		p[0] = cl[0] | s->eqcr.pi_vb;
+		if (flags && (flags[i] & QBMAN_ENQUEUE_FLAG_DCA)) {
+			struct qbman_eq_desc *d = (struct qbman_eq_desc *)p;
+
+			d->eq.dca = (1 << QB_ENQUEUE_CMD_DCA_EN_SHIFT) |
+				((flags[i]) & QBMAN_EQCR_DCA_IDXMASK);
+		}
+		eqcr_pi++;
+		if (!(eqcr_pi & half_mask))
+			s->eqcr.pi_vb ^= QB_VALID_BIT;
+	}
+
+	/* Flush all the cacheline without load/store in between */
+	eqcr_pi = s->eqcr.pi;
+	addr_cena = (size_t)s->sys.addr_cena;
+	for (i = 0; i < num_enqueued; i++) {
+		dcbf(addr_cena +
+			QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		eqcr_pi++;
+	}
+	s->eqcr.pi = eqcr_pi & full_mask;
+
+	return num_enqueued;
+}
+
 static int qbman_swp_enqueue_multiple_fd_mem_back(struct qbman_swp *s,
 						  const struct qbman_eq_desc *d,
 						  struct qbman_fd **fd,
@@ -1087,6 +1298,71 @@ static int qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s,
 	return num_enqueued;
 }
 
+static int qbman_swp_enqueue_multiple_desc_cinh_direct(
+		struct qbman_swp *s,
+		const struct qbman_eq_desc *d,
+		const struct qbman_fd *fd,
+		int num_frames)
+{
+	uint32_t *p;
+	const uint32_t *cl;
+	uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
+	int i, num_enqueued = 0;
+	uint64_t addr_cena;
+
+	half_mask = (s->eqcr.pi_ci_mask>>1);
+	full_mask = s->eqcr.pi_ci_mask;
+	if (!s->eqcr.available) {
+		eqcr_ci = s->eqcr.ci;
+		s->eqcr.ci = qbman_cinh_read(&s->sys,
+				QBMAN_CINH_SWP_EQCR_CI) & full_mask;
+		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
+					eqcr_ci, s->eqcr.ci);
+		if (!s->eqcr.available)
+			return 0;
+	}
+
+	eqcr_pi = s->eqcr.pi;
+	num_enqueued = (s->eqcr.available < num_frames) ?
+			s->eqcr.available : num_frames;
+	s->eqcr.available -= num_enqueued;
+	/* Fill in the EQCR ring */
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		cl = qb_cl(&d[i]);
+		memcpy(&p[1], &cl[1], 28);
+		memcpy(&p[8], &fd[i], sizeof(*fd));
+		eqcr_pi++;
+	}
+
+	lwsync();
+
+	/* Set the verb byte, have to substitute in the valid-bit */
+	eqcr_pi = s->eqcr.pi;
+	for (i = 0; i < num_enqueued; i++) {
+		p = qbman_cena_write_start_wo_shadow(&s->sys,
+				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		cl = qb_cl(&d[i]);
+		p[0] = cl[0] | s->eqcr.pi_vb;
+		eqcr_pi++;
+		if (!(eqcr_pi & half_mask))
+			s->eqcr.pi_vb ^= QB_VALID_BIT;
+	}
+
+	/* Flush all the cacheline without load/store in between */
+	eqcr_pi = s->eqcr.pi;
+	addr_cena = (size_t)s->sys.addr_cena;
+	for (i = 0; i < num_enqueued; i++) {
+		dcbf(addr_cena +
+			QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
+		eqcr_pi++;
+	}
+	s->eqcr.pi = eqcr_pi & full_mask;
+
+	return num_enqueued;
+}
+
 static int qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s,
 					const struct qbman_eq_desc *d,
 					const struct qbman_fd *fd,
diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h b/drivers/bus/fslmc/qbman/qbman_sys.h
index 71f7a6782..e59fcfd54 100644
--- a/drivers/bus/fslmc/qbman/qbman_sys.h
+++ b/drivers/bus/fslmc/qbman/qbman_sys.h
@@ -381,6 +381,14 @@ static inline uint32_t qbman_set_swp_cfg(uint8_t max_fill, uint8_t wn,
 #define QMAN_REV_5000	0x05000000
 #define QMAN_REV_MASK	0xffff0000
 
+#define SVR_LS1080A	0x87030000
+#define SVR_LS2080A	0x87010000
+#define SVR_LS2088A	0x87090000
+#define SVR_LX2160A	0x87360000
+
+/* Variable to store DPAA2 platform type */
+extern uint32_t dpaa2_svr_family;
+
 static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 				     const struct qbman_swp_desc *d,
 				     uint8_t dqrr_size)
@@ -388,16 +396,17 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 	uint32_t reg;
 	int i;
 	int cena_region_size = 4*1024;
-
-	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
-			&& (d->cena_access_mode == qman_cena_fastest_access))
-		cena_region_size = 64*1024;
+	uint8_t est = 1;
 #ifdef RTE_ARCH_64
 	uint8_t wn = CENA_WRITE_ENABLE;
 #else
 	uint8_t wn = CINH_WRITE_ENABLE;
 #endif
 
+
+	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
+			&& (d->cena_access_mode == qman_cena_fastest_access))
+		cena_region_size = 64*1024;
 	s->addr_cena = d->cena_bar;
 	s->addr_cinh = d->cinh_bar;
 	s->idx = (uint32_t)d->idx;
@@ -428,6 +437,9 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 			dccivac(s->addr_cena + i);
 	}
 
+	if (dpaa2_svr_family == SVR_LS1080A)
+		est = 0;
+
 	if (s->eqcr_mode == qman_eqcr_vb_array) {
 		reg = qbman_set_swp_cfg(dqrr_size, wn,
 					0, 3, 2, 3, 1, 1, 1, 1, 1, 1);
@@ -438,7 +450,7 @@ static inline int qbman_swp_sys_init(struct qbman_swp_sys *s,
 						1, 3, 2, 0, 1, 1, 1, 1, 1, 1);
 		else
 			reg = qbman_set_swp_cfg(dqrr_size, wn,
-						1, 3, 2, 2, 1, 1, 1, 1, 1, 1);
+						est, 3, 2, 2, 1, 1, 1, 1, 1, 1);
 	}
 
 	if ((d->qman_version & QMAN_REV_MASK) >= QMAN_REV_5000
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [dpdk-dev] [PATCH v3 5/5] mempool/dpaa2: vfio dmamap for user allocated memory
  2019-07-15  8:44     ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Hemant Agrawal
                         ` (3 preceding siblings ...)
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform Hemant Agrawal
@ 2019-07-15  8:44       ` Hemant Agrawal
  2019-07-15 21:53       ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Thomas Monjalon
  5 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-07-15  8:44 UTC (permalink / raw)
  To: dev; +Cc: thomas, Sachin Saxena

From: Sachin Saxena <sachin.saxena@nxp.com>

This patch help in adding a routine to help memory map
the user provided memory via VFIO.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c              | 39 +++++++++++++++++++++
 drivers/bus/fslmc/fslmc_vfio.h              |  5 ++-
 drivers/bus/fslmc/rte_bus_fslmc_version.map |  6 ++++
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c    | 13 +++++++
 4 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 1383af4f1..247b2a4a1 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -358,6 +358,45 @@ fslmc_dmamap_seg(const struct rte_memseg_list *msl __rte_unused,
 	return ret;
 }
 
+int
+rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size)
+{
+	int ret;
+	struct fslmc_vfio_group *group;
+	struct vfio_iommu_type1_dma_map dma_map = {
+		.argsz = sizeof(struct vfio_iommu_type1_dma_map),
+		.flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE,
+	};
+
+	if (fslmc_iommu_type == RTE_VFIO_NOIOMMU) {
+		DPAA2_BUS_DEBUG("Running in NOIOMMU mode");
+		return 0;
+	}
+
+	/* SET DMA MAP for IOMMU */
+	group = &vfio_group;
+	if (!group->container) {
+		DPAA2_BUS_ERR("Container is not connected");
+		return -1;
+	}
+
+	dma_map.size = size;
+	dma_map.vaddr = vaddr;
+	dma_map.iova = iova;
+
+	DPAA2_BUS_DEBUG("VFIO dmamap 0x%llx:0x%llx, size 0x%llx\n",
+			dma_map.vaddr, dma_map.iova, dma_map.size);
+	ret = ioctl(group->container->fd, VFIO_IOMMU_MAP_DMA,
+		    &dma_map);
+	if (ret) {
+		printf("Unable to map DMA address (errno = %d)\n",
+			errno);
+		return ret;
+	}
+
+	return 0;
+}
+
 int rte_fslmc_vfio_dmamap(void)
 {
 	int i = 0, ret;
diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h
index 9e2c4feef..4132f1fa4 100644
--- a/drivers/bus/fslmc/fslmc_vfio.h
+++ b/drivers/bus/fslmc/fslmc_vfio.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016 NXP
+ *   Copyright 2016,2019 NXP
  *
  */
 
@@ -50,5 +50,8 @@ int fslmc_vfio_process_group(void);
 char *fslmc_get_container(void);
 int fslmc_get_container_group(int *gropuid);
 int rte_fslmc_vfio_dmamap(void);
+__rte_experimental
+int
+rte_fslmc_vfio_mem_dmamap(uint64_t vaddr, uint64_t iova, uint64_t size);
 
 #endif /* _FSLMC_VFIO_H_ */
diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map
index e86007384..4da787236 100644
--- a/drivers/bus/fslmc/rte_bus_fslmc_version.map
+++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map
@@ -141,3 +141,9 @@ DPDK_19.05 {
 	qbman_result_eqresp_set_rspid;
 	qbman_swp_enqueue_multiple_fd;
 } DPDK_18.11;
+
+EXPERIMENTAL {
+	global:
+
+	rte_fslmc_vfio_mem_dmamap;
+};
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index da66577cc..f26c30b00 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -23,6 +23,7 @@
 #include <rte_dev.h>
 #include "rte_dpaa2_mempool.h"
 
+#include "fslmc_vfio.h"
 #include <fslmc_logs.h>
 #include <mc/fsl_dpbp.h>
 #include <portal/dpaa2_hw_pvt.h>
@@ -405,6 +406,18 @@ dpaa2_populate(struct rte_mempool *mp, unsigned int max_objs,
 	      void *vaddr, rte_iova_t paddr, size_t len,
 	      rte_mempool_populate_obj_cb_t *obj_cb, void *obj_cb_arg)
 {
+	struct rte_memseg_list *msl;
+	/* The memsegment list exists incase the memory is not external.
+	 * So, DMA-Map is required only when memory is provided by user,
+	 * i.e. External.
+	 */
+	msl = rte_mem_virt2memseg_list(vaddr);
+
+	if (!msl) {
+		DPAA2_MEMPOOL_DEBUG("Memsegment is External.\n");
+		rte_fslmc_vfio_mem_dmamap((size_t)vaddr,
+				(size_t)paddr, (size_t)len);
+	}
 	/* Insert entry into the PA->VA Table */
 	dpaax_iova_table_update(paddr, vaddr, len);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/5]  FSLMC bus enchancements
  2019-07-15  8:44     ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Hemant Agrawal
                         ` (4 preceding siblings ...)
  2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 5/5] mempool/dpaa2: vfio dmamap for user allocated memory Hemant Agrawal
@ 2019-07-15 21:53       ` Thomas Monjalon
  2019-07-16 11:40         ` Ferruh Yigit
  5 siblings, 1 reply; 26+ messages in thread
From: Thomas Monjalon @ 2019-07-15 21:53 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: dev

15/07/2019 10:44, Hemant Agrawal:
> Nipun Gupta (1):
>   bus/fslmc: use cinh read for eqcr ci on ls1088 platform
> 
> Sachin Saxena (1):
>   mempool/dpaa2: vfio dmamap for user allocated memory
> 
> Shreyansh Jain (3):
>   bus/fslmc: support device iteration
>   bus/fslmc: enhance error handling for dev parsing
>   bus/fslmc: dynamic iommu mode detection

I had the following comments on v1:
	The title should start with a verb.
	VFIO and DMA should be uppercase.
I tried to fix it.

Applied, thanks



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements
  2019-07-15 21:53       ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Thomas Monjalon
@ 2019-07-16 11:40         ` Ferruh Yigit
  2019-07-16 13:36           ` Thomas Monjalon
  0 siblings, 1 reply; 26+ messages in thread
From: Ferruh Yigit @ 2019-07-16 11:40 UTC (permalink / raw)
  To: Thomas Monjalon, Hemant Agrawal; +Cc: dev

On 7/15/2019 10:53 PM, Thomas Monjalon wrote:
> 15/07/2019 10:44, Hemant Agrawal:
>> Nipun Gupta (1):
>>   bus/fslmc: use cinh read for eqcr ci on ls1088 platform
>>
>> Sachin Saxena (1):
>>   mempool/dpaa2: vfio dmamap for user allocated memory
>>
>> Shreyansh Jain (3):
>>   bus/fslmc: support device iteration
>>   bus/fslmc: enhance error handling for dev parsing
>>   bus/fslmc: dynamic iommu mode detection
> 
> I had the following comments on v1:
> 	The title should start with a verb.
> 	VFIO and DMA should be uppercase.
> I tried to fix it.
> 
> Applied, thanks
> 
> 


Getting build error with "ppc_64-power8-linuxapp-gcc" target [1], related to the
wrong format specifier. Not sure it is only ppc one.

$ /opt/ppc/bin/powerpc64le-linux-gcc --version
powerpc64le-linux-gcc.br_real (Buildroot 2018.08-git-00807-g0184fa3) 8.2.0


[1]
In file included from .../drivers/bus/fslmc/fslmc_vfio.c:37:


                                           [75/3669]
.../drivers/bus/fslmc/fslmc_vfio.c: In function ‘rte_fslmc_vfio_mem_dmamap’:
.../drivers/bus/fslmc/fslmc_logs.h:18:44: error: format ‘%llx’ expects argument
of type ‘long long unsigned int’, but argument 5 has type ‘__u64’ {aka ‘long
unsigned int’} [-Werror=format=]
  rte_log(RTE_LOG_DEBUG, dpaa2_logtype_bus, "fslmc: %s(): " fmt "\n", \
                                            ^~~~~~~~~~~~~~~
.../drivers/bus/fslmc/fslmc_vfio.c:387:2: note: in expansion of macro
‘DPAA2_BUS_DEBUG’
  DPAA2_BUS_DEBUG("VFIO dmamap 0x%llx:0x%llx, size 0x%llx\n",
  ^~~~~~~~~~~~~~~
.../drivers/bus/fslmc/fslmc_vfio.c:387:36: note: format string is defined here
  DPAA2_BUS_DEBUG("VFIO dmamap 0x%llx:0x%llx, size 0x%llx\n",
                                 ~~~^
                                 %lx
In file included from .../drivers/bus/fslmc/fslmc_vfio.c:37:
.../drivers/bus/fslmc/fslmc_logs.h:18:44: error: format ‘%llx’ expects argument
of type ‘long long unsigned int’, but argument 6 has type ‘__u64’ {aka ‘long
unsigned int’} [-Werror=format=]
  rte_log(RTE_LOG_DEBUG, dpaa2_logtype_bus, "fslmc: %s(): " fmt "\n", \
                                            ^~~~~~~~~~~~~~~
.../drivers/bus/fslmc/fslmc_vfio.c:387:2: note: in expansion of macro
‘DPAA2_BUS_DEBUG’
  DPAA2_BUS_DEBUG("VFIO dmamap 0x%llx:0x%llx, size 0x%llx\n",
  ^~~~~~~~~~~~~~~
.../drivers/bus/fslmc/fslmc_vfio.c:387:43: note: format string is defined here
  DPAA2_BUS_DEBUG("VFIO dmamap 0x%llx:0x%llx, size 0x%llx\n",
                                        ~~~^
                                        %lx
In file included from .../drivers/bus/fslmc/fslmc_vfio.c:37:
.../drivers/bus/fslmc/fslmc_logs.h:18:44: error: format ‘%llx’ expects argument
of type ‘long long unsigned int’, but argument 7 has type ‘__u64’ {aka ‘long
unsigned int’} [-Werror=format=]
  rte_log(RTE_LOG_DEBUG, dpaa2_logtype_bus, "fslmc: %s(): " fmt "\n", \
                                            ^~~~~~~~~~~~~~~
.../drivers/bus/fslmc/fslmc_vfio.c:387:2: note: in expansion of macro
‘DPAA2_BUS_DEBUG’
  DPAA2_BUS_DEBUG("VFIO dmamap 0x%llx:0x%llx, size 0x%llx\n",
  ^~~~~~~~~~~~~~~
.../drivers/bus/fslmc/fslmc_vfio.c:387:56: note: format string is defined here
  DPAA2_BUS_DEBUG("VFIO dmamap 0x%llx:0x%llx, size 0x%llx\n",
                                                     ~~~^
                                                     %lx

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements
  2019-07-16 11:40         ` Ferruh Yigit
@ 2019-07-16 13:36           ` Thomas Monjalon
  2019-07-16 13:43             ` Bruce Richardson
  2019-07-19 19:09             ` Ferruh Yigit
  0 siblings, 2 replies; 26+ messages in thread
From: Thomas Monjalon @ 2019-07-16 13:36 UTC (permalink / raw)
  To: Ferruh Yigit, Hemant Agrawal; +Cc: dev

16/07/2019 13:40, Ferruh Yigit:
> On 7/15/2019 10:53 PM, Thomas Monjalon wrote:
> > 15/07/2019 10:44, Hemant Agrawal:
> >> Nipun Gupta (1):
> >>   bus/fslmc: use cinh read for eqcr ci on ls1088 platform
> >>
> >> Sachin Saxena (1):
> >>   mempool/dpaa2: vfio dmamap for user allocated memory
> >>
> >> Shreyansh Jain (3):
> >>   bus/fslmc: support device iteration
> >>   bus/fslmc: enhance error handling for dev parsing
> >>   bus/fslmc: dynamic iommu mode detection
> > 
> > I had the following comments on v1:
> > 	The title should start with a verb.
> > 	VFIO and DMA should be uppercase.
> > I tried to fix it.
> > 
> > Applied, thanks
> 
> Getting build error with "ppc_64-power8-linuxapp-gcc" target [1], related to the
> wrong format specifier. Not sure it is only ppc one.

It's so disappointing.
I don't know how many times I tried to explain the issue with %lx.
Should we just forbid %lx and %llx usage?




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements
  2019-07-16 13:36           ` Thomas Monjalon
@ 2019-07-16 13:43             ` Bruce Richardson
  2019-07-19 19:09             ` Ferruh Yigit
  1 sibling, 0 replies; 26+ messages in thread
From: Bruce Richardson @ 2019-07-16 13:43 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: Ferruh Yigit, Hemant Agrawal, dev

On Tue, Jul 16, 2019 at 03:36:53PM +0200, Thomas Monjalon wrote:
> 16/07/2019 13:40, Ferruh Yigit:
> > On 7/15/2019 10:53 PM, Thomas Monjalon wrote:
> > > 15/07/2019 10:44, Hemant Agrawal:
> > >> Nipun Gupta (1):
> > >>   bus/fslmc: use cinh read for eqcr ci on ls1088 platform
> > >>
> > >> Sachin Saxena (1):
> > >>   mempool/dpaa2: vfio dmamap for user allocated memory
> > >>
> > >> Shreyansh Jain (3):
> > >>   bus/fslmc: support device iteration
> > >>   bus/fslmc: enhance error handling for dev parsing
> > >>   bus/fslmc: dynamic iommu mode detection
> > > 
> > > I had the following comments on v1:
> > > 	The title should start with a verb.
> > > 	VFIO and DMA should be uppercase.
> > > I tried to fix it.
> > > 
> > > Applied, thanks
> > 
> > Getting build error with "ppc_64-power8-linuxapp-gcc" target [1], related to the
> > wrong format specifier. Not sure it is only ppc one.
> 
> It's so disappointing.
> I don't know how many times I tried to explain the issue with %lx.
> Should we just forbid %lx and %llx usage?
> 
We could, I suppose, so long as there never is a case where we actually do
use long, or long long variables. A checkpatch-style warning when one is
used probably is the best option, since it may help with catching these
earlier, while still allowing flexibility and human judgement as to whether
an instance is correct or not.

/Bruce

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements
  2019-07-16 13:36           ` Thomas Monjalon
  2019-07-16 13:43             ` Bruce Richardson
@ 2019-07-19 19:09             ` Ferruh Yigit
  2019-07-22  6:56               ` Hemant Agrawal
  1 sibling, 1 reply; 26+ messages in thread
From: Ferruh Yigit @ 2019-07-19 19:09 UTC (permalink / raw)
  To: Hemant Agrawal; +Cc: Thomas Monjalon, dev, Shreyansh Jain

On 7/16/2019 2:36 PM, Thomas Monjalon wrote:
> 16/07/2019 13:40, Ferruh Yigit:
>> On 7/15/2019 10:53 PM, Thomas Monjalon wrote:
>>> 15/07/2019 10:44, Hemant Agrawal:
>>>> Nipun Gupta (1):
>>>>   bus/fslmc: use cinh read for eqcr ci on ls1088 platform
>>>>
>>>> Sachin Saxena (1):
>>>>   mempool/dpaa2: vfio dmamap for user allocated memory
>>>>
>>>> Shreyansh Jain (3):
>>>>   bus/fslmc: support device iteration
>>>>   bus/fslmc: enhance error handling for dev parsing
>>>>   bus/fslmc: dynamic iommu mode detection
>>>
>>> I had the following comments on v1:
>>> 	The title should start with a verb.
>>> 	VFIO and DMA should be uppercase.
>>> I tried to fix it.
>>>
>>> Applied, thanks
>>
>> Getting build error with "ppc_64-power8-linuxapp-gcc" target [1], related to the
>> wrong format specifier. Not sure it is only ppc one.
> 
> It's so disappointing.
> I don't know how many times I tried to explain the issue with %lx.
> Should we just forbid %lx and %llx usage?
> 

Hi Hemant,

Is there any update on this? Has any fix sent?

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements
  2019-07-19 19:09             ` Ferruh Yigit
@ 2019-07-22  6:56               ` Hemant Agrawal
  0 siblings, 0 replies; 26+ messages in thread
From: Hemant Agrawal @ 2019-07-22  6:56 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Thomas Monjalon, dev, Shreyansh Jain

Hi Ferruh,

> 
> On 7/16/2019 2:36 PM, Thomas Monjalon wrote:
> > 16/07/2019 13:40, Ferruh Yigit:
> >> On 7/15/2019 10:53 PM, Thomas Monjalon wrote:
> >>> 15/07/2019 10:44, Hemant Agrawal:
> >>>> Nipun Gupta (1):
> >>>>   bus/fslmc: use cinh read for eqcr ci on ls1088 platform
> >>>>
> >>>> Sachin Saxena (1):
> >>>>   mempool/dpaa2: vfio dmamap for user allocated memory
> >>>>
> >>>> Shreyansh Jain (3):
> >>>>   bus/fslmc: support device iteration
> >>>>   bus/fslmc: enhance error handling for dev parsing
> >>>>   bus/fslmc: dynamic iommu mode detection
> >>>
> >>> I had the following comments on v1:
> >>> 	The title should start with a verb.
> >>> 	VFIO and DMA should be uppercase.
> >>> I tried to fix it.
> >>>
> >>> Applied, thanks
> >>
> >> Getting build error with "ppc_64-power8-linuxapp-gcc" target [1],
> >> related to the wrong format specifier. Not sure it is only ppc one.
> >
> > It's so disappointing.
> > I don't know how many times I tried to explain the issue with %lx.
> > Should we just forbid %lx and %llx usage?
> >
> 
> Hi Hemant,
> 
> Is there any update on this? Has any fix sent?
[Hemant]  I have just sent the fix.

Regards,
Hemant

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2019-07-22  6:56 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 10:44 [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Hemant Agrawal
2019-06-25 10:44 ` [dpdk-dev] [PATCH 2/5] bus/fslmc: enhance error handling for dev parsing Hemant Agrawal
2019-06-25 10:44 ` [dpdk-dev] [PATCH 3/5] bus/fslmc: dynamic iommu mode detection Hemant Agrawal
2019-06-25 10:44 ` [dpdk-dev] [PATCH 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform Hemant Agrawal
2019-06-25 10:44 ` [dpdk-dev] [PATCH 5/5] mempool/dpaa2: vfio dmamap for user allocated memory Hemant Agrawal
2019-06-26 21:50 ` [dpdk-dev] [PATCH 1/5] bus/fslmc: support device iteration Thomas Monjalon
2019-06-27  9:20   ` Hemant Agrawal
2019-06-27  9:33 ` [dpdk-dev] [PATCH v2 0/5] FSLMC bus enchancements Hemant Agrawal
2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 1/5] bus/fslmc: support device iteration Hemant Agrawal
2019-07-15  8:44     ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Hemant Agrawal
2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 1/5] bus/fslmc: support device iteration Hemant Agrawal
2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 2/5] bus/fslmc: enhance error handling for dev parsing Hemant Agrawal
2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 3/5] bus/fslmc: dynamic iommu mode detection Hemant Agrawal
2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform Hemant Agrawal
2019-07-15  8:44       ` [dpdk-dev] [PATCH v3 5/5] mempool/dpaa2: vfio dmamap for user allocated memory Hemant Agrawal
2019-07-15 21:53       ` [dpdk-dev] [PATCH v3 0/5] FSLMC bus enchancements Thomas Monjalon
2019-07-16 11:40         ` Ferruh Yigit
2019-07-16 13:36           ` Thomas Monjalon
2019-07-16 13:43             ` Bruce Richardson
2019-07-19 19:09             ` Ferruh Yigit
2019-07-22  6:56               ` Hemant Agrawal
2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 2/5] bus/fslmc: enhance error handling for dev parsing Hemant Agrawal
2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 3/5] bus/fslmc: dynamic iommu mode detection Hemant Agrawal
2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 4/5] bus/fslmc: use cinh read for eqcr ci on ls1088 platform Hemant Agrawal
2019-06-27  9:33   ` [dpdk-dev] [PATCH v2 5/5] mempool/dpaa2: vfio dmamap for user allocated memory Hemant Agrawal
2019-07-07 19:55     ` Thomas Monjalon

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).