From: Nikita Shubin <nikita.shubin@maquefel.me>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Nikita Shubin <nshubin@topcon.com>,
Ohad Ben-Cohen <ohad@wizery.com>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
"linux-remoteproc@vger.kernel.org"
<linux-remoteproc@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] remoteproc: imx_rproc: set pc on start
Date: Wed, 22 Apr 2020 10:35:49 +0300 [thread overview]
Message-ID: <20200422103549.0000512d@maquefel.me> (raw)
Message-ID: <20200422073549.yoylV6nJ4MZ2p4mb63nrlTp3JhIMYRBmVU0mL19u_zw@z> (raw)
In-Reply-To: <CANLsYkyUoG9fW7NoXMS1D7WjPGew7FT0jyOP1E0ipmwW-qEG7A@mail.gmail.com>
On Fri, 17 Apr 2020 16:24:21 -0600
Mathieu Poirier <mathieu.poirier@linaro.org> wrote:
> On Fri, 17 Apr 2020 at 11:27, Nikita Shubin
> <nikita.shubin@maquefel.me> wrote:
> >
> > On Fri, 17 Apr 2020 11:01:22 -0600
> > Mathieu Poirier <mathieu.poirier@linaro.org> wrote:
> >
> > > On Thu, 16 Apr 2020 at 23:40, <nikita.shubin@maquefel.me> wrote:
> > > >
> > > > Hi Mathieue,
> > > >
> > > > Hi Nikita,
> > > >
> > > > On Mon, Apr 06, 2020 at 02:33:08PM +0300,
> > > > nikita.shubin@maquefel.me wrote:
> > > >
> > > > In case elf file interrupt vector is not supposed to be at
> > > > OCRAM_S, it is needed to write elf entry point to OCRAM_S +
> > > > 0x4, to boot M4 firmware.
> > > >
> > > > Otherwise firmware located anywhere besides OCRAM_S won't boot.
> > > >
> > > > The firmware must set stack poiner as first instruction:
> > > >
> > > > Reset_Handler:
> > > > ldr sp, = __stack /* set stack pointer */
> > > >
> > > > Signed-off-by: Nikita Shubin <NShubin@topcon.com>
> > > >
> > > >
> > > > The address in the SoB has to match what is found in the "From:"
> > > > field of the email header. Checkpatch is complaining about that,
> > > > something I would have expected to be fixed before sending this
> > > > set out.
> > > >
> > > > Noted and will be fixed.
> > > >
> > > > ---
> > > > drivers/remoteproc/imx_rproc.c | 16 +++++++++++++++-
> > > > 1 file changed, 15 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/remoteproc/imx_rproc.c
> > > > b/drivers/remoteproc/imx_rproc.c index
> > > > 3e72b6f38d4b..bebc58d0f711 100644 ---
> > > > a/drivers/remoteproc/imx_rproc.c +++
> > > > b/drivers/remoteproc/imx_rproc.c @@ -45,6 +45,8 @@
> > > >
> > > > #define IMX7D_RPROC_MEM_MAX 8
> > > >
> > > > +#define IMX_BOOT_PC 0x4
> > > > +
> > > > /**
> > > > * struct imx_rproc_mem - slim internal memory structure
> > > > * @cpu_addr: MPU virtual address of the memory region
> > > > @@ -85,6 +87,7 @@ struct imx_rproc {
> > > > const struct imx_rproc_dcfg *dcfg;
> > > > struct imx_rproc_mem mem[IMX7D_RPROC_MEM_MAX];
> > > > struct clk *clk;
> > > > + void __iomem *bootreg;
> > > > };
> > > >
> > > > static const struct imx_rproc_att imx_rproc_att_imx7d[] = {
> > > > @@ -162,11 +165,16 @@ static int imx_rproc_start(struct rproc
> > > > *rproc) struct device *dev = priv->dev;
> > > > int ret;
> > > >
> > > > + /* write entry point to program counter */
> > > > + writel(rproc->bootaddr, priv->bootreg);
> > > >
> > > >
> > > > What happens on all the other IMX systems where this fix is not
> > > > needed? Will they continue to work properly?
> > > >
> > > > Yes, my bad, it is also needed for IMX6 (but even so i need to
> > > > study this topic more carefully), this should be applied
> > > > exclusively for imx7d for now, and if will be needed someone
> > > > with imx6 hardware to test on can extend this on imx6 also.
> > > >
> > > >
> > > >
> > > >
> > > > +
> > > > ret = regmap_update_bits(priv->regmap, dcfg->src_reg,
> > > > dcfg->src_mask,
> > > > dcfg->src_start); if (ret)
> > > > dev_err(dev, "Failed to enable M4!\n");
> > > >
> > > > + dev_info(&rproc->dev, "Started from 0x%x\n",
> > > > rproc->bootaddr); +
> > > > return ret;
> > > > }
> > > >
> > > > @@ -182,6 +190,9 @@ static int imx_rproc_stop(struct rproc
> > > > *rproc) if (ret)
> > > > dev_err(dev, "Failed to stop M4!\n");
> > > >
> > > > + /* clear entry points */
> > > > + writel(0, priv->bootreg);
> > > > +
> > > > return ret;
> > > > }
> > > >
> > > > @@ -243,7 +254,8 @@ static void *imx_rproc_da_to_va(struct
> > > > rproc *rproc, u64 da, int len) static const struct rproc_ops
> > > > imx_rproc_ops = { .start = imx_rproc_start,
> > > > .stop = imx_rproc_stop,
> > > > - .da_to_va = imx_rproc_da_to_va,
> > > > + .da_to_va = imx_rproc_da_to_va,
> > > > + .get_boot_addr = rproc_elf_get_boot_addr,
> > > >
> > > >
> > > > How is this useful? Sure it will set rproc->bootaddr in
> > > > rproc_fw_boot() but what good does that do when it is invariably
> > > > set again in imx_rproc_start() ?
> > > >
> > > > The priv->bootreg is the address where we are writing Entry
> > > > Point and it is fixed, 0x04 address is translated to
> > > > 0x00180004, so don't quite understand you we are writing
> > > > rproc->bootaddr into priv->bootreg, not wiseversa.
> > > >
> > >
> > > What is your reason to set ops->get_boot_addr ? How does that
> > > help the work done in this patch?
> >
> > The reason is the following :
> >
> > remoteproc_core.c:
> > | rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
> > | rproc->bootaddr = rproc_get_boot_addr(rproc, fw);
> >
> > remoteproc_internal.h
> > | static inline
> > | u32 rproc_get_boot_addr(struct rproc *rproc, const struct firmware
> > *fw) | {
> > | if (rproc->ops->get_boot_addr)
> > | return rproc->ops->get_boot_addr(rproc, fw);
> > |
> > | return 0;
> > | }
>
> And as I said above the value of rproc->bootaddr is set to
> priv->bootreg in imx_rproc_stop(). What am I missing? More over
> imx_rproc_ops doesn't have a ->load() function and as such rproc_alloc
> will set it to rproc_elf_get_boot_addr()
Yes, you are totally correct, it is not required in this patch thank you
for pointing this out.
>
> >
> > >
> > > >
> > > > };
> > > >
> > > > static int imx_rproc_addr_init(struct imx_rproc *priv,
> > > > @@ -360,6 +372,8 @@ static int imx_rproc_probe(struct
> > > > platform_device *pdev) goto err_put_rproc;
> > > > }
> > > >
> > > > + priv->bootreg = imx_rproc_da_to_va(rproc, IMX_BOOT_PC,
> > > > sizeof(u32)); +
> > > > /*
> > > > * clk for M4 block including memory. Should be
> > > > * enabled before .start for FW transfer.
> > > > --
> > > > 2.25.1
> > > >
> >
next prev parent reply other threads:[~2020-04-22 7:35 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-04 14:26 [PATCH 1/2] remoteproc: imx_rproc: dummy kick method Nikita Shubin
2020-03-04 14:26 ` [PATCH 2/2] remoteproc: imx_rproc: set pc on start Nikita Shubin
2020-03-05 16:16 ` [PATCH 1/2] remoteproc: imx_rproc: dummy kick method Mathieu Poirier
2020-03-05 17:29 ` nikita.shubin
2020-03-05 17:54 ` Mathieu Poirier
2020-03-05 18:07 ` nikita.shubin
2020-03-05 18:36 ` Mathieu Poirier
2020-03-05 18:46 ` nikita.shubin
2020-04-06 11:33 ` [PATCH v2 0/3] remoteproc: imx_rproc: add virtio support nikita.shubin
2020-04-06 11:33 ` nikita.shubin
2020-04-06 11:33 ` [PATCH v2 1/3] remoteproc: imx_rproc: set pc on start nikita.shubin
2020-04-06 11:33 ` nikita.shubin
2020-04-14 16:45 ` Mathieu Poirier
2020-04-14 16:45 ` Mathieu Poirier
2020-04-17 5:40 ` nikita.shubin
2020-04-17 17:01 ` Mathieu Poirier
2020-04-17 17:01 ` Mathieu Poirier
2020-04-17 17:26 ` Nikita Shubin
2020-04-17 17:26 ` Nikita Shubin
2020-04-17 22:24 ` Mathieu Poirier
2020-04-17 22:24 ` Mathieu Poirier
2020-04-22 7:35 ` Nikita Shubin [this message]
2020-04-22 7:35 ` Nikita Shubin
2020-04-17 12:11 ` Nikita Shubin
2020-04-17 12:11 ` Nikita Shubin
2020-04-17 15:37 ` Mathieu Poirier
2020-04-17 15:37 ` Mathieu Poirier
2020-04-17 15:46 ` Nikita Shubin
2020-04-17 15:46 ` Nikita Shubin
2020-04-06 11:33 ` [PATCH v2 2/3] remoteproc: imx_rproc: mailbox support nikita.shubin
2020-04-06 11:33 ` nikita.shubin
2020-04-07 1:07 ` kbuild test robot
2020-04-07 1:07 ` kbuild test robot
2020-04-14 17:20 ` Mathieu Poirier
2020-04-14 17:20 ` Mathieu Poirier
2020-04-17 8:37 ` Nikita Shubin
2020-04-17 8:37 ` Nikita Shubin
2020-04-17 16:02 ` Mathieu Poirier
2020-04-17 16:02 ` Mathieu Poirier
2020-04-14 17:36 ` Mathieu Poirier
2020-04-14 17:36 ` Mathieu Poirier
2020-04-06 11:33 ` [PATCH v2 3/3] remoteproc: imx_rproc: memory regions nikita.shubin
2020-04-06 11:33 ` nikita.shubin
2020-04-14 17:46 ` Mathieu Poirier
2020-04-14 17:46 ` Mathieu Poirier
2020-04-15 2:42 ` [PATCH v2 0/3] remoteproc: imx_rproc: add virtio support Peng Fan
2020-04-15 2:42 ` Peng Fan
2020-04-15 16:26 ` Mathieu Poirier
2020-04-15 16:26 ` Mathieu Poirier
2020-04-17 8:57 ` Nikita Shubin
2020-04-17 8:57 ` Nikita Shubin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200422103549.0000512d@maquefel.me \
--to=nikita.shubin@maquefel.me \
--cc=bjorn.andersson@linaro.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=nshubin@topcon.com \
--cc=ohad@wizery.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).