RE: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-02-14 Thread Richard Zhu

> -Original Message-
> From: Shawn Guo [mailto:shawn...@kernel.org]
> Sent: Monday, February 15, 2016 2:10 PM
> To: Richard Zhu
> Cc: o...@wizery.com; Stefan Agner; linux-kernel@vger.kernel.org; linux-arm-
> ker...@lists.infradead.org
> Subject: Re: [RFC 3/4] ARM: imx: add the platform related rpmsg
> implementation
> 
> +LAKML
> 
> On Thu, Jan 28, 2016 at 02:17:21AM +, Richard Zhu wrote:
> > Hi Shawn:
> > Thanks for your comments.
> > Further review would copied to Stefan Agner.
> 
> Please do not top-posting.
> 
> > On Wed, Jan 06, 2016 at 04:06:43PM +0800, Richard Zhu wrote:
> > > From: Richard Zhu <richard@freescale.com>
> > >
> > > - add mu driver support, the irq and 4bytes msg of the mu module are
> > > as the interaction channel between A# core and the M4 core on imx
> > > amp platforms.
> > > - register one notify in isr of the mu's irq used by rpmsg.
> > > - instance the virtual processor, and fill up the virtio_config_ops
> > > in the platform related rpmsg implementation codes.
> > > - hard-code the vring storage shared by A# core and M# core on AMP
> > > SOCs.
> > >
> > > Signed-off-by: Richard Zhu <hongxing@nxp.com>
> > > ---
> > >  arch/arm/mach-imx/Kconfig |  12 ++
> > >  arch/arm/mach-imx/Makefile|   2 +
> > >  arch/arm/mach-imx/imx_rpmsg.c | 364
> ++
> > >  arch/arm/mach-imx/mu.c| 217 +
> >
> > I'm not rpmsg expert, but it seems to me that the driver should be put into
> drivers/rpmsg/ rather than mach-imx.
> > [Richard] This part rpmsg codes are closed related to the platform. For
> example, kinds of ops callback functions.
> > Thus, these codes are placed into arch/arm/mach-imx/ folder. BTW,  so does
> to omap rpmsg implementation.
> > http://omappedia.org/wiki/RPMsg_Kernel_Sources
> 
> I just took a closer look at this.  What the omappedia page above describes is
> an OMAP rpmsg implementation in a vendor tree which is in turn based on a
> relatively old kernel version, i.e. v3.0.
> 
> I guess the implementation is a base of what mainline has today on
> remoteproc/rpmsg support, but they are somehow different.  For example, on
> mainline kernel today, there is no remoteproc/rpmsg code in arch/arm/plat-
> omap.  And, instead of handling rpmsg with a platform specific driver,
> remoteproc encapsulates the rpmsg support.  You can find the details in
> commit ac8954a41393 (remoteproc: create rpmsg virtio device).
> 
> I suggest you look at the mainline code today instead of any old
> implementation for reference.  And in any case, with device tree support to
> populate platform device as needed, it's a wrong to put remoteproc/rpmsg
> related driver code into arch/arm/mach-imx.
> 
> Shawn
[Zhu hongxing]  Thanks a lot for your advice. I would take look into it, and 
re-organize my
patch-set.

Best Regards
hongxing zhu



RE: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-02-14 Thread Richard Zhu

