From: Shreyansh Jain <shreyansh.jain@nxp.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, anatoly.burakov@intel.com,
Shreyansh Jain <shreyansh.jain@nxp.com>
Subject: [PATCH 5/5] fslmc: enable dpaax library
Date: Tue, 25 Sep 2018 18:24:23 +0530 [thread overview]
Message-ID: <20180925125423.7505-6-shreyansh.jain@nxp.com> (raw)
In-Reply-To: <20180925125423.7505-1-shreyansh.jain@nxp.com>
With this patch, fslmc bus and ethernet devices on this bus
would start using the physical-virtual library interfaces.
This patch impacts mempool/dpaa2, event/dpaa2, net/dpaa2,
raw/dpaa2_cmdif and raw/dpaa2_qdma as they are dependent
on the bus/fslmc and thus impact linkage of libraries.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/bus/fslmc/Makefile | 1 +
drivers/bus/fslmc/fslmc_bus.c | 20 +++++++++++++++
drivers/bus/fslmc/meson.build | 2 +-
drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 7 ------
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 32 ++++++++----------------
drivers/crypto/dpaa2_sec/Makefile | 1 +
drivers/event/dpaa2/Makefile | 2 ++
drivers/mempool/dpaa2/Makefile | 1 +
drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 29 +++------------------
drivers/net/dpaa2/Makefile | 1 +
drivers/raw/dpaa2_cmdif/Makefile | 2 ++
drivers/raw/dpaa2_qdma/Makefile | 1 +
mk/rte.app.mk | 1 +
13 files changed, 45 insertions(+), 55 deletions(-)
diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile
index 515d0f534..c5b580a4a 100644
--- a/drivers/bus/fslmc/Makefile
+++ b/drivers/bus/fslmc/Makefile
@@ -19,6 +19,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include
CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev
+LDLIBS += -lrte_common_dpaax
# versioning export map
EXPORT_MAP := rte_bus_fslmc_version.map
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index f5135e538..7dbe01e08 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -20,6 +20,8 @@
#include <fslmc_vfio.h>
#include "fslmc_logs.h"
+#include <dpaax_iova_table.h>
+
int dpaa2_logtype_bus;
#define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups"
@@ -375,6 +377,19 @@ rte_fslmc_probe(void)
probe_all = rte_fslmc_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST;
+ /* In case of PA, the FD addresses returned by qbman APIs are physical
+ * addresses, which need conversion into equivalent VA address for
+ * rte_mbuf. For that, a table (a serial array, in memory) is used to
+ * increase translation efficiency.
+ * This has to be done before probe as some device initialization
+ * (during) probe allocate memory (dpaa2_sec) which needs to be pinned
+ * to this table.
+ */
+ ret = dpaax_iova_table_populate();
+ if (ret) {
+ DPAA2_BUS_WARN("PA->VA Translation table not available;");
+ }
+
TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) {
TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) {
ret = rte_fslmc_match(drv, dev);
@@ -450,6 +465,11 @@ rte_fslmc_driver_unregister(struct rte_dpaa2_driver *driver)
fslmc_bus = driver->fslmc_bus;
+ /* Cleanup the PA->VA Translation table; From whereever this function
+ * is called from.
+ */
+ dpaax_iova_table_depopulate();
+
TAILQ_REMOVE(&fslmc_bus->driver_list, driver, next);
/* Update Bus references */
driver->fslmc_bus = NULL;
diff --git a/drivers/bus/fslmc/meson.build b/drivers/bus/fslmc/meson.build
index 22a56a6fc..49d71d2ba 100644
--- a/drivers/bus/fslmc/meson.build
+++ b/drivers/bus/fslmc/meson.build
@@ -5,7 +5,7 @@ if host_machine.system() != 'linux'
build = false
endif
-deps += ['eventdev', 'kvargs']
+deps += ['common_dpaax', 'eventdev', 'kvargs']
sources = files('fslmc_bus.c',
'fslmc_vfio.c',
'mc/dpbp.c',
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index db49d637f..39c5adf90 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -28,13 +28,6 @@
#include "portal/dpaa2_hw_pvt.h"
#include "portal/dpaa2_hw_dpio.h"
-/* List of all the memseg information locally maintained in dpaa2 driver. This
- * is to optimize the PA_to_VA searches until a better mechanism (algo) is
- * available.
- */
-struct dpaa2_memseg_list rte_dpaa2_memsegs
- = TAILQ_HEAD_INITIALIZER(rte_dpaa2_memsegs);
-
TAILQ_HEAD(dpbp_dev_list, dpaa2_dpbp_dev);
static struct dpbp_dev_list dpbp_dev_list
= TAILQ_HEAD_INITIALIZER(dpbp_dev_list); /*!< DPBP device list */
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index ec8f42806..7306d2598 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -9,6 +9,7 @@
#define _DPAA2_HW_PVT_H_
#include <rte_eventdev.h>
+#include <dpaax_iova_table.h>
#include <mc/fsl_mc_sys.h>
#include <fsl_qbman_portal.h>
@@ -277,42 +278,29 @@ enum qbman_fd_format {
*/
#define DPAA2_EQ_RESP_ALWAYS 1
-/* Various structures representing contiguous memory maps */
-struct dpaa2_memseg {
- TAILQ_ENTRY(dpaa2_memseg) next;
- char *vaddr;
- rte_iova_t iova;
- size_t len;
-};
-
-TAILQ_HEAD(dpaa2_memseg_list, dpaa2_memseg);
-extern struct dpaa2_memseg_list rte_dpaa2_memsegs;
-
#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA
extern uint8_t dpaa2_virt_mode;
static void *dpaa2_mem_ptov(phys_addr_t paddr) __attribute__((unused));
-/* todo - this is costly, need to write a fast coversion routine */
+
static void *dpaa2_mem_ptov(phys_addr_t paddr)
{
- struct dpaa2_memseg *ms;
+ void *va;
if (dpaa2_virt_mode)
return (void *)(size_t)paddr;
- /* Check if the address is already part of the memseg list internally
- * maintained by the dpaa2 driver.
- */
- TAILQ_FOREACH(ms, &rte_dpaa2_memsegs, next) {
- if (paddr >= ms->iova && paddr <
- ms->iova + ms->len)
- return RTE_PTR_ADD(ms->vaddr, (uintptr_t)(paddr - ms->iova));
- }
+ va = (void *)dpaax_iova_table_get_va(paddr);
+ if (likely(va != NULL))
+ return va;
/* If not, Fallback to full memseg list searching */
- return rte_mem_iova2virt(paddr);
+ va = rte_mem_iova2virt(paddr);
+
+ return va;
}
static phys_addr_t dpaa2_mem_vtop(uint64_t vaddr) __attribute__((unused));
+
static phys_addr_t dpaa2_mem_vtop(uint64_t vaddr)
{
const struct rte_memseg *memseg;
diff --git a/drivers/crypto/dpaa2_sec/Makefile b/drivers/crypto/dpaa2_sec/Makefile
index da3d8f84f..1f951a14b 100644
--- a/drivers/crypto/dpaa2_sec/Makefile
+++ b/drivers/crypto/dpaa2_sec/Makefile
@@ -51,5 +51,6 @@ LDLIBS += -lrte_bus_fslmc
LDLIBS += -lrte_mempool_dpaa2
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_cryptodev
+LDLIBS += -lrte_common_dpaax
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
index 46f7d061e..de6771551 100644
--- a/drivers/event/dpaa2/Makefile
+++ b/drivers/event/dpaa2/Makefile
@@ -21,6 +21,7 @@ CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
LDLIBS += -lrte_eal -lrte_eventdev
LDLIBS += -lrte_bus_fslmc -lrte_mempool_dpaa2 -lrte_pmd_dpaa2
LDLIBS += -lrte_bus_vdev -lrte_pmd_dpaa2_sec
+LDLIBS += -lrte_common_dpaax
CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec
@@ -39,4 +40,5 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2_hw_dpcon.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2_eventdev.c
+
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile
index 9e4c87d79..0fc69c3bf 100644
--- a/drivers/mempool/dpaa2/Makefile
+++ b/drivers/mempool/dpaa2/Makefile
@@ -30,6 +30,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2_hw_mempool.c
LDLIBS += -lrte_bus_fslmc
LDLIBS += -lrte_eal -lrte_mempool -lrte_ring
+LDLIBS += -lrte_common_dpaax
SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL)-include := rte_dpaa2_mempool.h
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 84ff12811..e74825598 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -30,6 +30,8 @@
#include "dpaa2_hw_mempool.h"
#include "dpaa2_hw_mempool_logs.h"
+#include <dpaax_iova_table.h>
+
struct dpaa2_bp_info rte_dpaa2_bpid_info[MAX_BPID];
static struct dpaa2_bp_list *h_bp_list;
@@ -393,31 +395,8 @@ 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 dpaa2_memseg *ms;
-
- /* For each memory chunk pinned to the Mempool, a linked list of the
- * contained memsegs is created for searching when PA to VA
- * conversion is required.
- */
- ms = rte_zmalloc(NULL, sizeof(struct dpaa2_memseg), 0);
- if (!ms) {
- DPAA2_MEMPOOL_ERR("Unable to allocate internal memory.");
- DPAA2_MEMPOOL_WARN("Fast Physical to Virtual Addr translation would not be available.");
- /* If the element is not added, it would only lead to failure
- * in searching for the element and the logic would Fallback
- * to traditional DPDK memseg traversal code. So, this is not
- * a blocking error - but, error would be printed on screen.
- */
- return 0;
- }
-
- ms->vaddr = vaddr;
- ms->iova = paddr;
- ms->len = len;
- /* Head insertions are generally faster than tail insertions as the
- * buffers pinned are picked from rear end.
- */
- TAILQ_INSERT_HEAD(&rte_dpaa2_memsegs, ms, next);
+ /* Insert entry into the PA->VA Table */
+ dpaax_iova_table_add(paddr, vaddr, len);
return rte_mempool_op_populate_default(mp, max_objs, vaddr, paddr, len,
obj_cb, obj_cb_arg);
diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile
index 42d45c1a8..59f7bf4a7 100644
--- a/drivers/net/dpaa2/Makefile
+++ b/drivers/net/dpaa2/Makefile
@@ -41,5 +41,6 @@ LDLIBS += -lrte_bus_fslmc
LDLIBS += -lrte_mempool_dpaa2
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_common_dpaax
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile
index 9b863dda2..83b5ecb56 100644
--- a/drivers/raw/dpaa2_cmdif/Makefile
+++ b/drivers/raw/dpaa2_cmdif/Makefile
@@ -21,6 +21,7 @@ LDLIBS += -lrte_eal
LDLIBS += -lrte_kvargs
LDLIBS += -lrte_mempool_dpaa2
LDLIBS += -lrte_rawdev
+LDLIBS += -lrte_common_dpaax
EXPORT_MAP := rte_pmd_dpaa2_cmdif_version.map
@@ -33,4 +34,5 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif.c
SYMLINK-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV)-include += rte_pmd_dpaa2_cmdif.h
+
include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/raw/dpaa2_qdma/Makefile b/drivers/raw/dpaa2_qdma/Makefile
index d88809ead..2f79a3f41 100644
--- a/drivers/raw/dpaa2_qdma/Makefile
+++ b/drivers/raw/dpaa2_qdma/Makefile
@@ -22,6 +22,7 @@ LDLIBS += -lrte_mempool
LDLIBS += -lrte_mempool_dpaa2
LDLIBS += -lrte_rawdev
LDLIBS += -lrte_ring
+LDLIBS += -lrte_common_dpaax
EXPORT_MAP := rte_pmd_dpaa2_qdma_version.map
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 89a008fe3..abfbe387c 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -119,6 +119,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_COMMON_DPAAX) += -lrte_common_dpaax
_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_MEMPOOL) += -lrte_mempool_dpaa
endif
ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_COMMON_DPAAX) += -lrte_common_dpaax
_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += -lrte_mempool_dpaa2
endif
--
2.17.1
next prev parent reply other threads:[~2018-09-25 12:55 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 12:54 [PATCH 0/5] Add a PA-VA Translation table for DPAAx Shreyansh Jain
2018-09-25 12:54 ` [PATCH 1/5] bus/fslmc: fix physical addressing check Shreyansh Jain
2018-09-25 12:54 ` [PATCH 2/5] drivers: common as dependency for bus Shreyansh Jain
2018-09-25 12:54 ` [PATCH 3/5] common/dpaax: add library for PA VA translation table Shreyansh Jain
2018-09-25 13:28 ` Burakov, Anatoly
2018-09-25 13:39 ` Shreyansh Jain
2018-09-25 13:51 ` Burakov, Anatoly
2018-09-25 14:00 ` Shreyansh Jain
2018-09-25 14:08 ` Burakov, Anatoly
2018-09-26 10:16 ` Burakov, Anatoly
2018-10-09 10:45 ` Shreyansh Jain
2018-10-11 9:03 ` Burakov, Anatoly
2018-10-11 10:02 ` Shreyansh Jain
2018-10-11 10:07 ` Shreyansh Jain
2018-10-11 10:13 ` Burakov, Anatoly
2018-10-11 10:39 ` Shreyansh Jain
2018-10-11 10:46 ` Burakov, Anatoly
2018-10-11 10:09 ` Burakov, Anatoly
2018-09-25 12:54 ` [PATCH 4/5] dpaa: enable dpaax library Shreyansh Jain
2018-09-25 12:54 ` Shreyansh Jain [this message]
2018-10-09 11:25 ` [PATCH v2 0/5] Add a PA-VA Translation table for DPAAx Shreyansh Jain
2018-10-09 11:25 ` [PATCH v2 1/5] bus/fslmc: fix physical addressing check Shreyansh Jain
2018-10-12 9:01 ` Pavan Nikhilesh
2018-10-12 10:44 ` Shreyansh Jain
2018-10-12 16:29 ` Pavan Nikhilesh
2018-10-09 11:25 ` [PATCH v2 2/5] drivers: common as dependency for bus Shreyansh Jain
2018-10-09 11:25 ` [PATCH v2 3/5] common/dpaax: add library for PA VA translation table Shreyansh Jain
2018-10-09 11:25 ` [PATCH v2 4/5] dpaa: enable dpaax library Shreyansh Jain
2018-10-09 11:25 ` [PATCH v2 5/5] fslmc: " Shreyansh Jain
2018-10-13 12:21 ` [PATCH v3 0/5] Add a PA-VA Translation table for DPAAx Shreyansh Jain
2018-10-13 12:21 ` [PATCH v3 1/5] bus/fslmc: fix physical addressing check Shreyansh Jain
2018-10-13 16:08 ` Pavan Nikhilesh
2018-10-15 6:36 ` Shreyansh Jain
2018-10-13 12:21 ` [PATCH v3 2/5] drivers: common as dependency for bus Shreyansh Jain
2018-10-13 12:21 ` [PATCH v3 3/5] common/dpaax: add library for PA VA translation table Shreyansh Jain
2018-10-13 12:21 ` [PATCH v3 4/5] dpaa: enable dpaax library Shreyansh Jain
2018-10-13 12:21 ` [PATCH v3 5/5] fslmc: " Shreyansh Jain
2018-10-15 6:41 ` [PATCH v4 0/5] Add a PA-VA Translation table for DPAAx Shreyansh Jain
2018-10-15 6:41 ` [PATCH v4 1/5] bus/fslmc: fix physical addressing check Shreyansh Jain
2018-10-15 6:41 ` [PATCH v4 2/5] drivers: common as dependency for bus Shreyansh Jain
2018-10-15 6:42 ` [PATCH v4 3/5] common/dpaax: add library for PA VA translation table Shreyansh Jain
2018-10-15 6:42 ` [PATCH v4 4/5] dpaa: enable dpaax library Shreyansh Jain
2018-10-15 6:42 ` [PATCH v4 5/5] fslmc: " Shreyansh Jain
2018-10-15 12:01 ` [PATCH v5 0/5] Shreyansh Jain
2018-10-15 12:01 ` [PATCH v5 1/5] bus/fslmc: fix physical addressing check Shreyansh Jain
2018-10-16 10:02 ` Thomas Monjalon
2018-10-15 12:01 ` [PATCH v5 2/5] drivers: common as dependency for bus Shreyansh Jain
2018-10-15 12:01 ` [PATCH v5 3/5] common/dpaax: add library for PA VA translation table Shreyansh Jain
2018-10-15 23:17 ` Thomas Monjalon
2018-10-15 12:01 ` [PATCH v5 4/5] dpaa: enable dpaax library Shreyansh Jain
2018-10-15 12:01 ` [PATCH v5 5/5] fslmc: " Shreyansh Jain
2018-10-16 10:18 ` [PATCH v5 0/5] Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180925125423.7505-6-shreyansh.jain@nxp.com \
--to=shreyansh.jain@nxp.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.