[PATCH v2 0/2] staging: fsl-mc: Move DPBP and DPCON out of staging

2018-03-02 Thread Bogdan Purcareata
Previous submission: https://lkml.org/lkml/2018/3/1/733

Commit 6bd067c48ef ("staging: fsl-mc: Move core bus out of staging")
moves the fsl-mc bus driver infrastructure out of staging to
drivers/bus/fsl-mc. The next step is moving a couple of tightly
connected DPAA2 objects - DPBP (Data Path Buffer Pool) and DPCON
(Data Path Concentrator).

The patches handle moving out the mentioned objects, one at a time.

v1 -> v2:
- previous cleanup patch already applied, so removed from patchset
- properly refactor #include line (Laurentiu)

Bogdan Purcareata (2):
  staging: fsl-mc: Move DPBP out of staging
  staging: fsl-mc: Move DPCON out of staging

 drivers/bus/fsl-mc/Makefile|   2 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |   4 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |   4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h|  87 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |   3 +-
 drivers/staging/fsl-mc/bus/Makefile|   2 -
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  44 -
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |  53 --
 drivers/staging/fsl-mc/include/dpbp.h  |  53 --
 drivers/staging/fsl-mc/include/dpcon.h |  79 ---
 include/linux/fsl/mc.h | 108 +
 11 files changed, 202 insertions(+), 237 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/2] staging: fsl-mc: Move DPBP out of staging

2018-03-02 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpbp.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpbp-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpbp.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPBP stands for Data Path Buffer Pool - you can read more about the
object in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
v1 -> v2:
- properly refactor #include line (Laurentiu)

 drivers/bus/fsl-mc/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h   | 39 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
 drivers/staging/fsl-mc/bus/Makefile   |  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 44 ---
 drivers/staging/fsl-mc/include/dpbp.h | 53 ---
 include/linux/fsl/mc.h| 42 ++
 8 files changed, 86 insertions(+), 102 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index 6a97f2c..da26e52 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
+ dpbp.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
similarity index 98%
rename from drivers/staging/fsl-mc/bus/dpbp.c
rename to drivers/bus/fsl-mc/dpbp.c
index 85735bb..0aeacc5 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/bus/fsl-mc/dpbp.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpbp.h"
+#include 
 
-#include "dpbp-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpbp_open() - Open a control session for the specified object.
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index bed990c..4ef8d7e 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -379,6 +379,45 @@ int dprc_get_container_id(struct fsl_mc_io *mc_io,
  u32 cmd_flags,
  int *container_id);
 
+/*
+ * Data Path Buffer Pool (DPBP) API
+ */
+
+/* DPBP Version */
+#define DPBP_VER_MAJOR 3
+#define DPBP_VER_MINOR 2
+
+/* Command versioning */
+#define DPBP_CMD_BASE_VERSION  1
+#define DPBP_CMD_ID_OFFSET 4
+
+#define DPBP_CMD(id)   (((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
+#define DPBP_CMDID_OPENDPBP_CMD(0x804)
+
+#define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
+#define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
+#define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
+#define DPBP_CMDID_RESET   DPBP_CMD(0x005)
+
+struct dpbp_cmd_open {
+   __le32 dpbp_id;
+};
+
+#define DPBP_ENABLE0x1
+
+struct dpbp_rsp_get_attributes {
+   /* response word 0 */
+   __le16 pad;
+   __le16 bpid;
+   __le32 id;
+   /* response word 1 */
+   __le16 version_major;
+   __le16 version_minor;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index e577410..ce864ee 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -35,10 +35,10 @@
 
 #include 
 #include 
+#include 
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpbp.h"
 #include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index b67889e..ea6479f 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,8 +4,7 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += dpbp.o \
-   dpcon.o
+obj-$(CONFIG_FSL_MC_BUS) += dpcon.o
 
 # MC DPIO driver
 obj-$(CONFIG_FSL_MC_DP

RE: [PATCH 2/3] staging: fsl-mc: Move DPBP out of staging

2018-03-02 Thread Bogdan Purcareata
> -Original Message-
> From: Laurentiu Tudor
> Sent: Friday, March 02, 2018 11:18 AM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>; gre...@linuxfoundation.org;
> Ruxandra Ioana Ciocoi Radulescu <ruxandra.radule...@nxp.com>
> Cc: stuyo...@gmail.com; Ioana Ciornei <ioana.cior...@nxp.com>; Nipun Gupta
> <nipun.gu...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Horia Geantă
> <horia.gea...@nxp.com>; de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH 2/3] staging: fsl-mc: Move DPBP out of staging
> 
> Hi Bogdan,
> 
> On 03/01/2018 07:47 PM, Bogdan Purcareata wrote:
> > Move the source files out of staging into their final locations:
> > - dpbp.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
> > - dpbp-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
> >to the other internally used APIs
> > - dpbp.h gets merged into include/linux/fsl/mc.h, exposing the public
> >API
> >
> > Update references in the dpaa2-eth staging driver.
> >
> > DPBP stands for Data Path Buffer Pool - you can read more about the
> > object in Documentation/networking/dpaa2/overview.rst
> >
> > Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> > ---
> >   drivers/bus/fsl-mc/Makefile   |  1 +
> >   drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  4 +-
> >   drivers/bus/fsl-mc/fsl-mc-private.h   | 39 +
> >   drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
> >   drivers/staging/fsl-mc/bus/Makefile   |  3 +-
> >   drivers/staging/fsl-mc/bus/dpbp-cmd.h | 44 ---
> >   drivers/staging/fsl-mc/include/dpbp.h | 53 
> > 
> ---
> >   include/linux/fsl/mc.h| 42 ++
> >   8 files changed, 86 insertions(+), 102 deletions(-)
> >   rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
> >   delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
> >   delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h
> >
> > diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
> > index 6a97f2c..da26e52 100644
> > --- a/drivers/bus/fsl-mc/Makefile
> > +++ b/drivers/bus/fsl-mc/Makefile
> > @@ -9,6 +9,7 @@ obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
> >   mc-bus-driver-objs := fsl-mc-bus.o \
> >   mc-sys.o \
> >   mc-io.o \
> > + dpbp.o \
> >   dprc.o \
> >   dprc-driver.o \
> >   fsl-mc-allocator.o \
> > diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
> > similarity index 98%
> > rename from drivers/staging/fsl-mc/bus/dpbp.c
> > rename to drivers/bus/fsl-mc/dpbp.c
> > index 85735bb..31a360b 100644
> > --- a/drivers/staging/fsl-mc/bus/dpbp.c
> > +++ b/drivers/bus/fsl-mc/dpbp.c
> > @@ -5,9 +5,9 @@
> >*/
> >   #include 
> >   #include 
> > -#include "../include/dpbp.h"
> > +#include "linux/fsl/mc.h"
> 
> I think we can use <> here, same comment for patch 3/3.
> 
> Other than that, the series looks ok to me so for all the patches:
> 
> Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>

Thank you!
I will update the patchset - seeing that the cleanup one has already been 
applied - and will send a v2 shortly.

Best regards,
Bogdan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] staging: fsl-mc: Move DPBP out of staging

2018-03-01 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpbp.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpbp-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpbp.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPBP stands for Data Path Buffer Pool - you can read more about the
object in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/bus/fsl-mc/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h   | 39 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
 drivers/staging/fsl-mc/bus/Makefile   |  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 44 ---
 drivers/staging/fsl-mc/include/dpbp.h | 53 ---
 include/linux/fsl/mc.h| 42 ++
 8 files changed, 86 insertions(+), 102 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index 6a97f2c..da26e52 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
+ dpbp.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
similarity index 98%
rename from drivers/staging/fsl-mc/bus/dpbp.c
rename to drivers/bus/fsl-mc/dpbp.c
index 85735bb..31a360b 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/bus/fsl-mc/dpbp.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpbp.h"
+#include "linux/fsl/mc.h"
 
-#include "dpbp-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpbp_open() - Open a control session for the specified object.
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index bed990c..4ef8d7e 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -379,6 +379,45 @@ int dprc_get_container_id(struct fsl_mc_io *mc_io,
  u32 cmd_flags,
  int *container_id);
 
+/*
+ * Data Path Buffer Pool (DPBP) API
+ */
+
+/* DPBP Version */
+#define DPBP_VER_MAJOR 3
+#define DPBP_VER_MINOR 2
+
+/* Command versioning */
+#define DPBP_CMD_BASE_VERSION  1
+#define DPBP_CMD_ID_OFFSET 4
+
+#define DPBP_CMD(id)   (((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
+#define DPBP_CMDID_OPENDPBP_CMD(0x804)
+
+#define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
+#define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
+#define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
+#define DPBP_CMDID_RESET   DPBP_CMD(0x005)
+
+struct dpbp_cmd_open {
+   __le32 dpbp_id;
+};
+
+#define DPBP_ENABLE0x1
+
+struct dpbp_rsp_get_attributes {
+   /* response word 0 */
+   __le16 pad;
+   __le16 bpid;
+   __le32 id;
+   /* response word 1 */
+   __le16 version_major;
+   __le16 version_minor;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index e577410..ce864ee 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -35,10 +35,10 @@
 
 #include 
 #include 
+#include 
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpbp.h"
 #include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index b67889e..ea6479f 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,8 +4,7 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += dpbp.o \
-   dpcon.o
+obj-$(CONFIG_FSL_MC_BUS) += dpcon.o
 
 # MC DPIO driver
 obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bu

[PATCH 3/3] staging: fsl-mc: Move DPCON out of staging

2018-03-01 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpcon.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpcon-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpcon.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPCON stands for Data Path Concentrator - an interface between DPIO
(Data Path IO) and its users (e.g. dpaa2-eth). You can read more about
DPIO in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/bus/fsl-mc/Makefile|  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h| 48 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  1 -
 drivers/staging/fsl-mc/bus/Makefile|  1 -
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 53 ---
 drivers/staging/fsl-mc/include/dpcon.h | 79 --
 include/linux/fsl/mc.h | 66 ++
 8 files changed, 117 insertions(+), 136 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index da26e52..3c518c7 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -10,6 +10,7 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
  dpbp.o \
+ dpcon.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/bus/fsl-mc/dpcon.c
similarity index 99%
rename from drivers/staging/fsl-mc/bus/dpcon.c
rename to drivers/bus/fsl-mc/dpcon.c
index 021b425..5d220c9 100644
--- a/drivers/staging/fsl-mc/bus/dpcon.c
+++ b/drivers/bus/fsl-mc/dpcon.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpcon.h"
+#include "linux/fsl/mc.h"
 
-#include "dpcon-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpcon_open() - Open a control session for the specified object
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index 4ef8d7e..52c069d 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -418,6 +418,54 @@ struct dpbp_rsp_get_attributes {
__le16 version_minor;
 };
 
+/*
+ * Data Path Concentrator (DPCON) API
+ */
+
+/* DPCON Version */
+#define DPCON_VER_MAJOR3
+#define DPCON_VER_MINOR2
+
+/* Command versioning */
+#define DPCON_CMD_BASE_VERSION 1
+#define DPCON_CMD_ID_OFFSET4
+
+#define DPCON_CMD(id)  (((id) << DPCON_CMD_ID_OFFSET) | DPCON_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPCON_CMDID_CLOSE  DPCON_CMD(0x800)
+#define DPCON_CMDID_OPEN   DPCON_CMD(0x808)
+
+#define DPCON_CMDID_ENABLE DPCON_CMD(0x002)
+#define DPCON_CMDID_DISABLEDPCON_CMD(0x003)
+#define DPCON_CMDID_GET_ATTR   DPCON_CMD(0x004)
+#define DPCON_CMDID_RESET  DPCON_CMD(0x005)
+
+#define DPCON_CMDID_SET_NOTIFICATION   DPCON_CMD(0x100)
+
+struct dpcon_cmd_open {
+   __le32 dpcon_id;
+};
+
+#define DPCON_ENABLE   1
+
+struct dpcon_rsp_get_attr {
+   /* response word 0 */
+   __le32 id;
+   __le16 qbman_ch_id;
+   u8 num_priorities;
+   u8 pad;
+};
+
+struct dpcon_cmd_set_notification {
+   /* cmd word 0 */
+   __le32 dpio_id;
+   u8 priority;
+   u8 pad[3];
+   /* cmd word 1 */
+   __le64 user_ctx;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index ce864ee..b8990cf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -39,7 +39,6 @@
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
 
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index ea6479f..21d8ebc 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,7 +4,6 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += dpcon.o
 
 # MC DPIO driver
 obj-$(CONFIG_FSL_MC_DPIO) +=

[PATCH 1/3] staging: fsl-mc: Cleanup dpbp and dpcon API

2018-03-01 Thread Bogdan Purcareata
Some functions and associated structures are not used by current code,
so remove them.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 10 --
 drivers/staging/fsl-mc/bus/dpbp.c | 67 ---
 drivers/staging/fsl-mc/include/dpbp.h | 10 --
 3 files changed, 87 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 0b7f5c0..3340021 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -19,28 +19,18 @@
 /* Command IDs */
 #define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
 #define DPBP_CMDID_OPENDPBP_CMD(0x804)
-#define DPBP_CMDID_GET_API_VERSION DPBP_CMD(0xa04)
 
 #define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
 #define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
 #define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
 #define DPBP_CMDID_RESET   DPBP_CMD(0x005)
-#define DPBP_CMDID_IS_ENABLED  DPBP_CMD(0x006)
 
 struct dpbp_cmd_open {
__le32 dpbp_id;
 };
 
-struct dpbp_cmd_destroy {
-   __le32 object_id;
-};
-
 #define DPBP_ENABLE0x1
 
-struct dpbp_rsp_is_enabled {
-   u8 enabled;
-};
-
 struct dpbp_rsp_get_attributes {
/* response word 0 */
__le16 pad;
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index c0addaa..85735bb 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -126,40 +126,6 @@ int dpbp_disable(struct fsl_mc_io *mc_io,
 EXPORT_SYMBOL_GPL(dpbp_disable);
 
 /**
- * dpbp_is_enabled() - Check if the DPBP is enabled.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPBP object
- * @en:Returns '1' if object is enabled; '0' otherwise
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpbp_is_enabled(struct fsl_mc_io *mc_io,
-   u32 cmd_flags,
-   u16 token,
-   int *en)
-{
-   struct mc_command cmd = { 0 };
-   struct dpbp_rsp_is_enabled *rsp_params;
-   int err;
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, cmd_flags,
- token);
-
-   /* send command to mc*/
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   rsp_params = (struct dpbp_rsp_is_enabled *)cmd.params;
-   *en = rsp_params->enabled & DPBP_ENABLE;
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(dpbp_is_enabled);
-
-/**
  * dpbp_reset() - Reset the DPBP, returns the object to initial state.
  * @mc_io: Pointer to MC portal's I/O object
  * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
@@ -218,36 +184,3 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
return 0;
 }
 EXPORT_SYMBOL_GPL(dpbp_get_attributes);
-
-/**
- * dpbp_get_api_version - Get Data Path Buffer Pool API version
- * @mc_io: Pointer to Mc portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: Major version of Buffer Pool API
- * @minor_ver: Minor version of Buffer Pool API
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpbp_get_api_version(struct fsl_mc_io *mc_io,
-u32 cmd_flags,
-u16 *major_ver,
-u16 *minor_ver)
-{
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_API_VERSION,
- cmd_flags, 0);
-
-   /* send command to mc */
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   mc_cmd_read_api_version(, major_ver, minor_ver);
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(dpbp_get_api_version);
diff --git a/drivers/staging/fsl-mc/include/dpbp.h 
b/drivers/staging/fsl-mc/include/dpbp.h
index 4a18096..7b9f7ad 100644
--- a/drivers/staging/fsl-mc/include/dpbp.h
+++ b/drivers/staging/fsl-mc/include/dpbp.h
@@ -30,11 +30,6 @@ int dpbp_disable(struct fsl_mc_io *mc_io,
 u32 cmd_flags,
 u16 token);
 
-int dpbp_is_enabled(struct fsl_mc_io *mc_io,
-   u32 cmd_flags,
-   u16 token,
-   int *en);
-
 int dpbp_reset(struct fsl_mc_io *mc_io,
   u32 cmd_flags,
   u16 token);
@@ -55,9 +50,4 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
u16 token,
struct dpbp_attr *attr);
 
-int dpbp_get_api_version(struct fsl_mc_io *mc_io,
-u32 cmd_flags,
-u16 *major_ver,
-u

[PATCH 0/3] staging: fsl-mc: Move DPBP and DPCON out of staging

2018-03-01 Thread Bogdan Purcareata
Commit 6bd067c48ef ("staging: fsl-mc: Move core bus out of staging")
moves the fsl-mc bus driver infrastructure out of staging to
drivers/bus/fsl-mc. The next step is moving a couple of tightly
connected DPAA2 objects - DPBP (Data Path Buffer Pool) and DPCON
(Data Path Concentrator).

Patch 1 removes dead code from the involved source files.

Patches 2-3 handle moving out the mentioned objects, one at a time.

Bogdan Purcareata (3):
  staging: fsl-mc: Cleanup dpbp and dpcon API
  staging: fsl-mc: Move DPBP out of staging
  staging: fsl-mc: Move DPCON out of staging

 drivers/bus/fsl-mc/Makefile|   2 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |  71 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |   4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h|  87 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |   3 +-
 drivers/staging/fsl-mc/bus/Makefile|   2 -
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  54 ---
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |  53 --
 drivers/staging/fsl-mc/include/dpbp.h  |  63 
 drivers/staging/fsl-mc/include/dpcon.h |  79 ---
 include/linux/fsl/mc.h | 108 +
 11 files changed, 202 insertions(+), 324 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (73%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v6 1/2] staging: fsl-mc: Move core bus out of staging

2018-02-06 Thread Bogdan Purcareata
> -Original Message-
> From: Horia Geantă
> Sent: Tuesday, February 06, 2018 9:18 AM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>; gre...@linuxfoundation.org;
> Laurentiu Tudor <laurentiu.tu...@nxp.com>; Ruxandra Ioana Ciocoi Radulescu
> <ruxandra.radule...@nxp.com>
> Cc: stuyo...@gmail.com; a...@arndb.de; r...@kernel.org; Razvan Stefanescu
> <razvan.stefane...@nxp.com>; Ioana Ciornei <ioana.cior...@nxp.com>; Nipun 
> Gupta
> <nipun.gu...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; marc.zyng...@arm.com;
> t...@linutronix.de; ja...@lakedaemon.net; de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH v6 1/2] staging: fsl-mc: Move core bus out of staging
> 
> On 2/5/2018 4:08 PM, Bogdan Purcareata wrote:
> > Move the source files out of staging into their final locations:
> >   -mc.h include file in drivers/staging/fsl-mc/include go to
> include/linux/fsl
> >   -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
> >   -overview.rst, providing an overview of DPAA2, goes to
> >Documentation/networking/dpaa2/overview.rst
> [...]
> >  rename {drivers/staging/fsl-mc =>
> Documentation/networking/dpaa2}/overview.rst (100%)
> 
> Is this the proper location for documentation?
> The doc focuses on networking, however there's also information about fsl mc
> bus, dpio.

Yes, after internal discussions we concluded it would be the best fit, since
the end usage scenario is a networking one. So far the main user of the fsl-mc
bus and dpio is dpaa2-eth, which is an Ethernet driver. It's also next to the
previous DPAA generation driver documentation at 
Documentation/networking/dpaa.txt.

> In the future, we might want to add doc for other dpaa2 objects sitting on the
> fsl mc bus:
> -dpseci ("Data Path SEC Interface" - abstraction for the crypto engine)
> -dpdcei ("Data Path Decompression and Compression Engine Interface")
> 
> Would these fit under networking doc folder too?

IMO it would make sense to place them in the same 
Documentation/networking/dpaa2/
folder, since they're part of the same architecture. Of course, the end location
can be changed based on later feedback.

Cheers,
Bogdan P.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v6 0/2] staging: fsl-mc: Move bus driver out of staging

2018-02-05 Thread Bogdan Purcareata
Previous submission: https://lkml.org/lkml/2018/1/26/215

Split the code into moving out the core bus infrastructure separate from
the irqchip glue code. Add a Kconfig dependency on ARM_GIC_V3_ITS.
Integrate the documentation with the kernel build system.

This patchset only handles moving the fsl-mc bus core out of staging.
The remaining objects (DPBP, DPCON) and drivers (dpio, dpaa2-eth) will
be moved out in subsequent patches.

Notes:
-v6:
  - generate patchset with rename detection enabled (GregKH)
  - add Kconfig dependecy on ARM_GIC_V3_ITS (Mark Zyngier)
-v5:
  - split irqchip glue code to separate patch (GregKH)
  - integrate doc with the kernel build system
-v4:
  - regenerated patch with renames detection disabled (Andrew Lunn)
-v3:
  - rebased
-v2:
  - group irqchip gic its glue code together with the rest (Marc Zyngier)

Bogdan Purcareata (2):
  staging: fsl-mc: Move core bus out of staging
  staging: fsl-mc: Move irqchip code out of staging

 Documentation/networking/dpaa2/index.rst   |  8 
 .../networking/dpaa2}/overview.rst |  0
 Documentation/networking/index.rst |  1 +
 MAINTAINERS|  3 ++-
 drivers/bus/Kconfig|  2 ++
 drivers/bus/Makefile   |  4 
 drivers/bus/fsl-mc/Kconfig | 16 
 drivers/bus/fsl-mc/Makefile| 16 
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c   |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |  3 ++-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c|  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c|  1 +
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|  2 +-
 drivers/irqchip/Kconfig|  6 ++
 drivers/irqchip/Makefile   |  1 +
 .../fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c |  4 +---
 drivers/staging/fsl-dpaa2/ethernet/README  |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  |  2 +-
 drivers/staging/fsl-mc/TODO| 18 --
 drivers/staging/fsl-mc/bus/Kconfig | 10 --
 drivers/staging/fsl-mc/bus/Makefile| 15 ++-
 drivers/staging/fsl-mc/bus/dpbp.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  2 +-
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h  |  0
 32 files changed, 76 insertions(+), 60 deletions(-)
 create mode 100644 Documentation/networking/dpaa2/index.rst
 rename {drivers/staging/fsl-mc => Documentation/networking/dpaa2}/overview.rst 
(100%)
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (99%)
 rename drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c 
(97%)
 delete mode 100644 drivers/staging/fsl-mc/TODO
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/mc.h (100%)

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v6 1/2] staging: fsl-mc: Move core bus out of staging

