@@ -147,6 +147,13 @@ STACK_FRAME_NON_STANDARD(machine_real_restart);
*/
static int __init set_pci_reboot(const struct dmi_system_id *d)
{
+ /*
+ * Only apply the DMI-based change if reboot_type hasn't been
+ * overridden on the command line.
+ */
+ if (!reboot_default)
+ return 0;
+
if (reboot_type != BOOT_CF9_FORCE) {
reboot_type = BOOT_CF9_FORCE;
pr_info("%s series board detected. Selecting %s-method for reboots.\n",
@@ -157,6 +164,13 @@ static int __init set_pci_reboot(const struct dmi_system_id *d)
static int __init set_kbd_reboot(const struct dmi_system_id *d)
{
+ /*
+ * Only apply the DMI-based change if reboot_type hasn't been
+ * overridden on the command line.
+ */
+ if (!reboot_default)
+ return 0;
+
if (reboot_type != BOOT_KBD) {
reboot_type = BOOT_KBD;
pr_info("%s series board detected. Selecting %s-method for reboot.\n",
@@ -165,6 +179,21 @@ static int __init set_kbd_reboot(const struct dmi_system_id *d)
return 0;
}
+static int __init set_pci_power_cycle_reboot(const struct dmi_system_id *d)
+{
+ /*
+ * This has to be applied even if reboot_type has been set on the
+ * command line because that's the only way to enable PCI mode.
+ */
+
+ if (reboot_type == BOOT_CF9_FORCE) {
+ reboot_quirks |= REBOOT_QUIRK_POWER_CYCLE;
+ pr_info("%s series board detected. Assume that a PCI reboot includes a power cycle.\n",
+ d->ident);
+ }
+ return 0;
+}
+
/*
* This is a single dmi_table handling all reboot quirks.
*/
@@ -247,6 +276,14 @@ static const struct dmi_system_id reboot_dmi_table[] __initconst = {
DMI_MATCH(DMI_BOARD_NAME, "Q1900DC-ITX"),
},
},
+ { /* PCI reboots cause a power cycle */
+ .callback = set_pci_power_cycle_reboot,
+ .ident = "ASRock Z170 Extreme4",
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "ASRock"),
+ DMI_MATCH(DMI_BOARD_NAME, "Z170 Extreme4"),
+ },
+ },
/* ASUS */
{ /* Handle problems with rebooting on ASUS P4S800 */
@@ -494,13 +531,6 @@ static int __init reboot_init(void)
{
int rv;
- /*
- * Only do the DMI check if reboot_type hasn't been overridden
- * on the command line
- */
- if (!reboot_default)
- return 0;
-
/*
* The DMI quirks table takes precedence. If no quirks entry
* matches and the ACPI Hardware Reduced bit is set and EFI
@@ -508,6 +538,13 @@ static int __init reboot_init(void)
*/
rv = dmi_check_system(reboot_dmi_table);
+ /*
+ * Only force EFI reboot if reboot_type hasn't been overridden
+ * on the command line.
+ */
+ if (!reboot_default)
+ return 0;
+
if (!rv && efi_reboot_required() && !efi_runtime_disabled())
reboot_type = BOOT_EFI;
If a PCI mode reboot is performed on the ASRock Z170 Extreme4, a power cycle will occur. Automatically set the reboot quirk for this to prepare for the power off (i.e. stop all disks). This will only take effect if PCI mode is manually used. It'll be too late in the reboot process to prepare for power off if the other reboot methods fail. It is necessary to re-order the processing of DMI checks because this quirk must apply even if a reboot= command line parameter is used as that's the only way to specify a PCI mode reboot. Signed-off-by: Simon Arlott <simon@octiron.net> --- Previous patches to make scsi/sd stop before a reboot: https://lore.kernel.org/lkml/499138c8-b6d5-ef4a-2780-4f750ed337d3@0882a8b5-c6c3-11e9-b005-00805fc181fe/ https://lore.kernel.org/lkml/e726ffd8-8897-4a79-c3d6-6271eda8aebb@0882a8b5-c6c3-11e9-b005-00805fc181fe/ arch/x86/kernel/reboot.c | 51 ++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-)