lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a7c26ca1-0201-7526-8b69-484868725ee3@0882a8b5-c6c3-11e9-b005-00805fc181fe>
Date:   Mon, 29 Jun 2020 21:58:05 +0100
From:   Simon Arlott <simon@...iron.net>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org
Cc:     "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        linux-scsi@...r.kernel.org, Bart Van Assche <bvanassche@....org>,
        Christoph Hellwig <hch@...radead.org>,
        Damien Le Moal <Damien.LeMoal@....com>,
        Pavel Machek <pavel@....cz>,
        Henrique de Moraes Holschuh <hmh@....eng.br>
Subject: [PATCH 2/2] x86/reboot/quirks: Add ASRock Z170 Extreme4

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@...iron.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(-)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 0ec7ced727fe..a82d5db1c8ca 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -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;
 
-- 
2.17.1

-- 
Simon Arlott

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