Skip to content
Snippets Groups Projects
Commit 0f444376 authored by Dmitry Osipenko's avatar Dmitry Osipenko
Browse files

XXX: reboot: Add reboot_lava_test= kernel cmdline option


Add reboot_lava_test= kernel cmdline option which skips power-off/reboot
made by drivers, allowing us to test whether basics are working properly
in the LAVA environment.

Signed-off-by: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
parent 069c5dbf
No related branches found
No related tags found
No related merge requests found
...@@ -48,6 +48,8 @@ int reboot_cpu; ...@@ -48,6 +48,8 @@ int reboot_cpu;
enum reboot_type reboot_type = BOOT_ACPI; enum reboot_type reboot_type = BOOT_ACPI;
int reboot_force; int reboot_force;
static bool reboot_lava_test_mode;
/** /**
* emergency_restart - reboot the system * emergency_restart - reboot the system
* *
...@@ -235,6 +237,9 @@ void migrate_to_reboot_cpu(void) ...@@ -235,6 +237,9 @@ void migrate_to_reboot_cpu(void)
*/ */
void kernel_restart(char *cmd) void kernel_restart(char *cmd)
{ {
if (reboot_lava_test_mode)
return do_kernel_restart(cmd);
kernel_restart_prepare(cmd); kernel_restart_prepare(cmd);
migrate_to_reboot_cpu(); migrate_to_reboot_cpu();
syscore_shutdown(); syscore_shutdown();
...@@ -354,6 +359,11 @@ static int sys_off_handler_power_off(struct notifier_block *nb, ...@@ -354,6 +359,11 @@ static int sys_off_handler_power_off(struct notifier_block *nb,
struct sys_off_handler *h; struct sys_off_handler *h;
int ret = NOTIFY_DONE; int ret = NOTIFY_DONE;
if (reboot_lava_test_mode) {
pr_emerg("power-off test: okay\n");
return NOTIFY_DONE;
}
priv = container_of(nb, struct sys_off_handler_private_data, power_off_nb); priv = container_of(nb, struct sys_off_handler_private_data, power_off_nb);
h = container_of(priv, struct sys_off_handler, priv); h = container_of(priv, struct sys_off_handler, priv);
prep_data.cb_data = h->cb_data; prep_data.cb_data = h->cb_data;
...@@ -395,6 +405,11 @@ static int sys_off_handler_restart(struct notifier_block *nb, ...@@ -395,6 +405,11 @@ static int sys_off_handler_restart(struct notifier_block *nb,
struct restart_data data = {}; struct restart_data data = {};
struct sys_off_handler *h; struct sys_off_handler *h;
if (reboot_lava_test_mode) {
pr_emerg("restart test: okay\n");
return NOTIFY_DONE;
}
priv = container_of(nb, struct sys_off_handler_private_data, restart_nb); priv = container_of(nb, struct sys_off_handler_private_data, restart_nb);
h = container_of(priv, struct sys_off_handler, priv); h = container_of(priv, struct sys_off_handler, priv);
...@@ -415,6 +430,11 @@ static int sys_off_handler_reboot(struct notifier_block *nb, ...@@ -415,6 +430,11 @@ static int sys_off_handler_reboot(struct notifier_block *nb,
struct reboot_prep_data data = {}; struct reboot_prep_data data = {};
struct sys_off_handler *h; struct sys_off_handler *h;
if (reboot_lava_test_mode) {
pr_emerg("reboot test: okay\n");
return NOTIFY_DONE;
}
priv = container_of(nb, struct sys_off_handler_private_data, reboot_nb); priv = container_of(nb, struct sys_off_handler_private_data, reboot_nb);
h = container_of(priv, struct sys_off_handler, priv); h = container_of(priv, struct sys_off_handler, priv);
...@@ -805,6 +825,9 @@ static void do_kernel_power_off_prepare(void) ...@@ -805,6 +825,9 @@ static void do_kernel_power_off_prepare(void)
*/ */
void kernel_power_off(void) void kernel_power_off(void)
{ {
if (reboot_lava_test_mode)
return do_kernel_power_off();
kernel_shutdown_prepare(SYSTEM_POWER_OFF); kernel_shutdown_prepare(SYSTEM_POWER_OFF);
do_kernel_power_off_prepare(); do_kernel_power_off_prepare();
migrate_to_reboot_cpu(); migrate_to_reboot_cpu();
...@@ -1231,6 +1254,17 @@ static int __init reboot_setup(char *str) ...@@ -1231,6 +1254,17 @@ static int __init reboot_setup(char *str)
} }
__setup("reboot=", reboot_setup); __setup("reboot=", reboot_setup);
static int __init reboot_lava_test_setup(char *str)
{
if (!strcmp(str, "1")) {
pr_info("enabled reboot_lava_test_mode\n");
reboot_lava_test_mode = 1;
}
return 1;
}
__setup("reboot_lava_test=", reboot_lava_test_setup);
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
#define REBOOT_COLD_STR "cold" #define REBOOT_COLD_STR "cold"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment