'efi' instructs Xen to reboot using the EFI reboot call (in EFI mode by
default it will use that method first).
+`xen` instructs Xen to reboot using Xen's SCHEDOP hypercall (this is the default
+when running nested Xen)
+
### rmrr
> '= start<-end>=[s1]bdf1[,[s1]bdf2[,...]];start<-end>=[s2]bdf1[,[s2]bdf2[,...]]
#include <asm/mpspec.h>
#include <asm/tboot.h>
#include <asm/apic.h>
+#include <asm/guest.h>
enum reboot_type {
BOOT_INVALID,
BOOT_CF9 = 'p',
BOOT_CF9_PWR = 'P',
BOOT_EFI = 'e',
+ BOOT_XEN = 'x',
};
static int reboot_mode;
* pci Use the so-called "PCI reset register", CF9
* Power Like 'pci' but for a full power-cyle reset
* efi Use the EFI reboot (if running under EFI)
+ * xen Use Xen SCHEDOP hypercall (if running under Xen as a guest)
*/
static enum reboot_type reboot_type = BOOT_INVALID;
case 'P':
case 'p':
case 't':
+ case 'x':
reboot_type = *str;
break;
default:
reboot_type = BOOT_INVALID;
}
+ if ( reboot_type == BOOT_XEN && !xen_guest )
+ {
+ printk("Xen reboot selected, but Xen hypervisor not detected\n"
+ "Falling back to default\n");
+ reboot_type = BOOT_INVALID;
+ }
+
return rc;
}
custom_param("reboot", set_reboot_type);
static void noreturn __machine_halt(void *unused)
{
local_irq_disable();
+
+ if ( reboot_type == BOOT_XEN )
+ xen_hypercall_shutdown(SHUTDOWN_poweroff);
+
for ( ; ; )
halt();
}
static void default_reboot_type(void)
{
- if ( reboot_type == BOOT_INVALID )
- reboot_type = efi_enabled(EFI_RS) ? BOOT_EFI
- : acpi_disabled ? BOOT_KBD
- : BOOT_ACPI;
+ if ( reboot_type != BOOT_INVALID )
+ return;
+
+ if ( xen_guest )
+ reboot_type = BOOT_XEN;
+ else if ( efi_enabled(EFI_RS) )
+ reboot_type = BOOT_EFI;
+ else if ( acpi_disabled )
+ reboot_type = BOOT_KBD;
+ else
+ reboot_type = BOOT_ACPI;
}
static int __init override_reboot(struct dmi_system_id *d)
}
reboot_type = BOOT_ACPI;
break;
+
+ case BOOT_XEN:
+ xen_hypercall_shutdown(SHUTDOWN_reboot);
+ break;
}
}
}
#ifdef CONFIG_XEN_GUEST
+#include <xen/types.h>
+
+#include <public/xen.h>
+#include <public/sched.h>
+
/*
* Hypercall primatives for 64bit
*
(type)res; \
})
+/*
+ * Primitive Hypercall wrappers
+ */
+static inline long xen_hypercall_sched_op(unsigned int cmd, void *arg)
+{
+ return _hypercall64_2(long, __HYPERVISOR_sched_op, cmd, arg);
+}
+
+/*
+ * Higher level hypercall helpers
+ */
+static inline long xen_hypercall_shutdown(unsigned int reason)
+{
+ struct sched_shutdown s = { .reason = reason };
+ return xen_hypercall_sched_op(SCHEDOP_shutdown, &s);
+}
+
+#else /* CONFIG_XEN_GUEST */
+
+#include <public/sched.h>
+
+static inline long xen_hypercall_shutdown(unsigned int reason)
+{
+ ASSERT_UNREACHABLE();
+ return 0;
+}
+
#endif /* CONFIG_XEN_GUEST */
#endif /* __X86_XEN_HYPERCALL_H__ */