@@ -52,6 +52,34 @@ static void test_start(void)
report(1, "start");
}
+/*
+ * Does only test restart when the target is running.
+ * The other tests do restarts when stopped multiple times already.
+ */
+static void test_restart(void)
+{
+ struct cpu *cpu = smp_cpu_from_addr(1);
+ struct lowcore *lc = cpu->lowcore;
+
+ lc->restart_new_psw.mask = extract_psw_mask();
+ lc->restart_new_psw.addr = (unsigned long)test_func;
+
+ /* Make sure cpu is running */
+ smp_cpu_stop(0);
+ set_flag(0);
+ smp_cpu_restart(1);
+ wait_for_flag();
+
+ /*
+ * Wait until cpu 1 has set the flag because it executed the
+ * restart function.
+ */
+ set_flag(0);
+ smp_cpu_restart(1);
+ wait_for_flag();
+ report(1, "restart while running");
+}
+
static void test_stop(void)
{
smp_cpu_stop(1);
@@ -300,6 +328,7 @@ int main(void)
smp_cpu_stop(1);
test_start();
+ test_restart();
test_stop();
test_stop_store_status();
test_store_status();