Skip to contentSkip to conversation

ACPI / bus: Only call dmi_check_system on X86

PATCH Superseded Jean Delvare 1 participant 1 message Aug 29, 2018 ACPI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI / bus: Only call dmi_check_system on X86

Calling dmi_check_system() early only works on X86. Other architectures initialize the DMI subsystem later so it's not ready yet when ACPI itself gets initialized.

In the best case it results in a useless call to a function which will do nothing. But depending on the dmi implementation, it could also result in warnings. Best is to not call the function when it can't work and isn't needed.

Additionally, if anyone ever needs to add non-x86 quirks, it would surprisingly not work, so document the limitation to avoid confusion.

Fixes cce4f632db20 ("ACPI: fix early DSDT dmi check warnings on ia64")
Cc Takashi Iwai <[email protected]>
Cc "Zheng, Lv" <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]> (supporter:ACPI)
Cc Len Brown <[email protected]> (supporter:ACPI)
---
 drivers/acpi/bus.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/acpi/bus.c +9 -6
@@ -35,11 +35,11 @@
 #include <linux/delay.h>
 #ifdef CONFIG_X86
 #include <asm/mpspec.h>
+#include <linux/dmi.h>
 #endif
 #include <linux/acpi_iort.h>
 #include <linux/pci.h>
 #include <acpi/apei.h>
-#include <linux/dmi.h>
 #include <linux/suspend.h>
 
 #include "internal.h"
@@ -109,10 +109,6 @@ static const struct dmi_system_id acpi_q
 	},
 	{}
 };
-#else
-static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = {
-	{}
-};
 #endif
 
 /* --------------------------------------------------------------------------
@@ -1060,8 +1056,15 @@ void __init acpi_early_init(void)
 
 	acpi_permanent_mmap = true;
 
-	/* Check machine-specific quirks */
+#ifdef CONFIG_X86
+	/*
+	 * Check machine-specific quirks
+	 * Note that calling dmi_check_system here on other architectures
+	 * would not be OK because only x86 intializes dmi early enough.
+	 * Thankfully only x86 systems need such quirks for now.
+	 */
 	dmi_check_system(acpi_quirks_dmi_table);
+#endif
 
 	status = acpi_reallocate_root_table();
 	if (ACPI_FAILURE(status)) {
Signature · 2 lines
Jean Delvare
SUSE L3 Support