lib: sbi: Save context for all non-retentive suspend types
PATCH v2 1/1 lib: sbi: Save context for all non-retentive suspend types
Instead of saving context only for default non-retentive suspend, we should save context for all non-retentive suspend types.
---
Changes since v1:
- Fixed typo in commit description and improved it.
--- lib/sbi/sbi_hsm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
lib/sbi/sbi_hsm.c +7 -6
@@ -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 ) {
Signature · 1 line
2.25.1
PATCH v2 1/1 lib: sbi: Save context for all non-retentive suspend types
Quoted 45 lines · anup patel anup.patel at wdc.com
Instead of saving context only for default non-retentive suspend, we should save context for all non-retentive suspend types.
Fixes 74756891cc35 ("lib: sbi: Implement SBI HSM suspend function")Signed-off-by Anup Patel <[email protected]>---
Changes since v1:
- Fixed typo in commit description and improved it.
---lib/sbi/sbi_hsm.c| 13 +++++++------1 file changed, 7 insertions(+), 6 deletions(-)lib/sbi/sbi_hsm.c +7
-6@@ -358,12 +358,6 @@ static int __sbi_hsm_suspend_non_ret_default(structsbi_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) {
Quoted 3 lines
--
2.25.1
Looks good to me.
Quoted 4 lines
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH v2 1/1 lib: sbi: Save context for all non-retentive suspend types
In reply to Anup Patel? 2021-10-11???? 13:54 +0530?Anup Patel???
Quoted 5 lines
Instead of saving context only for default non-retentive suspend, we should save context for all non-retentive suspend types.
Fixes 74756891cc35 ("lib: sbi: Implement SBI HSM suspend function")Signed-off-by Anup Patel <[email protected]>
Looks good to me.
Quoted 47 lines
---
Changes since v1:
?- Fixed typo in commit description and improved it.
---
?lib/sbi/sbi_hsm.c | 13 +++++++------
?1 file changed, 7 insertions(+), 6 deletions(-)lib/sbi/sbi_hsm.c +0
-0@@ -358,12 +358,6 @@ static int __sbi_hsm_suspend_non_ret_default(struct sbi_scratch *scratch, ?{????????void (*jump_warmboot)(void) = (void (*)(void))scratch-
Quoted 1 line
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();
?lib/sbi/sbi_hsm.c +0
-0@@ -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-Quoted 1 line
warmboot_addr);????????if (ret ==
SBI_ENOTSUPP) {Signature · 1 line
2.25.1
Anup Patel
AppliedPATCH v2 1/1 lib: sbi: Save context for all non-retentive suspend types
Quoted 10 lines · Xiang W
? 2021-10-11???? 13:54 +0530?Anup Patel???
Quoted 5 lines
Instead of saving context only for default non-retentive suspend, we should save context for all non-retentive suspend types.
Fixes 74756891cc35 ("lib: sbi: Implement SBI HSM suspend function")Signed-off-by Anup Patel <[email protected]>Looks good to me.
Reviewed-by Xiang W <[email protected]>
Applied this patch to the riscv/opensbi repo.
Regards,
Anup
Quoted 49 lines
Quoted 47 lines
---
Changes since v1:
- Fixed typo in commit description and improved it.--- lib/sbi/sbi_hsm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)lib/sbi/sbi_hsm.c +0
-2@@ -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
lib/sbi/sbi_hsm.c +7
-4-* 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-Quoted 1 line
warmboot_addr);if (ret == SBI_ENOTSUPP) {--
2.25.1