> -Original Message-
> From: Shawn Guo [mailto:shawn...@kernel.org]
> Sent: Monday, February 15, 2016 2:10 PM
> To: Richard Zhu
> Cc: o...@wizery.com; Stefan Agner; linux-kernel@vger.kernel.org; linux-arm-
> ker...@lists.infradead.org
> Subject: Re: [RFC 3/4] ARM: imx: add the platform related rpmsg
> implementation
> 
> +LAKML
> 
> On Thu, Jan 28, 2016 at 02:17:21AM +, Richard Zhu wrote:
> > Hi Shawn:
> > Thanks for your comments.
> > Further review would copied to Stefan Agner.
> 
> Please do not top-posting.
> 
> > On Wed, Jan 06, 2016 at 04:06:43PM +0800, Richard Zhu wrote:
> > > From: Richard Zhu 
> > >
> > > - add mu driver support, the irq and 4bytes msg of the mu module are
> > > as the interaction channel between A# core and the M4 core on imx
> > > amp platforms.
> > > - register one notify in isr of the mu's irq used by rpmsg.
> > > - instance the virtual processor, and fill up the virtio_config_ops
> > > in the platform related rpmsg implementation codes.
> > > - hard-code the vring storage shared by A# core and M# core on AMP
> > > SOCs.
> > >
> > > Signed-off-by: Richard Zhu 
> > > ---
> > >  arch/arm/mach-imx/Kconfig |  12 ++
> > >  arch/arm/mach-imx/Makefile|   2 +
> > >  arch/arm/mach-imx/imx_rpmsg.c | 364
> ++
> > >  arch/arm/mach-imx/mu.c| 217 +
> >
> > I'm not rpmsg expert, but it seems to me that the driver should be put into
> drivers/rpmsg/ rather than mach-imx.
> > [Richard] This part rpmsg codes are closed related to the platform. For
> example, kinds of ops callback functions.
> > Thus, these codes are placed into arch/arm/mach-imx/ folder. BTW,  so does
> to omap rpmsg implementation.
> > http://omappedia.org/wiki/RPMsg_Kernel_Sources
> 
> I just took a closer look at this.  What the omappedia page above describes is
> an OMAP rpmsg implementation in a vendor tree which is in turn based on a
> relatively old kernel version, i.e. v3.0.
> 
> I guess the implementation is a base of what mainline has today on
> remoteproc/rpmsg support, but they are somehow different.  For example, on
> mainline kernel today, there is no remoteproc/rpmsg code in arch/arm/plat-
> omap.  And, instead of handling rpmsg with a platform specific driver,
> remoteproc encapsulates the rpmsg support.  You can find the details in
> commit ac8954a41393 (remoteproc: create rpmsg virtio device).
> 
> I suggest you look at the mainline code today instead of any old
> implementation for reference.  And in any case, with device tree support to
> populate platform device as needed, it's a wrong to put remoteproc/rpmsg
> related driver code into arch/arm/mach-imx.
> 
> Shawn
[Zhu hongxing]  Thanks a lot for your advice. I would take look into it, and 
re-organize my
patch-set.

Best Regards
hongxing zhu



Re: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-02-14 Thread Shawn Guo
+LAKML

On Thu, Jan 28, 2016 at 02:17:21AM +, Richard Zhu wrote:
> Hi Shawn:
> Thanks for your comments.
> Further review would copied to Stefan Agner.

Please do not top-posting.

> On Wed, Jan 06, 2016 at 04:06:43PM +0800, Richard Zhu wrote:
> > From: Richard Zhu 
> > 
> > - add mu driver support, the irq and 4bytes msg of the mu module are 
> > as the interaction channel between A# core and the M4 core on imx amp 
> > platforms.
> > - register one notify in isr of the mu's irq used by rpmsg.
> > - instance the virtual processor, and fill up the virtio_config_ops in 
> > the platform related rpmsg implementation codes.
> > - hard-code the vring storage shared by A# core and M# core on AMP 
> > SOCs.
> > 
> > Signed-off-by: Richard Zhu 
> > ---
> >  arch/arm/mach-imx/Kconfig |  12 ++
> >  arch/arm/mach-imx/Makefile|   2 +
> >  arch/arm/mach-imx/imx_rpmsg.c | 364 
> > ++
> >  arch/arm/mach-imx/mu.c| 217 +
> 
> I'm not rpmsg expert, but it seems to me that the driver should be put into 
> drivers/rpmsg/ rather than mach-imx.
> [Richard] This part rpmsg codes are closed related to the platform. For 
> example, kinds of ops callback functions.
> Thus, these codes are placed into arch/arm/mach-imx/ folder. BTW,  so does to 
> omap rpmsg implementation.
> http://omappedia.org/wiki/RPMsg_Kernel_Sources

I just took a closer look at this.  What the omappedia page above
describes is an OMAP rpmsg implementation in a vendor tree which is
in turn based on a relatively old kernel version, i.e. v3.0.

I guess the implementation is a base of what mainline has today on
remoteproc/rpmsg support, but they are somehow different.  For example,
on mainline kernel today, there is no remoteproc/rpmsg code in
arch/arm/plat-omap.  And, instead of handling rpmsg with a platform
specific driver, remoteproc encapsulates the rpmsg support.  You can
find the details in commit ac8954a41393 (remoteproc: create rpmsg virtio
device).

I suggest you look at the mainline code today instead of any old
implementation for reference.  And in any case, with device tree
support to populate platform device as needed, it's a wrong to put
remoteproc/rpmsg related driver code into arch/arm/mach-imx.

Shawn


Re: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-02-14 Thread Shawn Guo
+LAKML

On Thu, Jan 28, 2016 at 02:17:21AM +, Richard Zhu wrote:
> Hi Shawn:
> Thanks for your comments.
> Further review would copied to Stefan Agner.

Please do not top-posting.

