From: Andrew Jones <ajones@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 2/6] lib: sbi_hsm: handle failure when hart_stop returns SBI_ENOTSUPP
Date: Fri, 6 Jan 2023 14:40:32 +0100 [thread overview]
Message-ID: <20230106134032.37cd7yui2l76vpwv@orel> (raw)
In-Reply-To: <20230104062927.15628-3-peterlin@andestech.com>
On Wed, Jan 04, 2023 at 02:29:23PM +0800, Yu Chien Peter Lin wrote:
> Make use of generic warm-boot path when platform hart_stop callback
> returns SBI_ENOTSUPP, in case certain hart can not turn off its
> power domain, or it detects some error occured in power management
> unit, it can fall through warmboot flow and wait for interrupt in
> sbi_hsm_hart_wait().
>
> Also improves comment in sbi_hsm_hart_wait().
>
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
> On ae350-ax25mp, hart0 shares power domain with L2-cache, thus turning
> it off would break working system.
> ---
> include/sbi/sbi_hsm.h | 8 ++++++--
> lib/sbi/sbi_hsm.c | 7 +++----
> 2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h
> index d6cc468..1e23884 100644
> --- a/include/sbi/sbi_hsm.h
> +++ b/include/sbi/sbi_hsm.h
> @@ -21,8 +21,12 @@ struct sbi_hsm_device {
> int (*hart_start)(u32 hartid, ulong saddr);
>
> /**
> - * Stop (or power-down) the current hart from running. This call
> - * doesn't expect to return if success.
> + * Stop (or power-down) the current hart from running.
> + *
> + * Return SBI_ENOTSUPP if the hart does not support platform-specific
> + * stop actions.
> + *
> + * For successful stop, the call won't return.
> */
> int (*hart_stop)(void);
>
> diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
> index 836008f..b89253b 100644
> --- a/lib/sbi/sbi_hsm.c
> +++ b/lib/sbi/sbi_hsm.c
> @@ -116,7 +116,7 @@ static void sbi_hsm_hart_wait(struct sbi_scratch *scratch, u32 hartid)
> /* Set MSIE and MEIE bits to receive IPI */
> csr_set(CSR_MIE, MIP_MSIP | MIP_MEIP);
>
> - /* Wait for hart_add call*/
> + /* Wait for state transition requested by sbi_hsm_hart_start() */
> while (atomic_read(&hdata->state) != SBI_HSM_STATE_START_PENDING) {
> wfi();
> };
> @@ -228,9 +228,8 @@ void __noreturn sbi_hsm_exit(struct sbi_scratch *scratch)
> goto fail_exit;
>
> if (hsm_device_has_hart_hotplug()) {
> - hsm_device_hart_stop();
> - /* It should never reach here */
> - goto fail_exit;
> + if (hsm_device_hart_stop() != SBI_ENOTSUPP)
> + goto fail_exit;
> }
>
> /**
> --
> 2.34.1
>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
next prev parent reply other threads:[~2023-01-06 13:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 6:29 [PATCH 0/6] Implement hart hotplug using HSM extension for Yu Chien Peter Lin
2023-01-04 6:29 ` [PATCH 1/6] docs: generic.md: fix typo of andes-ae350 Yu Chien Peter Lin
2023-01-16 9:00 ` Anup Patel
2023-01-04 6:29 ` [PATCH 2/6] lib: sbi_hsm: handle failure when hart_stop returns SBI_ENOTSUPP Yu Chien Peter Lin
2023-01-06 13:40 ` Andrew Jones [this message]
2023-01-09 9:08 ` Atish Patra
2023-01-16 9:01 ` Anup Patel
2023-01-04 6:29 ` [PATCH 3/6] include: types: add always inline compiler attribute Yu Chien Peter Lin
2023-01-16 9:02 ` Anup Patel
2023-01-04 6:29 ` [PATCH 4/6] platform: andes/ae350: Implement hart hotplug using HSM extension Yu Chien Peter Lin
2023-01-16 9:09 ` Anup Patel
2023-01-04 6:29 ` [PATCH 5/6] lib: reset/fdt_reset_atcwdt200: use defined macros in atcsmu.h Yu Chien Peter Lin
2023-01-16 9:15 ` Anup Patel
2023-01-16 20:17 ` Yu-Chien Peter Lin
2023-01-04 6:29 ` [PATCH 6/6] lib: sbi_hsm: Introduce hart_secondary_boot() callback Yu Chien Peter Lin
2023-01-06 14:29 ` Andrew Jones
2023-01-08 21:09 ` Yu-Chien Peter Lin
2023-01-16 9:18 ` Anup Patel
2023-01-16 20:15 ` Yu-Chien Peter Lin
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=20230106134032.37cd7yui2l76vpwv@orel \
--to=ajones@ventanamicro.com \
--cc=opensbi@lists.infradead.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