Freescale DPAA QBMan Drivers
Subsystems (5)
PATCH 2/11 soc/fsl: Introduce DPAA BMan device management driver
In reply to Roy PledgeFrom: Geoff Thorpe <[email protected]>
This driver enables the Freescale DPAA 1.0 Buffer Manager block. BMan is a hardware buffer pool manager that allows accelerators connected to the SoC datapath to acquire and release buffers during data processing.
--- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/fsl/Kconfig | 5 + drivers/soc/fsl/Makefile | 3 + drivers/soc/fsl/qbman/Kconfig | 33 +++ drivers/soc/fsl/qbman/Makefile | 1 + drivers/soc/fsl/qbman/bman.c | 553 +++++++++++++++++++++++++++++++++++++ drivers/soc/fsl/qbman/bman_priv.h | 53 ++++ drivers/soc/fsl/qbman/dpaa_sys.h | 55 ++++ 9 files changed, 705 insertions(+) create mode 100644 drivers/soc/fsl/Kconfig create mode 100644 drivers/soc/fsl/Makefile create mode 100644 drivers/soc/fsl/qbman/Kconfig create mode 100644 drivers/soc/fsl/qbman/Makefile create mode 100644 drivers/soc/fsl/qbman/bman.c create mode 100644 drivers/soc/fsl/qbman/bman_priv.h create mode 100644 drivers/soc/fsl/qbman/dpaa_sys.h
drivers/soc/Kconfig +1 -0
@@ -1,6 +1,7 @@ menu "SOC (System On Chip) specific Drivers" source "drivers/soc/mediatek/Kconfig" +source "drivers/soc/fsl/Kconfig" source "drivers/soc/qcom/Kconfig" source "drivers/soc/sunxi/Kconfig" source "drivers/soc/ti/Kconfig"
drivers/soc/Makefile +1 -0
@@ -3,6 +3,7 @@ # obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ +obj-$(CONFIG_FSL_SOC) += fsl/ obj-$(CONFIG_ARCH_QCOM) += qcom/ obj-$(CONFIG_ARCH_SUNXI) += sunxi/ obj-$(CONFIG_ARCH_TEGRA) += tegra/
drivers/soc/fsl/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +menu "Freescale SOC (System On Chip) specific Drivers" + +source "drivers/soc/fsl/qbman/Kconfig" + +endmenu
drivers/soc/fsl/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# Common +obj-$(CONFIG_FSL_DPA) += qbman/ +
drivers/soc/fsl/qbman/Kconfig new file +33 -0
@@ -0,0 +1,33 @@ +menuconfig FSL_DPA + bool "Freescale DPAA support" + depends on FSL_SOC || COMPILE_TEST + default n + help + FSL Data-Path Acceleration Architecture drivers + + These are not the actual Ethernet driver(s) + +if FSL_DPA + +config FSL_DPA_CHECKING + bool "additional driver checking" + default n + help + Compiles in additional checks to sanity-check the drivers and + any use of it by other code. Not recommended for performance + +config FSL_DPA_CAN_WAIT + bool + default y + +config FSL_DPA_CAN_WAIT_SYNC + bool + default y + +config FSL_BMAN + tristate "BMan device management" + default n + help + FSL DPAA BMan driver + +endif # FSL_DPA
drivers/soc/fsl/qbman/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_FSL_BMAN) += bman.o
drivers/soc/fsl/qbman/bman.c new file +553 -0
553 lines not on this page · raw message
drivers/soc/fsl/qbman/bman_priv.h new file +53 -0
53 lines not on this page · raw message
drivers/soc/fsl/qbman/dpaa_sys.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 3/11 soc/fsl: Introduce the DPAA BMan portal driver
In reply to Roy PledgeFrom: Geoff Thorpe <[email protected]>
Add support for Freescale DPAA 1.0 Buffer Manager portals. These portals allow software drivers for accelerators connected to the datapath to manage the hardware buffer pools.
--- drivers/soc/fsl/qbman/Kconfig | 18 + drivers/soc/fsl/qbman/Makefile | 6 + drivers/soc/fsl/qbman/bman.c | 1 + drivers/soc/fsl/qbman/bman.h | 542 +++++++++++++++++ drivers/soc/fsl/qbman/bman_api.c | 1048 +++++++++++++++++++++++++++++++++ drivers/soc/fsl/qbman/bman_portal.c | 351 +++++++++++ drivers/soc/fsl/qbman/bman_priv.h | 81 +++ drivers/soc/fsl/qbman/bman_utils.c | 72 +++ drivers/soc/fsl/qbman/dpaa_resource.c | 356 +++++++++++ drivers/soc/fsl/qbman/dpaa_sys.h | 187 ++++++ include/soc/fsl/bman.h | 514 ++++++++++++++++ 11 files changed, 3176 insertions(+) create mode 100644 drivers/soc/fsl/qbman/bman.h create mode 100644 drivers/soc/fsl/qbman/bman_api.c create mode 100644 drivers/soc/fsl/qbman/bman_portal.c create mode 100644 drivers/soc/fsl/qbman/bman_utils.c create mode 100644 drivers/soc/fsl/qbman/dpaa_resource.c create mode 100644 include/soc/fsl/bman.h
drivers/soc/fsl/qbman/Kconfig +18 -0
@@ -24,10 +24,28 @@ config FSL_DPA_CAN_WAIT_SYNC bool default y +config FSL_DPA_PIRQ_FAST + bool + default y + +config FSL_DPA_PIRQ_SLOW + bool + default y + +config FSL_DPA_PORTAL_SHARE + bool + default y + config FSL_BMAN tristate "BMan device management" default n help FSL DPAA BMan driver +config FSL_BMAN_PORTAL + tristate "BMan portal(s)" + default n + help + FSL BMan portal driver + endif # FSL_DPA
drivers/soc/fsl/qbman/Makefile +6 -0
@@ -1 +1,7 @@ +# Common +obj-$(CONFIG_FSL_DPA) += dpaa_resource.o + obj-$(CONFIG_FSL_BMAN) += bman.o +obj-$(CONFIG_FSL_BMAN_PORTAL) += bman-portal.o +bman-portal-y = bman_portal.o bman_api.o \ + bman_utils.o
drivers/soc/fsl/qbman/bman.c +1 -0
@@ -341,6 +341,7 @@ u32 bm_pool_free_buffers(u32 bpid) {return bm_in (POOL_CONTENT (bpid)); } +EXPORT_SYMBOL (bm_pool_free_buffers);static ssize_t show_fbpr_fpc (struct device *dev,struct device_attribute *dev_attr,char *buf)
drivers/soc/fsl/qbman/bman.h new file +542 -0
542 lines not on this page · raw message
drivers/soc/fsl/qbman/bman_api.c new file +1048 -0
1,048 lines not on this page · raw message
drivers/soc/fsl/qbman/bman_portal.c new file +351 -0
351 lines not on this page · raw message
drivers/soc/fsl/qbman/bman_priv.h +81 -0
96 lines not on this page · raw message
drivers/soc/fsl/qbman/bman_utils.c new file +72 -0
72 lines not on this page · raw message
drivers/soc/fsl/qbman/dpaa_resource.c new file +356 -0
356 lines not on this page · raw message
drivers/soc/fsl/qbman/dpaa_sys.h +187 -0
203 lines not on this page · raw message
include/soc/fsl/bman.h new file +514 -0
290 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.9.5
Part of the diff is not shown here. View the raw message.
PATCH 5/11 soc/bman: Add self-tester for BMan driver
In reply to Roy PledgeFrom: Geoff Thorpe <[email protected]>
Add a self test for the DPAA 1.0 Buffer Manager driver. This test ensures that the driver can properly acquire and release buffers using the BMan portal infrastructure.
--- drivers/soc/fsl/qbman/Kconfig | 26 ++++ drivers/soc/fsl/qbman/Makefile | 4 + drivers/soc/fsl/qbman/bman_test.c | 56 +++++++++ drivers/soc/fsl/qbman/bman_test.h | 34 +++++ drivers/soc/fsl/qbman/bman_test_api.c | 184 +++++++++++++++++++++++++++ drivers/soc/fsl/qbman/bman_test_thresh.c | 198 ++++++++++++++++++++++++++++++ drivers/soc/fsl/qbman/dpaa_sys.h | 1 + 7 files changed, 503 insertions(+) create mode 100644 drivers/soc/fsl/qbman/bman_test.c create mode 100644 drivers/soc/fsl/qbman/bman_test.h create mode 100644 drivers/soc/fsl/qbman/bman_test_api.c create mode 100644 drivers/soc/fsl/qbman/bman_test_thresh.c
drivers/soc/fsl/qbman/Kconfig +26 -0
@@ -49,6 +49,32 @@ config FSL_BMAN_PORTAL help FSL BMan portal driver +config FSL_BMAN_TEST + tristate "BMan self-tests" + default n + help + Compile self-test code + +config FSL_BMAN_TEST_API + bool "High-level API self-test" + depends on FSL_BMAN_TEST + default y + help + This requires the presence of cpu-affine portals, and performs + high-level API testing with them (whichever portal(s) are affine + to the cpu(s) the test executes on). + +config FSL_BMAN_TEST_THRESH + bool "Thresholds self-test" + depends on FSL_BMAN_TEST + default y + help + Multi-threaded (SMP) test of BMan pool depletion. A pool is seeded + before multiple threads (one per cpu) create pool objects to track + depletion state changes. The pool is then drained to empty by a + "drainer" thread, and the other threads that they observe exactly + the depletion state changes that are expected. + config FSL_QMAN tristate "QMan device management" default n
drivers/soc/fsl/qbman/Makefile +4 -0
@@ -5,6 +5,10 @@ obj-$(CONFIG_FSL_BMAN) += bman.o obj-$(CONFIG_FSL_BMAN_PORTAL) += bman-portal.o bman-portal-y = bman_portal.o bman_api.o \ bman_utils.o +obj-$(CONFIG_FSL_BMAN_TEST) += bman-test.o +bman-test-y = bman_test.o +bman-test-$(CONFIG_FSL_BMAN_TEST_API) += bman_test_api.o +bman-test-$(CONFIG_FSL_BMAN_TEST_THRESH) += bman_test_thresh.o obj-$(CONFIG_FSL_QMAN) += qman_api.o qman_utils.o qman_driver.o obj-$(CONFIG_FSL_QMAN_CONFIG) += qman.o qman_portal.o
drivers/soc/fsl/qbman/bman_test.c new file +56 -0
56 lines not on this page · raw message
drivers/soc/fsl/qbman/bman_test.h new file +34 -0
@@ -0,0 +1,34 @@ +/* Copyright 2008 - 2015 Freescale Semiconductor, Inc. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* * Neither the name of Freescale Semiconductor nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* ALTERNATIVELY, this software may be distributed under the terms of the +* GNU General Public License ("GPL") as published by the Free Software +* Foundation, either version 2 of that License or (at your option) any +* later version. +* +* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "bman_priv.h" + +void bman_test_api (void ); +void bman_test_thresh (void );
drivers/soc/fsl/qbman/bman_test_api.c new file +184 -0
184 lines not on this page · raw message
drivers/soc/fsl/qbman/bman_test_thresh.c new file +198 -0
198 lines not on this page · raw message
drivers/soc/fsl/qbman/dpaa_sys.h +1 -0
@@ -37,6 +37,7 @@#include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/of_reserved_mem.h> +#include <linux/kthread.h> #include <linux/platform_device.h> #include <linux/ctype.h>
Signature · 1 line
1.7.9.5
PATCH 6/11 soc/qman: Add self-tester for QMan driver
In reply to Roy PledgeFrom: Geoff Thorpe <[email protected]>
Add a self test for the DPAA 1.0 Queue Manager driver. The tests ensure that the driver can properly enqueue and dequeue from frame queues using the QMan portal infrastructure.
--- drivers/soc/fsl/qbman/Kconfig | 26 +- drivers/soc/fsl/qbman/Makefile | 4 + drivers/soc/fsl/qbman/qman_test.c | 57 ++++ drivers/soc/fsl/qbman/qman_test.h | 44 +++ drivers/soc/fsl/qbman/qman_test_api.c | 216 +++++++++++++ drivers/soc/fsl/qbman/qman_test_stash.c | 502 +++++++++++++++++++++++++++++++ 6 files changed, 848 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/fsl/qbman/qman_test.c create mode 100644 drivers/soc/fsl/qbman/qman_test.h create mode 100644 drivers/soc/fsl/qbman/qman_test_api.c create mode 100644 drivers/soc/fsl/qbman/qman_test_stash.c
drivers/soc/fsl/qbman/Kconfig +25 -1
@@ -95,6 +95,30 @@ config FSL_QMAN_CONFIG linux image is running as a guest OS under the hypervisor, only one guest OS ("the control plane") needs this option. +config FSL_QMAN_TEST + tristate "QMan self-tests" + default n + help + Compile self-test code for QMan. + +config FSL_QMAN_TEST_API + bool "QMan high-level self-test" + depends on FSL_QMAN_TEST + default y + help + This requires the presence of cpu-affine portals, and performs + high-level API testing with them (whichever portal(s) are affine to + the cpu(s) the test executes on). + +config FSL_QMAN_TEST_STASH + bool "QMan 'hot potato' data-stashing self-test" + depends on FSL_QMAN_TEST + default y + help + This performs a "hot potato" style test enqueuing/dequeuing a frame + across a series of FQs scheduled to different portals (and cpus), with + DQRR, data and context stashing always on. + config FSL_QMAN_FQD_SZ int "size of Frame Queue Descriptor region" default 10
@@ -137,7 +161,7 @@ config FSL_QMAN_PIRQ_IPERIOD int default 100 -# 64 bit kernel support +# 64-bit kernel support config FSL_QMAN_FQ_LOOKUP bool default n
drivers/soc/fsl/qbman/Makefile +4 -0
@@ -12,3 +12,7 @@ bman-test-$(CONFIG_FSL_BMAN_TEST_THRESH) += bman_test_thresh.o obj-$(CONFIG_FSL_QMAN) += qman_api.o qman_utils.o qman_driver.o obj-$(CONFIG_FSL_QMAN_CONFIG) += qman.o qman_portal.o +obj-$(CONFIG_FSL_QMAN_TEST) += qman-test.o +qman-test-y = qman_test.o +qman-test-$(CONFIG_FSL_QMAN_TEST_API) += qman_test_api.o +qman-test-$(CONFIG_FSL_QMAN_TEST_STASH) += qman_test_stash.o
drivers/soc/fsl/qbman/qman_test.c new file +57 -0
57 lines not on this page · raw message
drivers/soc/fsl/qbman/qman_test.h new file +44 -0
44 lines not on this page · raw message
drivers/soc/fsl/qbman/qman_test_api.c new file +216 -0
216 lines not on this page · raw message
drivers/soc/fsl/qbman/qman_test_stash.c new file +502 -0
502 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 7/11 soc/bman: Add debugfs support for the BMan driver
In reply to Roy PledgeFrom: Geoff Thorpe <[email protected]>
Add debugfs support for querying the state of hardware based Buffer Manager pools used in DPAA 1.0.
--- drivers/soc/fsl/qbman/Kconfig | 7 ++ drivers/soc/fsl/qbman/Makefile | 1 + drivers/soc/fsl/qbman/bman-debugfs.c | 117 ++++++++++++++++++++++++++++++++++ drivers/soc/fsl/qbman/bman_api.c | 19 ++++++ drivers/soc/fsl/qbman/dpaa_sys.h | 7 +- 5 files changed, 145 insertions(+), 6 deletions(-) create mode 100644 drivers/soc/fsl/qbman/bman-debugfs.c
drivers/soc/fsl/qbman/Kconfig +7 -0
@@ -75,6 +75,13 @@ config FSL_BMAN_TEST_THRESH "drainer" thread, and the other threads that they observe exactly the depletion state changes that are expected. +config FSL_BMAN_DEBUGFS + tristate "BMan debugfs support" + depends on DEBUG_FS + default n + help + BMan debugfs support + config FSL_QMAN tristate "QMan device management" default n
drivers/soc/fsl/qbman/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_FSL_BMAN_TEST) += bman-test.o bman-test-y = bman_test.o bman-test-$(CONFIG_FSL_BMAN_TEST_API) += bman_test_api.o bman-test-$(CONFIG_FSL_BMAN_TEST_THRESH) += bman_test_thresh.o +obj-$(CONFIG_FSL_BMAN_DEBUGFS) += bman-debugfs.o obj-$(CONFIG_FSL_QMAN) += qman_api.o qman_utils.o qman_driver.o obj-$(CONFIG_FSL_QMAN_CONFIG) += qman.o qman_portal.o
drivers/soc/fsl/qbman/bman-debugfs.c new file +117 -0
117 lines not on this page · raw message
drivers/soc/fsl/qbman/bman_api.c +19 -0
@@ -1012,6 +1012,25 @@ int bman_flush_stockpile(struct bman_pool *pool, u32 flags) }EXPORT_SYMBOL (bman_flush_stockpile); +int bman_query_pools (struct bm_pool_state *state) +{ +struct bman_portal *p =get_affine_portal (); +struct bm_mc_result *mcr; +__maybe_unused unsigned long irqflags; + +PORTAL_IRQ_LOCK (p, irqflags); +bm_mc_start (&p->p); +bm_mc_commit (&p->p,BM_MCC_VERB_CMD_QUERY ); +while (!(mcr =bm_mc_result (&p->p))) +cpu_relax (); +DPA_ASSERT ((mcr->verb &BM_MCR_VERB_CMD_MASK ) ==BM_MCR_VERB_CMD_QUERY ); + *state = mcr->query; +PORTAL_IRQ_UNLOCK (p, irqflags); +put_affine_portal (); +return 0 ; +} +EXPORT_SYMBOL (bman_query_pools); +#ifdef CONFIG_FSL_BMAN u32 bman_query_free_buffers (struct bman_pool *pool) {
drivers/soc/fsl/qbman/dpaa_sys.h +1 -6
@@ -38,6 +38,7 @@#include <linux/of_irq.h> #include <linux/of_reserved_mem.h> #include <linux/kthread.h> +#include <linux/debugfs.h> #include <linux/platform_device.h> #include <linux/ctype.h>
@@ -76,9 +77,7 @@ int dpaa_resource_reserve(struct dpaa_resource *alloc, u32 base, u32 num);#define DPA_PORTAL_CE 0#define DPA_PORTAL_CI 1 -/***********************/ /* Misc inline assists */ -/***********************/ /* TODO: NB, we currently assume that hwsync() and lwsync() imply compiler * barriers and that dcb*() won't fall victim to compiler or execution
@@ -187,9 +186,7 @@ static inline void copy_bytes(void *dest, const void *src, size_t sz)#define copy_bytes memcpy#endif -/************/ /* RB-trees */ -/************/ /* We encapsulate RB-trees so that its easier to use non-linux forms in * non-linux systems. This also encapsulates the extra plumbing that linux code
@@ -245,9 +242,7 @@ static inline type *name##_find(struct dpa_rbtree *tree, u32 val) \return NULL ; \ } -/************/ /* Bootargs */ -/************/ /* QMan has "qportals=" and BMan has "bportals=", they use the same syntax * though; a comma-separated list of items, each item being a cpu index and/or a
Signature · 1 line
1.7.9.5
PATCH 10/11 soc/qman: Add HOTPLUG_CPU support to the QMan driver
In reply to Roy PledgeFrom: Hai-Ying Wang <[email protected]>
Add support for CPU hotplug for the DPAA 1.0 Queue Manager driver.
--- drivers/soc/fsl/qbman/qman_portal.c | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/soc/fsl/qbman/qman_portal.c +43 -0
@@ -475,6 +475,46 @@ static void qman_offline_cpu(unsigned int cpu) } } +#ifdef CONFIG_HOTPLUG_CPU +static void qman_online_cpu (unsigned int cpu) +{ +struct qman_portal *p; +const struct qm_portal_config *pcfg; + + p = (struct qman_portal *)affine_portals[cpu]; +if (p) { + pcfg =qman_get_qm_portal_config (p); +if (pcfg) { +irq_set_affinity (pcfg->public_cfg.irq,cpumask_of (cpu)); +qman_portal_update_sdest (pcfg, cpu); + } + } +} + +static int qman_hotplug_cpu_callback (struct notifier_block *nfb, +unsigned long action,void *hcpu) +{ +unsigned int cpu = (unsigned long )hcpu; + +switch (action) { +case CPU_ONLINE : +case CPU_ONLINE_FROZEN : +qman_online_cpu (cpu); +break ; +case CPU_DOWN_PREPARE : +case CPU_DOWN_PREPARE_FROZEN : +qman_offline_cpu (cpu); +default : +break ; + } +return NOTIFY_OK ; +} + +static struct notifier_block qman_hotplug_cpu_notifier = { + .notifier_call = qman_hotplug_cpu_callback, +}; +#endif /* CONFIG_HOTPLUG_CPU */ +__init int qman_init (void ) {struct cpumask slave_cpus;
@@ -598,6 +638,9 @@ __init int qman_init(void)cpumask_andnot (&offline_cpus, cpu_possible_mask, cpu_online_mask);for_each_cpu (cpu, &offline_cpus)qman_offline_cpu (cpu); +#ifdef CONFIG_HOTPLUG_CPU +register_hotcpu_notifier (&qman_hotplug_cpu_notifier); +#endif return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 11/11 soc/qman: add qman_delete_cgr_safe()
In reply to Roy PledgeFrom: Madalin Bucur <[email protected]>
Add qman_delete_cgr_safe() that can be called from any CPU. This in turn schedules qman_delete_cgr() on the proper CPU.
--- drivers/soc/fsl/qbman/qman_api.c | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
drivers/soc/fsl/qbman/qman_api.c +46 -0
@@ -2459,6 +2459,8 @@ EXPORT_SYMBOL(qman_modify_cgr); QM_CHANNEL_SWPORTAL0))#define PORTAL_IDX (n) (n->config->public_cfg.channel - QM_CHANNEL_SWPORTAL0) +static u8 qman_cgr_cpus[__CGR_NUM]; +int qman_create_cgr (struct qman_cgr *cgr,u32 flags,struct qm_mcc_initcgr *opts) {
@@ -2475,7 +2477,10 @@ int qman_create_cgr(struct qman_cgr *cgr, u32 flags,if (cgr->cgrid >= __CGR_NUM)return -EINVAL ; +preempt_disable (); p =get_affine_portal (); + qman_cgr_cpus[cgr->cgrid] =smp_processor_id (); +preempt_enable ();memset (&local_opts,0 ,sizeof (struct qm_mcc_initcgr )); cgr->chan = p->config->public_cfg.channel;
@@ -2617,6 +2622,47 @@ put_portal: }EXPORT_SYMBOL (qman_delete_cgr); +struct cgr_comp { +struct qman_cgr *cgr; +struct completion completion; +}; + +static int qman_delete_cgr_thread (void *p) +{ +struct cgr_comp *cgr_comp = (struct cgr_comp *)p; +int res; + + res =qman_delete_cgr ((struct qman_cgr *)cgr_comp->cgr); +complete (&cgr_comp->completion); + +return res; +} + +void qman_delete_cgr_safe (struct qman_cgr *cgr) +{ +struct task_struct *thread; +struct cgr_comp cgr_comp; + +preempt_disable (); +if (qman_cgr_cpus[cgr->cgrid] !=smp_processor_id ()) { +init_completion (&cgr_comp.completion); + cgr_comp.cgr = cgr; + thread =kthread_create (qman_delete_cgr_thread, &cgr_comp, +"cgr_del" ); + +if (likely (!IS_ERR (thread))) { +kthread_bind (thread, qman_cgr_cpus[cgr->cgrid]); +wake_up_process (thread); +wait_for_completion (&cgr_comp.completion); +preempt_enable (); +return ; + } + } +qman_delete_cgr (cgr); +preempt_enable (); +} +EXPORT_SYMBOL (qman_delete_cgr_safe); +int qman_set_wpm (int wpm_enable) {return qm_set_wpm (wpm_enable);
Signature · 1 line
1.7.9.5
PATCH 1/11 powerpc: re-add devm_ioremap_prot()
In reply to Roy PledgeFrom: Emil Medve <[email protected]>
devm_ioremap_prot() was removed in commit dedd24a12, and was introduced in commit b41e5fffe8.
This reverts commit dedd24a12fe6735898feeb06184ee346907abb5d.
--- arch/powerpc/include/asm/io.h | 3 +++ arch/powerpc/lib/Makefile | 1 + arch/powerpc/lib/devres.c | 43 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 arch/powerpc/lib/devres.c
arch/powerpc/include/asm/io.h +3 -0
@@ -855,6 +855,9 @@ static inline void * bus_to_virt(unsigned long address)#define clrsetbits_8 (addr, clear, set) clrsetbits(8, addr, clear, set) +void __iomem *devm_ioremap_prot (struct device *dev,resource_size_t offset, +size_t size,unsigned long flags); +#endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_IO_H */
arch/powerpc/lib/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-y += string.o alloc.o crtsavres.o ppc_ksyms.o code-patching.o \ feature-fixups.o obj-$(CONFIG_PPC32) += div64.o copy_32.o +obj-$(CONFIG_HAS_IOMEM) += devres.o obj64-y += copypage_64.o copyuser_64.o usercopy_64.o mem_64.o hweight_64.o \ copyuser_power7.o string_64.o copypage_power7.o memcpy_power7.o \
arch/powerpc/lib/devres.c new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 8/11 soc/qman: Add debugfs support for the QMan driver
In reply to Roy PledgeFrom: Geoff Thorpe <[email protected]>
Add debugfs sypport for querying the state of hardware based queues managed by the DPAA 1.0 Queue Manager.
--- drivers/soc/fsl/qbman/Kconfig | 7 + drivers/soc/fsl/qbman/Makefile | 1 + drivers/soc/fsl/qbman/dpaa_sys.h | 2 + drivers/soc/fsl/qbman/qman-debugfs.c | 1313 ++++++++++++++++++++++++++++++++++ drivers/soc/fsl/qbman/qman_api.c | 60 +- drivers/soc/fsl/qbman/qman_priv.h | 8 + 6 files changed, 1389 insertions(+), 2 deletions(-) create mode 100644 drivers/soc/fsl/qbman/qman-debugfs.c
drivers/soc/fsl/qbman/Kconfig +7 -0
@@ -126,6 +126,13 @@ config FSL_QMAN_TEST_STASH across a series of FQs scheduled to different portals (and cpus), with DQRR, data and context stashing always on. +config FSL_QMAN_DEBUGFS + tristate "QMan debugfs support" + depends on DEBUG_FS + default n + help + QMan debugfs support + config FSL_QMAN_FQD_SZ int "size of Frame Queue Descriptor region" default 10
drivers/soc/fsl/qbman/Makefile +1 -0
@@ -17,3 +17,4 @@ obj-$(CONFIG_FSL_QMAN_TEST) += qman-test.o qman-test-y = qman_test.o qman-test-$(CONFIG_FSL_QMAN_TEST_API) += qman_test_api.o qman-test-$(CONFIG_FSL_QMAN_TEST_STASH) += qman_test_stash.o +obj-$(CONFIG_FSL_QMAN_DEBUGFS) += qman-debugfs.o
drivers/soc/fsl/qbman/dpaa_sys.h +2 -0
@@ -38,7 +38,9 @@#include <linux/of_irq.h> #include <linux/of_reserved_mem.h> #include <linux/kthread.h> +#include <linux/uaccess.h> #include <linux/debugfs.h> +#include <linux/vmalloc.h> #include <linux/platform_device.h> #include <linux/ctype.h>
drivers/soc/fsl/qbman/qman-debugfs.c new file +1313 -0
1,313 lines not on this page · raw message
drivers/soc/fsl/qbman/qman_api.c +58 -2
79 lines not on this page · raw message
drivers/soc/fsl/qbman/qman_priv.h +8 -0
@@ -159,6 +159,14 @@ struct qman_portal *qman_create_affine_slave(struct qman_portal *redirect,const struct qm_portal_config *qman_destroy_affine_portal (void );void qman_destroy_portal (struct qman_portal *qm); +/* This CGR feature is supported by h/w and required by unit-tests and the +* debugfs hooks, so is implemented in the driver. However it allows an explicit +* corruption of h/w fields by s/w that are usually incorruptible (because the +* counters are usually maintained entirely within h/w). As such, we declare +* this API internally. */ +int qman_testwrite_cgr (struct qman_cgr *cgr,u64 i_bcnt, +struct qm_mcr_cgrtestwrite *result); +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP /* If the fq object pointer is greater than the size of context_b field, * than a lookup table is required. */
Signature · 1 line
1.7.9.5
PATCH 9/11 soc/bman: Add HOTPLUG_CPU support to the BMan driver
In reply to Roy PledgeFrom: Hai-Ying Wang <[email protected]>
Add support for CPU hotplug for the DPAA 1.0 Buffer Manager driver
--- drivers/soc/fsl/qbman/bman_portal.c | 40 +++++++++++++++++++++++++++++++++++ drivers/soc/fsl/qbman/dpaa_sys.h | 3 +++ 2 files changed, 43 insertions(+)
drivers/soc/fsl/qbman/bman_portal.c +40 -0
@@ -129,6 +129,42 @@ static void __cold bman_offline_cpu(unsigned int cpu) } } +#ifdef CONFIG_HOTPLUG_CPU +static void __cold bman_online_cpu (unsigned int cpu) +{ +struct bman_portal *p = (struct bman_portal *)affine_bportals[cpu]; +const struct bm_portal_config *pcfg; + +if (p) { + pcfg =bman_get_bm_portal_config (p); +if (pcfg) +irq_set_affinity (pcfg->public_cfg.irq,cpumask_of (cpu)); + } +} + +static int __cold bman_hotplug_cpu_callback (struct notifier_block *nfb, +unsigned long action,void *hcpu) +{ +unsigned int cpu = (unsigned long )hcpu; + +switch (action) { +case CPU_ONLINE : +case CPU_ONLINE_FROZEN : +bman_online_cpu (cpu); +break ; +case CPU_DOWN_PREPARE : +case CPU_DOWN_PREPARE_FROZEN : +bman_offline_cpu (cpu); + } + +return NOTIFY_OK ; +} + +static struct notifier_block bman_hotplug_cpu_notifier = { + .notifier_call = bman_hotplug_cpu_callback, +}; +#endif /* CONFIG_HOTPLUG_CPU */ +static int __cold bman_portal_probe (struct platform_device *of_dev) {struct device *dev = &of_dev->dev;
@@ -342,6 +378,10 @@ static int __init bman_portal_driver_register(struct platform_driver *drv)for_each_cpu (cpu, &offline_cpus)bman_offline_cpu (cpu); +#ifdef CONFIG_HOTPLUG_CPU +register_hotcpu_notifier (&bman_hotplug_cpu_notifier); +#endif +bman_seed_bpid_range (0 , bman_pool_max);return 0 ;
drivers/soc/fsl/qbman/dpaa_sys.h +3 -0
@@ -43,6 +43,9 @@#include <linux/vmalloc.h> #include <linux/platform_device.h> #include <linux/ctype.h> +#ifdef CONFIG_HOTPLUG_CPU +#include <linux/cpu.h> +#endif #include <asm/pgtable.h>
Signature · 1 line
1.7.9.5
cover Freescale DPAA QBMan Drivers
The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators.
The Queue Manager (QMan) is a hardware queue management block that allows software and accelerators on the datapath to enqueue and dequeue frames in order to communicate.
The Buffer Manager (BMan) is a hardware buffer pool management block that allows software and accelerators on the datapath to acquire and release buffers in order to build frames.
This patch set introduces the QBMan driver code that configures initializes the QBMan hardware and provides APIs for software to use the frame queues and buffer pools the blocks provide. These drivers provide the base fuctionality for software to communicate with the other DPAA accelerators on Freescale QorIQ processors.
Emil Medve (1):
powerpc: re-add devm_ioremap_prot()
Geoff Thorpe (7):
soc/fsl: Introduce DPAA BMan device management driver soc/fsl: Introduce the DPAA BMan portal driver soc/fsl: Introduce drivers for the DPAA QMan soc/bman: Add self-tester for BMan driver soc/qman: Add self-tester for QMan driver soc/bman: Add debugfs support for the BMan driver soc/qman: Add debugfs support for the QMan driver
Hai-Ying Wang (2):
soc/bman: Add HOTPLUG_CPU support to the BMan driver soc/qman: Add HOTPLUG_CPU support to the QMan driver
Madalin Bucur (1):
soc/qman: add qman_delete_cgr_safe()
arch/powerpc/include/asm/io.h | 3 + arch/powerpc/lib/Makefile | 1 + arch/powerpc/lib/devres.c | 43 + arch/powerpc/platforms/85xx/corenet_generic.c | 16 + arch/powerpc/platforms/85xx/p1023_rdb.c | 14 + drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/fsl/Kconfig | 5 + drivers/soc/fsl/Makefile | 3 + drivers/soc/fsl/qbman/Kconfig | 192 ++ drivers/soc/fsl/qbman/Makefile | 20 + drivers/soc/fsl/qbman/bman-debugfs.c | 117 + drivers/soc/fsl/qbman/bman.c | 554 +++++ drivers/soc/fsl/qbman/bman.h | 542 +++++ drivers/soc/fsl/qbman/bman_api.c | 1070 +++++++++ drivers/soc/fsl/qbman/bman_portal.c | 391 ++++ drivers/soc/fsl/qbman/bman_priv.h | 134 ++ drivers/soc/fsl/qbman/bman_test.c | 56 + drivers/soc/fsl/qbman/bman_test.h | 34 + drivers/soc/fsl/qbman/bman_test_api.c | 184 ++ drivers/soc/fsl/qbman/bman_test_thresh.c | 198 ++ drivers/soc/fsl/qbman/bman_utils.c | 72 + drivers/soc/fsl/qbman/dpaa_resource.c | 359 +++ drivers/soc/fsl/qbman/dpaa_sys.h | 301 +++ drivers/soc/fsl/qbman/qman-debugfs.c | 1313 +++++++++++ drivers/soc/fsl/qbman/qman.c | 1015 +++++++++ drivers/soc/fsl/qbman/qman.h | 1128 ++++++++++ drivers/soc/fsl/qbman/qman_api.c | 2917 +++++++++++++++++++++++++ drivers/soc/fsl/qbman/qman_driver.c | 83 + drivers/soc/fsl/qbman/qman_portal.c | 673 ++++++ drivers/soc/fsl/qbman/qman_priv.h | 290 +++ drivers/soc/fsl/qbman/qman_test.c | 57 + drivers/soc/fsl/qbman/qman_test.h | 44 + drivers/soc/fsl/qbman/qman_test_api.c | 216 ++ drivers/soc/fsl/qbman/qman_test_stash.c | 502 +++++ drivers/soc/fsl/qbman/qman_utils.c | 305 +++ include/soc/fsl/bman.h | 514 +++++ include/soc/fsl/qman.h | 1968 +++++++++++++++++ 38 files changed, 15336 insertions(+) create mode 100644 arch/powerpc/lib/devres.c create mode 100644 drivers/soc/fsl/Kconfig create mode 100644 drivers/soc/fsl/Makefile create mode 100644 drivers/soc/fsl/qbman/Kconfig create mode 100644 drivers/soc/fsl/qbman/Makefile create mode 100644 drivers/soc/fsl/qbman/bman-debugfs.c create mode 100644 drivers/soc/fsl/qbman/bman.c create mode 100644 drivers/soc/fsl/qbman/bman.h create mode 100644 drivers/soc/fsl/qbman/bman_api.c create mode 100644 drivers/soc/fsl/qbman/bman_portal.c create mode 100644 drivers/soc/fsl/qbman/bman_priv.h create mode 100644 drivers/soc/fsl/qbman/bman_test.c create mode 100644 drivers/soc/fsl/qbman/bman_test.h create mode 100644 drivers/soc/fsl/qbman/bman_test_api.c create mode 100644 drivers/soc/fsl/qbman/bman_test_thresh.c create mode 100644 drivers/soc/fsl/qbman/bman_utils.c create mode 100644 drivers/soc/fsl/qbman/dpaa_resource.c create mode 100644 drivers/soc/fsl/qbman/dpaa_sys.h create mode 100644 drivers/soc/fsl/qbman/qman-debugfs.c create mode 100644 drivers/soc/fsl/qbman/qman.c create mode 100644 drivers/soc/fsl/qbman/qman.h create mode 100644 drivers/soc/fsl/qbman/qman_api.c create mode 100644 drivers/soc/fsl/qbman/qman_driver.c create mode 100644 drivers/soc/fsl/qbman/qman_portal.c create mode 100644 drivers/soc/fsl/qbman/qman_priv.h create mode 100644 drivers/soc/fsl/qbman/qman_test.c create mode 100644 drivers/soc/fsl/qbman/qman_test.h create mode 100644 drivers/soc/fsl/qbman/qman_test_api.c create mode 100644 drivers/soc/fsl/qbman/qman_test_stash.c create mode 100644 drivers/soc/fsl/qbman/qman_utils.c create mode 100644 include/soc/fsl/bman.h create mode 100644 include/soc/fsl/qman.h
--
1.7.9.5
PATCH 4/11 soc/fsl: Introduce drivers for the DPAA QMan
From: Geoff Thorpe <[email protected]>
This driver enables the Freescale DPAA 1.0 Queue Manager block. QMan is hardware queue manager that allows accelerators connected to the SoC datapath to enqueue and dequeue frames to hardware queues, allowing data exchange between software and accelerators.
--- arch/powerpc/platforms/85xx/corenet_generic.c | 16 + arch/powerpc/platforms/85xx/p1023_rdb.c | 14 + drivers/soc/fsl/qbman/Kconfig | 77 + drivers/soc/fsl/qbman/Makefile | 3 + drivers/soc/fsl/qbman/bman_api.c | 5 +- drivers/soc/fsl/qbman/dpaa_resource.c | 7 +- drivers/soc/fsl/qbman/dpaa_sys.h | 60 +- drivers/soc/fsl/qbman/qman.c | 1015 +++++++++ drivers/soc/fsl/qbman/qman.h | 1128 ++++++++++ drivers/soc/fsl/qbman/qman_api.c | 2815 +++++++++++++++++++++++++ drivers/soc/fsl/qbman/qman_driver.c | 83 + drivers/soc/fsl/qbman/qman_portal.c | 630 ++++++ drivers/soc/fsl/qbman/qman_priv.h | 282 +++ drivers/soc/fsl/qbman/qman_utils.c | 305 +++ include/soc/fsl/qman.h | 1968 +++++++++++++++++ 15 files changed, 8404 insertions(+), 4 deletions(-) create mode 100644 drivers/soc/fsl/qbman/qman.c create mode 100644 drivers/soc/fsl/qbman/qman.h create mode 100644 drivers/soc/fsl/qbman/qman_api.c create mode 100644 drivers/soc/fsl/qbman/qman_driver.c create mode 100644 drivers/soc/fsl/qbman/qman_portal.c create mode 100644 drivers/soc/fsl/qbman/qman_priv.h create mode 100644 drivers/soc/fsl/qbman/qman_utils.c create mode 100644 include/soc/fsl/qman.h
arch/powerpc/platforms/85xx/corenet_generic.c +16 -0
@@ -203,6 +203,21 @@ static int __init corenet_generic_probe(void)return 0 ; } +/* Early setup is required for large chunks of contiguous (and coarsely-aligned) +* memory. The following shoe-horns QMan "init_early" calls into the +* platform setup to let them parse their CCSR nodes early on. +*/ +#ifdef CONFIG_FSL_QMAN_CONFIG +void __init qman_init_early (void ); +#endif + +__init void corenet_ds_init_early (void ) +{ +#ifdef CONFIG_FSL_QMAN_CONFIG +qman_init_early (); +#endif +} +define_machine (corenet_generic) { .name = "CoreNet Generic", .probe = corenet_generic_probe,
@@ -221,6 +236,7 @@ define_machine(corenet_generic) {#else .power_save = e500_idle, #endif + .init_early = corenet_ds_init_early, };machine_arch_initcall (corenet_generic, corenet_gen_publish_devices);
arch/powerpc/platforms/85xx/p1023_rdb.c +14 -0
@@ -103,7 +103,20 @@ static int __init p1023_rdb_probe(void)unsigned long root =of_get_flat_dt_root ();return of_flat_dt_is_compatible (root,"fsl,P1023RDB" ); +} + +/* Early setup is required for large chunks of contiguous (and coarsely-aligned) +* memory. The following shoe-horns QMan "init_early" calls into the +* platform setup to let them parse their CCSR nodes early on. */ +#ifdef CONFIG_FSL_QMAN_CONFIG +void __init qman_init_early (void ); +#endif +static __init void p1023_rdb_init_early (void ) +{ +#ifdef CONFIG_FSL_QMAN_CONFIG +qman_init_early (); +#endif }define_machine (p1023_rdb) {
@@ -119,4 +132,5 @@ define_machine(p1023_rdb) { .pcibios_fixup_bus = fsl_pcibios_fixup_bus, .pcibios_fixup_phb = fsl_pcibios_fixup_phb, #endif + .init_early = p1023_rdb_init_early, };
drivers/soc/fsl/qbman/Kconfig +77 -0
87 lines not on this page · raw message
drivers/soc/fsl/qbman/Makefile +3 -0
@@ -5,3 +5,6 @@ obj-$(CONFIG_FSL_BMAN) += bman.o obj-$(CONFIG_FSL_BMAN_PORTAL) += bman-portal.o bman-portal-y = bman_portal.o bman_api.o \ bman_utils.o + +obj-$(CONFIG_FSL_QMAN) += qman_api.o qman_utils.o qman_driver.o +obj-$(CONFIG_FSL_QMAN_CONFIG) += qman.o qman_portal.o
drivers/soc/fsl/qbman/bman_api.c +4 -1
@@ -64,6 +64,9 @@ struct bman_portal {u8 alloced; }; +/* For an explanation of the locking, redirection, or affine-portal logic, +* please consult the QMan driver for details. This is the same, only simpler +* (no fiddly QMan-specific bits.) */ #ifdef CONFIG_FSL_DPA_PORTAL_SHARE #define PORTAL_IRQ_LOCK (p, irqflags) \ do { \
@@ -172,7 +175,7 @@ static void depletion_unlink(struct bman_pool *pool)PORTAL_IRQ_UNLOCK (pool->portal, irqflags); } -/* In the case that the application's core loop calls +/* In the case that the application's core loop calls qman_poll() and * bman_poll(), we ought to balance how often we incur the overheads of the * slow-path poll. We'll use two decrementer sources. The idle decrementer * constant is used when the last slow-poll detected no work to do, and the busy
drivers/soc/fsl/qbman/dpaa_resource.c +5 -2
@@ -28,7 +28,10 @@* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if defined(CONFIG_FSL_BMAN_PORTAL ) || defined(CONFIG_FSL_BMAN_PORTAL_MODULE ) +#if defined(CONFIG_FSL_BMAN_PORTAL ) || \ + defined(CONFIG_FSL_BMAN_PORTAL_MODULE ) || \ + defined(CONFIG_FSL_QMAN_PORTAL ) || \ + defined(CONFIG_FSL_QMAN_PORTAL_MODULE )#include "dpaa_sys.h" /* The allocator is a (possibly-empty) list of these */
@@ -353,4 +356,4 @@ u32 dpaa_resource_release(struct dpaa_resource *alloc, return total_invalid; }EXPORT_SYMBOL (dpaa_resource_release); -#endif /* CONFIG_FSL_BMAN_PORTAL* */ +#endif /* CONFIG_FSL_*MAN_PORTAL* */
drivers/soc/fsl/qbman/dpaa_sys.h +59 -1
69 lines not on this page · raw message
drivers/soc/fsl/qbman/qman.c new file +1015 -0
1,015 lines not on this page · raw message
drivers/soc/fsl/qbman/qman.h new file +1128 -0
1,128 lines not on this page · raw message
drivers/soc/fsl/qbman/qman_api.c new file +2815 -0
609 lines not on this page · raw message
drivers/soc/fsl/qbman/qman_driver.c new file +83 -0
83 lines not on this page · raw message
drivers/soc/fsl/qbman/qman_portal.c new file +630 -0
630 lines not on this page · raw message
drivers/soc/fsl/qbman/qman_priv.h new file +282 -0
282 lines not on this page · raw message
drivers/soc/fsl/qbman/qman_utils.c new file +305 -0
305 lines not on this page · raw message
include/soc/fsl/qman.h new file +1968 -0
1,968 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.9.5
Part of the diff is not shown here. View the raw message.
Re: [PATCH 02/11] soc/fsl: Introduce DPAA BMan device management driver
In reply to Roy Pledgedrivers/soc/fsl/qbman/Kconfig line 3
Quoted 6 lines · Roy Pledge
drivers/soc/fsl/qbman/Kconfig new file +3
-0@@ -0,0 +1,33 @@ +menuconfig FSL_DPA + bool "Freescale DPAA support" + depends on FSL_SOC || COMPILE_TEST
Are you sure about COMPILE_TEST?
Quoted 7 lines
drivers/soc/fsl/qbman/Kconfig new file +7
-0+ default n + help + FSL Data-Path Acceleration Architecture drivers + + These are not the actual Ethernet driver(s) + +if FSL_DPA
[...]
drivers/soc/fsl/qbman/Kconfig line 33
Quoted 7 lines
drivers/soc/fsl/qbman/Kconfig new file +7
-0+config FSL_BMAN + tristate "BMan device management" + default n + help + FSL DPAA BMan driver + +endif # FSL_DPA
Because with FSL_BMAN set to 'm' testing things with
make -C ../../../.. M=$PWD bman.ko
will not actually compile on x86_64:
make: Entering directory '[...]'
CC [M] [...]/drivers/soc/fsl/qbman/bman.o
In file included from [...]/drivers/soc/fsl/qbman/bman_priv.h:33:0,
from [...]/drivers/soc/fsl/qbman/bman.c:31:
[...]/drivers/soc/fsl/qbman/dpaa_sys.h: In function ‘mfatb’:
[...]/drivers/soc/fsl/qbman/dpaa_sys.h:134:8: error: implicit declaration of function ‘mfspr’ [-Werror=implicit-function-declaration]
hi = mfspr(SPRN_ATBU);
^
[...]/drivers/soc/fsl/qbman/dpaa_sys.h:134:14: error: ‘SPRN_ATBU’ undeclared (first use in this function)
hi = mfspr(SPRN_ATBU);
^
[...]/drivers/soc/fsl/qbman/dpaa_sys.h:134:14: note: each undeclared identifier is reported only once for each function it appears in
[...]/drivers/soc/fsl/qbman/dpaa_sys.h:135:14: error: ‘SPRN_ATBL’ undeclared (first use in this function)
lo = mfspr(SPRN_ATBL);
^
[...]/drivers/soc/fsl/qbman/bman.c: In function ‘__bm_in’:
[...]/drivers/soc/fsl/qbman/bman.c:168:9: error: implicit declaration of function ‘in_be32’ [-Werror=implicit-function-declaration]
return in_be32((void *)bm + offset);
^[...]/drivers/soc/fsl/qbman/bman.c: In function ‘__bm_out’:
[...]/drivers/soc/fsl/qbman/bman.c:172:2: error: implicit declaration of function ‘out_be32’ [-Werror=implicit-function-declaration]
out_be32((void *)bm + offset, val);
^
[...]/drivers/soc/fsl/qbman/bman.c: In function ‘of_fsl_bman_probe’:
[...]/drivers/soc/fsl/qbman/bman.c:463:17: error: ‘NO_IRQ’ undeclared (first use in this function)
if (err_irq == NO_IRQ) {
^cc1: some warnings being treated as errorsscripts/Makefile.build:264: recipe for target '[...]/drivers/soc/fsl/qbman/bman.o' failed make[1]: *** [[...]/drivers/soc/fsl/qbman/bman.o] Error 1
Makefile:1568: recipe for target 'bman.ko' failed
make: *** [bman.ko] Error 2
make: Leaving directory '[...]'
Thanks,
Paul Bolle
Re: [PATCH 02/11] soc/fsl: Introduce DPAA BMan device management driver
In reply to Roy Pledgedrivers/soc/fsl/qbman/Kconfig line 3
Quoted 6 lines · Roy Pledge
drivers/soc/fsl/qbman/Kconfig new file +3
-0+menuconfig FSL_DPA + bool "Freescale DPAA support" + depends on FSL_SOC || COMPILE_TEST
(I already commented on COMPILE_TEST in a separate mail.)
Quoted 4 lines
drivers/soc/fsl/qbman/Kconfig new file +4
-0+ default n + help + FSL Data-Path Acceleration Architecture drivers +
drivers/soc/fsl/qbman/Kconfig line 17
Quoted 10 lines
drivers/soc/fsl/qbman/Kconfig new file +10
-0+ These are not the actual Ethernet driver(s) + +if FSL_DPA + +config FSL_DPA_CHECKING + bool "additional driver checking" + default n + help + Compiles in additional checks to sanity-check the drivers and + any use of it by other code. Not recommended for performance
Only recommended for people that are certain none of the 100+ asserts will ever trigger. See below.
drivers/soc/fsl/qbman/Kconfig line 25
Quoted 7 lines
drivers/soc/fsl/qbman/Kconfig new file +7
-0+config FSL_DPA_CAN_WAIT + bool + default y + +config FSL_DPA_CAN_WAIT_SYNC + bool + default y
Both these aren't actually used in this patch. The first patch that uses them is 3/11.
Besides, the way these two symbols are implemented makes them function as aliases for FSL_DPA. So why are they needed?
drivers/soc/fsl/qbman/Kconfig line 31
Quoted 5 lines
drivers/soc/fsl/qbman/Kconfig new file +5
-0+config FSL_BMAN + tristate "BMan device management" + default n + help + FSL DPAA BMan driver
(Will readers know what BMan means?)
Quoted 9 lines
drivers/soc/fsl/qbman/Kconfig new file +1
-0+endif # FSL_DPAdrivers/soc/fsl/qbman/Makefile new file +1
-0+obj-$(CONFIG_FSL_BMAN) += bman.o
drivers/soc/fsl/qbman/bman.c line 265
Quoted 10 lines
drivers/soc/fsl/qbman/bman.c new file +9
-0+int bm_pool_set (u32 bpid,const u32 *thresholds) +{ +if (!bm) +return -ENODEV ; +bm_set_pool (bm, bpid, thresholds[0 ], thresholds[1 ], + thresholds[2 ], thresholds[3 ]); +return 0 ; +} +EXPORT_SYMBOL (bm_pool_set);
Nit: the first (caller of this function and) user of this export is added in 3/11.
I couldn't find a MODULE_LICENSE() in bman.c. So building this as a module and loading that module will generate a warning and taint the kernel.
drivers/soc/fsl/qbman/dpaa_sys.h line 48
Quoted 11 lines
drivers/soc/fsl/qbman/dpaa_sys.h new file +8
-0+#ifdef CONFIG_FSL_DPA_CHECKING +#define DPA_ASSERT (x) \ + do { \ + if (!(x)) { \ + pr_crit("ASSERT: (%s:%d) %s\n", __FILE__, __LINE__, \ + __stringify_1(x)); \ + dump_stack(); \ + panic("assertion failure"); \
Not my call, but why panic() here?
drivers/soc/fsl/qbman/dpaa_sys.h line 53
Quoted 5 lines
drivers/soc/fsl/qbman/dpaa_sys.h new file +5
-0+ } \ + } while (0) +#else +#define DPA_ASSERT (x) +#endif
Thanks,
Paul Bolle
Re: [PATCH 03/11] soc/fsl: Introduce the DPAA BMan portal driver
In reply to Roy Pledgedrivers/soc/fsl/qbman/Kconfig config FSL_DPA_CAN_WAIT_SYNC · line 29
Quoted 6 lines · Roy Pledge
drivers/soc/fsl/qbman/Kconfig +3
-0+config FSL_DPA_PIRQ_FAST + bool + default y
First used in 04/11.
drivers/soc/fsl/qbman/Kconfig config FSL_DPA_CAN_WAIT_SYNC · line 37
Quoted 7 lines
drivers/soc/fsl/qbman/Kconfig +7
-0+config FSL_DPA_PIRQ_SLOW + bool + default y + +config FSL_DPA_PORTAL_SHARE + bool + default y
As in 02/11: these three symbols function as aliases for FSL_DPA. Why are they needed?
Quoted 14 lines
config
FSL_BMANdrivers/soc/fsl/qbman/Kconfig +5
-0tristate "BMan device management" default n help FSL DPAA BMan driver +config FSL_BMAN_PORTAL + tristate "BMan portal(s)" + default n + help + FSL BMan portal driver
drivers/soc/fsl/qbman/bman_api.c line 45
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +3
-0+struct bman_portal { + [...] +#ifdef CONFIG_FSL_DPA_CAN_WAIT_SYNC
This check will always evaluate to true, right? (I'll only report this once.)
drivers/soc/fsl/qbman/bman_api.c
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +1
-0+struct bman_pool *rcri_owned;/* only 1 release WAIT_SYNC at a time */
drivers/soc/fsl/qbman/bman_api.c new file +2
-0+#endif +#ifdef CONFIG_FSL_DPA_PORTAL_SHARE
Ditto.
drivers/soc/fsl/qbman/bman_api.c line 94
Quoted 11 lines
drivers/soc/fsl/qbman/bman_api.c new file +10
-0+raw_spinlock_t sharing_lock;/* only used if is_shared */ +int is_shared; +struct bman_portal *sharing_redirect; +#endif + [...] +}; +const struct bman_portal_config *bman_get_portal_config (void ) +{ + [...] +}
I couldn't find callers of this function.
Quoted 1 line
+EXPORT_SYMBOL(bman_get_portal_config);
Nor users of this export, obviously.
drivers/soc/fsl/qbman/bman_api.c line 484
Quoted 5 lines
drivers/soc/fsl/qbman/bman_api.c new file +5
-0+ +u32 bman_irqsource_get (void ) +{ + [...] +}
Ditto.
Quoted 1 line
+EXPORT_SYMBOL(bman_irqsource_get);
Ditto.
drivers/soc/fsl/qbman/bman_api.c line 501
Quoted 5 lines
drivers/soc/fsl/qbman/bman_api.c new file +5
-0+int bman_p_irqsource_add (struct bman_portal *p,__maybe_unused u32 bits) +{ + [...] +} +EXPORT_SYMBOL (bman_p_irqsource_add);
There seem to be no users of this export.
drivers/soc/fsl/qbman/bman_api.c line 510
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +4
-0+int bman_irqsource_add (__maybe_unused u32 bits) +{ + [...] +}
Unused.
Quoted 1 line
+EXPORT_SYMBOL(bman_irqsource_add);
Ditto.
drivers/soc/fsl/qbman/bman_api.c line 523
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +4
-0+int bman_irqsource_remove (u32 bits) +{ + [...] +}
Ditto.
Quoted 1 line
+EXPORT_SYMBOL(bman_irqsource_remove);
Ditto.
drivers/soc/fsl/qbman/bman_api.c line 568
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +4
-0+u32 bman_poll_slow (void ) +{ + [...] +}
Ditto.
Quoted 1 line
+EXPORT_SYMBOL(bman_poll_slow);
Ditto.
drivers/soc/fsl/qbman/bman_api.c line 591
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +4
-0+void bman_poll (void ) +{ + [...] +}
Ditto.
Quoted 1 line
+EXPORT_SYMBOL(bman_poll);
Ditto.
drivers/soc/fsl/qbman/bman_api.c
Quoted 2 lines
drivers/soc/fsl/qbman/bman_api.c new file +2
-0+static inline struct bm_rcr_entry *try_rel_start (struct bman_portal **p, +#ifdef CONFIG_FSL_DPA_CAN_WAIT
Always true, right?
drivers/soc/fsl/qbman/bman_api.c line 722
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +4
-0+ __maybe_unused struct bman_pool *pool, +#endif +__maybe_unused unsigned long *irqflags, + __maybe_unused u32 flags)
And this is a, well, novel way to declare a function.
drivers/soc/fsl/qbman/bman_api.c line 1007
Quoted 8 lines
drivers/soc/fsl/qbman/bman_api.c new file +7
-0+{ + [...] +} +int bman_flush_stockpile (struct bman_pool *pool,u32 flags) +{ + [...] +}
Unused function.
Quoted 1 line
+EXPORT_SYMBOL(bman_flush_stockpile);
So unused export too.
Quoted 6 lines
drivers/soc/fsl/qbman/bman_api.c new file +6
-0+#ifdef CONFIG_FSL_BMAN +u32 bman_query_free_buffers (struct bman_pool *pool) +{ +return bm_pool_free_buffers (pool->params.bpid); +} +EXPORT_SYMBOL (bman_query_free_buffers);
drivers/soc/fsl/qbman/bman_api.c line 1027
Quoted 10 lines
drivers/soc/fsl/qbman/bman_api.c new file +10
-0+ +int bman_update_pool_thresholds (struct bman_pool *pool,const u32 *thresholds) +{ +u32 bpid; + + bpid =bman_get_params (pool)->bpid; + +return bm_pool_set (bpid, thresholds); +} +EXPORT_SYMBOL (bman_update_pool_thresholds);
More of the same.
drivers/soc/fsl/qbman/bman_portal.c line 351
Quoted 7 lines
drivers/soc/fsl/qbman/bman_api.c new file +1
-0+#endif drivers/soc/fsl/qbman/bman_portal.c new file +2
-0+module_driver (bman_portal_driver, + bman_portal_driver_register, platform_driver_unregister);
No MODULE_LICENSE() here, nor in the other files that make up this module. So loading this module will trigger a warning and taint the kernel.
drivers/soc/fsl/qbman/bman_utils.c
Quoted 4 lines
drivers/soc/fsl/qbman/bman_utils.c new file +1
-0+EXPORT_SYMBOL (bman_alloc_bpid_range);
Unused export.
Quoted 1 line
+EXPORT_SYMBOL(bman_release_bpid_range);
Ditto.
Quoted 1 line
+EXPORT_SYMBOL(bman_seed_bpid_range);
Ditto.
drivers/soc/fsl/qbman/bman_utils.c line 72
Quoted 5 lines
drivers/soc/fsl/qbman/bman_utils.c new file +5
-0+int bman_reserve_bpid_range (u32 bpid,u32 count) +{ +return dpaa_resource_reserve (&bpalloc, bpid, count); +} +EXPORT_SYMBOL (bman_reserve_bpid_range);
Because bman_reserve_bpid() is unused, see below, this function and this export are unused too.
drivers/soc/fsl/qbman/dpaa_resource.c
Quoted 4 lines
drivers/soc/fsl/qbman/dpaa_resource.c new file +1
-0+#if defined(CONFIG_FSL_BMAN_PORTAL ) || defined(CONFIG_FSL_BMAN_PORTAL_MODULE )
#if IS_ENABLED(CONFIG_FSL_BMAN_PORTAL)
Quoted 1 line
+#ifdef
DPAA_RESOURCE_DEBUG
Never defined. So DUMP() is dead code.
drivers/soc/fsl/qbman/dpaa_sys.h line 72
Quoted 4 lines
drivers/soc/fsl/qbman/dpaa_sys.h +1
-0+#define CONFIG_TRY_BETTER_MEMCPY
Please replace the CONFIG_ prefix with something else.
Quoted 1 line
+#ifdef
CONFIG_TRY_BETTER_MEMCPY
This will always be true, right?
Quoted 9 lines
[...]
drivers/soc/fsl/qbman/dpaa_sys.h +5
-0+#else +#define copy_words memcpy +#define copy_shorts memcpy +#define copy_bytes memcpy +#endif
include/soc/fsl/bman.h line 396
Quoted 5 lines
include/soc/fsl/bman.h new file +4
-0+static inline int bman_reserve_bpid (u32 bpid) +{ +return bman_reserve_bpid_range (bpid,1 ); +}
Unused.
Thanks,
Paul Bolle
RE: [PATCH 03/11] soc/fsl: Introduce the DPAA BMan portal driver
Paul,
Thanks you for your valuable feedback so far. Let me try to address a general issue you mention below: unused exported APIs.
The QMan and BMan drivers provide a base layer for other blocks built on top of them, for instance an Ethernet Driver, an Encrypt/Decrypt Engine, a pattern matcher, a compress/decompress engine, etc... Some of these drivers will be presented for review in the near future, but in order to try and layer the review/up streaming process we're presenting each layer as independently as possible. If you really were to start dissecting which APIs are called you would come to a very small set of pieces that merely initialize the hardware but don't provide any opportunity for other users to invoke that HW.
I hope that this helps you understand our goals in trying to upstream these drivers.
Roy
Quoted 256 lines
-----Original Message-----
From: Paul Bolle [mailto:[email protected]]
Sent: Friday, July 10, 2015 9:33 AM
To: Pledge Roy-R01356
Cc: [email protected]; Wood Scott-B07421; [email protected]; [email protected]
Subject: Re: [PATCH 03/11] soc/fsl: Introduce the DPAA BMan portal driverdrivers/soc/fsl/qbman/Kconfig config FSL_DPA_CAN_WAIT_SYNC · line 29
Quoted 6 lines · Roy Pledge
drivers/soc/fsl/qbman/Kconfig +3
-0+config FSL_DPA_PIRQ_FAST + bool + default yFirst used in 04/11.
drivers/soc/fsl/qbman/Kconfig config FSL_DPA_CAN_WAIT_SYNC · line 37
Quoted 7 lines
drivers/soc/fsl/qbman/Kconfig +7
-0+config FSL_DPA_PIRQ_SLOW + bool + default y + +config FSL_DPA_PORTAL_SHARE + bool + default yAs in 02/11: these three symbols function as aliases for
FSL_DPA. Why are they needed?Quoted 14 lines
config
FSL_BMANdrivers/soc/fsl/qbman/Kconfig +5
-0tristate "BMan device management" default n help FSL DPAA BMan driver +config FSL_BMAN_PORTAL + tristate "BMan portal(s)" + default n + help + FSL BMan portal driverdrivers/soc/fsl/qbman/bman_api.c line 45
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +3
-0+struct bman_portal { + [...] +#ifdef CONFIG_FSL_DPA_CAN_WAIT_SYNC This check will always evaluate to true, right? (I'll only report this once.)
drivers/soc/fsl/qbman/bman_api.c
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +1
-0+struct bman_pool *rcri_owned;/* only 1 release WAIT_SYNC at a time */
drivers/soc/fsl/qbman/bman_api.c new file +2
-0+#endif +#ifdef CONFIG_FSL_DPA_PORTAL_SHARE Ditto.
drivers/soc/fsl/qbman/bman_api.c
Quoted 9 lines
drivers/soc/fsl/qbman/bman_api.c new file +8
-0+raw_spinlock_t sharing_lock;/* only used if is_shared */ +int is_shared; +struct bman_portal *sharing_redirect;#endif + [...] +}; +const struct bman_portal_config *bman_get_portal_config (void ) { + [...] +}I couldn't find callers of this function.
Quoted 1 line
+EXPORT_SYMBOL(bman_get_portal_config);
Nor users of this export, obviously.
drivers/soc/fsl/qbman/bman_api.c line 484
Quoted 5 lines
drivers/soc/fsl/qbman/bman_api.c new file +5
-0+ +u32 bman_irqsource_get (void ) +{ + [...] +}Ditto.
Quoted 1 line
+EXPORT_SYMBOL(bman_irqsource_get);
Ditto.
drivers/soc/fsl/qbman/bman_api.c
Quoted 5 lines
drivers/soc/fsl/qbman/bman_api.c new file +5
-0+int bman_p_irqsource_add (struct bman_portal *p,__maybe_unused u32 +bits) { + [...] +} +EXPORT_SYMBOL (bman_p_irqsource_add);There seem to be no users of this export.
drivers/soc/fsl/qbman/bman_api.c
Quoted 3 lines
drivers/soc/fsl/qbman/bman_api.c new file +3
-0+int bman_irqsource_add (__maybe_unused u32 bits) { + [...] +}Unused.
Quoted 1 line
+EXPORT_SYMBOL(bman_irqsource_add);
Ditto.
drivers/soc/fsl/qbman/bman_api.c line 523
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +4
-0+int bman_irqsource_remove (u32 bits) +{ + [...] +}Ditto.
Quoted 1 line
+EXPORT_SYMBOL(bman_irqsource_remove);
Ditto.
drivers/soc/fsl/qbman/bman_api.c line 568
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +4
-0+u32 bman_poll_slow (void ) +{ + [...] +}Ditto.
Quoted 1 line
+EXPORT_SYMBOL(bman_poll_slow);
Ditto.
drivers/soc/fsl/qbman/bman_api.c line 591
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +4
-0+void bman_poll (void ) +{ + [...] +}Ditto.
Quoted 1 line
+EXPORT_SYMBOL(bman_poll);
Ditto.
drivers/soc/fsl/qbman/bman_api.c
Quoted 2 lines
drivers/soc/fsl/qbman/bman_api.c new file +2
-0+static inline struct bm_rcr_entry *try_rel_start (struct bman_portal +**p, #ifdef CONFIG_FSL_DPA_CAN_WAITAlways true, right?
drivers/soc/fsl/qbman/bman_api.c
Quoted 1 line
drivers/soc/fsl/qbman/bman_api.c new file +1
-0+__maybe_unused struct bman_pool *pool, #endif
drivers/soc/fsl/qbman/bman_api.c
Quoted 1 line
drivers/soc/fsl/qbman/bman_api.c new file +1
-0+__maybe_unused unsigned long *irqflags,
drivers/soc/fsl/qbman/bman_api.c line 722
Quoted 1 line
drivers/soc/fsl/qbman/bman_api.c new file +1
-0+ __maybe_unused u32 flags)And this is a, well, novel way to declare a function.
drivers/soc/fsl/qbman/bman_api.c
Quoted 7 lines
drivers/soc/fsl/qbman/bman_api.c new file +6
-0+{ + [...] +} +int bman_flush_stockpile (struct bman_pool *pool,u32 flags) { + [...] +}Unused function.
Quoted 1 line
+EXPORT_SYMBOL(bman_flush_stockpile);
So unused export too.
Quoted 4 lines
drivers/soc/fsl/qbman/bman_api.c new file +4
-0+#ifdef CONFIG_FSL_BMAN +u32 bman_query_free_buffers (struct bman_pool *pool) { +return bm_pool_free_buffers (pool->params.bpid); +}drivers/soc/fsl/qbman/bman_api.c line 1027
Quoted 10 lines
drivers/soc/fsl/qbman/bman_api.c new file +10
-0+EXPORT_SYMBOL (bman_query_free_buffers); + +int bman_update_pool_thresholds (struct bman_pool *pool,const u32 +*thresholds) { +u32 bpid; + + bpid =bman_get_params (pool)->bpid; + +return bm_pool_set (bpid, thresholds); } +EXPORT_SYMBOL (bman_update_pool_thresholds);More of the same.
drivers/soc/fsl/qbman/bman_portal.c line 351
Quoted 7 lines
drivers/soc/fsl/qbman/bman_api.c new file +1
-0+#endif drivers/soc/fsl/qbman/bman_portal.c new file +2
-0+module_driver (bman_portal_driver, + bman_portal_driver_register, platform_driver_unregister);No
MODULE_LICENSE()here, nor in the other files that make up this module. So loading this module will trigger a warning and taint the kernel.drivers/soc/fsl/qbman/bman_utils.c
Quoted 4 lines
drivers/soc/fsl/qbman/bman_utils.c new file +1
-0+EXPORT_SYMBOL (bman_alloc_bpid_range);Unused export.
Quoted 1 line
+EXPORT_SYMBOL(bman_release_bpid_range);
Ditto.
Quoted 1 line
+EXPORT_SYMBOL(bman_seed_bpid_range);
Ditto.
drivers/soc/fsl/qbman/bman_utils.c
Quoted 3 lines
drivers/soc/fsl/qbman/bman_utils.c new file +3
-0+int bman_reserve_bpid_range (u32 bpid,u32 count) { +return dpaa_resource_reserve (&bpalloc, bpid, count); } +EXPORT_SYMBOL (bman_reserve_bpid_range);Because
bman_reserve_bpid()is unused, see below, this function and this export are unused too.drivers/soc/fsl/qbman/dpaa_resource.c
Quoted 5 lines
drivers/soc/fsl/qbman/dpaa_resource.c new file +2
-0+#if defined(CONFIG_FSL_BMAN_PORTAL ) || +defined(CONFIG_FSL_BMAN_PORTAL_MODULE )#if
IS_ENABLED(CONFIG_FSL_BMAN_PORTAL)Quoted 1 line
+#ifdef
DPAA_RESOURCE_DEBUGNever defined. So
DUMP()is dead code.drivers/soc/fsl/qbman/dpaa_sys.h line 72
Quoted 4 lines
drivers/soc/fsl/qbman/dpaa_sys.h +1
-0+#define CONFIG_TRY_BETTER_MEMCPY Please replace the
CONFIG_prefix with something else.Quoted 1 line
+#ifdef
CONFIG_TRY_BETTER_MEMCPYThis will always be true, right?
include/soc/fsl/bman.h
Quoted 12 lines
[...]
drivers/soc/fsl/qbman/dpaa_sys.h +5
-0+#else +#define copy_words memcpy +#define copy_shorts memcpy +#define copy_bytes memcpy +#endif include/soc/fsl/bman.h new file +2
-0+static inline int bman_reserve_bpid (u32 bpid) { +return bman_reserve_bpid_range (bpid,1 ); }Unused.
Thanks,
Paul Bolle
Re: [PATCH 03/11] soc/fsl: Introduce the DPAA BMan portal driver
Hi Roy,
Quoted 1 line · Roy Pledge
Thanks you for your valuable feedback so far.
You're welcome. Please note that I just scan for, well, common build issues. Ie, stuff that requires no domain specific knowledge.
Quoted 2 lines
Let me try to address a general issue you mention below: unused exported APIs.
Good timing. I was pondering how to handle 04/11, a big patch that exports 79 (!) symbols. Many of those appear to have no users.
Quoted 10 lines
The QMan and BMan drivers provide a base layer for other blocks built on top of them, for instance an Ethernet Driver, an Encrypt/Decrypt Engine, a pattern matcher, a compress/decompress engine, etc... Some of these drivers will be presented for review in the near future, but in order to try and layer the review/up streaming process we're presenting each layer as independently as possible.
If you really were to start dissecting which APIs are called you would come to a very small set of pieces that merely initialize the hardware but don't provide any opportunity for other users to invoke that HW.
Quoted 2 lines
I hope that this helps you understand our goals in trying to upstream these drivers.
At the end of the day, what matters is what the people that need to sign off on these drivers (ppc? netdev?) are comfortable with. I know that some maintainers won't even bother looking at code that has no callers.
In the mean time I'll skip the exports for the remainder of this series.
Thanks,
Paul Bolle
Re: [PATCH 02/11] soc/fsl: Introduce DPAA BMan device management driver
In reply to Paul BolleQuoted 57 lines · Paul Bolle
drivers/soc/fsl/qbman/Kconfig line 3
Quoted 6 lines · Roy Pledge
drivers/soc/fsl/qbman/Kconfig new file +3
-0@@ -0,0 +1,33 @@ +menuconfig FSL_DPA + bool "Freescale DPAA support" + depends on FSL_SOC || COMPILE_TESTAre you sure about
COMPILE_TEST?Quoted 7 lines
drivers/soc/fsl/qbman/Kconfig new file +7
-0+ default n + help + FSL Data-Path Acceleration Architecture drivers + + These are not the actual Ethernet driver(s) + +if FSL_DPA[...]
drivers/soc/fsl/qbman/Kconfig line 33
Quoted 7 lines
drivers/soc/fsl/qbman/Kconfig new file +7
-0+config FSL_BMAN + tristate "BMan device management" + default n + help + FSL DPAA BMan driver + +endif # FSL_DPABecause with
FSL_BMANset to 'm' testing things withmake -C ../../../.. M=$PWD bman.kowill not actually compile on
x86_64:make: Entering directory '[...]'
CC [M] [...]/drivers/soc/fsl/qbman/bman.o
In file included from [...]/drivers/soc/fsl/qbman/bman_priv.h:33:0,from [...]/drivers/soc/fsl/qbman/bman.c:31: [...]/drivers/soc/fsl/qbman/dpaa_sys.h: In function ‘mfatb’: [...]/drivers/soc/fsl/qbman/dpaa_sys.h:134:8: error: implicit declaration of function ‘mfspr’ [-Werror=implicit-function-declaration] hi = mfspr(SPRN_ATBU); ^ [...]/drivers/soc/fsl/qbman/dpaa_sys.h:134:14: error: ‘SPRN_ATBU’ undeclared (first use in this function) hi = mfspr(SPRN_ATBU); ^[...]/drivers/soc/fsl/qbman/dpaa_sys.h:134:14: note: each undeclared identifier is reported only once for each function it appears in [...]/drivers/soc/fsl/qbman/dpaa_sys.h:135:14: error: ‘SPRN_ATBL’ undeclared (first use in this function)
lo = mfspr(SPRN_ATBL); ^ [...]/drivers/soc/fsl/qbman/bman.c: In function ‘__bm_in’: [...]/drivers/soc/fsl/qbman/bman.c:168:9: error: implicit declaration of function ‘in_be32’ [-Werror=implicit-function-declaration] return in_be32((void *)bm + offset); ^
Quoted 4 lines
[...]/drivers/soc/fsl/qbman/bman.c: In function ‘__bm_out’:
[...]/drivers/soc/fsl/qbman/bman.c:172:2: error: implicit declaration of function ‘out_be32’ [-Werror=implicit-function-declaration]
out_be32((void *)bm + offset, val);
These PPCisms will need to be fixed. LS1043A is an ARM chip with DPAA 1.0.
Quoted 5 lines
^
[...]/drivers/soc/fsl/qbman/bman.c: In function ‘of_fsl_bman_probe’:
[...]/drivers/soc/fsl/qbman/bman.c:463:17: error: ‘NO_IRQ’ undeclared (first use in this function)
if (err_irq==NO_IRQ) {
This isn't even a PPCism. It's just wrong. Compare to zero instead.
-Scott
Re: [PATCH 02/11] soc/fsl: Introduce DPAA BMan device management driver
In reply to Paul BolleQuoted 11 lines · Paul Bolle
drivers/soc/fsl/qbman/dpaa_sys.h line 48
Quoted 8 lines · Roy Pledge
drivers/soc/fsl/qbman/dpaa_sys.h new file +8
-0+#ifdef CONFIG_FSL_DPA_CHECKING +#define DPA_ASSERT (x) \ + do { \ + if (!(x)) { \ + pr_crit("ASSERT: (%s:%d) %s\n", __FILE__, __LINE__, \ + __stringify_1(x)); \ + dump_stack(); \ + panic("assertion failure"); \Not my call, but why
panic()here?
I'm pretty sure I've complained about this before (as well as all the BUG_ONs).
-Scott
RE: [PATCH 02/11] soc/fsl: Introduce DPAA BMan device management driver
In reply to Scott WoodQuoted 8 lines
return
in_be32((void *)bm + offset);Quoted 5 lines
^[...]/drivers/soc/fsl/qbman/bman.c: In function ‘__bm_out’:
[...]/drivers/soc/fsl/qbman/bman.c:172:2: error: implicit declaration of function ‘out_be32’ [-Werror=implicit-function-declaration]
out_be32((void *)bm + offset, val);These PPCisms will need to be fixed. LS1043A is an ARM chip with DPAA 1.0.
LS1043 (ARM, Little Endian) support is still work in progress. The patches for that are being tested now but are based on the SDK version of the driver and will need to be massaged in order to get them applied here. Our plan of record is to add upstream support for this at a later time.
Quoted 8 lines
Quoted 6 lines
^
[...]/drivers/soc/fsl/qbman/bman.c: In function ‘of_fsl_bman_probe’:
[...]/drivers/soc/fsl/qbman/bman.c:463:17: error: ‘NO_IRQ’ undeclared (first use in this function)
if (err_irq==NO_IRQ) {This isn't even a PPCism. It's just wrong. Compare to zero instead.
Yeah - I recall fixing this when doing the ARM port but I guess I didn't make the same change in this version. I will address this in the next version.
Quoted 2 lines
-Scott
Re: [PATCH 02/11] soc/fsl: Introduce DPAA BMan device management driver
Quoted 7 lines · On Fri, 2015-07-10 at 13:29 -0500, Pledge Roy-R01356 wrote:
Quoted 7 lines
return
in_be32((void *)bm + offset);Quoted 5 lines
^[...]/drivers/soc/fsl/qbman/bman.c: In function ‘__bm_out’:
[...]/drivers/soc/fsl/qbman/bman.c:172:2: error: implicit declaration of function ‘out_be32’ [-Werror=implicit-function-declaration]
out_be32((void *)bm + offset, val);
Quoted 7 lines
Quoted 2 lines
These PPCisms will need to be fixed. LS1043A is an ARM chip with DPAA 1.0.
LS1043 (ARM, Little Endian) support is still work in progress. The patches for that are being tested now but are based on the SDK version of the driver and will need to be massaged in order to get them applied here. Our plan of record is to add upstream support for this at a later time.
If you're already reworking this for upstream acceptance, why not fix the more obvious PPCisms now?
-Scott
RE: [PATCH 02/11] soc/fsl: Introduce DPAA BMan device management driver
In reply to Scott WoodQuoted 14 lines · Paul Bolle
Quoted 11 lines · Roy Pledge
drivers/soc/fsl/qbman/dpaa_sys.h line 48
Quoted 8 lines
drivers/soc/fsl/qbman/dpaa_sys.h new file +8
-0+#ifdef CONFIG_FSL_DPA_CHECKING +#define DPA_ASSERT (x) \ + do { \ + if (!(x)) { \ + pr_crit("ASSERT: (%s:%d) %s\n", __FILE__, __LINE__, \ + __stringify_1(x)); \ + dump_stack(); \ + panic("assertion failure"); \Not my call, but why
panic()here?
Quoted 3 lines
I'm pretty sure I've complained about this before (as well as all the
BUG_ONs).
Is the concern here just the call to panic()? I'm happy to change what happens when an issue is detected but the DPA_ASSERT() calls are very useful when testing changes to the driver and when bringing up the drivers on new silicon variants.
Re: [PATCH 02/11] soc/fsl: Introduce DPAA BMan device management driver
Quoted 15 lines · On Fri, 2015-07-10 at 15:57 -0500, Pledge Roy-R01356 wrote:
Quoted 15 lines · Paul Bolle
Quoted 12 lines · Roy Pledge
drivers/soc/fsl/qbman/dpaa_sys.h line 48
Quoted 9 lines
drivers/soc/fsl/qbman/dpaa_sys.h new file +5
-0+#ifdef CONFIG_FSL_DPA_CHECKING +#define DPA_ASSERT (x) \ + do { \ + if (!(x)) { \ + pr_crit("ASSERT: (%s:%d) %s\n", __FILE__,
__LINE__, \drivers/soc/fsl/qbman/dpaa_sys.h new file +3
-0+ __stringify_1(x)); \ +dump_stack (); \ +panic ("assertion failure" ); \Not my call, but why
panic()here?
Quoted 7 lines
Quoted 3 lines
I'm pretty sure I've complained about this before (as well as all the
BUG_ONs).Is the concern here just the call to
panic()? I'm happy to change what happens when an issue is detected but theDPA_ASSERT()calls are very useful when testing changes to the driver and when bringing up the drivers on new silicon variants.
Use WARN_ON() or a variant thereof.
-Scott
Re: [PATCH 04/11] soc/fsl: Introduce drivers for the DPAA QMan
In reply to Roy Pledgedrivers/soc/fsl/qbman/Kconfig config FSL_BMAN_PORTAL · line 62
Quoted 12 lines · Roy Pledge
drivers/soc/fsl/qbman/Kconfig +8
-0+config FSL_QMAN + tristate "QMan device management" + default n + help + FSL DPAA QMan driver +config FSL_QMAN_POLL_LIMIT + int + default 32
This Kconfig symbol will always be set to its default (32). So why bother with a Kconfig symbol. Can't you use, say, a preprocessor define directly?
Quoted 17 lines
drivers/soc/fsl/qbman/Kconfig +16
-0+config FSL_QMAN_CONFIG + bool "QMan device management" + default y + help + If this linux image is running natively, you need this option. If this + linux image is running as a guest OS under the hypervisor, only one + guest OS ("the control plane") needs this option. +config FSL_QMAN_CI_SCHED_CFG_SRCCIV + int + depends on FSL_QMAN_CONFIG + default 4 + +config FSL_QMAN_CI_SCHED_CFG_SRQ_W + int + depends on FSL_QMAN_CONFIG + default 3
drivers/soc/fsl/qbman/Kconfig config FSL_BMAN_PORTAL · line 100
Quoted 10 lines
drivers/soc/fsl/qbman/Kconfig +10
-0+ +config FSL_QMAN_CI_SCHED_CFG_RW_W + int + depends on FSL_QMAN_CONFIG + default 2 + +config FSL_QMAN_CI_SCHED_CFG_BMAN_W + int + depends on FSL_QMAN_CONFIG + default 2
Ditto.
drivers/soc/fsl/qbman/Kconfig config FSL_BMAN_PORTAL · line 112
Quoted 11 lines
drivers/soc/fsl/qbman/Kconfig +11
-0+config FSL_QMAN_PIRQ_DQRR_ITHRESH + int + default 12 + +config FSL_QMAN_PIRQ_MR_ITHRESH + int + default 4 + +config FSL_QMAN_PIRQ_IPERIOD + int + default 100
Ditto.
drivers/soc/fsl/qbman/Makefile
Quoted 4 lines
drivers/soc/fsl/qbman/Makefile +1
-0+obj-$(CONFIG_FSL_QMAN) += qman_api.o qman_utils.o qman_driver.o
If FSL_QMAN is set to 'm' this should generate three modules. Is three modules what you want? (Just to be safe: cross compiling ran into problems, even for PPC64, probably because of silliness on my side. So I couldn't check this. And I trust make's results more than I trust my ability to parse Makefiles.)
Besides, there's no MODULE_LICENSE() in any of their source files. So, whether you create one or three modules, loading a module will trigger a warning and taint the kernel.
drivers/soc/fsl/qbman/qman.c
Quoted 6 lines
drivers/soc/fsl/qbman/Makefile +1
-0+obj-$(CONFIG_FSL_QMAN_CONFIG) += qman.o qman_portal.odrivers/soc/fsl/qbman/qman.c new file +1
-0+MODULE_DEVICE_TABLE (of, of_fsl_qman_ids);
qman.o is built if FSL_QMAN_CONFIG is set. FSL_QMAN_CONFIG is a bool symbol. The net effect is that MODULE_DEVICE_TABLE is preprocessed away.
drivers/soc/fsl/qbman/qman.c line 1013
Quoted 10 lines
drivers/soc/fsl/qbman/qman.c new file +10
-0+static struct platform_driver of_fsl_qman_driver = { + .driver = { + .name =DRV_NAME , + .of_match_table = of_fsl_qman_ids, + }, + .probe = of_fsl_qman_probe, + .remove = of_fsl_qman_remove, +}; + +module_platform_driver (of_fsl_qman_driver);
As of v4.2-rc1 you can use builtin_platform_driver() for built-in only code.
Thanks,
Paul Bolle
Re: [PATCH 02/11] soc/fsl: Introduce DPAA BMan device management driver
In reply to Scott WoodQuoted 11 lines · scottwood at freescale.com (Scott Wood)
Quoted 10 lines · On Fri, 2015-07-10 at 13:29 -0500, Pledge Roy-R01356 wrote:
Quoted 9 lines
return
in_be32((void *)bm + offset);Quoted 5 lines
^[...]/drivers/soc/fsl/qbman/bman.c: In function ‘__bm_out’:
[...]/drivers/soc/fsl/qbman/bman.c:172:2: error: implicit declaration of function ‘out_be32’ [-Werror=implicit-function-declaration]
out_be32((void *)bm + offset, val);These PPCisms will need to be fixed. LS1043A is an ARM chip with DPAA 1.0.
Quoted 7 lines
Quoted 4 lines
LS1043 (ARM, Little Endian) support is still work in progress. The patches for that are being tested now but are based on the SDK version of the driver and will need to be massaged in order to get them applied here. Our plan of record is to add upstream support for this at a later time.
If you're already reworking this for upstream acceptance, why not fix the more obvious PPCisms now?
Other drivers are facing similar problems wrt. I/O accessors. How should the problem be solved?
For caam driver (drivers/crypto/caam) we have the following combinations:
ARCH CORE CAAM SoC, options
PPC BIG BIG P4080 etc.
PPC BIG LITTLE N/A
PPC LITTLE BIG P4080 + CONFIG_CPU_LITTLE_ENDIAN
PPC LITTLE LITTLE N/A
ARM LITTLE LITTLE LS1021A, LS2085A etc.
ARM LITTLE BIG LS1043A
ARM BIG LITTLE LS1021A + CONFIG_CPU_BIG_ENDIAN
ARM BIG BIG LS1043A + CONFIG_CPU_BIG_ENDIAN
Not all need to be supported, but for e.g. we are being requested to run on ARM in BE mode.
Existing MMIO accessors have one of the following drawbacks:
-readl/writel: on ARM do swapping (cpu <--> le), while on PPC are bus-specific (for PCI)
-have weak semantics (no barriers / sequence points etc.), like __raw_*
Thus, it looks like drivers have to define their own MMIO accessors, taking into account:
-core endianness (which is independent of arch)
-device endianness
-already-defined MMIO accessors availability, depending on arch -semantics will have to match
Unfortunately, the code will look terrible. In each driver.
Thanks,
Horia
P.S. Sorry if the To/Cc list is screwed up, I've taken the message from the archive.