2018-02-05 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
  -mc.h include file in drivers/staging/fsl-mc/include go to include/linux/fsl
  -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
  -overview.rst, providing an overview of DPAA2, goes to
   Documentation/networking/dpaa2/overview.rst

Update or delete other remaining staging files -- Makefile, Kconfig, TODO.
Update dpaa2_eth and dpio staging drivers.
Add integration bits for the documentation build system.

Signed-off-by: Stuart Yoder <stuyo...@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Jason Cooper <ja...@lakedaemon.net>
Cc: Marc Zyngier <marc.zyng...@arm.com>
---
Notes:
-v6:
  - generate patch with rename detection enabled (GregKH)
-v5:
  - split irqchip glue code to separate patch (GregKH)
  - integrate doc with the kernel build system
-v4:
  - regenerated patch with renames detection disabled (Andrew Lunn)
-v3:
  - rebased
-v2:
  - group irqchip gic its glue code together with the rest (Marc Zyngier)

 Documentation/networking/dpaa2/index.rst   |  8 
 .../networking/dpaa2}/overview.rst |  0
 Documentation/networking/index.rst |  1 +
 MAINTAINERS|  3 ++-
 drivers/bus/Kconfig|  2 ++
 drivers/bus/Makefile   |  4 
 drivers/bus/fsl-mc/Kconfig | 16 
 drivers/bus/fsl-mc/Makefile| 16 
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c   |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |  3 ++-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c|  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c|  1 +
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|  2 +-
 drivers/staging/fsl-dpaa2/ethernet/README  |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  |  2 +-
 drivers/staging/fsl-mc/TODO| 18 --
 drivers/staging/fsl-mc/bus/Kconfig | 10 --
 drivers/staging/fsl-mc/bus/Makefile| 16 +++-
 drivers/staging/fsl-mc/bus/dpbp.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  2 +-
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  2 +-
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h  |  0
 30 files changed, 70 insertions(+), 58 deletions(-)
 create mode 100644 Documentation/networking/dpaa2/index.rst
 rename {drivers/staging/fsl-mc => Documentation/networking/dpaa2}/overview.rst 
(100%)
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/TODO
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/mc.h (100%)

diff --git a/Documentation/networking/dpaa2/index.rst 
b/Documentation/networking/dpaa2/index.rst
new file mode 100644
index 000..4c6586c
--- /dev/null
+++ b/Documentation/networking/dpaa2/index.rst
@@ -0,0 +1,8 @@
+===
+DPAA2 Documentation
+===
+
+.. toctree::
+   :maxdepth: 1
+
+   overview
diff --git a/drivers/staging/fsl-mc/overview.rst 
b/Documentation/networking/dpaa2/overview.rst
similarity index 100%
rename from drivers/staging/fsl-mc/overview.rst
rename to Documentation/networking/dpaa2/overview.rst
diff --git a/Documentation/networking/index.rst

[PATCH v6 2/2] staging: fsl-mc: Move irqchip code out of staging

2018-02-05 Thread Bogdan Purcareata
Now that the fsl-mc bus core infrastructure is out of staging, the
remaining irqchip glue code used (irq-gic-v3-its-fsl-mc-msi.c) goes
to drivers/irqchip.

Create new Kconfig option for irqchip code that depends on
FSL_MC_BUS and ARM_GIC_V3_ITS. This ensures irqchip code only
gets built on ARM64 platforms. We can now remove #ifdef
GENERIC_MSI_DOMAIN_OPS as it was only needed for x86.

Signed-off-by: Stuart Yoder <stuyo...@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
[add Kconfig dependency on ARM_GIC_V3_ITS]
Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Jason Cooper <ja...@lakedaemon.net>
Cc: Marc Zyngier <marc.zyng...@arm.com>
---
Notes:
-v6:
  - generate patch with rename detection enabled (GregKH)
  - add Kconfig dependecy on ARM_GIC_V3_ITS (Mark Zyngier)
-v5:
  - split irqchip glue code to separate patch (GregKH)
-v4 - v1:
  - no change

 drivers/irqchip/Kconfig | 6 ++
 drivers/irqchip/Makefile| 1 +
 drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c | 2 --
 drivers/staging/fsl-mc/bus/Makefile | 3 +--
 4 files changed, 8 insertions(+), 4 deletions(-)
 rename drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c 
(98%)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index d913aec..f2ace51 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -51,6 +51,12 @@ config ARM_GIC_V3_ITS_PCI
depends on PCI_MSI
default ARM_GIC_V3_ITS
 
+config ARM_GIC_V3_ITS_FSL_MC
+   bool
+   depends on ARM_GIC_V3_ITS
+   depends on FSL_MC_BUS
+   default ARM_GIC_V3_ITS
+
 config ARM_NVIC
bool
select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index d27e3e3..1ba4390 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_ARM_GIC_V2M) += irq-gic-v2m.o
 obj-$(CONFIG_ARM_GIC_V3)   += irq-gic-v3.o irq-gic-common.o
 obj-$(CONFIG_ARM_GIC_V3_ITS)   += irq-gic-v3-its.o 
irq-gic-v3-its-platform-msi.o irq-gic-v4.o
 obj-$(CONFIG_ARM_GIC_V3_ITS_PCI)   += irq-gic-v3-its-pci-msi.o
+obj-$(CONFIG_ARM_GIC_V3_ITS_FSL_MC)+= irq-gic-v3-its-fsl-mc-msi.o
 obj-$(CONFIG_PARTITION_PERCPU) += irq-partition-percpu.o
 obj-$(CONFIG_HISILICON_IRQ_MBIGEN) += irq-mbigen.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
similarity index 98%
rename from drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
rename to drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
index b365fbb..13a5d9a 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
@@ -43,9 +43,7 @@ static int its_fsl_mc_msi_prepare(struct irq_domain 
*msi_domain,
 * NOTE: This device id corresponds to the IOMMU stream ID
 * associated with the DPRC object (ICID).
 */
-#ifdef GENERIC_MSI_DOMAIN_OPS
info->scratchpad[0].ul = mc_bus_dev->icid;
-#endif
msi_info = msi_get_domain_info(msi_domain->parent);
return msi_info->ops->msi_prepare(msi_domain->parent, dev, nvec, info);
 }
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 18b1b5f..b67889e 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,8 +4,7 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += irq-gic-v3-its-fsl-mc-msi.o \
-   dpbp.o \
+obj-$(CONFIG_FSL_MC_BUS) += dpbp.o \
dpcon.o
 
 # MC DPIO driver
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v5 1/2] staging: fsl-mc: Move core bus out of staging

2018-01-26 Thread Bogdan Purcareata
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Friday, January 26, 2018 4:06 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>; Ruxandra Ioana Ciocoi Radulescu
> <ruxandra.radule...@nxp.com>; stuyo...@gmail.com; a...@arndb.de;
> r...@kernel.org; Ioana Ciornei <ioana.cior...@nxp.com>; Nipun Gupta
> <nipun.gu...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Horia Geantă
> <horia.gea...@nxp.com>; marc.zyng...@arm.com; t...@linutronix.de;
> ja...@lakedaemon.net; de...@driverdev.osuosl.org; 
> linux-ker...@vger.kernel.org;
> linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH v5 1/2] staging: fsl-mc: Move core bus out of staging
> 
> On Fri, Jan 26, 2018 at 06:51:26AM -0600, Bogdan Purcareata wrote:
> > Move the source files out of staging into their final locations:
> >   -mc.h include file in drivers/staging/fsl-mc/include go to
> include/linux/fsl
> >   -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
> >   -overview.rst, providing an overview of DPAA2, goes to
> >Documentation/networking/dpaa2/overview.rst
> >
> > Update or delete other remaining staging files -- Makefile, Kconfig, TODO.
> > Update dpaa2_eth and dpio staging drivers.
> > Add integration bits for the documentation build system.
> >
> > Signed-off-by: Stuart Yoder <stuyo...@gmail.com>
> > [rebased, add dpaa2_eth and dpio #include updates]
> > Signed-off-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
> > [rebased, split irqchip to separate patch]
> > Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> > Cc: Thomas Gleixner <t...@linutronix.de>
> > Cc: Jason Cooper <ja...@lakedaemon.net>
> > Cc: Marc Zyngier <marc.zyng...@arm.com>
> > ---
> > Notes:
> > -v5:
> >   - split irqchip glue code to separate patch (GregKH)
> >   - integrate doc with the kernel build system
> > -v4:
> >   - regenerated patch with renames detection disabled (Andrew Lunn)
> > -v3:
> >   - rebased
> > -v2:
> >   - group irqchip gic its glue code together with the rest (Marc 
> > Zyngier)
> >
> >  Documentation/networking/dpaa2/index.rst   |   8 +
> >  Documentation/networking/dpaa2/overview.rst| 404 +
> >  Documentation/networking/index.rst |   1 +
> >  MAINTAINERS|   3 +-
> >  drivers/bus/Kconfig|   2 +
> >  drivers/bus/Makefile   |   4 +
> >  drivers/bus/fsl-mc/Kconfig |  16 +
> >  drivers/bus/fsl-mc/Makefile|  16 +
> >  drivers/bus/fsl-mc/dpmcp.c |  99 +++
> >  drivers/bus/fsl-mc/dprc-driver.c   | 809 ++
> >  drivers/bus/fsl-mc/dprc.c  | 532 
> >  drivers/bus/fsl-mc/fsl-mc-allocator.c  | 648 ++
> >  drivers/bus/fsl-mc/fsl-mc-bus.c| 948
> +
> >  drivers/bus/fsl-mc/fsl-mc-msi.c| 285 +++
> >  drivers/bus/fsl-mc/fsl-mc-private.h| 475 +++
> >  drivers/bus/fsl-mc/mc-io.c | 268 ++
> >  drivers/bus/fsl-mc/mc-sys.c| 296 +++
> >  drivers/staging/fsl-dpaa2/ethernet/README  |   2 +-
> >  drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |   2 +-
> >  drivers/staging/fsl-dpaa2/ethernet/dpni.c  |   2 +-
> >  drivers/staging/fsl-mc/TODO|  18 -
> >  drivers/staging/fsl-mc/bus/Kconfig |  10 -
> >  drivers/staging/fsl-mc/bus/Makefile|  16 +-
> >  drivers/staging/fsl-mc/bus/dpbp.c  |   2 +-
> >  drivers/staging/fsl-mc/bus/dpcon.c |   2 +-
> >  drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |   2 +-
> >  drivers/staging/fsl-mc/bus/dpio/dpio-service.c |   2 +-
> >  drivers/staging/fsl-mc/bus/dpio/dpio.c |   2 +-
> >  drivers/staging/fsl-mc/bus/dpmcp.c |  99 ---
> >  drivers/staging/fsl-mc/bus/dprc-driver.c   | 809 --
> >  drivers/staging/fsl-mc/bus/dprc.c  | 531 
> >  drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 648 --
> >  drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 948 
> > ---
> --
> >  drivers/staging/fsl-mc/bus/fsl-mc-msi.c

[PATCH v5 0/2] staging: fsl-mc: Move bus driver out of staging

2018-01-26 Thread Bogdan Purcareata
Previous submission: https://patchwork.kernel.org/patch/10081731/

Most of the feedback was addressed by a separate series of cleanup
/ refactoring patches [1] which were applied.

The thing left to do is to split the original patch into moving out the
core bus infrastructure separate from the irqchip glue code, and
integrate the documentation with the kernel build system.

This patchset only handles moving the fsl-mc bus core out of staging.
The remaining objects (DPBP, DPCON) and drivers (dpio, dpaa2-eth) will
be moved out in subsequent patches.

[1] https://lkml.org/lkml/2018/1/16/386

Notes:
-v5:
  - split irqchip glue code to separate patch (GregKH)
  - integrate doc with the kernel build system
-v4:
  - regenerated patch with renames detection disabled (Andrew Lunn)
-v3:
  - rebased
-v2:
  - group irqchip gic its glue code together with the rest (Marc Zyngier)

Bogdan Purcareata (2):
  staging: fsl-mc: Move core bus out of staging
  staging: fsl-mc: Move irqchip code out of staging

 Documentation/networking/dpaa2/index.rst   |   8 +
 Documentation/networking/dpaa2/overview.rst| 404 +
 Documentation/networking/index.rst |   1 +
 MAINTAINERS|   3 +-
 drivers/bus/Kconfig|   2 +
 drivers/bus/Makefile   |   4 +
 drivers/bus/fsl-mc/Kconfig |  16 +
 drivers/bus/fsl-mc/Makefile|  16 +
 drivers/bus/fsl-mc/dpmcp.c |  99 +++
 drivers/bus/fsl-mc/dprc-driver.c   | 809 ++
 drivers/bus/fsl-mc/dprc.c  | 532 
 drivers/bus/fsl-mc/fsl-mc-allocator.c  | 648 ++
 drivers/bus/fsl-mc/fsl-mc-bus.c| 948 +
 drivers/bus/fsl-mc/fsl-mc-msi.c| 285 +++
 drivers/bus/fsl-mc/fsl-mc-private.h| 475 +++
 drivers/bus/fsl-mc/mc-io.c | 268 ++
 drivers/bus/fsl-mc/mc-sys.c| 296 +++
 drivers/irqchip/Makefile   |   1 +
 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c| 100 +++
 drivers/staging/fsl-dpaa2/ethernet/README  |   2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |   2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  |   2 +-
 drivers/staging/fsl-mc/TODO|  18 -
 drivers/staging/fsl-mc/bus/Kconfig |  10 -
 drivers/staging/fsl-mc/bus/Makefile|  15 +-
 drivers/staging/fsl-mc/bus/dpbp.c  |   2 +-
 drivers/staging/fsl-mc/bus/dpcon.c |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |   2 +-
 drivers/staging/fsl-mc/bus/dpmcp.c |  99 ---
 drivers/staging/fsl-mc/bus/dprc-driver.c   | 809 --
 drivers/staging/fsl-mc/bus/dprc.c  | 531 
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 648 --
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 948 -
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c| 284 --
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 475 ---
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 100 ---
 drivers/staging/fsl-mc/bus/mc-io.c | 268 --
 drivers/staging/fsl-mc/bus/mc-sys.c| 296 ---
 drivers/staging/fsl-mc/include/mc.h| 454 --
 drivers/staging/fsl-mc/overview.rst| 404 -
 include/linux/fsl/mc.h | 454 ++
 43 files changed, 5378 insertions(+), 5366 deletions(-)
 create mode 100644 Documentation/networking/dpaa2/index.rst
 create mode 100644 Documentation/networking/dpaa2/overview.rst
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 create mode 100644 drivers/bus/fsl-mc/dpmcp.c
 create mode 100644 drivers/bus/fsl-mc/dprc-driver.c
 create mode 100644 drivers/bus/fsl-mc/dprc.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-allocator.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-bus.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-msi.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-private.h
 create mode 100644 drivers/bus/fsl-mc/mc-io.c
 create mode 100644 drivers/bus/fsl-mc/mc-sys.c
 create mode 100644 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
 delete mode 100644 drivers/staging/fsl-mc/TODO
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.c
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-driver.c
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.c
 delete mode 100644 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
 delete mode 100644 drivers/staging/fsl-mc/bus/fsl-mc-bus.c
 delete

[PATCH v5 2/2] staging: fsl-mc: Move irqchip code out of staging

2018-01-26 Thread Bogdan Purcareata
Now that the fsl-mc bus core infrastructure is out of staging, the
remaining irqchip glue code used (irq-gic-v3-its-fsl-mc-msi.c) goes
to drivers/irqchip.

Signed-off-by: Stuart Yoder <stuyo...@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Jason Cooper <ja...@lakedaemon.net>
Cc: Marc Zyngier <marc.zyng...@arm.com>
---
Notes:
-v5:
  - split irqchip glue code to separate patch (GregKH)
-v4 - v1:
  - no change

 drivers/irqchip/Makefile   |   1 +
 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c| 100 +
 drivers/staging/fsl-mc/bus/Makefile|   3 +-
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 100 -
 4 files changed, 102 insertions(+), 102 deletions(-)
 create mode 100644 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
 delete mode 100644 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c

diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index d2df34a..641d8a4 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_ARM_GIC_V2M) += irq-gic-v2m.o
 obj-$(CONFIG_ARM_GIC_V3)   += irq-gic-v3.o irq-gic-common.o
 obj-$(CONFIG_ARM_GIC_V3_ITS)   += irq-gic-v3-its.o 
irq-gic-v3-its-platform-msi.o irq-gic-v4.o
 obj-$(CONFIG_ARM_GIC_V3_ITS_PCI)   += irq-gic-v3-its-pci-msi.o
+obj-$(CONFIG_FSL_MC_BUS)   += irq-gic-v3-its-fsl-mc-msi.o
 obj-$(CONFIG_PARTITION_PERCPU) += irq-partition-percpu.o
 obj-$(CONFIG_HISILICON_IRQ_MBIGEN) += irq-mbigen.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
diff --git a/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
new file mode 100644
index 000..b365fbb
--- /dev/null
+++ b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Freescale Management Complex (MC) bus driver MSI support
+ *
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
+ * Author: German Rivera <german.riv...@freescale.com>
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static struct irq_chip its_msi_irq_chip = {
+   .name = "ITS-fMSI",
+   .irq_mask = irq_chip_mask_parent,
+   .irq_unmask = irq_chip_unmask_parent,
+   .irq_eoi = irq_chip_eoi_parent,
+   .irq_set_affinity = msi_domain_set_affinity
+};
+
+static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,
+ struct device *dev,
+ int nvec, msi_alloc_info_t *info)
+{
+   struct fsl_mc_device *mc_bus_dev;
+   struct msi_domain_info *msi_info;
+
+   if (!dev_is_fsl_mc(dev))
+   return -EINVAL;
+
+   mc_bus_dev = to_fsl_mc_device(dev);
+   if (!(mc_bus_dev->flags & FSL_MC_IS_DPRC))
+   return -EINVAL;
+
+   /*
+* Set the device Id to be passed to the GIC-ITS:
+*
+* NOTE: This device id corresponds to the IOMMU stream ID
+* associated with the DPRC object (ICID).
+*/
+#ifdef GENERIC_MSI_DOMAIN_OPS
+   info->scratchpad[0].ul = mc_bus_dev->icid;
+#endif
+   msi_info = msi_get_domain_info(msi_domain->parent);
+   return msi_info->ops->msi_prepare(msi_domain->parent, dev, nvec, info);
+}
+
+static struct msi_domain_ops its_fsl_mc_msi_ops __ro_after_init = {
+   .msi_prepare = its_fsl_mc_msi_prepare,
+};
+
+static struct msi_domain_info its_fsl_mc_msi_domain_info = {
+   .flags  = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS),
+   .ops= _fsl_mc_msi_ops,
+   .chip   = _msi_irq_chip,
+};
+
+static const struct of_device_id its_device_id[] = {
+   {   .compatible = "arm,gic-v3-its", },
+   {},
+};
+
+static int __init its_fsl_mc_msi_init(void)
+{
+   struct device_node *np;
+   struct irq_domain *parent;
+   struct irq_domain *mc_msi_domain;
+
+   for (np = of_find_matching_node(NULL, its_device_id); np;
+np = of_find_matching_node(np, its_device_id)) {
+   if (!of_property_read_bool(np, "msi-controller"))
+   continue;
+
+   parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS);
+   if (!parent || !msi_get_domain_info(parent)) {
+   pr_err("%pOF: unable to locate ITS domain\n", np);
+   continue;
+   }
+
+   mc_msi_domain = fsl_mc_msi_create_irq_domain(
+of_node_to_fwnode(np),
+_fsl_mc_ms

[PATCH v2] staging: fsl-mc: Add SPDX license identifiers

2018-01-17 Thread Bogdan Purcareata
The fsl-mc bus and dpio driver files use a combination of GPL-2.0 and
GPL-2.0+ OR BSD-3-Clause licenses. Add SPDX tags and delete the full
license text, keeping the existing license for each file. Add GPL-2.0
for Kconfig / Makefile, where not present.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
v1 -> v2:
- keep existing license for each file, only update to use SPDX tags,
  don't change the license

 drivers/staging/fsl-mc/Kconfig |  1 +
 drivers/staging/fsl-mc/Makefile|  1 +
 drivers/staging/fsl-mc/bus/Kconfig |  3 +-
 drivers/staging/fsl-mc/bus/Makefile|  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  | 28 +--
 drivers/staging/fsl-mc/bus/dpbp.c  | 28 +--
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 28 +--
 drivers/staging/fsl-mc/bus/dpcon.c | 32 ++
 drivers/staging/fsl-mc/bus/dpio/Makefile   |  1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h | 28 +--
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  | 27 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 27 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 28 +--
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 28 +--
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 27 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h | 27 +-
 drivers/staging/fsl-mc/bus/dpmcp.c | 28 +--
 drivers/staging/fsl-mc/bus/dprc-driver.c   |  4 +--
 drivers/staging/fsl-mc/bus/dprc.c  | 28 +--
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  4 +--
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  4 +--
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|  4 +--
 drivers/staging/fsl-mc/bus/fsl-mc-private.h|  4 +--
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  4 +--
 drivers/staging/fsl-mc/bus/mc-io.c | 28 +--
 drivers/staging/fsl-mc/bus/mc-sys.c| 28 +--
 drivers/staging/fsl-mc/include/dpaa2-fd.h  | 27 +-
 drivers/staging/fsl-mc/include/dpaa2-global.h  | 27 +-
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 27 +-
 drivers/staging/fsl-mc/include/dpbp.h  | 29 +---
 drivers/staging/fsl-mc/include/dpcon.h | 32 ++
 drivers/staging/fsl-mc/include/mc.h|  4 +--
 32 files changed, 36 insertions(+), 563 deletions(-)

diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
index 32df07b..3002229 100644
--- a/drivers/staging/fsl-mc/Kconfig
+++ b/drivers/staging/fsl-mc/Kconfig
@@ -1 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
 source "drivers/staging/fsl-mc/bus/Kconfig"
diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile
index 9c6a001..1468388 100644
--- a/drivers/staging/fsl-mc/Makefile
+++ b/drivers/staging/fsl-mc/Makefile
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
 # Freescale Management Complex (MC) bus drivers
 obj-$(CONFIG_FSL_MC_BUS)   += bus/
diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
index 504c987..1f91000 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
 #
 # DPAA2 fsl-mc bus
 #
 # Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 
 config FSL_MC_BUS
bool "QorIQ DPAA2 fsl-mc bus driver"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 6df407e..29059db 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
 #
 # Freescale Management Complex (MC) bus drivers
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 
 mc-bus-driver-objs := fsl-mc-bus.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 5904836..0b7f5c0 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -1,33 +1,7 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
 /*
  * Copyright 2013-2016 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 followin

RE: [PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers

2018-01-17 Thread Bogdan Purcareata
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, January 16, 2018 5:13 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>; Ruxandra Ioana Ciocoi Radulescu
> <ruxandra.radule...@nxp.com>; de...@driverdev.osuosl.org; r...@kernel.org;
> stuyo...@gmail.com; a...@arndb.de; marc.zyng...@arm.com; Roy Pledge
> <roy.ple...@nxp.com>; Ioana Ciornei <ioana.cior...@nxp.com>; linux-
> ker...@vger.kernel.org; Horia Geantă <horia.gea...@nxp.com>; Nipun Gupta
> <nipun.gu...@nxp.com>; t...@linutronix.de; linux-arm-
> ker...@lists.infradead.org; ja...@lakedaemon.net
> Subject: Re: [PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers
> 
> On Tue, Jan 16, 2018 at 03:19:05PM +0200, Bogdan Purcareata wrote:
> > diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h b/drivers/staging/fsl-
> mc/bus/dpbp-cmd.h
> > index 5904836..1ac8ec6 100644
> > --- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
> > +++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
> > @@ -1,33 +1,8 @@
> > +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
> 
> Hm, I don't think you want to do that.  How can a Linux driver subsytem
> that wraps calls to the kernel's driver core (which are GPL-only), be
> accessed by BSD-3 code?

For this particular file, the original license was dual GPL/BSD. The patch 
removes the license text and adds an equivalent SPDX tag.

> If I didn't know any better, I would think you were trying to create a
> "GPL Condom" here :)
> 
> Anyway, why all of the BSD-3 stuff here?  That makes no sense for kernel
> code at all, and this is a relicensing of the file, have you gotten
> legal approval of everyone that has modified the file while it was under
> the GPL-v2 only text to be able to change it to BSD-3 as well?

Previous to this patch, the files under drivers/staging/fsl-mc/ use a 
combination of GPL-2.0 and (GPL-2.0+ / BSD-3-Clause) licenses (expressed by the 
full license text). 

The original intent was to have an uniform dual license for all files. Before 
making this change, I have consulted the other current contributors, but based 
on your feedback, we think it's best to keep the current licenses.

> Careful, this is a _VERY_ tricky thing to do right.  I need a
> signed-off-by on this type of patch from your legal council to ensure
> that they know exactly what you are doing, and have reviewed it
> properly, before I can take it.
> 
> Hint, stick to the existing license in the files, it makes more sense,
> you are not going to be taking this code out of Linux and putting it
> anywhere.

I will send a v2 keeping the existing license for each file - removing the full 
license text and adding a SPDX tag. This way there will be no change from a 
legal standpoint.

Thank you for the feedback!

Bogdan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/8] staging: fsl-mc: Cleanup

2018-01-16 Thread Bogdan Purcareata
The patchset aims to address most of the feedback gathered at the latest
attempt to move it out of staging. You can find the discussion here [1].

Patches 1-2 remove unused code and consolidate the fsl-mc core bus
infrastructure header files into fsl-mc-private.h.

Patch 3 removes full license text and adds SPDX tags to files under
staging/fsl-mc.

Patches 4-6 cleanup the fsl-mc msi/irq code, updating the initialization
routine and removing code that's no longer needed.

Patches 7-8 cleanup the fsl-mc bus documentation and convert it to be
compatible with the kernel documentation build process (.rst).

[1] https://patchwork.kernel.org/patch/10081731/

Bogdan Purcareata (3):
  staging: fsl-mc: Cleanup dprc and dpmcp header files
  staging: fsl-mc: Consolidate bus core header files
  staging: fsl-mc: Add SPDX license identifiers

Ioana Radulescu (5):
  staging: fsl-mc: Remove dead code
  staging: fsl-mc: Remove unnecessary dependency
  staging: fsl-mc: Update include header
  staging: fsl-mc: README cleanup
  staging: fsl-mc: Convert documentation to rst format

 drivers/staging/fsl-mc/Kconfig |   1 +
 drivers/staging/fsl-mc/Makefile|   1 +
 drivers/staging/fsl-mc/README.txt  | 386 --
 drivers/staging/fsl-mc/bus/Kconfig |   3 +-
 drivers/staging/fsl-mc/bus/Makefile|   3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  29 +-
 drivers/staging/fsl-mc/bus/dpbp.c  |  29 +-
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |  29 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  33 +-
 drivers/staging/fsl-mc/bus/dpio/Makefile   |   1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h |  30 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  29 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  29 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  30 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.h |  30 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c |  29 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h |  29 +-
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |  56 ---
 drivers/staging/fsl-mc/bus/dpmcp.c |  64 +--
 drivers/staging/fsl-mc/bus/dpmcp.h |  60 ---
 drivers/staging/fsl-mc/bus/dpmng-cmd.h |  58 ---
 drivers/staging/fsl-mc/bus/dprc-cmd.h  | 451 -
 drivers/staging/fsl-mc/bus/dprc-driver.c   |   6 +-
 drivers/staging/fsl-mc/bus/dprc.c  | 257 +---
 drivers/staging/fsl-mc/bus/dprc.h  | 268 
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  10 +-
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  14 +-
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|   5 +-
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 380 -
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  26 +-
 drivers/staging/fsl-mc/bus/mc-io.c |  31 +-
 drivers/staging/fsl-mc/bus/mc-sys.c|  31 +-
 drivers/staging/fsl-mc/include/dpaa2-fd.h  |  29 +-
 drivers/staging/fsl-mc/include/dpaa2-global.h  |  29 +-
 drivers/staging/fsl-mc/include/dpaa2-io.h  |  29 +-
 drivers/staging/fsl-mc/include/dpbp.h  |  30 +-
 drivers/staging/fsl-mc/include/dpcon.h |  33 +-
 drivers/staging/fsl-mc/include/mc.h|   5 +-
 drivers/staging/fsl-mc/overview.rst| 404 ++
 39 files changed, 840 insertions(+), 2157 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/README.txt
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmng-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.h
 create mode 100644 drivers/staging/fsl-mc/overview.rst

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 8/8] staging: fsl-mc: Convert documentation to rst format

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Update the doc file to comply with the rst format.

It's not integrated into the documentation build structure yet,
since it's still located in drivers/staging.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/README.txt   | 387 --
 drivers/staging/fsl-mc/overview.rst | 404 
 2 files changed, 404 insertions(+), 387 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/README.txt
 create mode 100644 drivers/staging/fsl-mc/overview.rst

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/README.txt
deleted file mode 100644
index 0ea5cd7..000
--- a/drivers/staging/fsl-mc/README.txt
+++ /dev/null
@@ -1,387 +0,0 @@
-Copyright (C) 2015 Freescale Semiconductor Inc.
-
-DPAA2 (Data Path Acceleration Architecture Gen2) Overview
--
-
-This document provides an overview of the Freescale DPAA2 architecture
-and how it is integrated into the Linux kernel.
-
-Contents summary
-   -DPAA2 overview
-   -Overview of DPAA2 objects
-   -DPAA2 Linux driver architecture overview
--bus driver
--DPRC driver
--allocator
--DPIO driver
--Ethernet
--MAC
-
-Introduction
-
-
-DPAA2 is a hardware architecture designed for high-speeed network
-packet processing.  DPAA2 consists of sophisticated mechanisms for
-processing Ethernet packets, queue management, buffer management,
-autonomous L2 switching, virtual Ethernet bridging, and accelerator
-(e.g. crypto) sharing.
-
-A DPAA2 hardware component called the Management Complex (or MC) manages the
-DPAA2 hardware resources.  The MC provides an object-based abstraction for
-software drivers to use the DPAA2 hardware.
-
-The MC uses DPAA2 hardware resources such as queues, buffer pools, and
-network ports to create functional objects/devices such as network
-interfaces, an L2 switch, or accelerator instances.
-
-The MC provides memory-mapped I/O command interfaces (MC portals)
-which DPAA2 software drivers use to operate on DPAA2 objects.
-
-The diagram below shows an overview of the DPAA2 resource management
-architecture:
-
- +--+
- |  OS  |
- |DPAA2 drivers |
- | ||
- +-|+
-   |
-   | (create,discover,connect
-   |  config,use,destroy)
-   |
- DPAA2 |
- +| mc portal |-+
- | ||
- |   +- - - - - - - - - - - - -V- - -+  |
- |   |   |  |
- |   |   Management Complex (MC) |  |
- |   |   |  |
- |   +- - - - - - - - - - - - - - - -+  |
- |  |
- | Hardware  Hardware   |
- | Resources Objects|
- | - ---|
- | -queues   -DPRC  |
- | -buffer pools -DPMCP |
- | -Eth MACs/ports   -DPIO  |
- | -network interface-DPNI  |
- |  profiles -DPMAC |
- | -queue portals-DPBP  |
- | -MC portals...   |
- |  ... |
- |  |
- +--+
-
-The MC mediates operations such as create, discover,
-connect, configuration, and destroy.  Fast-path operations
-on data, such as packet transmit/receive, are not mediated by
-the MC and are done directly using memory mapped regions in
-DPIO objects.
-
-Overview of DPAA2 Objects
--
-The section provides a brief overview of some key DPAA2 objects.
-A simple scenario is described illustrating the objects involved
-in creating a network interfaces.
-
--DPRC (Datapath Resource Container)
-
-A DPRC is a container object that holds all the other
-types of DPAA2 objects.  In the example diagram below there
-are 8 objects of 5 types (DPMCP, DPIO, DPBP, DPNI, and DPMAC)
-in the container.
-
-+-+
-| DPRC|
-| |
-|  +---+  +---+  +---+  +---+  +---+  |
-|  | DPMCP |  | DPIO  |  | DPBP  |  | DPNI  |  | DPMAC |  |
-|  +---+  

[PATCH 7/8] staging: fsl-mc: README cleanup

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Minor cosmetic changes to the DPAA2 overview documentation file.
Add a reference to the mc-bus driver sysfs documentation.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/README.txt | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/README.txt
index 524eda1..0ea5cd7 100644
--- a/drivers/staging/fsl-mc/README.txt
+++ b/drivers/staging/fsl-mc/README.txt
@@ -1,7 +1,7 @@
 Copyright (C) 2015 Freescale Semiconductor Inc.
 
-DPAA2 (Data Path Acceleration Architecture Gen2)
-
+DPAA2 (Data Path Acceleration Architecture Gen2) Overview
+-
 
 This document provides an overview of the Freescale DPAA2 architecture
 and how it is integrated into the Linux kernel.
@@ -17,8 +17,8 @@ Contents summary
 -Ethernet
 -MAC
 
-DPAA2 Overview
---
+Introduction
+
 
 DPAA2 is a hardware architecture designed for high-speeed network
 packet processing.  DPAA2 consists of sophisticated mechanisms for
@@ -35,7 +35,7 @@ network ports to create functional objects/devices such as 
network
 interfaces, an L2 switch, or accelerator instances.
 
 The MC provides memory-mapped I/O command interfaces (MC portals)
-which DPAA2 software drivers use to operate on DPAA2 objects:
+which DPAA2 software drivers use to operate on DPAA2 objects.
 
 The diagram below shows an overview of the DPAA2 resource management
 architecture:
@@ -130,8 +130,7 @@ in creating a network interfaces.
 level.
 
 DPRCs can be defined statically and populated with objects
-via a config file passed to the MC when firmware starts
-it.
+via a config file passed to the MC when firmware starts it.
 
 -DPAA2 Objects for an Ethernet Network Interface
 
@@ -217,8 +216,8 @@ in creating a network interfaces.
-IRQs: command completion
-commands: IRQ config, enable, reset
 
-Object Connections
---
+Object Connections
+--
 Some objects have explicit relationships that must
 be configured:
 
@@ -242,8 +241,8 @@ in creating a network interfaces.
   Ethernet driver configures the DPBPs associated with
   the network interface.
 
-Interrupts
---
+Interrupts
+--
 All interrupts generated by DPAA2 objects are message
 interrupts.  At the hardware level message interrupts
 generated by devices will normally have 3 components--
@@ -255,8 +254,8 @@ in creating a network interfaces.
 For ARM-based SoC this is the same as the stream ID.
 
 
-DPAA2 Linux Driver Overview

+DPAA2 Linux Drivers Overview
+
 
 This section provides an overview of the Linux kernel drivers for
 DPAA2-- 1) the bus driver and associated "DPAA2 infrastructure"
@@ -291,7 +290,7 @@ of each driver follows.
   ++--+ |  +--+---+
   |   MC-bus driver   | |  | PHY  |
   |   | |  |driver|
-  | /soc/fsl-mc   | |  +--+---+
+  | /bus/fsl-mc   | |  +--+---+
   +---+ | |
 | |
   HARDWARE =|=|==
@@ -322,6 +321,8 @@ A brief description of each driver is provided below.
 a bind of the root DPRC to the DPRC driver
 The binding for the MC-bus device-tree node can be consulted here:
 Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt
+The sysfs bind/unbind interfaces for the MC-bus can be consulted here:
+Documentation/ABI/testing/sysfs-bus-fsl-mc*
 
 DPRC driver
 ---
@@ -366,8 +367,8 @@ A brief description of each driver is provided below.
 active in the kernel--  Ethernet, crypto, compression,
 etc.
 
-Ethernet
-
+Ethernet driver
+---
 The Ethernet driver is bound to a DPNI and implements the kernel
 interfaces needed to connect the DPAA2 network interface to
 the network stack.
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 6/8] staging: fsl-mc: Update include header

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

With the declarations of its_fsl_mc_msi_init/cleanup() now removed
from fsl-mc-private.h, irq-gic-v3-its-fsl-mc-msi.c only needs a
couple of definitions from mc.h, so include that header directly.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 506fce1..12734dd 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 #include 
-#include "fsl-mc-private.h"
+#include "../include/mc.h"
 
 static struct irq_chip its_msi_irq_chip = {
.name = "ITS-fMSI",
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers

2018-01-16 Thread Bogdan Purcareata
The fsl-mc bus and dpio driver files use a combination of GPL-2.0 and
GPL-2.0+ OR BSD-3-Clause licenses. Update to latter for all files. Add SPDX
tags and delete the full license text. Update copyright information.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
 drivers/staging/fsl-mc/Kconfig |  1 +
 drivers/staging/fsl-mc/Makefile|  1 +
 drivers/staging/fsl-mc/bus/Kconfig |  3 +-
 drivers/staging/fsl-mc/bus/Makefile|  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  | 29 ++-
 drivers/staging/fsl-mc/bus/dpbp.c  | 29 ++-
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 29 ++-
 drivers/staging/fsl-mc/bus/dpcon.c | 33 +++---
 drivers/staging/fsl-mc/bus/dpio/Makefile   |  1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h | 29 ++-
 drivers/staging/fsl-mc/bus/dpmcp.c | 29 ++-
 drivers/staging/fsl-mc/bus/dprc-driver.c   |  5 ++--
 drivers/staging/fsl-mc/bus/dprc.c  | 29 ++-
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-private.h|  5 ++--
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  5 ++--
 drivers/staging/fsl-mc/bus/mc-io.c | 29 ++-
 drivers/staging/fsl-mc/bus/mc-sys.c| 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-fd.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-global.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpbp.h  | 30 ++--
 drivers/staging/fsl-mc/include/dpcon.h | 33 +++---
 drivers/staging/fsl-mc/include/mc.h|  5 ++--
 32 files changed, 63 insertions(+), 573 deletions(-)

diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
index 32df07b..d4bab69 100644
--- a/drivers/staging/fsl-mc/Kconfig
+++ b/drivers/staging/fsl-mc/Kconfig
@@ -1 +1,2 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 source "drivers/staging/fsl-mc/bus/Kconfig"
diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile
index 9c6a001..d717b41 100644
--- a/drivers/staging/fsl-mc/Makefile
+++ b/drivers/staging/fsl-mc/Makefile
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 # Freescale Management Complex (MC) bus drivers
 obj-$(CONFIG_FSL_MC_BUS)   += bus/
diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
index 504c987..9adb2a6 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 #
 # DPAA2 fsl-mc bus
 #
 # Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 
 config FSL_MC_BUS
bool "QorIQ DPAA2 fsl-mc bus driver"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 6df407e..cdf319f 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 #
 # Freescale Management Complex (MC) bus drivers
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 
 mc-bus-driver-objs := fsl-mc-bus.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 5904836..1ac8ec6 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -1,33 +1,8 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
 /*
  * Copyright 2013-2016 Freescale Semiconductor Inc.
+ * Copyright 2016-2017 NXP
  *
- * 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.
- * * Red

[PATCH 5/8] staging: fsl-mc: Remove unnecessary dependency

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

The function that enables fsl-mc msi interrupts doesn't need
to be explicitly called from the fsl-mc bus driver initialization
routine.

Mark it to be independently called at system init; this is in line
with how things are handled by other GICv3 irqchip users.

Due to this change we now have an unused cleanup function, so
remove it.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 5 -
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 7 ---
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 4 
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 ++
 4 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index 041d341..b9f5a56 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -647,8 +647,3 @@ int __init fsl_mc_allocator_driver_init(void)
 {
return fsl_mc_driver_register(_mc_allocator_driver);
 }
-
-void fsl_mc_allocator_driver_exit(void)
-{
-   fsl_mc_driver_unregister(_mc_allocator_driver);
-}
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 0d010aa..9cb08c2 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -932,15 +932,8 @@ static int __init fsl_mc_bus_driver_init(void)
if (error < 0)
goto error_cleanup_dprc_driver;
 
-   error = its_fsl_mc_msi_init();
-   if (error < 0)
-   goto error_cleanup_mc_allocator;
-
return 0;
 
-error_cleanup_mc_allocator:
-   fsl_mc_allocator_driver_exit();
-
 error_cleanup_dprc_driver:
dprc_driver_exit();
 
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h 
b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
index a74186e..7e50cd4 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
@@ -439,8 +439,6 @@ void dprc_driver_exit(void);
 
 int __init fsl_mc_allocator_driver_init(void);
 
-void fsl_mc_allocator_driver_exit(void);
-
 void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
 
 void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
@@ -457,8 +455,6 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
 
 void fsl_mc_msi_domain_free_irqs(struct device *dev);
 
-int __init its_fsl_mc_msi_init(void);
-
 int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
   struct irq_domain **mc_msi_domain);
 
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 097c401f..506fce1 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -97,3 +97,5 @@ int __init its_fsl_mc_msi_init(void)
 
return 0;
 }
+
+early_initcall(its_fsl_mc_msi_init);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/8] staging: fsl-mc: Remove dead code

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Remove one unused function from irq-gic-v3-its-fsl-mc-msi.c

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-private.h   |  2 --
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c| 19 ---
 2 files changed, 21 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h 
b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
index 4023c4f..a74186e 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
@@ -459,8 +459,6 @@ void fsl_mc_msi_domain_free_irqs(struct device *dev);
 
 int __init its_fsl_mc_msi_init(void);
 
-void its_fsl_mc_msi_cleanup(void);
-
 int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
   struct irq_domain **mc_msi_domain);
 
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index bbef06f..097c401f 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -97,22 +97,3 @@ int __init its_fsl_mc_msi_init(void)
 
return 0;
 }
-
-void its_fsl_mc_msi_cleanup(void)
-{
-   struct device_node *np;
-
-   for (np = of_find_matching_node(NULL, its_device_id); np;
-np = of_find_matching_node(np, its_device_id)) {
-   struct irq_domain *mc_msi_domain = irq_find_matching_host(
-   np,
-   DOMAIN_BUS_FSL_MC_MSI);
-
-   if (!of_property_read_bool(np, "msi-controller"))
-   continue;
-
-   if (mc_msi_domain &&
-   mc_msi_domain->host_data == _fsl_mc_msi_domain_info)
-   irq_domain_remove(mc_msi_domain);
-   }
-}
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/8] staging: fsl-mc: Consolidate bus core header files

2018-01-16 Thread Bogdan Purcareata
The DPAA2 objects involved (DPMNG, DPMCP, DPRC) are used by the fsl-mc
bus infrastructure only, so group the APIs and structs into
fsl-mc-private.h.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h  |  54 
 drivers/staging/fsl-mc/bus/dpmcp.c  |   3 +-
 drivers/staging/fsl-mc/bus/dpmcp.h  |  55 -
 drivers/staging/fsl-mc/bus/dpmng-cmd.h  |  58 -
 drivers/staging/fsl-mc/bus/dprc-cmd.h   | 188 --
 drivers/staging/fsl-mc/bus/dprc-driver.c|   1 -
 drivers/staging/fsl-mc/bus/dprc.c   |   4 +-
 drivers/staging/fsl-mc/bus/dprc.h   | 203 ---
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c |   2 -
 drivers/staging/fsl-mc/bus/fsl-mc-private.h | 369 +++-
 drivers/staging/fsl-mc/bus/mc-io.c  |   2 -
 drivers/staging/fsl-mc/bus/mc-sys.c |   2 +-
 12 files changed, 371 insertions(+), 570 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmng-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.h

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
deleted file mode 100644
index 60fff6f..000
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2013-2016 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 the above-listed copyright holders nor the
- * names of any 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
- */
-#ifndef _FSL_DPMCP_CMD_H
-#define _FSL_DPMCP_CMD_H
-
-/* Minimal supported DPMCP Version */
-#define DPMCP_MIN_VER_MAJOR3
-#define DPMCP_MIN_VER_MINOR0
-
-/* Command versioning */
-#define DPMCP_CMD_BASE_VERSION 1
-#define DPMCP_CMD_ID_OFFSET4
-
-#define DPMCP_CMD(id)  (((id) << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION)
-
-/* Command IDs */
-#define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
-#define DPMCP_CMDID_OPEN   DPMCP_CMD(0x80b)
-#define DPMCP_CMDID_RESET  DPMCP_CMD(0x005)
-
-struct dpmcp_cmd_open {
-   __le32 dpmcp_id;
-};
-
-#endif /* _FSL_DPMCP_CMD_H */
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index 2989cc4..63b967c 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -32,8 +32,7 @@
 #include 
 #include "../include/mc.h"
 
-#include "dpmcp.h"
-#include "dpmcp-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpmcp_open() - Open a control session for the specified object.
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
deleted file mode 100644
index 873a4d0..000
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2016 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 ab

[PATCH 1/8] staging: fsl-mc: Cleanup dprc and dpmcp header files

2018-01-16 Thread Bogdan Purcareata
A lot of API and associated structures are not used by current code, so
remove them.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |   2 -
 drivers/staging/fsl-mc/bus/dpmcp.c |  32 
 drivers/staging/fsl-mc/bus/dpmcp.h |   5 -
 drivers/staging/fsl-mc/bus/dprc-cmd.h  | 263 -
 drivers/staging/fsl-mc/bus/dprc.c  | 224 
 drivers/staging/fsl-mc/bus/dprc.h  |  65 
 6 files changed, 591 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
index 861b2a7..60fff6f 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
@@ -45,8 +45,6 @@
 /* Command IDs */
 #define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
 #define DPMCP_CMDID_OPEN   DPMCP_CMD(0x80b)
-#define DPMCP_CMDID_GET_API_VERSIONDPMCP_CMD(0xa0b)
-
 #define DPMCP_CMDID_RESET  DPMCP_CMD(0x005)
 
 struct dpmcp_cmd_open {
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index eea42f6..2989cc4 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -124,35 +124,3 @@ int dpmcp_reset(struct fsl_mc_io *mc_io,
/* send command to mc*/
return mc_send_command(mc_io, );
 }
-
-/**
- * dpmcp_get_api_version - Get Data Path Management Command Portal API version
- * @mc_io: Pointer to Mc portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: Major version of Data Path Management Command Portal API
- * @minor_ver: Minor version of Data Path Management Command Portal API
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmcp_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver)
-{
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_API_VERSION,
- cmd_flags, 0);
-
-   /* send command to mc */
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   mc_cmd_read_api_version(, major_ver, minor_ver);
-
-   return 0;
-}
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
index f616031..873a4d0 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp.h
@@ -48,11 +48,6 @@ int dpmcp_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token);
 
-int dpmcp_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver);
-
 int dpmcp_reset(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token);
diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h 
b/drivers/staging/fsl-mc/bus/dprc-cmd.h
index d9b2dcd..ab13175 100644
--- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
@@ -58,56 +58,21 @@
 #define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
 
 #define DPRC_CMDID_SET_IRQ  DPRC_CMD(0x010)
-#define DPRC_CMDID_GET_IRQ  DPRC_CMD(0x011)
 #define DPRC_CMDID_SET_IRQ_ENABLE   DPRC_CMD(0x012)
-#define DPRC_CMDID_GET_IRQ_ENABLE   DPRC_CMD(0x013)
 #define DPRC_CMDID_SET_IRQ_MASK DPRC_CMD(0x014)
-#define DPRC_CMDID_GET_IRQ_MASK DPRC_CMD(0x015)
 #define DPRC_CMDID_GET_IRQ_STATUS   DPRC_CMD(0x016)
 #define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
 
 #define DPRC_CMDID_GET_CONT_ID  DPRC_CMD(0x830)
 #define DPRC_CMDID_GET_OBJ_COUNTDPRC_CMD(0x159)
 #define DPRC_CMDID_GET_OBJ  DPRC_CMD(0x15A)
-#define DPRC_CMDID_GET_RES_COUNTDPRC_CMD(0x15B)
 #define DPRC_CMDID_GET_OBJ_REG  DPRC_CMD(0x15E)
 #define DPRC_CMDID_SET_OBJ_IRQ  DPRC_CMD(0x15F)