> On Wed, Jan 06, 2016 at 04:06:43PM +0800, Richard Zhu wrote:
> > From: Richard Zhu 
> > 
> > - add mu driver support, the irq and 4bytes msg of the mu module are 
> > as the interaction channel between A# core and the M4 core on imx amp 
> > platforms.
> > - register one notify in isr of the mu's irq used by rpmsg.
> > - instance the virtual processor, and fill up the virtio_config_ops in 
> > the platform related rpmsg implementation codes.
> > - hard-code the vring storage shared by A# core and M# core on AMP 
> > SOCs.
> > 
> > Signed-off-by: Richard Zhu 
> > ---
> >  arch/arm/mach-imx/Kconfig |  12 ++
> >  arch/arm/mach-imx/Makefile|   2 +
> >  arch/arm/mach-imx/imx_rpmsg.c | 364 
> > ++
> >  arch/arm/mach-imx/mu.c| 217 +
> 
> I'm not rpmsg expert, but it seems to me that the driver should be put into 
> drivers/rpmsg/ rather than mach-imx.
> [Richard] This part rpmsg codes are closed related to the platform. For 
> example, kinds of ops callback functions.
> Thus, these codes are placed into arch/arm/mach-imx/ folder. BTW,  so does to 
> omap rpmsg implementation.
> http://omappedia.org/wiki/RPMsg_Kernel_Sources

I just took a closer look at this.  What the omappedia page above
describes is an OMAP rpmsg implementation in a vendor tree which is
in turn based on a relatively old kernel version, i.e. v3.0.

I guess the implementation is a base of what mainline has today on
remoteproc/rpmsg support, but they are somehow different.  For example,
on mainline kernel today, there is no remoteproc/rpmsg code in
arch/arm/plat-omap.  And, instead of handling rpmsg with a platform
specific driver, remoteproc encapsulates the rpmsg support.  You can
find the details in commit ac8954a41393 (remoteproc: create rpmsg virtio
device).

I suggest you look at the mainline code today instead of any old
implementation for reference.  And in any case, with device tree
support to populate platform device as needed, it's a wrong to put
remoteproc/rpmsg related driver code into arch/arm/mach-imx.

Shawn


RE: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-01-27 Thread Richard Zhu
Thanks a lot.

Best Regards
hongxing zhu
Linux BSP team
Office: 86-21-28937189
Email: hongxing@nxp.com


-Original Message-
From: Shawn Guo [mailto:shawn...@kernel.org] 
Sent: Thursday, January 28, 2016 1:50 PM
To: Richard Zhu
Cc: o...@wizery.com; Stefan Agner; linux-kernel@vger.kernel.org
Subject: Re: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

On Thu, Jan 28, 2016 at 02:17:21AM +, Richard Zhu wrote:
> >  arch/arm/mach-imx/Kconfig |  12 ++
> >  arch/arm/mach-imx/Makefile|   2 +
> >  arch/arm/mach-imx/imx_rpmsg.c | 364 
> > ++
> >  arch/arm/mach-imx/mu.c| 217 +
> 
> I'm not rpmsg expert, but it seems to me that the driver should be put into 
> drivers/rpmsg/ rather than mach-imx.
> [Richard] This part rpmsg codes are closed related to the platform. For 
> example, kinds of ops callback functions.
> Thus, these codes are placed into arch/arm/mach-imx/ folder. BTW,  so does to 
> omap rpmsg implementation.
> http://omappedia.org/wiki/RPMsg_Kernel_Sources

Okay, I will find some time slot to get myself familiar with rpmsg subsystem 
and then review the patch.

Shawn


Re: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-01-27 Thread Shawn Guo
On Thu, Jan 28, 2016 at 02:17:21AM +, Richard Zhu wrote:
> >  arch/arm/mach-imx/Kconfig |  12 ++
> >  arch/arm/mach-imx/Makefile|   2 +
> >  arch/arm/mach-imx/imx_rpmsg.c | 364 
> > ++
> >  arch/arm/mach-imx/mu.c| 217 +
> 
> I'm not rpmsg expert, but it seems to me that the driver should be put into 
> drivers/rpmsg/ rather than mach-imx.
> [Richard] This part rpmsg codes are closed related to the platform. For 
> example, kinds of ops callback functions.
> Thus, these codes are placed into arch/arm/mach-imx/ folder. BTW,  so does to 
> omap rpmsg implementation.
> http://omappedia.org/wiki/RPMsg_Kernel_Sources

Okay, I will find some time slot to get myself familiar with rpmsg
subsystem and then review the patch.

Shawn


RE: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-01-27 Thread Richard Zhu
Hi Shawn:
Thanks for your comments.
Further review would copied to Stefan Agner.

