[PATCH 08/10] x86: jailhouse: Halt instead of failing to restart

From: Jan Kiszka
Date: Thu Nov 16 2017 - 02:36:05 EST


From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>

Jailhouse provides no guest-initiated restart. So, do not even try to.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
arch/x86/kernel/jailhouse.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/x86/kernel/jailhouse.c b/arch/x86/kernel/jailhouse.c
index c1ed7fcd7bfa..0bcca175c35e 100644
--- a/arch/x86/kernel/jailhouse.c
+++ b/arch/x86/kernel/jailhouse.c
@@ -12,10 +12,12 @@

#include <linux/acpi_pmtmr.h>
#include <linux/kernel.h>
+#include <linux/reboot.h>
#include <asm/apic.h>
#include <asm/cpu.h>
#include <asm/hypervisor.h>
#include <asm/i8259.h>
+#include <asm/reboot.h>
#include <asm/setup.h>

#define SETUP_JAILHOUSE 0x53484c4a /* "JLHS" */
@@ -133,6 +135,12 @@ static unsigned long jailhouse_calibrate_tsc(void)
return 0;
}

+static void jailhouse_no_restart(void)
+{
+ pr_notice("Jailhouse: Restart not supported, halting\n");
+ machine_halt();
+}
+
static unsigned int x2apic_get_apic_id(unsigned long id)
{
return id;
@@ -153,6 +161,8 @@ static void __init jailhouse_init_platform(void)
x86_platform.calibrate_cpu = jailhouse_calibrate_cpu;
x86_platform.calibrate_tsc = jailhouse_calibrate_tsc;

+ machine_ops.emergency_restart = jailhouse_no_restart;
+
data = early_memremap(pa_data, sizeof(*data));

if (data->header.type != SETUP_JAILHOUSE ||
--
2.12.3