From: Tanmay Shah <tanmays@amd.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>,
Tanmay Shah <tanmay.shah@amd.com>
Cc: michal.simek@amd.com, andersson@kernel.org,
jaswinder.singh@linaro.org, ben.levinsky@amd.com,
shubhrajyoti.datta@amd.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-remoteproc@vger.kernel.org
Subject: Re: [PATCH v3 3/3] remoteproc: xilinx: add mailbox channels for rpmsg
Date: Wed, 22 Feb 2023 14:49:34 -0600 [thread overview]
Message-ID: <cda08910-52f1-b0d2-3e06-6c5b930f898a@amd.com> (raw)
In-Reply-To: <20230222190623.GC909075@p14s>
On 2/22/23 11:06 AM, Mathieu Poirier wrote:
> On Mon, Feb 13, 2023 at 01:18:26PM -0800, Tanmay Shah wrote:
>> [ ... ]
>> +
>> /*
>> * zynqmp_r5_set_mode()
>> *
>> @@ -617,7 +819,7 @@ static int zynqmp_r5_rproc_unprepare(struct rproc *rproc)
>> return 0;
>> }
>>
>> -static const struct rproc_ops zynqmp_r5_rproc_ops = {
>> +static struct rproc_ops zynqmp_r5_rproc_ops = {
>> .prepare = zynqmp_r5_rproc_prepare,
>> .unprepare = zynqmp_r5_rproc_unprepare,
>> .start = zynqmp_r5_rproc_start,
>> @@ -642,6 +844,7 @@ static struct zynqmp_r5_core *zynqmp_r5_add_rproc_core(struct device *cdev)
>> {
>> struct zynqmp_r5_core *r5_core;
>> struct rproc *r5_rproc;
>> + struct mbox_info *ipi;
>> int ret;
>>
>> /* Set up DMA mask */
>> @@ -649,12 +852,23 @@ static struct zynqmp_r5_core *zynqmp_r5_add_rproc_core(struct device *cdev)
>> if (ret)
>> return ERR_PTR(ret);
>>
>> + /*
>> + * If mailbox nodes are disabled using "status" property then setting up
>> + * mailbox channels will be failed. In that case we don't really need
>> + * kick() operation. Include .kick() only if mbox channels are acquired
>> + * successfully.
>> + */
>> + ipi = zynqmp_r5_setup_mbox(cdev);
>> + if (ipi)
>> + zynqmp_r5_rproc_ops.kick = zynqmp_r5_rproc_kick;
>> +
>> /* Allocate remoteproc instance */
>> r5_rproc = rproc_alloc(cdev, dev_name(cdev),
>> &zynqmp_r5_rproc_ops,
>> NULL, sizeof(struct zynqmp_r5_core));
>> if (!r5_rproc) {
>> dev_err(cdev, "failed to allocate memory for rproc instance\n");
>> + zynqmp_r5_free_mbox(ipi);
>> return ERR_PTR(-ENOMEM);
>> }
>>
>> @@ -665,6 +879,7 @@ static struct zynqmp_r5_core *zynqmp_r5_add_rproc_core(struct device *cdev)
>> if (!r5_core->np) {
>> dev_err(cdev, "can't get device node for r5 core\n");
>> ret = -EINVAL;
>> + zynqmp_r5_free_mbox(ipi);
>> goto free_rproc;
>> }
>>
>> @@ -672,10 +887,17 @@ static struct zynqmp_r5_core *zynqmp_r5_add_rproc_core(struct device *cdev)
>> ret = rproc_add(r5_rproc);
>> if (ret) {
>> dev_err(cdev, "failed to add r5 remoteproc\n");
>> + zynqmp_r5_free_mbox(ipi);
>> goto free_rproc;
>> }
>>
>> + if (ipi) {
>> + r5_core->ipi = ipi;
>> + ipi->r5_core = r5_core;
>> + }
>> +
>> r5_core->rproc = r5_rproc;
>> +
>> return r5_core;
>>
>> free_rproc:
>> @@ -918,6 +1140,7 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
>> while (i >= 0) {
>> put_device(child_devs[i]);
>> if (r5_cores[i]) {
>> + zynqmp_r5_free_mbox(r5_cores[i]->ipi);
> The mailboxes are initialized in zynqmp_r5_add_rproc_core() but free'd here in
> case of trouble, which introduces coupling between the two functions. I suggest
> moving zynqmp_r5_setup_mbox() in zynqmp_r5_cluster_init() and initialize both
> mailboxes in it.
>
> I am done reviewing this set.
Ack. Yes that makes sense.
Thanks,
Tanmay
>
> Thanks,
> Mathieu
>
> Thanks,
> Mathieu
>
>> of_reserved_mem_device_release(r5_cores[i]->dev);
>> rproc_del(r5_cores[i]->rproc);
>> rproc_free(r5_cores[i]->rproc);
>> @@ -942,6 +1165,7 @@ static void zynqmp_r5_cluster_exit(void *data)
>>
>> for (i = 0; i < cluster->core_count; i++) {
>> r5_core = cluster->r5_cores[i];
>> + zynqmp_r5_free_mbox(r5_core->ipi);
>> of_reserved_mem_device_release(r5_core->dev);
>> put_device(r5_core->dev);
>> rproc_del(r5_core->rproc);
>> --
>> 2.25.1
>>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2023-02-22 20:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 21:18 [PATCH v3 0/3] drivers: remoteproc: xilinx: add mailbox support Tanmay Shah
2023-02-13 21:18 ` [PATCH v3 1/3] drivers: mailbox: zynqmp: handle multiple child nodes Tanmay Shah
2023-02-22 5:28 ` Datta, Shubhrajyoti
2023-02-22 17:34 ` Mathieu Poirier
2023-02-23 9:40 ` Michal Simek
2023-02-23 14:47 ` Tanmay Shah
2023-02-24 8:37 ` Michal Simek
2023-02-27 15:25 ` Tanmay Shah
2023-02-27 15:28 ` Michal Simek
2023-02-13 21:18 ` [PATCH v3 2/3] drivers: remoteproc: xilinx: fix carveout names Tanmay Shah
2023-02-22 18:41 ` Mathieu Poirier
2023-02-22 20:47 ` Tanmay Shah
2023-02-13 21:18 ` [PATCH v3 3/3] remoteproc: xilinx: add mailbox channels for rpmsg Tanmay Shah
2023-02-22 19:06 ` Mathieu Poirier
2023-02-22 20:49 ` Tanmay Shah [this message]
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=cda08910-52f1-b0d2-3e06-6c5b930f898a@amd.com \
--to=tanmays@amd.com \
--cc=andersson@kernel.org \
--cc=ben.levinsky@amd.com \
--cc=jaswinder.singh@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=michal.simek@amd.com \
--cc=shubhrajyoti.datta@amd.com \
--cc=tanmay.shah@amd.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).