-#define DPRC_CMDID_GET_OBJ_IRQ  DPRC_CMD(0x160)
 
 struct dprc_cmd_open {
__le32 container_id;
 };
 
-struct dprc_cmd_create_container {
-   /* cmd word 0 */
-   __le32 options;
-   __le16 icid;
-   __le16 pad0;
-   /* cmd word 1 */
-   __le32 pad1;
-   __le32 portal_id;
-   /* cmd words 2-3 */
-   u8 label[16];
-};
-
-struct dprc_rsp_create_container {
-   /* response word 0 */
-   __le64 pad0;
-   /* response word 1 */
-   __le32 child_container_id;
-   __le32 pad1;
-   /* response word 2 */
-   __le64 child_portal_addr;
-};
-
-struct dprc_cmd_destroy_container {
-   __le32 child_

RE: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-30 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Monday, October 30, 2017 10:56 AM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: de...@driverdev.osuosl.org; gre...@linuxfoundation.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment
> 
> On Fri, Oct 27, 2017 at 02:44:37PM +, Bogdan Purcareata wrote:
> > > -Original Message-
> > > From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> > > Sent: Friday, October 27, 2017 5:30 PM
> > > To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> > > Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> > > gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> > > de...@driverdev.osuosl.org
> > > Subject: Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer 
> > > alignment
> > >
> > > On Fri, Oct 27, 2017 at 02:11:35PM +, Bogdan Purcareata wrote:
> > > > @@ -93,10 +100,10 @@
> > > >   * buffers large enough to allow building an skb around them and also
> > > account
> > > >   * for alignment restrictions
> > > >   */
> > > > -#define DPAA2_ETH_BUF_RAW_SIZE \
> > > > +#define DPAA2_ETH_BUF_RAW_SIZE(priv) \
> > > > (DPAA2_ETH_RX_BUF_SIZE + \
> > > > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
> > > > -   DPAA2_ETH_RX_BUF_ALIGN)
> > > > +   (priv)->rx_buf_align)
> > > >
> > >
> > > Not related to this patch, but this macro is ugly.  It would be better
> > > as function.
> >
> > Okay, will change the macros to inline functions in v2, where applicable.
> >
> 
> You didn't need to do that, because I said it was "not related to this
> change".  I try not to make people redo paches for stuff like this.  But
> thanks, it looks nicer now.

I agree with you, it does look better with inline functions. I know the change
wasn't absolutely necessary, but the code is easier on the eyes in v2, so I
thought it was good enough reason to go for it.

Thanks for the feedback! :)
Bogdan P.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-29 Thread Bogdan Purcareata
When configuring the Tx buffer layout, the software annotation size is
mentioned, and MC accounts for it when configuring the frame
tx_data_offset. No need to handle it in the driver as well.

This results in 64B less memory allocated per frame.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
v1 -> v2:
- added clarification in commit message

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 92faaaf..d68c1f5 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1872,9 +1872,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
 priv->tx_data_offset);
 
-   /* Accommodate software annotation space (SWA) */
-   priv->tx_data_offset += DPAA2_ETH_SWA_SIZE;
-
return 0;
 
 close:
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-29 Thread Bogdan Purcareata
The WRIOP hardware block v1.0.0 (found on LS2080A board)
requires data in RX buffers to be aligned to 256B, but
newer revisions (e.g. on LS2088A, LS1088A) only require
64B alignment.

Check WRIOP version and decide at runtime which alignment
requirement to configure for ingress buffers.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
v1 -> v2:
- changed *_RAW_BUF_SIZE macro to inline function

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 18 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 27 ++
 2 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index d68c1f5..d65950d 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -766,11 +766,11 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
/* Allocate buffer visible to WRIOP + skb shared info +
 * alignment padding
 */
-   buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE);
+   buf = napi_alloc_frag(dpaa2_eth_buf_raw_size(priv));
if (unlikely(!buf))
goto err_alloc;
 
-   buf = PTR_ALIGN(buf, DPAA2_ETH_RX_BUF_ALIGN);
+   buf = PTR_ALIGN(buf, priv->rx_buf_align);
 
addr = dma_map_single(dev, buf, DPAA2_ETH_RX_BUF_SIZE,
  DMA_FROM_DEVICE);
@@ -781,7 +781,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
 
/* tracing point */
trace_dpaa2_eth_buf_seed(priv->net_dev,
-buf, DPAA2_ETH_BUF_RAW_SIZE,
+buf, dpaa2_eth_buf_raw_size(priv),
 addr, DPAA2_ETH_RX_BUF_SIZE,
 bpid);
}
@@ -1782,11 +1782,21 @@ static int set_buffer_layout(struct dpaa2_eth_priv 
*priv)
struct dpni_buffer_layout buf_layout = {0};
int err;
 
+   /* We need to check for WRIOP version 1.0.0, but depending on the MC
+* version, this number is not always provided correctly on rev1.
+* We need to check for both alternatives in this situation.
+*/
+   if (priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(0, 0, 0) ||
+   priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(1, 0, 0))
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN_REV1;
+   else
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
+
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = DPAA2_ETH_RX_BUF_ALIGN;
+   buf_layout.data_align = priv->rx_buf_align;
buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
 DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index bfbabae..749bd6b 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -45,6 +45,8 @@
 
 #include "dpaa2-eth-trace.h"
 
+#define DPAA2_WRIOP_VERSION(x, y, z) ((x) << 10 | (y) << 5 | (z) << 0)
+
 #define DPAA2_ETH_STORE_SIZE   16
 
 /* Maximum number of scatter-gather entries in an ingress frame,
@@ -85,18 +87,15 @@
  */
 #define DPAA2_ETH_RX_BUF_SIZE  2048
 #define DPAA2_ETH_TX_BUF_ALIGN 64
-#define DPAA2_ETH_RX_BUF_ALIGN 256
+
 #define DPAA2_ETH_NEEDED_HEADROOM(p_priv) \
((p_priv)->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN)
 
-/* Hardware only sees DPAA2_ETH_RX_BUF_SIZE, but we need to allocate ingress
- * buffers large enough to allow building an skb around them and also account
- * for alignment restrictions
+/* Due to a limitation in WRIOP 1.0.0, the RX buffer data must be aligned
+ * to 256B. For newer revisions, the requirement is only for 64B alignment
  */
-#define DPAA2_ETH_BUF_RAW_SIZE \
-   (DPAA2_ETH_RX_BUF_SIZE + \
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
-   DPAA2_ETH_RX_BUF_ALIGN)
+#define DPAA2_ETH_RX_BUF_ALIGN_REV1256
+#define DPAA2_ETH_RX_BUF_ALIGN 64
 
 /* We are accommodating a skb backpointer and some S/G info
  * in the frame's software annotation. The hardware
@@ -318,6 +317,7 @@ struct dpaa2_eth_priv {
struct iommu_domain *iommu_domain;
 
u16 tx_qdid;
+   u16 rx_buf_align;
struct fsl_mc_io *mc_io;
/* Cores which have an affine DPIO/DPCON.
 * This is the cpu set on which Rx and Tx c

[PATCH v2 2/5] staging: fsl-dpaa2/eth: Split function

2017-10-29 Thread Bogdan Purcareata
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Since setup_dpni() became a bit too long, move the buffer layout
configuration to a separate function.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
v1 -> v2:
- no changes

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++---
 1 file changed, 45 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 5d2bd18..92faaaf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1776,42 +1776,12 @@ static void free_dpbp(struct dpaa2_eth_priv *priv)
fsl_mc_object_free(priv->dpbp_dev);
 }
 
-/* Configure the DPNI object this interface is associated with */
-static int setup_dpni(struct fsl_mc_device *ls_dev)
+static int set_buffer_layout(struct dpaa2_eth_priv *priv)
 {
-   struct device *dev = _dev->dev;
-   struct dpaa2_eth_priv *priv;
-   struct net_device *net_dev;
+   struct device *dev = priv->net_dev->dev.parent;
struct dpni_buffer_layout buf_layout = {0};
int err;
 
-   net_dev = dev_get_drvdata(dev);
-   priv = netdev_priv(net_dev);
-
-   /* get a handle for the DPNI object */
-   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
-   if (err) {
-   dev_err(dev, "dpni_open() failed\n");
-   return err;
-   }
-
-   ls_dev->mc_io = priv->mc_io;
-   ls_dev->mc_handle = priv->mc_token;
-
-   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
-   if (err) {
-   dev_err(dev, "dpni_reset() failed\n");
-   goto close;
-   }
-
-   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
- >dpni_attrs);
-   if (err) {
-   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto close;
-   }
-
-   /* Configure buffer layouts */
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
@@ -1825,7 +1795,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto close;
+   return err;
}
 
/* tx buffer */
@@ -1835,7 +1805,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto close;
+   return err;
}
 
/* tx-confirm buffer */
@@ -1844,9 +1814,50 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
+   return err;
+   }
+
+   return 0;
+}
+
+/* Configure the DPNI object this interface is associated with */
+static int setup_dpni(struct fsl_mc_device *ls_dev)
+{
+   struct device *dev = _dev->dev;
+   struct dpaa2_eth_priv *priv;
+   struct net_device *net_dev;
+   int err;
+
+   net_dev = dev_get_drvdata(dev);
+   priv = netdev_priv(net_dev);
+
+   /* get a handle for the DPNI object */
+   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
+   if (err) {
+   dev_err(dev, "dpni_open() failed\n");
+   return err;
+   }
+
+   ls_dev->mc_io = priv->mc_io;
+   ls_dev->mc_handle = priv->mc_token;
+
+   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
+   if (err) {
+   dev_err(dev, "dpni_reset() failed\n");
goto close;
}
 
+   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
+ >dpni_attrs);
+   if (err) {
+   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
+   goto close;
+   }
+
+   err = set_buffer_layout(priv);
+   if (err)
+   goto close;
+
/* Now that we've set our tx buffer layout, retrieve the minimum
 * required tx data offset.
 */
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/5] staging: fsl-dpaa2/eth: Label cleanup

2017-10-29 Thread Bogdan Purcareata
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Clean up goto labels in a couple of functions, by
removing/renaming redundant ones.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
v1 -> v2:
- no changes

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 35 +++---
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 9fbc0ee..5d2bd18 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1444,34 +1444,32 @@ static struct fsl_mc_device *setup_dpcon(struct 
dpaa2_eth_priv *priv)
err = dpcon_open(priv->mc_io, 0, dpcon->obj_desc.id, >mc_handle);
if (err) {
dev_err(dev, "dpcon_open() failed\n");
-   goto err_open;
+   goto free;
}
 
err = dpcon_reset(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpcon_get_attributes(priv->mc_io, 0, dpcon->mc_handle, );
if (err) {
dev_err(dev, "dpcon_get_attributes() failed\n");
-   goto err_get_attr;
+   goto close;
}
 
err = dpcon_enable(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_enable() failed\n");
-   goto err_enable;
+   goto close;
}
 
return dpcon;
 
-err_enable:
-err_get_attr:
-err_reset:
+close:
dpcon_close(priv->mc_io, 0, dpcon->mc_handle);
-err_open:
+free:
fsl_mc_object_free(dpcon);
 
return NULL;
@@ -1794,7 +1792,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
if (err) {
dev_err(dev, "dpni_open() failed\n");
-   goto err_open;
+   return err;
}
 
ls_dev->mc_io = priv->mc_io;
@@ -1803,14 +1801,14 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_reset(priv->mc_io, 0, priv->mc_token);
if (err) {
dev_err(dev, "dpni_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
  >dpni_attrs);
if (err) {
dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto err_get_attr;
+   goto close;
}
 
/* Configure buffer layouts */
@@ -1827,7 +1825,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx buffer */
@@ -1837,7 +1835,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx-confirm buffer */
@@ -1846,7 +1844,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* Now that we've set our tx buffer layout, retrieve the minimum
@@ -1856,7 +1854,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
  >tx_data_offset);
if (err) {
dev_err(dev, "dpni_get_tx_data_offset() failed\n");
-   goto err_data_offset;
+   goto close;
}
 
if ((priv->tx_data_offset % 64) != 0)
@@ -1868,12 +1866,9 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 
return 0;
 
-err_data_offset:
-err_buf_layout:
-err_get_attr:
-err_reset:
+close:
dpni_close(priv->mc_io, 0, priv->mc_token);
-err_open:
+
return err;
 }
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 5/5] staging: fsl-dpaa2/eth: Extra headroom in RX buffers

2017-10-29 Thread Bogdan Purcareata
The needed headroom that we ask the stack to reserve for us in TX
skbs is larger than the headroom available in RX frames, which
leads to skb reallocations in forwarding scenarios involving two
DPNI interfaces.

Configure the hardware to reserve some extra space in the RX
frame headroom to avoid this situation. The value is chosen based
on the Tx frame data offset, the Rx buffer alignment value and the
netdevice required headroom.

The network stack will take care to reserve space for HH_DATA_MOD when
building the skb, so there's no need to account for it in the netdevice
needed headroom.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
v1 -> v2:
- changed *_RX_HEAD_ROOM from macro to inline function
- since the patch is touching the area, did the same for *_NEEDED_HEADROOM

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 85 +++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 39 
 2 files changed, 76 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index d65950d..0d8ed00 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -135,8 +135,7 @@ static struct sk_buff *build_linear_skb(struct 
dpaa2_eth_priv *priv,
 
ch->buf_count--;
 
-   skb = build_skb(fd_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(fd_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb))
return NULL;
 
@@ -178,8 +177,7 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv 
*priv,
 
if (i == 0) {
/* We build the skb around the first data buffer */
-   skb = build_skb(sg_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(sg_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb)) {
/* Free the first SG entry now, since we already
 * unmapped it and obtained the virtual address
@@ -573,10 +571,10 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, 
struct net_device *net_dev)
percpu_stats = this_cpu_ptr(priv->percpu_stats);
percpu_extras = this_cpu_ptr(priv->percpu_extras);
 
-   if (unlikely(skb_headroom(skb) < DPAA2_ETH_NEEDED_HEADROOM(priv))) {
+   if (unlikely(skb_headroom(skb) < dpaa2_eth_needed_headroom(priv))) {
struct sk_buff *ns;
 
-   ns = skb_realloc_headroom(skb, DPAA2_ETH_NEEDED_HEADROOM(priv));
+   ns = skb_realloc_headroom(skb, dpaa2_eth_needed_headroom(priv));
if (unlikely(!ns)) {
percpu_stats->tx_dropped++;
goto err_alloc_headroom;
@@ -1792,23 +1790,9 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
else
priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
 
-   /* rx buffer */
-   buf_layout.pass_parser_result = true;
+   /* tx buffer */
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = priv->rx_buf_align;
-   buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
-DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
-DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
-DPNI_BUF_LAYOUT_OPT_DATA_ALIGN;
-   err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
-DPNI_QUEUE_RX, _layout);
-   if (err) {
-   dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   return err;
-   }
-
-   /* tx buffer */
buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
@@ -1827,6 +1811,36 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
return err;
}
 
+   /* Now that we've set our tx buffer layout, retrieve the minimum
+* required tx data offset.
+*/
+   err = dpni_get_tx_data_offset(priv->mc_io, 0, priv->mc_token,
+ >tx_data_offset);
+   if (err) {
+   dev_err(dev, "dpni_get_tx_data_offset() failed\n");
+   return err;
+   }
+
+   if ((priv->tx_data_offset % 64) != 0)
+   dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
+priv->tx_data_offset);
+
+   /* rx buffer */
+   buf_layout.pass_parser_resu

[PATCH v2 0/5] staging: fsl-dpaa2/eth: Frame buffer work

2017-10-29 Thread Bogdan Purcareata
This patchset does some refactoring in the frame buffer area, in order
for it to be in line with firmware (MC) configuration.

Patches 1 - 2 do some label cleanup and move the buffer layout setup
to a dedicated function.

Patch 3 updates tx_data_offset - the offset for Tx frame buffers - to
not account the software annotation area, since it's already accounted
for by the firmware. This results in slightly less allocated memory.

Patch 4 updates the required alignment for Rx frame buffers, based on
the accelerator hardware version.

Patch 5 configures a headroom in the Rx frame buffers to prevent
netstack reallocations in forwarding scenarios.

Patchset sent against staging-next.

v1 -> v2:
- clarified one commit message
- changed some macros to inline functions
- more comments per individual patches

Bogdan Purcareata (3):
  staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
  staging: fsl-dpaa2/eth: Change RX buffer alignment
  staging: fsl-dpaa2/eth: Extra headroom in RX buffers

Ioana Radulescu (2):
  staging: fsl-dpaa2/eth: Label cleanup
  staging: fsl-dpaa2/eth: Split function

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 176 ++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  54 +---
 2 files changed, 141 insertions(+), 89 deletions(-)

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-27 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, October 27, 2017 5:30 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment
> 
> On Fri, Oct 27, 2017 at 02:11:35PM +, Bogdan Purcareata wrote:
> > @@ -93,10 +100,10 @@
> >   * buffers large enough to allow building an skb around them and also
> account
> >   * for alignment restrictions
> >   */
> > -#define DPAA2_ETH_BUF_RAW_SIZE \
> > +#define DPAA2_ETH_BUF_RAW_SIZE(priv) \
> > (DPAA2_ETH_RX_BUF_SIZE + \
> > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
> > -   DPAA2_ETH_RX_BUF_ALIGN)
> > +   (priv)->rx_buf_align)
> >
> 
> Not related to this patch, but this macro is ugly.  It would be better
> as function.

Okay, will change the macros to inline functions in v2, where applicable.

Thank you!
Bogdan P.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-27 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, October 27, 2017 5:27 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in
> tx_data_offset
> 
> 
> On Fri, Oct 27, 2017 at 02:11:34PM +, Bogdan Purcareata wrote:
> > When configuring the Tx buffer layout, the software annotation size is
> > mentioned, and MC accounts for it when configuring the frame
> > tx_data_offset. No need to handle it in the driver as well.
> >
> 
> The impact is that we allocate slightly less memory right?

Yes, 64B per frame.

Bogdan P.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-27 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, October 27, 2017 5:34 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in
> tx_data_offset
> 
> On Fri, Oct 27, 2017 at 02:31:22PM +, Bogdan Purcareata wrote:
> > > -Original Message-
> > > From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> > > Sent: Friday, October 27, 2017 5:27 PM
> > > To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> > > Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> > > gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> > > de...@driverdev.osuosl.org
> > > Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in
> > > tx_data_offset
> > >
> > >
> > > On Fri, Oct 27, 2017 at 02:11:34PM +, Bogdan Purcareata wrote:
> > > > When configuring the Tx buffer layout, the software annotation size is
> > > > mentioned, and MC accounts for it when configuring the frame
> > > > tx_data_offset. No need to handle it in the driver as well.
> > > >
> > >
> > > The impact is that we allocate slightly less memory right?
> >
> > Yes, 64B per frame.
> 
> Ok.  Cool.  Please put this kind of stuff in the changelog.  At first I
> thought it was maybe a buffer overflow just from reading what was in the
> email without looking at the code.

Okay, will update in v2.

Thank you!
Bogdan P.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/5] staging: fsl-dpaa2/eth: Extra headroom in RX buffers

2017-10-27 Thread Bogdan Purcareata
The needed headroom that we ask the stack to reserve for us in TX
skbs is larger than the headroom available in RX frames, which
leads to skb reallocations in forwarding scenarios involving two
DPNI interfaces.

Configure the hardware to reserve some extra space in the RX
frame headroom to avoid this situation. The value is chosen based
on the Tx frame data offset, the Rx buffer alignment value and the
netdevice required headroom.

The network stack will take care to reserve space for HH_DATA_MOD when
building the skb, so there's no need to account for it in the netdevice
needed headroom.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 32 +++
 2 files changed, 67 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 29b4928..636beac 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -135,8 +135,7 @@ static struct sk_buff *build_linear_skb(struct 
dpaa2_eth_priv *priv,
 
ch->buf_count--;
 
-   skb = build_skb(fd_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(fd_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb))
return NULL;
 
@@ -178,8 +177,7 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv 
*priv,
 
if (i == 0) {
/* We build the skb around the first data buffer */
-   skb = build_skb(sg_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(sg_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb)) {
/* Free the first SG entry now, since we already
 * unmapped it and obtained the virtual address
@@ -1792,23 +1790,9 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
else
priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
 
-   /* rx buffer */
-   buf_layout.pass_parser_result = true;
+   /* tx buffer */
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = priv->rx_buf_align;
-   buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
-DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
-DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
-DPNI_BUF_LAYOUT_OPT_DATA_ALIGN;
-   err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
-DPNI_QUEUE_RX, _layout);
-   if (err) {
-   dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   return err;
-   }
-
-   /* tx buffer */
buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
@@ -1827,6 +1811,36 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
return err;
}
 
+   /* Now that we've set our tx buffer layout, retrieve the minimum
+* required tx data offset.
+*/
+   err = dpni_get_tx_data_offset(priv->mc_io, 0, priv->mc_token,
+ >tx_data_offset);
+   if (err) {
+   dev_err(dev, "dpni_get_tx_data_offset() failed\n");
+   return err;
+   }
+
+   if ((priv->tx_data_offset % 64) != 0)
+   dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
+priv->tx_data_offset);
+
+   /* rx buffer */
+   buf_layout.pass_parser_result = true;
+   buf_layout.data_align = priv->rx_buf_align;
+   buf_layout.data_head_room = DPAA2_ETH_RX_HEAD_ROOM(priv);
+   buf_layout.private_data_size = 0;
+   buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
+DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
+DPNI_BUF_LAYOUT_OPT_DATA_ALIGN |
+DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM;
+   err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
+DPNI_QUEUE_RX, _layout);
+   if (err) {
+   dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
+   return err;
+   }
+
return 0;
 }
 
@@ -1868,19 +1882,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
if (err)
goto close;
 
-   /*

[PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-27 Thread Bogdan Purcareata
The WRIOP hardware block v1.0.0 (found on LS2080A board)
requires data in RX buffers to be aligned to 256B, but
newer revisions (e.g. on LS2088A, LS1088A) only require
64B alignment.

Check WRIOP version and decide at runtime which alignment
requirement to configure for ingress buffers.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 18 ++
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 14 +++---
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index d68c1f5..29b4928 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -766,11 +766,11 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
/* Allocate buffer visible to WRIOP + skb shared info +
 * alignment padding
 */
-   buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE);
+   buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE(priv));
if (unlikely(!buf))
goto err_alloc;
 
-   buf = PTR_ALIGN(buf, DPAA2_ETH_RX_BUF_ALIGN);
+   buf = PTR_ALIGN(buf, priv->rx_buf_align);
 
addr = dma_map_single(dev, buf, DPAA2_ETH_RX_BUF_SIZE,
  DMA_FROM_DEVICE);
@@ -781,7 +781,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
 
/* tracing point */
trace_dpaa2_eth_buf_seed(priv->net_dev,
-buf, DPAA2_ETH_BUF_RAW_SIZE,
+buf, DPAA2_ETH_BUF_RAW_SIZE(priv),
 addr, DPAA2_ETH_RX_BUF_SIZE,
 bpid);
}
@@ -1782,11 +1782,21 @@ static int set_buffer_layout(struct dpaa2_eth_priv 
*priv)
struct dpni_buffer_layout buf_layout = {0};
int err;
 
+   /* We need to check for WRIOP version 1.0.0, but depending on the MC
+* version, this number is not always provided correctly on rev1.
+* We need to check for both alternatives in this situation.
+*/
+   if (priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(0, 0, 0) ||
+   priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(1, 0, 0))
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN_REV1;
+   else
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
+
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = DPAA2_ETH_RX_BUF_ALIGN;
+   buf_layout.data_align = priv->rx_buf_align;
buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
 DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index bfbabae..374a99a 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -45,6 +45,8 @@
 
 #include "dpaa2-eth-trace.h"
 
+#define DPAA2_WRIOP_VERSION(x, y, z) ((x) << 10 | (y) << 5 | (z) << 0)
+
 #define DPAA2_ETH_STORE_SIZE   16
 
 /* Maximum number of scatter-gather entries in an ingress frame,
@@ -85,7 +87,12 @@
  */
 #define DPAA2_ETH_RX_BUF_SIZE  2048
 #define DPAA2_ETH_TX_BUF_ALIGN 64
-#define DPAA2_ETH_RX_BUF_ALIGN 256
+/* Due to a limitation in WRIOP 1.0.0, the RX buffer data must be aligned
+ * to 256B. For newer revisions, the requirement is only for 64B alignment
+ */
+#define DPAA2_ETH_RX_BUF_ALIGN_REV1256
+#define DPAA2_ETH_RX_BUF_ALIGN 64
+
 #define DPAA2_ETH_NEEDED_HEADROOM(p_priv) \
((p_priv)->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN)
 
@@ -93,10 +100,10 @@
  * buffers large enough to allow building an skb around them and also account
  * for alignment restrictions
  */
-#define DPAA2_ETH_BUF_RAW_SIZE \
+#define DPAA2_ETH_BUF_RAW_SIZE(priv) \
(DPAA2_ETH_RX_BUF_SIZE + \
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
-   DPAA2_ETH_RX_BUF_ALIGN)
+   (priv)->rx_buf_align)
 
 /* We are accommodating a skb backpointer and some S/G info
  * in the frame's software annotation. The hardware
@@ -318,6 +325,7 @@ struct dpaa2_eth_priv {
struct iommu_domain *iommu_domain;
 
u16 tx_qdid;
+   u16 rx_buf_align;
struct fsl_mc_io *mc_io;
/* Cores which have an affine DPIO/DPCON.
 * This is the cpu set on which Rx and Tx conf frames are processed
-- 
2.7.4

__

[PATCH 2/5] staging: fsl-dpaa2/eth: Split function

2017-10-27 Thread Bogdan Purcareata
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Since setup_dpni() became a bit too long, move the buffer layout
configuration to a separate function.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++---
 1 file changed, 45 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 5d2bd18..92faaaf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1776,42 +1776,12 @@ static void free_dpbp(struct dpaa2_eth_priv *priv)
fsl_mc_object_free(priv->dpbp_dev);
 }
 
-/* Configure the DPNI object this interface is associated with */
-static int setup_dpni(struct fsl_mc_device *ls_dev)
+static int set_buffer_layout(struct dpaa2_eth_priv *priv)
 {
-   struct device *dev = _dev->dev;
-   struct dpaa2_eth_priv *priv;
-   struct net_device *net_dev;
+   struct device *dev = priv->net_dev->dev.parent;
struct dpni_buffer_layout buf_layout = {0};
int err;
 
-   net_dev = dev_get_drvdata(dev);
-   priv = netdev_priv(net_dev);
-
-   /* get a handle for the DPNI object */
-   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
-   if (err) {
-   dev_err(dev, "dpni_open() failed\n");
-   return err;
-   }
-
-   ls_dev->mc_io = priv->mc_io;
-   ls_dev->mc_handle = priv->mc_token;
-
-   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
-   if (err) {
-   dev_err(dev, "dpni_reset() failed\n");
-   goto close;
-   }
-
-   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
- >dpni_attrs);
-   if (err) {
-   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto close;
-   }
-
-   /* Configure buffer layouts */
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
@@ -1825,7 +1795,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto close;
+   return err;
}
 
/* tx buffer */
@@ -1835,7 +1805,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto close;
+   return err;
}
 
/* tx-confirm buffer */
@@ -1844,9 +1814,50 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
+   return err;
+   }
+
+   return 0;
+}
+
+/* Configure the DPNI object this interface is associated with */
+static int setup_dpni(struct fsl_mc_device *ls_dev)
+{
+   struct device *dev = _dev->dev;
+   struct dpaa2_eth_priv *priv;
+   struct net_device *net_dev;
+   int err;
+
+   net_dev = dev_get_drvdata(dev);
+   priv = netdev_priv(net_dev);
+
+   /* get a handle for the DPNI object */
+   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
+   if (err) {
+   dev_err(dev, "dpni_open() failed\n");
+   return err;
+   }
+
+   ls_dev->mc_io = priv->mc_io;
+   ls_dev->mc_handle = priv->mc_token;
+
+   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
+   if (err) {
+   dev_err(dev, "dpni_reset() failed\n");
goto close;
}
 
+   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
+ >dpni_attrs);
+   if (err) {
+   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
+   goto close;
+   }
+
+   err = set_buffer_layout(priv);
+   if (err)
+   goto close;
+
/* Now that we've set our tx buffer layout, retrieve the minimum
 * required tx data offset.
 */
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-27 Thread Bogdan Purcareata
When configuring the Tx buffer layout, the software annotation size is
mentioned, and MC accounts for it when configuring the frame
tx_data_offset. No need to handle it in the driver as well.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 92faaaf..d68c1f5 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1872,9 +1872,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
 priv->tx_data_offset);
 
-   /* Accommodate software annotation space (SWA) */
-   priv->tx_data_offset += DPAA2_ETH_SWA_SIZE;
-
return 0;
 
 close:
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/5] staging: fsl-dpaa2/eth: Label cleanup

2017-10-27 Thread Bogdan Purcareata
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Clean up goto labels in a couple of functions, by
removing/renaming redundant ones.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 35 +++---
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 9fbc0ee..5d2bd18 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1444,34 +1444,32 @@ static struct fsl_mc_device *setup_dpcon(struct 
dpaa2_eth_priv *priv)
err = dpcon_open(priv->mc_io, 0, dpcon->obj_desc.id, >mc_handle);
if (err) {
dev_err(dev, "dpcon_open() failed\n");
-   goto err_open;
+   goto free;
}
 
err = dpcon_reset(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpcon_get_attributes(priv->mc_io, 0, dpcon->mc_handle, );
if (err) {
dev_err(dev, "dpcon_get_attributes() failed\n");
-   goto err_get_attr;
+   goto close;
}
 
err = dpcon_enable(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_enable() failed\n");
-   goto err_enable;
+   goto close;
}
 
return dpcon;
 
-err_enable:
-err_get_attr:
-err_reset:
+close:
dpcon_close(priv->mc_io, 0, dpcon->mc_handle);
-err_open:
+free:
fsl_mc_object_free(dpcon);
 
return NULL;
@@ -1794,7 +1792,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
if (err) {
dev_err(dev, "dpni_open() failed\n");
-   goto err_open;
+   return err;
}
 
ls_dev->mc_io = priv->mc_io;
@@ -1803,14 +1801,14 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_reset(priv->mc_io, 0, priv->mc_token);
if (err) {
dev_err(dev, "dpni_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
  >dpni_attrs);
if (err) {
dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto err_get_attr;
+   goto close;
}
 
/* Configure buffer layouts */
@@ -1827,7 +1825,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx buffer */
@@ -1837,7 +1835,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx-confirm buffer */
@@ -1846,7 +1844,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* Now that we've set our tx buffer layout, retrieve the minimum
@@ -1856,7 +1854,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
  >tx_data_offset);
if (err) {
dev_err(dev, "dpni_get_tx_data_offset() failed\n");
-   goto err_data_offset;
+   goto close;
}
 
if ((priv->tx_data_offset % 64) != 0)
@@ -1868,12 +1866,9 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 
return 0;
 
-err_data_offset:
-err_buf_layout:
-err_get_attr:
-err_reset:
+close:
dpni_close(priv->mc_io, 0, priv->mc_token);
-err_open:
+
return err;
 }
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/5] staging: fsl-dpaa2/eth: Frame buffer work

2017-10-27 Thread Bogdan Purcareata
This patchset does some refactoring in the frame buffer area, in order
for it to be in line with firmware (MC) configuration.

Patches 1 - 2 do some label cleanup and move the buffer layout setup
to a dedicated function.

Patch 3 updates tx_data_offset - the offset for Tx frame buffers - to
not account the software annotation area, since it's already accounted
for by the firmware.

Patch 4 updates the required alignment for Rx frame buffers, based on
the accelerator hardware version.

Patch 5 configures a headroom in the Rx frame buffers to prevent
netstack reallocations in forwarding scenarios.

Patchset sent against staging-next.

Bogdan Purcareata (3):
  staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
  staging: fsl-dpaa2/eth: Change RX buffer alignment
  staging: fsl-dpaa2/eth: Extra headroom in RX buffers

Ioana Radulescu (2):
  staging: fsl-dpaa2/eth: Label cleanup
  staging: fsl-dpaa2/eth: Split function

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 170 ++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  44 +--
 2 files changed, 129 insertions(+), 85 deletions(-)

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [RESEND PATCH 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver

2017-09-29 Thread Bogdan Purcareata
> Introduce the DPAA2 Ethernet Switch driver, which manages Datapath Switch
> (DPSW) objects discovered on the MC bus.
> 
> Suggested-by: Alexandru Marginean 
> Signed-off-by: Razvan Stefanescu 
> ---
>  drivers/staging/fsl-dpaa2/ethsw/Makefile |2 +-
>  drivers/staging/fsl-dpaa2/ethsw/ethsw.c  | 1523 
> ++
>  drivers/staging/fsl-dpaa2/ethsw/ethsw.h  |   88 ++
>  3 files changed, 1612 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.c
>  create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.h
> 
> diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile b/drivers/staging/fsl-
> dpaa2/ethsw/Makefile
> index db137f7..a6d72d1 100644
> --- a/drivers/staging/fsl-dpaa2/ethsw/Makefile
> +++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile
> @@ -4,4 +4,4 @@
> 
>  obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o
> 
> -dpaa2-ethsw-objs := dpsw.o
> +dpaa2-ethsw-objs := ethsw.o dpsw.o
> diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-
> dpaa2/ethsw/ethsw.c
> new file mode 100644
> index 000..ae86078
> --- /dev/null
> +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
> @@ -0,0 +1,1523 @@
> +/* Copyright 2014-2016 Freescale Semiconductor Inc.
> + * Copyright 2017 NXP
> + *
> + * 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 the above-listed copyright holders nor the
> + *names of any 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS OR CONTRIBUTORS 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 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "../../fsl-mc/include/mc.h"
> +
> +#include "ethsw.h"
> +
> +static struct workqueue_struct *ethsw_owq;
> +
> +/* Minimal supported DPSW version */
> +#define DPSW_MIN_VER_MAJOR   8
> +#define DPSW_MIN_VER_MINOR   0
> +
> +#define DEFAULT_VLAN_ID  1
> +
> +static int ethsw_add_vlan(struct ethsw_core *ethsw, u16 vid)
> +{
> + int err;
> +
> + struct dpsw_vlan_cfgvcfg = {
> + .fdb_id = 0,
> + };
> +
> + if (ethsw->vlans[vid]) {
> + dev_err(ethsw->dev, "VLAN already configured\n");
> + return -EEXIST;
> + }
> +
> + err = dpsw_vlan_add(ethsw->mc_io, 0,
> + ethsw->dpsw_handle, vid, );
> + if (err) {
> + dev_err(ethsw->dev, "dpsw_vlan_add err %d\n", err);
> + return err;
> + }
> + ethsw->vlans[vid] = ETHSW_VLAN_MEMBER;/
> +
> + return 0;
> +}
> +
> +static int ethsw_port_add_vlan(struct ethsw_port_priv *port_priv,
> +u16 vid, u16 flags)
> +{
> + struct ethsw_core *ethsw = port_priv->ethsw_data;
> + struct net_device *netdev = port_priv->netdev;
> + struct dpsw_vlan_if_cfg vcfg;
> + bool is_oper;
> + int err, err2;

Mild suggestion - s/err2/ret/, just because it sounds better, at least to me 
(same for similar situations in the rest of the file).

> +
> + if (port_priv->vlans[vid]) {
> + netdev_warn(netdev, "VLAN %d already configured\n", vid);
> + return -EEXIST;
> + }
> +
> + vcfg.num_ifs = 1;
> + vcfg.if_id[0] = port_priv->idx;
> + err = dpsw_vlan_add_if(ethsw->mc_io, 0, ethsw->dpsw_handle, vid, );
> + if (err) {
> + 

[PATCH] staging: fsl-mc/dpio: Skip endianness conversion in portal config

2017-07-20 Thread Bogdan Purcareata
Writing to the register using writel does the CPU to LE conversion down the
line, so it's not required here. Doing it breaks portal configuration on
big endian kernels.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c 
b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
index 7988612..163bdac 100644
--- a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
+++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
@@ -136,18 +136,18 @@ static inline u32 qbman_set_swp_cfg(u8 max_fill, u8 wn,   
u8 est, u8 rpm, u8 dcm,
u8 epm, int sd, int sp, int se,
int dp, int de, int ep)
 {
-   return cpu_to_le32 (max_fill << SWP_CFG_DQRR_MF_SHIFT |
-   est << SWP_CFG_EST_SHIFT |
-   wn << SWP_CFG_WN_SHIFT |
-   rpm << SWP_CFG_RPM_SHIFT |
-   dcm << SWP_CFG_DCM_SHIFT |
-   epm << SWP_CFG_EPM_SHIFT |
-   sd << SWP_CFG_SD_SHIFT |
-   sp << SWP_CFG_SP_SHIFT |
-   se << SWP_CFG_SE_SHIFT |
-   dp << SWP_CFG_DP_SHIFT |
-   de << SWP_CFG_DE_SHIFT |
-   ep << SWP_CFG_EP_SHIFT);
+   return (max_fill << SWP_CFG_DQRR_MF_SHIFT |
+   est << SWP_CFG_EST_SHIFT |
+   wn << SWP_CFG_WN_SHIFT |
+   rpm << SWP_CFG_RPM_SHIFT |
+   dcm << SWP_CFG_DCM_SHIFT |
+   epm << SWP_CFG_EPM_SHIFT |
+   sd << SWP_CFG_SD_SHIFT |
+   sp << SWP_CFG_SP_SHIFT |
+   se << SWP_CFG_SE_SHIFT |
+   dp << SWP_CFG_DP_SHIFT |
+   de << SWP_CFG_DE_SHIFT |
+   ep << SWP_CFG_EP_SHIFT);
 }
 
 /**
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 1/2] staging: fsl-dpaa2/eth: Fix skb use after free

2017-07-20 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Thursday, July 20, 2017 2:18 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 1/2] staging: fsl-dpaa2/eth: Fix skb use after free
> 
> On Thu, Jul 20, 2017 at 10:58:37AM +, Bogdan Purcareata wrote:
> > Once a Tx frame descriptor is enqueued, an interrupt might be triggered
> > to process the Tx confirmation and free the skb, hitting a memory use
> > after free when updating the tx_bytes statistic based on skb->len.
> >
> > Use the frame descriptor length instead.
> >
> > Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> > ---
> >  drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> > index b9a0a31..0f3e497 100644
> > --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> > +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> > @@ -616,7 +616,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb,
> struct net_device *net_dev)
> > free_tx_fd(priv, , NULL);
> > } else {
> > percpu_stats->tx_packets++;
> > -   percpu_stats->tx_bytes += skb->len;
> > +   percpu_stats->tx_bytes += dpaa2_fd_get_len();
> 
> This feels like the wrong thing.  Can't we just save skb->len earlier
> in the function and use it here?  This is the common case right?  So
> we'd be saving slightly wrong information for almost every packet.

The "len" field in the frame descriptor means the length of the actual data, 
like the "len" field in the skb. It's set to skb->len both for linear 
(build_single_fd) and fragmented (build_sg_fd) skbs. I thought it would be more 
straightforward to use it rather than define an additional local variable 
solely for this purpose.

Thank you!
Bogdan P.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: fsl-dpaa2/eth: Error report format fixes

2017-07-20 Thread Bogdan Purcareata
Fix mishaps in error format strings.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 0f3e497..26017fe 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -656,7 +656,7 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv,
has_fas_errors = (fd_errors & DPAA2_FD_CTRL_FAERR) &&
 !!(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV);
if (net_ratelimit())
-   netdev_dbg(priv->net_dev, "TX frame FD error: %x08\n",
+   netdev_dbg(priv->net_dev, "TX frame FD error: 0x%08x\n",
   fd_errors);
}
 
@@ -670,7 +670,7 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv,
percpu_stats->tx_errors++;
 
if (has_fas_errors && net_ratelimit())
-   netdev_dbg(priv->net_dev, "TX frame FAS error: %x08\n",
+   netdev_dbg(priv->net_dev, "TX frame FAS error: 0x%08x\n",
   status & DPAA2_FAS_TX_ERR_MASK);
 }
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: fsl-dpaa2/eth: Fix skb use after free

2017-07-20 Thread Bogdan Purcareata
Once a Tx frame descriptor is enqueued, an interrupt might be triggered
to process the Tx confirmation and free the skb, hitting a memory use
after free when updating the tx_bytes statistic based on skb->len.

Use the frame descriptor length instead.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index b9a0a31..0f3e497 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -616,7 +616,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct 
net_device *net_dev)
free_tx_fd(priv, , NULL);
} else {
percpu_stats->tx_packets++;
-   percpu_stats->tx_bytes += skb->len;
+   percpu_stats->tx_bytes += dpaa2_fd_get_len();
}
 
return NETDEV_TX_OK;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] staging: fsl-dpaa2/eth: Remove dead code

2017-06-30 Thread Bogdan Purcareata
> -Original Message-
> From: Ioana Radulescu [mailto:ruxandra.radule...@nxp.com]
> Sent: Thursday, June 29, 2017 7:26 PM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; linux-arm-ker...@lists.infradead.org; Bogdan
> Purcareata <bogdan.purcare...@nxp.com>; stuyo...@gmail.com; Laurentiu Tudor
> <laurentiu.tu...@nxp.com>
> Subject: [PATCH] staging: fsl-dpaa2/eth: Remove dead code
> 
> All possible values of the switch statement are explicitly
> handled, so there's no need to have a default branch.
> 
> Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>

Acked-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>

> ---
>  drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> index 5312edc26f01..031179ab3a22 100644
> --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> @@ -217,8 +217,6 @@ static void dpaa2_eth_get_ethtool_stats(struct
> net_device *net_dev,
>   case 2:
>   num_cnt = sizeof(dpni_stats.page_2) / sizeof(u64);
>   break;
> - default:
> - break;
>   }
>   for (k = 0; k < num_cnt; k++)
>   *(data + i++) = dpni_stats.raw.counter[k];
> --
> 2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] staging: fsl-mc/dpio: Propagate error code

2017-06-15 Thread Bogdan Purcareata
> -Original Message-
> From: Ioana Radulescu [mailto:ruxandra.radule...@nxp.com]
> Sent: Thursday, June 15, 2017 11:55 AM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; linux-arm-ker...@lists.infradead.org; Bogdan
> Purcareata <bogdan.purcare...@nxp.com>; stuyo...@gmail.com; Laurentiu Tudor
> <laurentiu.tu...@nxp.com>; Ruxandra Ioana Radulescu
> <ruxandra.radule...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Haiying Wang
> <haiying.w...@nxp.com>
> Subject: [PATCH] staging: fsl-mc/dpio: Propagate error code
> 
> dpaa2_io_service_register() returns zero even if
> qbman_swp_CDAN_set() encountered an error. Fix this
> by propagating the error code so the caller is informed
> data availability notifications are not properly set
> for a channel.
> 
> Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>

Acked-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>

> ---
>  drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> index e5d66749614c..762f045f53f7 100644
> --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> @@ -260,9 +260,9 @@ int dpaa2_io_service_register(struct dpaa2_io *d,
> 
>   /* Enable the generation of CDAN notifications */
>   if (ctx->is_cdan)
> - qbman_swp_CDAN_set_context_enable(d->swp,
> -   (u16)ctx->id,
> -   ctx->qman64);
> + return qbman_swp_CDAN_set_context_enable(d->swp,
> +  (u16)ctx->id,
> +  ctx->qman64);
>   return 0;
>  }
>  EXPORT_SYMBOL(dpaa2_io_service_register);
> --
> 2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: fsl-mc: Add missing header

2017-02-13 Thread Bogdan Purcareata
Compiling the fsl-mc bus driver will yield a couple of static analysis
errors:
warning: symbol 'fsl_mc_msi_domain_alloc_irqs' was not declared
warning: symbol 'fsl_mc_msi_domain_free_irqs' was not declared.
warning: symbol 'its_fsl_mc_msi_init' was not declared.
warning: symbol 'its_fsl_mc_msi_cleanup' was not declared.

Since these are properly declared, but the header is not included, add
it in the source files. This way the symbol is properly exported.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
Sent against staging-testing.

 drivers/staging/fsl-mc/bus/fsl-mc-msi.c| 1 +
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
index 7975c6e..b8b2c86 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include "../include/mc-bus.h"
+#include "fsl-mc-private.h"
 
 /*
  * Generate a unique ID identifying the interrupt (only used within the MSI
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 0e2c1b5..87e4471 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include "../include/mc-bus.h"
+#include "fsl-mc-private.h"
 
 static struct irq_chip its_msi_irq_chip = {
.name = "ITS-fMSI",
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 4/4] staging: android/ion: Use variable names in header

2017-01-12 Thread Bogdan Purcareata
Populate header function signatures with variable names as well, not
just variable types.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
v1 -> v2:
- fix CHECK report from checkpatch

 drivers/staging/android/ion/ion_priv.h | 38 +-
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/android/ion/ion_priv.h 
b/drivers/staging/android/ion/ion_priv.h
index 00d8b53..5b3059c 100644
--- a/drivers/staging/android/ion/ion_priv.h
+++ b/drivers/staging/android/ion/ion_priv.h
@@ -287,10 +287,10 @@ void ion_device_add_heap(struct ion_device *dev, struct 
ion_heap *heap);
  * some helpers for common operations on buffers using the sg_table
  * and vaddr fields
  */
-void *ion_heap_map_kernel(struct ion_heap *, struct ion_buffer *);
-void ion_heap_unmap_kernel(struct ion_heap *, struct ion_buffer *);
-int ion_heap_map_user(struct ion_heap *, struct ion_buffer *,
-   struct vm_area_struct *);
+void *ion_heap_map_kernel(struct ion_heap *heap, struct ion_buffer *buffer);
+void ion_heap_unmap_kernel(struct ion_heap *heap, struct ion_buffer *buffer);
+int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer,
+ struct vm_area_struct *vma);
 int ion_heap_buffer_zero(struct ion_buffer *buffer);
 int ion_heap_pages_zero(struct page *page, size_t size, pgprot_t pgprot);
 
@@ -371,21 +371,21 @@ size_t ion_heap_freelist_size(struct ion_heap *heap);
  * heaps as appropriate.
  */
 
-struct ion_heap *ion_heap_create(struct ion_platform_heap *);
-void ion_heap_destroy(struct ion_heap *);
-struct ion_heap *ion_system_heap_create(struct ion_platform_heap *);
-void ion_system_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_heap_create(struct ion_platform_heap *heap_data);
+void ion_heap_destroy(struct ion_heap *heap);
+struct ion_heap *ion_system_heap_create(struct ion_platform_heap *unused);
+void ion_system_heap_destroy(struct ion_heap *heap);
 
-struct ion_heap *ion_system_contig_heap_create(struct ion_platform_heap *);
-void ion_system_contig_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_system_contig_heap_create(struct ion_platform_heap *heap);
+void ion_system_contig_heap_destroy(struct ion_heap *heap);
 
-struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *);
-void ion_carveout_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data);
+void ion_carveout_heap_destroy(struct ion_heap *heap);
 
-struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *);
-void ion_chunk_heap_destroy(struct ion_heap *);
-struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *);
-void ion_cma_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data);
+void ion_chunk_heap_destroy(struct ion_heap *heap);
+struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *data);
+void ion_cma_heap_destroy(struct ion_heap *heap);
 
 /**
  * functions for creating and destroying a heap pool -- allows you
@@ -427,9 +427,9 @@ struct ion_page_pool {
 
 struct ion_page_pool *ion_page_pool_create(gfp_t gfp_mask, unsigned int order,
   bool cached);
-void ion_page_pool_destroy(struct ion_page_pool *);
-struct page *ion_page_pool_alloc(struct ion_page_pool *);
-void ion_page_pool_free(struct ion_page_pool *, struct page *);
+void ion_page_pool_destroy(struct ion_page_pool *pool);
+struct page *ion_page_pool_alloc(struct ion_page_pool *pool);
+void ion_page_pool_free(struct ion_page_pool *pool, struct page *page);
 
 /** ion_page_pool_shrink - shrinks the size of the memory cached in the pool
  * @pool:  the pool
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 3/4] staging: android/ion: Align comment mark

2017-01-12 Thread Bogdan Purcareata
Fix missing space right before multiple line comment closing.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
v1 -> v2
- add changelog

 drivers/staging/android/ion/ion_priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_priv.h 
b/drivers/staging/android/ion/ion_priv.h
index 3c3b324..00d8b53 100644
--- a/drivers/staging/android/ion/ion_priv.h
+++ b/drivers/staging/android/ion/ion_priv.h
@@ -54,7 +54,7 @@
  * handle, used for debugging
  * @pid:   pid of last client to reference this buffer in a
  * handle, used for debugging
-*/
+ */
 struct ion_buffer {
struct kref ref;
union {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/4] staging: android/ion: Split function call

2017-01-12 Thread Bogdan Purcareata
Fix checkpatch error of line exceeding 80 characters.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
v1 -> v2:
- add changelog
- fix CHECK reports from checkpatch

 drivers/staging/android/ion/ion-ioctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index 7e7431d..9ff815a 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -111,7 +111,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
struct ion_handle *handle;
 
mutex_lock(>lock);
-   handle = ion_handle_get_by_id_nolock(client, 
data.handle.handle);
+   handle = ion_handle_get_by_id_nolock(client,
+data.handle.handle);
if (IS_ERR(handle)) {
mutex_unlock(>lock);
return PTR_ERR(handle);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 2/4] staging: android/ion: Don't use return in void function

2017-01-12 Thread Bogdan Purcareata
Return statements are superfluous in void functions, and checkpatch
complains about them too.

Remove offending return.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
v1 -> v2
- add changelog

 drivers/staging/android/ion/ion_of.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c
index 46b2bb9..7791c70 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -161,7 +161,6 @@ static int rmem_ion_device_init(struct reserved_mem *rmem, 
struct device *dev)
 static void rmem_ion_device_release(struct reserved_mem *rmem,
struct device *dev)
 {
-   return;
 }
 
 static const struct reserved_mem_ops rmem_dma_ops = {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/4] staging: android/ion: Fix line over 80 characters

2017-01-12 Thread Bogdan Purcareata
On Thu, Jan 12, 2017 at 11:56 AM, Greg KH <gre...@linuxfoundation.org> wrote:
> On Thu, Jan 12, 2017 at 12:32:26PM +0300, Dan Carpenter wrote:
>> On Thu, Jan 12, 2017 at 09:54:16AM +0200, Bogdan Purcareata wrote:
>> > Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
>>
>> All staging patches need a changelog, no matter how trivial.
>
> s/staging//g  :)

Will send a v2 with the changes.

Thank you!
Bogdan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/4] staging: android/ion: Fix line over 80 characters

2017-01-12 Thread Bogdan Purcareata
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
 drivers/staging/android/ion/ion-ioctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index 7e7431d..e28fffb 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -111,7 +111,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
struct ion_handle *handle;
 
mutex_lock(>lock);
-   handle = ion_handle_get_by_id_nolock(client, 
data.handle.handle);
+   handle = ion_handle_get_by_id_nolock(client,
+   data.handle.handle);
if (IS_ERR(handle)) {
mutex_unlock(>lock);
return PTR_ERR(handle);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/4] staging: android/ion: Align comment mark

2017-01-12 Thread Bogdan Purcareata
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
 drivers/staging/android/ion/ion_priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_priv.h 
b/drivers/staging/android/ion/ion_priv.h
index 3c3b324..00d8b53 100644
--- a/drivers/staging/android/ion/ion_priv.h
+++ b/drivers/staging/android/ion/ion_priv.h
@@ -54,7 +54,7 @@
  * handle, used for debugging
  * @pid:   pid of last client to reference this buffer in a
  * handle, used for debugging
-*/
+ */
 struct ion_buffer {
struct kref ref;
union {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/4] staging: android/ion: Use variable names in header

2017-01-11 Thread Bogdan Purcareata
Populate header function signatures with variable names as well, not
just variable types.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
 drivers/staging/android/ion/ion_priv.h | 38 +-
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/android/ion/ion_priv.h 
b/drivers/staging/android/ion/ion_priv.h
index 00d8b53..444a1a1 100644
--- a/drivers/staging/android/ion/ion_priv.h
+++ b/drivers/staging/android/ion/ion_priv.h
@@ -287,10 +287,10 @@ void ion_device_add_heap(struct ion_device *dev, struct 
ion_heap *heap);
  * some helpers for common operations on buffers using the sg_table
  * and vaddr fields
  */
-void *ion_heap_map_kernel(struct ion_heap *, struct ion_buffer *);
-void ion_heap_unmap_kernel(struct ion_heap *, struct ion_buffer *);
-int ion_heap_map_user(struct ion_heap *, struct ion_buffer *,
-   struct vm_area_struct *);
+void *ion_heap_map_kernel(struct ion_heap *heap, struct ion_buffer *buffer);
+void ion_heap_unmap_kernel(struct ion_heap *heap, struct ion_buffer *buffer);
+int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer,
+   struct vm_area_struct *vma);
 int ion_heap_buffer_zero(struct ion_buffer *buffer);
 int ion_heap_pages_zero(struct page *page, size_t size, pgprot_t pgprot);
 
@@ -371,21 +371,21 @@ size_t ion_heap_freelist_size(struct ion_heap *heap);
  * heaps as appropriate.
  */
 
-struct ion_heap *ion_heap_create(struct ion_platform_heap *);
-void ion_heap_destroy(struct ion_heap *);
-struct ion_heap *ion_system_heap_create(struct ion_platform_heap *);
-void ion_system_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_heap_create(struct ion_platform_heap *heap_data);
+void ion_heap_destroy(struct ion_heap *heap);
+struct ion_heap *ion_system_heap_create(struct ion_platform_heap *unused);
+void ion_system_heap_destroy(struct ion_heap *heap);
 
-struct ion_heap *ion_system_contig_heap_create(struct ion_platform_heap *);
-void ion_system_contig_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_system_contig_heap_create(struct ion_platform_heap *heap);
+void ion_system_contig_heap_destroy(struct ion_heap *heap);
 
-struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *);
-void ion_carveout_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data);
+void ion_carveout_heap_destroy(struct ion_heap *heap);
 
-struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *);
-void ion_chunk_heap_destroy(struct ion_heap *);
-struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *);
-void ion_cma_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data);
+void ion_chunk_heap_destroy(struct ion_heap *heap);
+struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *data);
+void ion_cma_heap_destroy(struct ion_heap *heap);
 
 /**
  * functions for creating and destroying a heap pool -- allows you
@@ -427,9 +427,9 @@ struct ion_page_pool {
 
 struct ion_page_pool *ion_page_pool_create(gfp_t gfp_mask, unsigned int order,
   bool cached);
-void ion_page_pool_destroy(struct ion_page_pool *);
-struct page *ion_page_pool_alloc(struct ion_page_pool *);
-void ion_page_pool_free(struct ion_page_pool *, struct page *);
+void ion_page_pool_destroy(struct ion_page_pool *pool);
+struct page *ion_page_pool_alloc(struct ion_page_pool *pool);
+void ion_page_pool_free(struct ion_page_pool *pool, struct page *page);
 
 /** ion_page_pool_shrink - shrinks the size of the memory cached in the pool
  * @pool:  the pool
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/4] staging: android/ion: Don't use return in void function

2017-01-11 Thread Bogdan Purcareata
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
 drivers/staging/android/ion/ion_of.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c
index 46b2bb9..7791c70 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -161,7 +161,6 @@ static int rmem_ion_device_init(struct reserved_mem *rmem, 
struct device *dev)
 static void rmem_ion_device_release(struct reserved_mem *rmem,
struct device *dev)
 {
-   return;
 }
 
 static const struct reserved_mem_ops rmem_dma_ops = {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: android/ion: Fix coding style issues

2017-01-11 Thread Bogdan Purcareata
Fix following checkpatch warnings:
- Lines over 80 characters
- void function with return statement
- Unaligned comment mark
- Header function prototypes missing variable names

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
 drivers/staging/android/ion/ion-ioctl.c |  3 ++-
 drivers/staging/android/ion/ion_of.c|  1 -
 drivers/staging/android/ion/ion_priv.h  | 40 -
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index 7e7431d..e28fffb 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -111,7 +111,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
struct ion_handle *handle;
 
mutex_lock(>lock);
-   handle = ion_handle_get_by_id_nolock(client, 
data.handle.handle);
+   handle = ion_handle_get_by_id_nolock(client,
+   data.handle.handle);
if (IS_ERR(handle)) {
mutex_unlock(>lock);
return PTR_ERR(handle);
diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c
index 46b2bb9..7791c70 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -161,7 +161,6 @@ static int rmem_ion_device_init(struct reserved_mem *rmem, 
struct device *dev)
 static void rmem_ion_device_release(struct reserved_mem *rmem,
struct device *dev)
 {
-   return;
 }
 
 static const struct reserved_mem_ops rmem_dma_ops = {
diff --git a/drivers/staging/android/ion/ion_priv.h 
b/drivers/staging/android/ion/ion_priv.h
index 3c3b324..444a1a1 100644
--- a/drivers/staging/android/ion/ion_priv.h
+++ b/drivers/staging/android/ion/ion_priv.h
@@ -54,7 +54,7 @@
  * handle, used for debugging
  * @pid:   pid of last client to reference this buffer in a
  * handle, used for debugging
-*/
+ */
 struct ion_buffer {
struct kref ref;
union {
@@ -287,10 +287,10 @@ void ion_device_add_heap(struct ion_device *dev, struct 
ion_heap *heap);
  * some helpers for common operations on buffers using the sg_table
  * and vaddr fields
  */
-void *ion_heap_map_kernel(struct ion_heap *, struct ion_buffer *);
-void ion_heap_unmap_kernel(struct ion_heap *, struct ion_buffer *);
-int ion_heap_map_user(struct ion_heap *, struct ion_buffer *,
-   struct vm_area_struct *);
+void *ion_heap_map_kernel(struct ion_heap *heap, struct ion_buffer *buffer);
+void ion_heap_unmap_kernel(struct ion_heap *heap, struct ion_buffer *buffer);
+int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer,
+   struct vm_area_struct *vma);
 int ion_heap_buffer_zero(struct ion_buffer *buffer);
 int ion_heap_pages_zero(struct page *page, size_t size, pgprot_t pgprot);
 
@@ -371,21 +371,21 @@ size_t ion_heap_freelist_size(struct ion_heap *heap);
  * heaps as appropriate.
  */
 
-struct ion_heap *ion_heap_create(struct ion_platform_heap *);
-void ion_heap_destroy(struct ion_heap *);
-struct ion_heap *ion_system_heap_create(struct ion_platform_heap *);
-void ion_system_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_heap_create(struct ion_platform_heap *heap_data);
+void ion_heap_destroy(struct ion_heap *heap);
+struct ion_heap *ion_system_heap_create(struct ion_platform_heap *unused);
+void ion_system_heap_destroy(struct ion_heap *heap);
 
-struct ion_heap *ion_system_contig_heap_create(struct ion_platform_heap *);
-void ion_system_contig_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_system_contig_heap_create(struct ion_platform_heap *heap);
+void ion_system_contig_heap_destroy(struct ion_heap *heap);
 
-struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *);
-void ion_carveout_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *heap_data);
+void ion_carveout_heap_destroy(struct ion_heap *heap);
 
-struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *);
-void ion_chunk_heap_destroy(struct ion_heap *);
-struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *);
-void ion_cma_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *heap_data);
+void ion_chunk_heap_destroy(struct ion_heap *heap);
+struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *data);
+void ion_cma_heap_destroy(struct ion_heap *heap);
 
 /**
  * functions for creating and destroying a heap pool -- allows you
@@ -427,9 +427,9 @@ struct ion_page_pool {
 
 struct ion_page_pool *ion_page_pool_create(gfp_t gfp_mask, unsigned int order,
   bool cached);
-void ion_page_pool_destroy(struct ion_page_pool *);

[PATCH] staging: android/ion: Fix coding style issues

2017-01-10 Thread Bogdan Purcareata

Fix following checkpatch warnings:
- Lines over 80 characters
- void function with return statement
- Unaligned comment mark
- Header function prototypes missing variable names

Sent against staging-next.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@gmail.com>
---
 drivers/staging/android/ion/ion-ioctl.c |  3 ++-
 drivers/staging/android/ion/ion_of.c|  1 -
 drivers/staging/android/ion/ion_priv.h  | 40 
-

 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c

index 7e7431d..e28fffb 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -111,7 +111,8 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)

struct ion_handle *handle;

mutex_lock(>lock);
-   handle = ion_handle_get_by_id_nolock(client, 
data.handle.handle);
+   handle = ion_handle_get_by_id_nolock(client,
+   data.handle.handle);
if (IS_ERR(handle)) {
mutex_unlock(>lock);
return PTR_ERR(handle);
diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c

index 46b2bb9..7791c70 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -161,7 +161,6 @@ static int rmem_ion_device_init(struct reserved_mem 
*rmem, struct device *dev)

 static void rmem_ion_device_release(struct reserved_mem *rmem,
struct device *dev)
 {
-   return;
 }

 static const struct reserved_mem_ops rmem_dma_ops = {
diff --git a/drivers/staging/android/ion/ion_priv.h 
b/drivers/staging/android/ion/ion_priv.h

index 3c3b324..444a1a1 100644
--- a/drivers/staging/android/ion/ion_priv.h
+++ b/drivers/staging/android/ion/ion_priv.h
@@ -54,7 +54,7 @@
  * handle, used for debugging
  * @pid:   pid of last client to reference this buffer in a
  * handle, used for debugging
-*/
+ */
 struct ion_buffer {
struct kref ref;
union {
@@ -287,10 +287,10 @@ void ion_device_add_heap(struct ion_device *dev, 
struct ion_heap *heap);

  * some helpers for common operations on buffers using the sg_table
-void *ion_heap_map_kernel(struct ion_heap *, struct ion_buffer *);
-void ion_heap_unmap_kernel(struct ion_heap *, struct ion_buffer *);
-int ion_heap_map_user(struct ion_heap *, struct ion_buffer *,
-   struct vm_area_struct *);
+void *ion_heap_map_kernel(struct ion_heap *heap, struct ion_buffer 
*buffer);
+void ion_heap_unmap_kernel(struct ion_heap *heap, struct ion_buffer 
*buffer);

+int ion_heap_map_user(struct ion_heap *heap, struct ion_buffer *buffer,
+   struct vm_area_struct *vma);
 int ion_heap_buffer_zero(struct ion_buffer *buffer);
 int ion_heap_pages_zero(struct page *page, size_t size, pgprot_t pgprot);

@@ -371,21 +371,21 @@ size_t ion_heap_freelist_size(struct ion_heap *heap);
  * heaps as appropriate.
  */

-struct ion_heap *ion_heap_create(struct ion_platform_heap *);
-void ion_heap_destroy(struct ion_heap *);
-struct ion_heap *ion_system_heap_create(struct ion_platform_heap *);
-void ion_system_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_heap_create(struct ion_platform_heap *heap_data);
+void ion_heap_destroy(struct ion_heap *heap);
+struct ion_heap *ion_system_heap_create(struct ion_platform_heap *unused);
+void ion_system_heap_destroy(struct ion_heap *heap);

-struct ion_heap *ion_system_contig_heap_create(struct ion_platform_heap *);
-void ion_system_contig_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_system_contig_heap_create(struct ion_platform_heap 
*heap);

+void ion_system_contig_heap_destroy(struct ion_heap *heap);

-struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap *);
-void ion_carveout_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_carveout_heap_create(struct ion_platform_heap 
*heap_data);

+void ion_carveout_heap_destroy(struct ion_heap *heap);

-struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap *);
-void ion_chunk_heap_destroy(struct ion_heap *);
-struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *);
-void ion_cma_heap_destroy(struct ion_heap *);
+struct ion_heap *ion_chunk_heap_create(struct ion_platform_heap 
*heap_data);

+void ion_chunk_heap_destroy(struct ion_heap *heap);
+struct ion_heap *ion_cma_heap_create(struct ion_platform_heap *data);
+void ion_cma_heap_destroy(struct ion_heap *heap);

 /**
  * functions for creating and destroying a heap pool -- allows you
@@ -427,9 +427,9 @@ struct ion_page_pool {

 struct ion_page_pool *ion_page_pool_create(gfp_t gfp_mask, unsigned 
int order,

   bool cached);
-void ion_page_pool_destroy(struct ion_page_pool