Skip to contentSkip to conversation

ACPI / x86: boot: Not all platforms require acpi_reduced_hw_init()

PATCH Superseded Andy Shevchenko 4 participants 8 messages Jan 17, 2018 – Feb 4, 2018

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ACPI / x86: boot: Not all platforms require acpi_reduced_hw_init()

Some platforms might take care of legacy devices on theirs own. Let's allow them to do that by exporting a weak function.

---
 arch/x86/kernel/acpi/boot.c | 2 +-
 include/linux/acpi.h        | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
arch/x86/kernel/acpi/boot.c +1 -1
index ec3a286163c3..9a714b79ebed 100644
@@ -1375,7 +1375,7 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
  *
  * We initialize the Hardware-reduced ACPI model here:
  */
-static void __init acpi_reduced_hw_init(void)
+void __init __weak acpi_reduced_hw_init(void)
 {
 	if (acpi_gbl_reduced_hardware) {
 		/*
include/linux/acpi.h +3 -0
index f0ea50ba0550..eb881516bce6 100644
@@ -226,6 +226,8 @@ struct acpi_subtable_proc {
 
 void __iomem *__acpi_map_table(unsigned long phys, unsigned long size);
 void __acpi_unmap_table(void __iomem *map, unsigned long size);
+
+void acpi_reduced_hw_init(void);
 int early_acpi_boot_init(void);
 int acpi_boot_init (void);
 void acpi_boot_table_init (void);
@@ -707,6 +709,7 @@ static inline struct device *acpi_get_first_physical_node(struct acpi_device *ad
 static inline void acpi_early_init(void) { }
 static inline void acpi_subsystem_init(void) { }
 
+static inline void acpi_reduced_hw_init(void) { }
 static inline int early_acpi_boot_init(void)
 {
 	return 0;
Signature · 1 line
2.15.1
#1 lore raw

PATCH 2/3 x86/platform/intel-mid: Move PCI initialization to arch_init()

ACPI redefines x86_init.pci.init when enabled. Though we still need special treatment for MID platforms.

Move our specific callback to x86_init.pci.arch_init() and, by calling acpi_noirq_set(), take back a control over IRQ assignment.

---
 arch/x86/pci/intel_mid_pci.c            | 1 +
 arch/x86/platform/intel-mid/intel-mid.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/x86/pci/intel_mid_pci.c +1 -0
index 511921045312..43867bc85368 100644
@@ -300,6 +300,7 @@ int __init intel_mid_pci_init(void)
 	pci_root_ops = intel_mid_pci_ops;
 	pci_soc_mode = 1;
 	/* Continue with standard init */
+	acpi_noirq_set();
 	return 1;
 }
 
arch/x86/platform/intel-mid/intel-mid.c +1 -1
index 86676cec99a1..2c67bae6bb53 100644
@@ -194,7 +194,7 @@ void __init x86_intel_mid_early_setup(void)
 	x86_platform.calibrate_tsc = intel_mid_calibrate_tsc;
 	x86_platform.get_nmi_reason = intel_mid_get_nmi_reason;
 
-	x86_init.pci.init = intel_mid_pci_init;
+	x86_init.pci.arch_init = intel_mid_pci_init;
 	x86_init.pci.fixup_irqs = x86_init_noop;
 
 	legacy_pic = &null_legacy_pic;
Signature · 1 line
2.15.1
#2 lore raw

[tip:x86/platform] x86/platform/intel-mid: Move PCI initialization to arch_init()

x86/platform/intel-mid: Move PCI initialization to arch_init()
Commit-ID:  a912a7584ec39647fb032c1001eb69746f27b1d3
Gitweb:     https://git.kernel.org/tip/a912a7584ec39647fb032c1001eb69746f27b1d3
Author:     Andy Shevchenko <[email protected]>
AuthorDate: Wed, 17 Jan 2018 19:34:08 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 19 Jan 2018 09:15:42 +0100

x86/platform/intel-mid: Move PCI initialization to arch_init()

ACPI redefines x86_init.pci.init when enabled. Though we still need special treatment for MID platforms.

Move our specific callback to x86_init.pci.arch_init() and, by calling acpi_noirq_set(), take back a control over IRQ assignment.

---
 arch/x86/pci/intel_mid_pci.c            | 1 +
 arch/x86/platform/intel-mid/intel-mid.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/x86/pci/intel_mid_pci.c +1 -0
index 5119210..43867bc 100644
@@ -300,6 +300,7 @@ int __init intel_mid_pci_init(void)
 	pci_root_ops = intel_mid_pci_ops;
 	pci_soc_mode = 1;
 	/* Continue with standard init */
+	acpi_noirq_set();
 	return 1;
 }
 
arch/x86/platform/intel-mid/intel-mid.c +1 -1
index 86676ce..2c67bae 100644
@@ -194,7 +194,7 @@ void __init x86_intel_mid_early_setup(void)
 	x86_platform.calibrate_tsc = intel_mid_calibrate_tsc;
 	x86_platform.get_nmi_reason = intel_mid_get_nmi_reason;
 
-	x86_init.pci.init = intel_mid_pci_init;
+	x86_init.pci.arch_init = intel_mid_pci_init;
 	x86_init.pci.fixup_irqs = x86_init_noop;
 
 	legacy_pic = &null_legacy_pic;
