From: Pi-Hsun Shih <pihsun@chromium.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
Erin Lo <erin.lo@mediatek.com>
Cc: Ohad Ben-Cohen <ohad@wizery.com>,
Nicolas Boichat <drinkcat@chromium.org>,
"open list:REMOTE PROCESSOR \(REMOTEPROC\) SUBSYSTEM"
<linux-remoteproc@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@lists.infradead.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
"moderated list:ARM/Mediatek SoC support"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v20 2/4] remoteproc/mediatek: add SCP support for mt8183
Date: Tue, 12 Nov 2019 15:55:38 +0800 [thread overview]
Message-ID: <CANdKZ0ecgLjhnL9CawW+pPerTtPhnMkaUSmjxcB10OoMBzQaGQ@mail.gmail.com> (raw)
In-Reply-To: <20191111225316.GC3108315@builder>
Hi,
Thanks for the review, I'll address them in the next version. Some
inline comment below.
On Tue, Nov 12, 2019 at 6:53 AM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> On Mon 14 Oct 00:58 PDT 2019, Pi-Hsun Shih wrote:
> > diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> [..]
> > +struct platform_device *scp_get_pdev(struct platform_device *pdev)
>
> I'm unable to find a patch that calls this, but I assume you're only
> using the returned struct platform_device * in order to call the other
> exported functions in this driver.
Some more information:
Patches for drivers that are using this function includes:
https://patchwork.kernel.org/patch/11126059/
https://patchwork.kernel.org/patch/11134913/
https://patchwork.kernel.org/patch/11135073/
https://patchwork.kernel.org/patch/11138511/
https://patchwork.kernel.org/patch/11140755/
The returned platform_device are used either:
* As a pointer passing back to the scp_ipi_{register,unregister,send} APIs
# This is the case above.
* Use the ->dev field for either passing to dma_alloc_coherent
(11134913, 11138511), or logging
(https://patchwork.kernel.org/patch/11140755/ mdp_vpu_register).
# Probably would need to export another function for mtk_scp* ->
device* if going for this change.
A particular problematic patch for this change is
https://patchwork.kernel.org/patch/11135073/, which stores both
platform_device from SCP or VPU in the same field, but it can be
changed to two different fields.
>
> If this is the case I would suggest that you return a struct mtk_scp *
> instead, as this makes your API cleaner and prevents confusion about
> what platform_device could/should be passed in.
>
> Note that you don't need to disclose the struct mtk_scp to your clients,
> just add a "struct mtk_scp;" in include/remoteproc/mtk_scp.h and your
> clients can pass this pointer around.
Ok I'll change to this.
> > + return -ENOMEM;
> > + }
> > +
> > + /* Reserved SCP code size */
> > + scp->dram_size = MAX_CODE_SIZE;
> > + scp->cpu_addr = dma_alloc_coherent(scp->dev, scp->dram_size,
> > + &scp->phys_addr, GFP_KERNEL);
>
> Don't you have a problem with that the reserved memory region must be
> 8MB for this allocation to succeed? If so, consider using devm_ioremap
> or similar to map the region.
Yes the reserved memory need to be large enough.
There are other drivers (https://patchwork.kernel.org/patch/11134913/,
https://patchwork.kernel.org/patch/11138511/) that also use
dma_alloc_coherent on the same reserved memory, so we need to use
dma_alloc_coherent here too.
It seems to be problematic if this dma_alloc_coherent is not called
before the other two dma_alloc_coherent, I'll check this.
> [...]
> Regards,
> Bjorn
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2019-11-12 7:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 7:58 [PATCH v20 0/4] Add support for mt8183 SCP Pi-Hsun Shih
2019-10-14 7:58 ` [PATCH v20 1/4] dt-bindings: Add a binding for Mediatek SCP Pi-Hsun Shih
2019-10-14 7:58 ` [PATCH v20 2/4] remoteproc/mediatek: add SCP support for mt8183 Pi-Hsun Shih
2019-11-11 22:53 ` Bjorn Andersson
2019-11-12 7:55 ` Pi-Hsun Shih [this message]
2019-10-14 7:58 ` [PATCH v20 3/4] rpmsg: add rpmsg support for mt8183 SCP Pi-Hsun Shih
2019-11-11 23:10 ` Bjorn Andersson
2019-11-12 6:42 ` Pi-Hsun Shih
2019-11-12 7:08 ` Bjorn Andersson
2019-10-14 7:58 ` [PATCH v20 4/4] arm64: dts: mt8183: add scp node Pi-Hsun Shih
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=CANdKZ0ecgLjhnL9CawW+pPerTtPhnMkaUSmjxcB10OoMBzQaGQ@mail.gmail.com \
--to=pihsun@chromium.org \
--cc=bjorn.andersson@linaro.org \
--cc=drinkcat@chromium.org \
--cc=erin.lo@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=ohad@wizery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is 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).