OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib: sbi: Save context for all non-retentive suspend types
@ 2021-10-11  5:55 Anup Patel
  2021-10-11  7:55 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Anup Patel @ 2021-10-11  5:55 UTC (permalink / raw)
  To: opensbi

Instead of saving context only for default non-retentvie suspend,
we should save CSRs for both default and non-retentive suspend.

Fixes: 74756891cc35 ("lib: sbi: Implement SBI HSM suspend function")
Signed-off-by: Anup Patel <anup.patel@wdc.com>
---
 lib/sbi/sbi_hsm.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
index 67890f3..ecd2e45 100644
--- a/lib/sbi/sbi_hsm.c
+++ b/lib/sbi/sbi_hsm.c
@@ -358,12 +358,6 @@ static int __sbi_hsm_suspend_non_ret_default(struct sbi_scratch *scratch,
 {
 	void (*jump_warmboot)(void) = (void (*)(void))scratch->warmboot_addr;
 
-	/*
-	 * Save some of the M-mode CSRs which should be restored after
-	 * resuming from suspend state
-	 */
-	__sbi_hsm_suspend_non_ret_save(scratch);
-
 	/* Wait for interrupt */
 	wfi();
 
@@ -463,6 +457,13 @@ int sbi_hsm_hart_suspend(struct sbi_scratch *scratch, u32 suspend_type,
 	/* Save the suspend type */
 	hdata->suspend_type = suspend_type;
 
+	/*
+	 * Save context which will be restored after resuming from
+	 * non-retentive suspend.
+	 */
+	if (suspend_type & SBI_HSM_SUSP_NON_RET_BIT)
+		__sbi_hsm_suspend_non_ret_save(scratch);
+
 	/* Try platform specific suspend */
 	ret = hsm_device_hart_suspend(suspend_type, scratch->warmboot_addr);
 	if (ret == SBI_ENOTSUPP) {
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] lib: sbi: Save context for all non-retentive suspend types
  2021-10-11  5:55 [PATCH] lib: sbi: Save context for all non-retentive suspend types Anup Patel
@ 2021-10-11  7:55 ` Andreas Schwab
  2021-10-11  8:10   ` Anup Patel
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2021-10-11  7:55 UTC (permalink / raw)
  To: opensbi

On Okt 11 2021, Anup Patel wrote:

> Instead of saving context only for default non-retentvie suspend,

Typo: retentive.

Andreas.

-- 
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] lib: sbi: Save context for all non-retentive suspend types
  2021-10-11  7:55 ` Andreas Schwab
@ 2021-10-11  8:10   ` Anup Patel
  0 siblings, 0 replies; 3+ messages in thread
From: Anup Patel @ 2021-10-11  8:10 UTC (permalink / raw)
  To: opensbi

On Mon, Oct 11, 2021 at 1:25 PM Andreas Schwab <schwab@linux-m68k.org> wrote:
>
> On Okt 11 2021, Anup Patel wrote:
>
> > Instead of saving context only for default non-retentvie suspend,
>
> Typo: retentive.

Thanks Andreas, I will update it soon.

Regards,
Anup

>
> Andreas.
>
> --
> Andreas Schwab, schwab at linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> "And now for something completely different."


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-11  8:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-11  5:55 [PATCH] lib: sbi: Save context for all non-retentive suspend types Anup Patel
2021-10-11  7:55 ` Andreas Schwab
2021-10-11  8:10   ` Anup Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox