From: "Kumar, Udit" <u-kumar1@ti.com>
To: Beleswar Padhi <b-padhi@ti.com>, <andersson@kernel.org>,
<mathieu.poirier@linaro.org>
Cc: <afd@ti.com>, <hnagalla@ti.com>, <s-anna@ti.com>,
<linux-remoteproc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] remoteproc: k3-r5: Decouple firmware booting from probe routine
Date: Sat, 7 Sep 2024 15:41:38 +0530 [thread overview]
Message-ID: <56b63a39-ea4d-4edf-9295-ca28c83655c8@ti.com> (raw)
In-Reply-To: <20240906094045.2428977-1-b-padhi@ti.com>
On 9/6/2024 3:10 PM, Beleswar Padhi wrote:
> The current implementation of the waiting mechanism in probe() waits for
> the 'released_from_reset' flag to be set which is done in
> k3_r5_rproc_prepare() as part of rproc_fw_boot(). This causes unexpected
> failures in cases where the firmware is unavailable at boot time,
> resulting in probe failure and removal of the remoteproc handles in the
> sysfs paths.
I won't say failure, I will say this is behavior of driver.
Driver expect firmware to be available , but I agree driver should be
able to execute
with/without firmware availability.
> To address this, the waiting mechanism is refactored out of the probe
> routine into the appropriate k3_r5_rproc_prepare/unprepare() and
> k3_r5_rproc_start/stop() functions. This allows the probe routine to
> complete without depending on firmware booting, while still maintaining
> the required power-synchronization between cores.
>
> Fixes: 61f6f68447ab ("remoteproc: k3-r5: Wait for core0 power-up before powering up core1")
> Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
> ---
> Posted this as a Fix as this was breaking usecases where we wanted to load a
> firmware by writing to sysfs handles in userspace.
>
> drivers/remoteproc/ti_k3_r5_remoteproc.c | 170 ++++++++++++++++-------
> 1 file changed, 118 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c
> [..]
> + core0 = list_first_entry(&cluster->cores, struct k3_r5_core, elem);
> + core1 = list_last_entry(&cluster->cores, struct k3_r5_core, elem);
> + if (cluster->mode == CLUSTER_MODE_SPLIT && core == core1 &&
> + core0->released_from_reset == false) {
> + ret = wait_event_interruptible_timeout(cluster->core_transition,
> + core0->released_from_reset,
> + msecs_to_jiffies(2000));
only one wait in start should be good enough,
> + if (ret <= 0) {
> + dev_err(dev, "can not power up core1 before core0");
> + return -EPERM;
> + }
> + }
> +
> ret = ti_sci_proc_get_status(core->tsp, &boot_vec, &cfg, &ctrl, &stat);
> if (ret < 0)
> return ret;
> @@ -470,6 +492,12 @@ static int k3_r5_rproc_prepare(struct rproc *rproc)
> return ret;
> }
>
> + /* Notify all threads in the wait queue when core state has changed so
> + * that threads waiting for this condition can be executed.
> + */
> + core->released_from_reset = true;
> + wake_up_interruptible(&cluster->core_transition);
> +
> /*
> * Newer IP revisions like on J7200 SoCs support h/w auto-initialization
> * of TCMs, so there is no need to perform the s/w memzero. This bit is
> @@ -515,14 +543,46 @@ static int k3_r5_rproc_unprepare(struct rproc *rproc)
> {
> struct k3_r5_rproc *kproc = rproc->priv;
> struct k3_r5_cluster *cluster = kproc->cluster;
> - struct k3_r5_core *core = kproc->core;
> + struct k3_r5_core *core0, *core1, *core = kproc->core;
why you need wait in unprepare/stop,
In case you are failing during firmware load or so then already we are
in bad state.
if this is call from user land then, i don't except anyone will auto
trigger stopping of core-0
IMO, in unprepare/stop, if action is attempted on core1 with core-0 ON,
simply return error.
> [..]
> @@ -629,7 +702,7 @@ static int k3_r5_rproc_stop(struct rproc *rproc)
> struct k3_r5_rproc *kproc = rproc->priv;
> struct k3_r5_cluster *cluster = kproc->cluster;
> struct device *dev = kproc->dev;
>
next prev parent reply other threads:[~2024-09-07 10:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-06 9:40 Beleswar Padhi
2024-09-06 16:47 ` Mathieu Poirier
2024-09-06 18:17 ` Beleswar Prasad Padhi
2024-09-07 10:11 ` Kumar, Udit [this message]
2024-09-09 4:16 ` Beleswar Prasad Padhi
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=56b63a39-ea4d-4edf-9295-ca28c83655c8@ti.com \
--to=u-kumar1@ti.com \
--cc=afd@ti.com \
--cc=andersson@kernel.org \
--cc=b-padhi@ti.com \
--cc=hnagalla@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=s-anna@ti.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
all inboxes | Powered by JetHome®