hibernate: restart when resume fail and remove resume keep sign

If hibernation image exists, this bootup dtb is cut as
minimal system for faster to resume. So, when resume failed
need do restart because dtb was cut. Next bootup u-boot will
put a normal dtb( no valid hibernate image sign).

And more, removed resume keep sign feature for its unneed.

Signed-off-by: xianbing Zhu <xianbing.zhu@linux.alibaba.com>
Change-Id: I85b5a1eacb9e7924333de80fe99e2f5853b9576f
This commit is contained in:
xianbing Zhu
2024-03-29 15:54:38 +08:00
committed by Han Gao
parent ea8582dab3
commit 43759394d6
3 changed files with 11 additions and 19 deletions

View File

@@ -42,7 +42,6 @@ static int nohibernate;
static int resume_wait;
static unsigned int resume_delay;
static char resume_file[256] = CONFIG_PM_STD_PARTITION;
static int resume_keep_sign;
dev_t swsusp_resume_device;
sector_t swsusp_resume_block;
__visible int in_suspend __nosavedata;
@@ -844,7 +843,7 @@ int hibernate(void)
unlock_device_hotplug();
if (snapshot_test) {
pm_pr_dbg("Checking hibernation image\n");
error = swsusp_check(0);
error = swsusp_check();
if (!error)
error = load_image_and_restore();
}
@@ -1041,7 +1040,7 @@ static int software_resume(void)
MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
pm_pr_dbg("Looking for hibernation image.\n");
error = swsusp_check(resume_keep_sign);
error = swsusp_check();
if (error)
goto Unlock;
@@ -1450,11 +1449,6 @@ static int __init nohibernate_setup(char *str)
return 1;
}
static int __init resume_keepsign_setup(char *str)
{
resume_keep_sign = 1;
return 1;
}
__setup("noresume", noresume_setup);
__setup("resume_offset=", resume_offset_setup);
@@ -1463,4 +1457,3 @@ __setup("hibernate=", hibernate_setup);
__setup("resumewait", resumewait_setup);
__setup("resumedelay=", resumedelay_setup);
__setup("nohibernate", nohibernate_setup);
__setup("resume_keepsign", resume_keepsign_setup);

View File

@@ -170,7 +170,7 @@ extern int swsusp_swap_in_use(void);
#define SF_CRC32_MODE 4
/* kernel/power/hibernate.c */
extern int swsusp_check(int keep_sign);
extern int swsusp_check(void);
extern void swsusp_free(void);
extern int swsusp_read(unsigned int *flags_p);
extern int swsusp_write(unsigned int flags);

View File

@@ -1449,10 +1449,9 @@ int swsusp_mark_sign_retry(void)
}
/**
* swsusp_check - Check for swsusp signature in the resume device
* @keep_sign : indicate for reset wap signature, for resume used as fast bootup
*/
int swsusp_check(int keep_sign)
int swsusp_check(void)
{
int error;
void *holder;
@@ -1474,13 +1473,13 @@ int swsusp_check(int keep_sign)
swsusp_can_retry = true;
else
swsusp_can_retry = false;
if(!keep_sign) {
memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
/* Reset swap signature now */
error = hib_submit_io(REQ_OP_WRITE, REQ_SYNC,
swsusp_resume_block,
swsusp_header, NULL);
}
memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
/* Reset swap signature now */
error = hib_submit_io(REQ_OP_WRITE, REQ_SYNC,
swsusp_resume_block,
swsusp_header, NULL);
} else {
error = -EINVAL;
}