Best Regards
hongxing zhu
Linux BSP team
Office: 86-21-28937189
Email: hongxing@nxp.com


-Original Message-
From: Shawn Guo [mailto:shawn...@kernel.org] 
Sent: Thursday, January 28, 2016 9:35 AM
To: Richard Zhu
Cc: o...@wizery.com; Stefan Agner; linux-kernel@vger.kernel.org
Subject: Re: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

On Wed, Jan 06, 2016 at 04:06:43PM +0800, Richard Zhu wrote:
> From: Richard Zhu 
> 
> - add mu driver support, the irq and 4bytes msg of the mu module are 
> as the interaction channel between A# core and the M4 core on imx amp 
> platforms.
> - register one notify in isr of the mu's irq used by rpmsg.
> - instance the virtual processor, and fill up the virtio_config_ops in 
> the platform related rpmsg implementation codes.
> - hard-code the vring storage shared by A# core and M# core on AMP 
> SOCs.
> 
> Signed-off-by: Richard Zhu 
> ---
>  arch/arm/mach-imx/Kconfig |  12 ++
>  arch/arm/mach-imx/Makefile|   2 +
>  arch/arm/mach-imx/imx_rpmsg.c | 364 
> ++
>  arch/arm/mach-imx/mu.c| 217 +

I'm not rpmsg expert, but it seems to me that the driver should be put into 
drivers/rpmsg/ rather than mach-imx.
[Richard] This part rpmsg codes are closed related to the platform. For 
example, kinds of ops callback functions.
Thus, these codes are placed into arch/arm/mach-imx/ folder. BTW,  so does to 
omap rpmsg implementation.
http://omappedia.org/wiki/RPMsg_Kernel_Sources

Also, when you repost, you may want to copy Stefan Agner , who 
is helping maintain Vybrid platform and might be interested in your patches.

Shawn

>  include/linux/imx_rpmsg.h |  27 
>  5 files changed, 622 insertions(+)
>  create mode 100644 arch/arm/mach-imx/imx_rpmsg.c  create mode 100644 
> arch/arm/mach-imx/mu.c  create mode 100644 include/linux/imx_rpmsg.h
> 
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig 
> index 8ceda28..a7bc41c 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -56,6 +56,12 @@ config HAVE_IMX_GPC  config HAVE_IMX_MMDC
>   bool
>  
> +config HAVE_IMX_MU
> + bool
> +
> +config HAVE_IMX_RPMSG
> + bool
> +
>  config HAVE_IMX_SRC
>   def_bool y if SMP
>   select ARCH_HAS_RESET_CONTROLLER
> @@ -544,6 +550,9 @@ config SOC_IMX6SX
>   bool "i.MX6 SoloX support"
>   select PINCTRL_IMX6SX
>   select SOC_IMX6
> + select HAVE_IMX_MU
> + select HAVE_IMX_RPMSG
> + select RPMSG
>  
>   help
> This enables support for Freescale i.MX6 SoloX processor.
> @@ -562,6 +571,9 @@ config SOC_IMX7D
>   select ARM_GIC
>   select HAVE_IMX_ANATOP
>   select HAVE_IMX_MMDC
> + select HAVE_IMX_MU
> + select HAVE_IMX_RPMSG
> + select RPMSG
>   help
>   This enables support for Freescale i.MX7 Dual processor.
>  
> diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile 
> index fb689d8..a3c1814 100644
> --- a/arch/arm/mach-imx/Makefile
> +++ b/arch/arm/mach-imx/Makefile
> @@ -74,7 +74,9 @@ obj-$(CONFIG_MACH_IMX35_DT) += imx35-dt.o
>  obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o
>  obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
>  obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o
> +obj-$(CONFIG_HAVE_IMX_MU) += mu.o
>  obj-$(CONFIG_HAVE_IMX_SRC) += src.o
> +obj-$(CONFIG_HAVE_IMX_RPMSG) += imx_rpmsg.o
>  ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),)
>  AFLAGS_headsmp.o :=-Wa,-march=armv7-a
>  obj-$(CONFIG_SMP) += headsmp.o platsmp.o diff --git 
> a/arch/arm/mach-imx/imx_rpmsg.c b/arch/arm/mach-imx/imx_rpmsg.c new 
> file mode 100644 index 000..ab6ba7a
> --- /dev/null
> +++ b/arch/arm/mach-imx/imx_rpmsg.c
> @@ -0,0 +1,364 @@
> +/*
> + * Copyright (C) 2016 Freescale Semiconductor, Inc.
> + *
> + * derived from the omap-rpmsg implementation.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct imx_rpmsg_vproc {
> + struct virtio_device vdev;
> + unsigned int vring[2];
> + char *rproc_name;
> + struct mutex lock;
> + struct notifier_block nb;
> + struct virtq

Re: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-01-27 Thread Shawn Guo
On Wed, Jan 06, 2016 at 04:06:43PM +0800, Richard Zhu wrote:
> From: Richard Zhu 
> 
> - add mu driver support, the irq and 4bytes msg of
> the mu module are as the interaction channel
> between A# core and the M4 core on imx amp platforms.
> - register one notify in isr of the mu's irq used by
> rpmsg.
> - instance the virtual processor, and fill up the
> virtio_config_ops in the platform related rpmsg
> implementation codes.
> - hard-code the vring storage shared by A# core and
> M# core on AMP SOCs.
> 
> Signed-off-by: Richard Zhu 
> ---
>  arch/arm/mach-imx/Kconfig |  12 ++
>  arch/arm/mach-imx/Makefile|   2 +
>  arch/arm/mach-imx/imx_rpmsg.c | 364 
> ++
>  arch/arm/mach-imx/mu.c| 217 +

I'm not rpmsg expert, but it seems to me that the driver should be
put into drivers/rpmsg/ rather than mach-imx.

Also, when you repost, you may want to copy
Stefan Agner , who is helping maintain Vybrid platform
and might be interested in your patches.

Shawn

>  include/linux/imx_rpmsg.h |  27 
>  5 files changed, 622 insertions(+)
>  create mode 100644 arch/arm/mach-imx/imx_rpmsg.c
>  create mode 100644 arch/arm/mach-imx/mu.c
>  create mode 100644 include/linux/imx_rpmsg.h
> 
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> index 8ceda28..a7bc41c 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -56,6 +56,12 @@ config HAVE_IMX_GPC
>  config HAVE_IMX_MMDC
>   bool
>  
> +config HAVE_IMX_MU
> + bool
> +
> +config HAVE_IMX_RPMSG
> + bool
> +
>  config HAVE_IMX_SRC
>   def_bool y if SMP
>   select ARCH_HAS_RESET_CONTROLLER
> @@ -544,6 +550,9 @@ config SOC_IMX6SX
>   bool "i.MX6 SoloX support"
>   select PINCTRL_IMX6SX
>   select SOC_IMX6
> + select HAVE_IMX_MU
> + select HAVE_IMX_RPMSG
> + select RPMSG
>  
>   help
> This enables support for Freescale i.MX6 SoloX processor.
> @@ -562,6 +571,9 @@ config SOC_IMX7D
>   select ARM_GIC
>   select HAVE_IMX_ANATOP
>   select HAVE_IMX_MMDC
> + select HAVE_IMX_MU
> + select HAVE_IMX_RPMSG
> + select RPMSG
>   help
>   This enables support for Freescale i.MX7 Dual processor.
>  
> diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
> index fb689d8..a3c1814 100644
> --- a/arch/arm/mach-imx/Makefile
> +++ b/arch/arm/mach-imx/Makefile
> @@ -74,7 +74,9 @@ obj-$(CONFIG_MACH_IMX35_DT) += imx35-dt.o
>  obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o
>  obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
>  obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o
> +obj-$(CONFIG_HAVE_IMX_MU) += mu.o
>  obj-$(CONFIG_HAVE_IMX_SRC) += src.o
> +obj-$(CONFIG_HAVE_IMX_RPMSG) += imx_rpmsg.o
>  ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),)
>  AFLAGS_headsmp.o :=-Wa,-march=armv7-a
>  obj-$(CONFIG_SMP) += headsmp.o platsmp.o
> diff --git a/arch/arm/mach-imx/imx_rpmsg.c b/arch/arm/mach-imx/imx_rpmsg.c
> new file mode 100644
> index 000..ab6ba7a
> --- /dev/null
> +++ b/arch/arm/mach-imx/imx_rpmsg.c
> @@ -0,0 +1,364 @@
> +/*
> + * Copyright (C) 2016 Freescale Semiconductor, Inc.
> + *
> + * derived from the omap-rpmsg implementation.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct imx_rpmsg_vproc {
> + struct virtio_device vdev;
> + unsigned int vring[2];
> + char *rproc_name;
> + struct mutex lock;
> + struct notifier_block nb;
> + struct virtqueue *vq[2];
> + int base_vq_id;
> + int num_of_vqs;
> +};
> +
> +/*
> + * For now, allocate 256 buffers of 512 bytes for each side. each buffer
> + * will then have 16B for the msg header and 496B for the payload.
> + * This will require a total space of 256KB for the buffers themselves, and
> + * 3 pages for every vring (the size of the vring depends on the number of
> + * buffers it supports).
> + */
> +#define RPMSG_NUM_BUFS   (512)
> +#define RPMSG_BUF_SIZE   (512)
> +#define RPMSG_BUFS_SPACE (RPMSG_NUM_BUFS * RPMSG_BUF_SIZE)
> +
> +/*
> + * The alignment between the consumer and producer parts of the vring.
> + * Note: this is part of the "wire" protocol. If you change this, you need
> + * to update your BIOS image as well
> + */
> +#define RPMSG_VRING_ALIGN(4096)
> +
> +/* With 256 buffers, our vring will occupy 3 pages */
> +#define RPMSG_RING_SIZE  ((DIV_ROUND_UP(vring_size(RPMSG_NUM_BUFS / 2, \
> + RPMSG_VRING_ALIGN), PAGE_SIZE)) * PAGE_SIZE)
> +
> +#define to_imx_rpdev(vd) 

Re: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-01-27 Thread Shawn Guo
On Wed, Jan 06, 2016 at 04:06:43PM +0800, Richard Zhu wrote:
> From: Richard Zhu 
> 
> - add mu driver support, the irq and 4bytes msg of
> the mu module are as the interaction channel
> between A# core and the M4 core on imx amp platforms.
> - register one notify in isr of the mu's irq used by
> rpmsg.
> - instance the virtual processor, and fill up the
> virtio_config_ops in the platform related rpmsg
> implementation codes.
> - hard-code the vring storage shared by A# core and
> M# core on AMP SOCs.
> 
> Signed-off-by: Richard Zhu 
> ---
>  arch/arm/mach-imx/Kconfig |  12 ++
>  arch/arm/mach-imx/Makefile|   2 +
>  arch/arm/mach-imx/imx_rpmsg.c | 364 
> ++
>  arch/arm/mach-imx/mu.c| 217 +

I'm not rpmsg expert, but it seems to me that the driver should be
put into drivers/rpmsg/ rather than mach-imx.

Also, when you repost, you may want to copy
Stefan Agner , who is helping maintain Vybrid platform
and might be interested in your patches.

Shawn

>  include/linux/imx_rpmsg.h |  27 
>  5 files changed, 622 insertions(+)
>  create mode 100644 arch/arm/mach-imx/imx_rpmsg.c
>  create mode 100644 arch/arm/mach-imx/mu.c
>  create mode 100644 include/linux/imx_rpmsg.h
> 
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> index 8ceda28..a7bc41c 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -56,6 +56,12 @@ config HAVE_IMX_GPC
>  config HAVE_IMX_MMDC
>   bool
>  
> +config HAVE_IMX_MU
> + bool
> +
> +config HAVE_IMX_RPMSG
> + bool
> +
>  config HAVE_IMX_SRC
>   def_bool y if SMP
>   select ARCH_HAS_RESET_CONTROLLER
> @@ -544,6 +550,9 @@ config SOC_IMX6SX
>   bool "i.MX6 SoloX support"
>   select PINCTRL_IMX6SX
>   select SOC_IMX6
> + select HAVE_IMX_MU
> + select HAVE_IMX_RPMSG
> + select RPMSG
>  
>   help
> This enables support for Freescale i.MX6 SoloX processor.
> @@ -562,6 +571,9 @@ config SOC_IMX7D
>   select ARM_GIC
>   select HAVE_IMX_ANATOP
>   select HAVE_IMX_MMDC
> + select HAVE_IMX_MU
> + select HAVE_IMX_RPMSG
> + select RPMSG
>   help
>   This enables support for Freescale i.MX7 Dual processor.
>  
> diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
> index fb689d8..a3c1814 100644
> --- a/arch/arm/mach-imx/Makefile
> +++ b/arch/arm/mach-imx/Makefile
> @@ -74,7 +74,9 @@ obj-$(CONFIG_MACH_IMX35_DT) += imx35-dt.o
>  obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o
>  obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
>  obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o
> +obj-$(CONFIG_HAVE_IMX_MU) += mu.o
>  obj-$(CONFIG_HAVE_IMX_SRC) += src.o
> +obj-$(CONFIG_HAVE_IMX_RPMSG) += imx_rpmsg.o
>  ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),)
>  AFLAGS_headsmp.o :=-Wa,-march=armv7-a
>  obj-$(CONFIG_SMP) += headsmp.o platsmp.o
> diff --git a/arch/arm/mach-imx/imx_rpmsg.c b/arch/arm/mach-imx/imx_rpmsg.c
> new file mode 100644
> index 000..ab6ba7a
> --- /dev/null
> +++ b/arch/arm/mach-imx/imx_rpmsg.c
> @@ -0,0 +1,364 @@
> +/*
> + * Copyright (C) 2016 Freescale Semiconductor, Inc.
> + *
> + * derived from the omap-rpmsg implementation.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct imx_rpmsg_vproc {
> + struct virtio_device vdev;
> + unsigned int vring[2];
> + char *rproc_name;
> + struct mutex lock;
> + struct notifier_block nb;
> + struct virtqueue *vq[2];
> + int base_vq_id;
> + int num_of_vqs;
> +};
> +
> +/*
> + * For now, allocate 256 buffers of 512 bytes for each side. each buffer
> + * will then have 16B for the msg header and 496B for the payload.
> + * This will require a total space of 256KB for the buffers themselves, and
> + * 3 pages for every vring (the size of the vring depends on the number of
> + * buffers it supports).
> + */
> +#define RPMSG_NUM_BUFS   (512)
> +#define RPMSG_BUF_SIZE   (512)
> +#define RPMSG_BUFS_SPACE (RPMSG_NUM_BUFS * RPMSG_BUF_SIZE)
> +
> +/*
> + * The alignment between the consumer and producer parts of the vring.
> + * Note: this is part of the "wire" protocol. If you change this, you need
> + * to update your BIOS image as well
> + */
> +#define RPMSG_VRING_ALIGN(4096)
> +
> +/* With 256 buffers, our vring will occupy 3 pages */
> +#define RPMSG_RING_SIZE  ((DIV_ROUND_UP(vring_size(RPMSG_NUM_BUFS / 2, \
> + 

Re: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-01-27 Thread Shawn Guo
On Thu, Jan 28, 2016 at 02:17:21AM +, Richard Zhu wrote:
> >  arch/arm/mach-imx/Kconfig |  12 ++
> >  arch/arm/mach-imx/Makefile|   2 +
> >  arch/arm/mach-imx/imx_rpmsg.c | 364 
> > ++
> >  arch/arm/mach-imx/mu.c| 217 +
> 
> I'm not rpmsg expert, but it seems to me that the driver should be put into 
> drivers/rpmsg/ rather than mach-imx.
> [Richard] This part rpmsg codes are closed related to the platform. For 
> example, kinds of ops callback functions.
> Thus, these codes are placed into arch/arm/mach-imx/ folder. BTW,  so does to 
> omap rpmsg implementation.
> http://omappedia.org/wiki/RPMsg_Kernel_Sources

Okay, I will find some time slot to get myself familiar with rpmsg
subsystem and then review the patch.

Shawn


RE: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-01-27 Thread Richard Zhu
Thanks a lot.

Best Regards
hongxing zhu
Linux BSP team
Office: 86-21-28937189
Email: hongxing@nxp.com


-Original Message-
From: Shawn Guo [mailto:shawn...@kernel.org] 
Sent: Thursday, January 28, 2016 1:50 PM
To: Richard Zhu
Cc: o...@wizery.com; Stefan Agner; linux-kernel@vger.kernel.org
Subject: Re: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

On Thu, Jan 28, 2016 at 02:17:21AM +, Richard Zhu wrote:
> >  arch/arm/mach-imx/Kconfig |  12 ++
> >  arch/arm/mach-imx/Makefile|   2 +
> >  arch/arm/mach-imx/imx_rpmsg.c | 364 
> > ++
> >  arch/arm/mach-imx/mu.c| 217 +
> 
> I'm not rpmsg expert, but it seems to me that the driver should be put into 
> drivers/rpmsg/ rather than mach-imx.
> [Richard] This part rpmsg codes are closed related to the platform. For 
> example, kinds of ops callback functions.
> Thus, these codes are placed into arch/arm/mach-imx/ folder. BTW,  so does to 
> omap rpmsg implementation.
> http://omappedia.org/wiki/RPMsg_Kernel_Sources

Okay, I will find some time slot to get myself familiar with rpmsg subsystem 
and then review the patch.

Shawn


RE: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

2016-01-27 Thread Richard Zhu
Hi Shawn:
Thanks for your comments.
Further review would copied to Stefan Agner.

Best Regards
hongxing zhu
Linux BSP team
Office: 86-21-28937189
Email: hongxing@nxp.com


-Original Message-
From: Shawn Guo [mailto:shawn...@kernel.org] 
Sent: Thursday, January 28, 2016 9:35 AM
To: Richard Zhu
Cc: o...@wizery.com; Stefan Agner; linux-kernel@vger.kernel.org
Subject: Re: [RFC 3/4] ARM: imx: add the platform related rpmsg implementation

On Wed, Jan 06, 2016 at 04:06:43PM +0800, Richard Zhu wrote:
> From: Richard Zhu <richard@freescale.com>
> 
> - add mu driver support, the irq and 4bytes msg of the mu module are 
> as the interaction channel between A# core and the M4 core on imx amp 
> platforms.
> - register one notify in isr of the mu's irq used by rpmsg.
> - instance the virtual processor, and fill up the virtio_config_ops in 
> the platform related rpmsg implementation codes.
> - hard-code the vring storage shared by A# core and M# core on AMP 
> SOCs.
> 
> Signed-off-by: Richard Zhu <hongxing@nxp.com>
> ---
>  arch/arm/mach-imx/Kconfig |  12 ++
>  arch/arm/mach-imx/Makefile|   2 +
>  arch/arm/mach-imx/imx_rpmsg.c | 364 
> ++
>  arch/arm/mach-imx/mu.c| 217 +

I'm not rpmsg expert, but it seems to me that the driver should be put into 
drivers/rpmsg/ rather than mach-imx.
[Richard] This part rpmsg codes are closed related to the platform. For 
example, kinds of ops callback functions.
Thus, these codes are placed into arch/arm/mach-imx/ folder. BTW,  so does to 
omap rpmsg implementation.
http://omappedia.org/wiki/RPMsg_Kernel_Sources

Also, when you repost, you may want to copy Stefan Agner <ste...@agner.ch>, who 
is helping maintain Vybrid platform and might be interested in your patches.

Shawn

>  include/linux/imx_rpmsg.h |  27 
>  5 files changed, 622 insertions(+)
>  create mode 100644 arch/arm/mach-imx/imx_rpmsg.c  create mode 100644 
> arch/arm/mach-imx/mu.c  create mode 100644 include/linux/imx_rpmsg.h
> 
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig 
> index 8ceda28..a7bc41c 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -56,6 +56,12 @@ config HAVE_IMX_GPC  config HAVE_IMX_MMDC
>   bool
>  
> +config HAVE_IMX_MU
> + bool
> +
> +config HAVE_IMX_RPMSG
> + bool
> +
>  config HAVE_IMX_SRC
>   def_bool y if SMP
>   select ARCH_HAS_RESET_CONTROLLER
> @@ -544,6 +550,9 @@ config SOC_IMX6SX
>   bool "i.MX6 SoloX support"
>   select PINCTRL_IMX6SX
>   select SOC_IMX6
> + select HAVE_IMX_MU
> + select HAVE_IMX_RPMSG
> + select RPMSG
>  
>   help
> This enables support for Freescale i.MX6 SoloX processor.
> @@ -562,6 +571,9 @@ config SOC_IMX7D
>   select ARM_GIC
>   select HAVE_IMX_ANATOP
>   select HAVE_IMX_MMDC
> + select HAVE_IMX_MU
> + select HAVE_IMX_RPMSG
> + select RPMSG
>   help
>   This enables support for Freescale i.MX7 Dual processor.
>  
> diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile 
> index fb689d8..a3c1814 100644
> --- a/arch/arm/mach-imx/Makefile
> +++ b/arch/arm/mach-imx/Makefile
> @@ -74,7 +74,9 @@ obj-$(CONFIG_MACH_IMX35_DT) += imx35-dt.o
>  obj-$(CONFIG_HAVE_IMX_ANATOP) += anatop.o
>  obj-$(CONFIG_HAVE_IMX_GPC) += gpc.o
>  obj-$(CONFIG_HAVE_IMX_MMDC) += mmdc.o
> +obj-$(CONFIG_HAVE_IMX_MU) += mu.o
>  obj-$(CONFIG_HAVE_IMX_SRC) += src.o
> +obj-$(CONFIG_HAVE_IMX_RPMSG) += imx_rpmsg.o
>  ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),)
>  AFLAGS_headsmp.o :=-Wa,-march=armv7-a
>  obj-$(CONFIG_SMP) += headsmp.o platsmp.o diff --git 
> a/arch/arm/mach-imx/imx_rpmsg.c b/arch/arm/mach-imx/imx_rpmsg.c new 
> file mode 100644 index 000..ab6ba7a
> --- /dev/null
> +++ b/arch/arm/mach-imx/imx_rpmsg.c
> @@ -0,0 +1,364 @@
> +/*
> + * Copyright (C) 2016 Freescale Semiconductor, Inc.
> + *
> + * derived from the omap-rpmsg implementation.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct imx_rpmsg_vproc {
> + struct virtio_device vdev;
> + unsigned int vring[2];
> + char *rproc_name;
> + s