#3 lore raw

PATCH 3/3 x86/platform/intel-mid: Add special handling of ACPI HW reduced platforms

In reply to Andy Shevchenko

When switching to ACPI HW reduced platforms we still want to initialize timers. Override acpi_reduced_hw_init() to achieve that.

---
 arch/x86/platform/intel-mid/intel-mid.c | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/x86/platform/intel-mid/intel-mid.c +9 -0
index 2c67bae6bb53..51bf2f6c9e97 100644
@@ -13,6 +13,7 @@
 
 #define pr_fmt(fmt) "intel_mid: " fmt
 
+#include <linux/acpi.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
@@ -172,6 +173,14 @@ static unsigned char intel_mid_get_nmi_reason(void)
 	return 0;
 }
 
+void __init acpi_reduced_hw_init(void)
+{
+	/*
+	 * Do nothing for now as everything needed done in
+	 * x86_intel_mid_early_setup() below.
+	 */
+}
+
 /*
  * Moorestown specific x86_init function overrides and early setup
  * calls.
Signature · 1 line
2.15.1
#4 lore raw

Re: [PATCH v1 3/3] x86/platform/intel-mid: Add special handling of ACPI HW reduced platforms

Quoted 3 lines · Andy Shevchenko

When switching to ACPI HW reduced platforms we still want to initialize timers.
Override acpi_reduced_hw_init() to achieve that.

Just realized, that it may annihilate the other acpi_reduced_hw_init() on non-MID platforms...

Open to suggestions how would be better to deal with this (I really don't like the idea to spread MID quirks all over the code).

P.S. Patch 2 from the series still makes sense per se.

Quoted 35 lines
---
 arch/x86/platform/intel-mid/intel-mid.c | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/x86/platform/intel-mid/intel-mid.c +9 -0
index 2c67bae6bb53..51bf2f6c9e97 100644
@@ -13,6 +13,7 @@
 
 #define pr_fmt(fmt) "intel_mid: " fmt
 
+#include <linux/acpi.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
@@ -172,6 +173,14 @@ static unsigned char
 intel_mid_get_nmi_reason(void)
 	return 0;
 }
 
+void __init acpi_reduced_hw_init(void)
+{
+	/*
+	 * Do nothing for now as everything needed done in
+	 * x86_intel_mid_early_setup() below.
+	 */
+}
+
 /*
  * Moorestown specific x86_init function overrides and early setup

* calls.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#5 lore raw

Re: [PATCH v1 3/3] x86/platform/intel-mid: Add special handling of ACPI HW reduced platforms

Quoted 5 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko

When switching to ACPI HW reduced platforms we still want to initialize timers.
Override acpi_reduced_hw_init() to achieve that.

Quoted 7 lines

Just realized, that it may annihilate the other acpi_reduced_hw_init() on non-MID platforms...

Open to suggestions how would be better to deal with this (I really don't like the idea to spread MID quirks all over the code).

P.S. Patch 2 from the series still makes sense per se.

Ok, I'll apply patch #2 to tip:x86/platform.

Thanks,

Ingo

#6 lore raw
In reply to Andy Shevchenko
Quoted 36 lines · CET Andy Shevchenko

Some platforms might take care of legacy devices on theirs own. Let's allow them to do that by exporting a weak function.

---
 arch/x86/kernel/acpi/boot.c | 2 +-
 include/linux/acpi.h        | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
arch/x86/kernel/acpi/boot.c +1 -1
index ec3a286163c3..9a714b79ebed 100644
@@ -1375,7 +1375,7 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
  *
  * We initialize the Hardware-reduced ACPI model here:
  */
-static void __init acpi_reduced_hw_init(void)
+void __init __weak acpi_reduced_hw_init(void)
 {
 	if (acpi_gbl_reduced_hardware) {
 		/*
include/linux/acpi.h +2 -0
index f0ea50ba0550..eb881516bce6 100644
@@ -226,6 +226,8 @@ struct acpi_subtable_proc {
 
 void __iomem *__acpi_map_table(unsigned long phys, unsigned long size);
 void __acpi_unmap_table(void __iomem *map, unsigned long size);
+
+void acpi_reduced_hw_init(void);
 int early_acpi_boot_init(void);
 int acpi_boot_init (void);
 void acpi_boot_table_init (void);

include/linux/acpi.h static inline struct device *acpi_get_first_physical_node(struct acpi_device *ad · line 715

Quoted 7 lines
include/linux/acpi.h +1 -0
@@ -707,6 +709,7 @@ static inline struct device *acpi_get_first_physical_node(struct acpi_device *ad
 static inline void acpi_early_init(void) { }
 static inline void acpi_subsystem_init(void) { }
 
+static inline void acpi_reduced_hw_init(void) { }
 static inline int early_acpi_boot_init(void)
 {
 	return 0;

May I suggest folding this into the [3/3]?

It would be clear why you need the __weak thing then.

OTOH, I guess you'll go for the new init callbacks rather.

#7 lore raw
Quoted 1 line · Rafael J. Wysocki

OTOH, I guess you'll go for the new init callbacks rather.

Yep, just ignore these two for now. I will remake it later.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy