All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-01-18 15:09 ` Prarit Bhargava
  0 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-01-18 15:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Prarit Bhargava, Jonathan Corbet, x86, graeme.gregory, linux-pm,
	Catalin Marinas, Bhupesh Sharma, linux-doc, Will Deacon,
	mark.salter, linux-acpi, Ingo Molnar, Lv Zheng, linux-serial,
	H. Peter Anvin, Thomas Gleixner, Timur Tabi, linux-arm-kernel

Note on testing:  I've tested this on several ARM64 and x86 boxes (only
earlycon, console=ttyS0,115200, and with both options), verified that
functionality on ARM64 has not changed (ie, CONFIG_ACPI_SPCR_TABLE is
always =y), and verified functionality when !CONFIG_ACPI_SPCR_TABLE on
x86.

P.

----8<----

SPCR is currently only enabled or ARM64 and x86 can use SPCR to setup an
early console.

General fixes include updating Documentation & Kconfig (for x86), updating
comments, and changing parse_spcr() to acpi_parse_spcr(), and
earlycon_init_is_deferred to earlycon_acpi_spcr_enable to be more
descriptive.

On x86, many systems have a valid SPCR table but the table version is not
2 so the table version check must be a warning.

On ARM64 when the kernel parameter earlycon is used both the early console
and console are enabled.  On x86, only the earlycon should be enabled by
by default.  Modify acpi_parse_spcr() to allow options for initializing
the early console and console separately.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: linux-acpi@vger.kernel.org
Cc: linux-doc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-pm@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Cc: Bhupesh Sharma <bhsharma@redhat.com>
Cc: Lv Zheng <lv.zheng@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: "Rafael J. Wysocki" Mrjw@rjwysocki.net>
Cc: Timur Tabi <timur@codeaurora.org>
Cc: graeme.gregory@linaro.org
Cc: mark.salter@redhat.com
---
 Documentation/admin-guide/kernel-parameters.txt |  9 +++++---
 arch/arm64/kernel/acpi.c                        |  4 ++--
 arch/x86/kernel/acpi/boot.c                     |  3 +++
 drivers/acpi/Kconfig                            |  7 +++++-
 drivers/acpi/spcr.c                             | 29 +++++++++++++------------
 drivers/tty/serial/earlycon.c                   | 15 +++++--------
 include/linux/acpi.h                            |  7 ++++--
 include/linux/serial_core.h                     |  4 ++--
 8 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 46b26bfee27b..6f519230ed34 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -915,9 +915,12 @@
 
 	earlycon=	[KNL] Output early console device and options.
 
-			When used with no options, the early console is
-			determined by the stdout-path property in device
-			tree's chosen node.
+			[ARM64] The early console is determined by the
+			stdout-path property in device tree's chosen node,
+			or determined by the ACPI SPCR table.
+
+			[X86] When used with no options the early console is
+			determined by the ACPI SPCR table.
 
 		cdns,<addr>[,options]
 			Start an early, polled-mode console on a Cadence
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index b3162715ed78..2aa5609def27 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -230,10 +230,10 @@ void __init acpi_boot_table_init(void)
 
 done:
 	if (acpi_disabled) {
-		if (earlycon_init_is_deferred)
+		if (earlycon_acpi_spcr_enable)
 			early_init_dt_scan_chosen_stdout();
 	} else {
-		parse_spcr(earlycon_init_is_deferred);
+		acpi_parse_spcr(earlycon_acpi_spcr_enable, true);
 		if (IS_ENABLED(CONFIG_ACPI_BGRT))
 			acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
 	}
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index f4c463df8b08..0bf6a58f7a6d 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -36,6 +36,7 @@
 #include <linux/ioport.h>
 #include <linux/pci.h>
 #include <linux/efi-bgrt.h>
+#include <linux/serial_core.h>
 
 #include <asm/e820/api.h>
 #include <asm/irqdomain.h>
@@ -1626,6 +1627,8 @@ int __init acpi_boot_init(void)
 	if (!acpi_noirq)
 		x86_init.pci.init = pci_acpi_init;
 
+	/* Do not enable ACPI SPCR console by default */
+	acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
 	return 0;
 }
 
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 46505396869e..ddcb5f40e8ee 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -79,7 +79,12 @@ config ACPI_DEBUGGER_USER
 endif
 
 config ACPI_SPCR_TABLE
-	bool
+	bool "ACPI Serial Port Console Redirection Support"
+	default y if X86
+	help
+	  Enable support for Serial Port Console Redirection (SPCR) Table.
+	  This table provides information about the configuration of the
+	  earlycon console.
 
 config ACPI_LPIT
 	bool
diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index 324b35bfe781..89e97d21a89c 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -21,7 +21,7 @@
  * occasionally getting stuck as 1. To avoid the potential for a hang, check
  * TXFE == 0 instead of BUSY == 1. This may not be suitable for all UART
  * implementations, so only do so if an affected platform is detected in
- * parse_spcr().
+ * acpi_parse_spcr().
  */
 bool qdf2400_e44_present;
 EXPORT_SYMBOL(qdf2400_e44_present);
@@ -74,19 +74,21 @@ static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
 }
 
 /**
- * parse_spcr() - parse ACPI SPCR table and add preferred console
+ * acpi_parse_spcr() - parse ACPI SPCR table and add preferred console
  *
- * @earlycon: set up earlycon for the console specified by the table
+ * @enable_earlycon: set up earlycon for the console specified by the table
+ * @enable_console: setup the console specified by the table.
  *
  * For the architectures with support for ACPI, CONFIG_ACPI_SPCR_TABLE may be
  * defined to parse ACPI SPCR table.  As a result of the parsing preferred
- * console is registered and if @earlycon is true, earlycon is set up.
+ * console is registered and if @enable_earlycon is true, earlycon is set up.
+ * If @enable_console is true the system console is also configured.
  *
  * When CONFIG_ACPI_SPCR_TABLE is defined, this function should be called
  * from arch initialization code as soon as the DT/ACPI decision is made.
  *
  */
-int __init parse_spcr(bool earlycon)
+int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
 {
 	static char opts[64];
 	struct acpi_table_spcr *table;
@@ -105,11 +107,8 @@ int __init parse_spcr(bool earlycon)
 	if (ACPI_FAILURE(status))
 		return -ENOENT;
 
-	if (table->header.revision < 2) {
-		err = -ENOENT;
-		pr_err("wrong table version\n");
-		goto done;
-	}
+	if (table->header.revision < 2)
+		pr_info("SPCR table version %d\n", table->header.revision);
 
 	if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
 		switch (ACPI_ACCESS_BIT_WIDTH((
@@ -185,7 +184,7 @@ int __init parse_spcr(bool earlycon)
 	 */
 	if (qdf2400_erratum_44_present(&table->header)) {
 		qdf2400_e44_present = true;
-		if (earlycon)
+		if (enable_earlycon)
 			uart = "qdf2400_e44";
 	}
 
@@ -205,11 +204,13 @@ int __init parse_spcr(bool earlycon)
 
 	pr_info("console: %s\n", opts);
 
-	if (earlycon)
+	if (enable_earlycon)
 		setup_earlycon(opts);
 
-	err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
-
+	if (enable_console)
+		err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
+	else
+		err = 0;
 done:
 	acpi_put_table((struct acpi_table_header *)table);
 	return err;
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 4c8b80f1c688..870e84fb6e39 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -197,25 +197,20 @@ int __init setup_earlycon(char *buf)
 }
 
 /*
- * When CONFIG_ACPI_SPCR_TABLE is defined, "earlycon" without parameters in
- * command line does not start DT earlycon immediately, instead it defers
- * starting it until DT/ACPI decision is made.  At that time if ACPI is enabled
- * call parse_spcr(), else call early_init_dt_scan_chosen_stdout()
+ * This defers the initialization of the early console until after ACPI has
+ * been initialized.
  */
-bool earlycon_init_is_deferred __initdata;
+bool earlycon_acpi_spcr_enable __initdata;
 
 /* early_param wrapper for setup_earlycon() */
 static int __init param_setup_earlycon(char *buf)
 {
 	int err;
 
-	/*
-	 * Just 'earlycon' is a valid param for devicetree earlycons;
-	 * don't generate a warning from parse_early_params() in that case
-	 */
+	/* Just 'earlycon' is a valid param for devicetree and ACPI SPCR. */
 	if (!buf || !buf[0]) {
 		if (IS_ENABLED(CONFIG_ACPI_SPCR_TABLE)) {
-			earlycon_init_is_deferred = true;
+			earlycon_acpi_spcr_enable = true;
 			return 0;
 		} else if (!buf) {
 			return early_init_dt_scan_chosen_stdout();
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index dc1ebfeeb5ec..9aac8f0ebe23 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1242,9 +1242,12 @@ static inline void acpi_table_upgrade(void) { }
 
 #ifdef CONFIG_ACPI_SPCR_TABLE
 extern bool qdf2400_e44_present;
-int parse_spcr(bool earlycon);
+int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
 #else
-static inline int parse_spcr(bool earlycon) { return 0; }
+static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
+{
+	return 0;
+}
 #endif
 
 #if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 37b044e78333..aefd0e5115da 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -376,10 +376,10 @@ extern int of_setup_earlycon(const struct earlycon_id *match,
 			     const char *options);
 
 #ifdef CONFIG_SERIAL_EARLYCON
-extern bool earlycon_init_is_deferred __initdata;
+extern bool earlycon_acpi_spcr_enable __initdata;
 int setup_earlycon(char *buf);
 #else
-static const bool earlycon_init_is_deferred;
+static const bool earlycon_acpi_spcr_enable;
 static inline int setup_earlycon(char *buf) { return 0; }
 #endif
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-01-18 15:09 ` Prarit Bhargava
  0 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-01-18 15:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Prarit Bhargava, linux-acpi, linux-doc, linux-arm-kernel,
	linux-pm, linux-serial, Bhupesh Sharma, Lv Zheng,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Jonathan Corbet, Catalin Marinas, Will Deacon, Timur Tabi,
	graeme.gregory, mark.salter

Note on testing:  I've tested this on several ARM64 and x86 boxes (only
earlycon, console=ttyS0,115200, and with both options), verified that
functionality on ARM64 has not changed (ie, CONFIG_ACPI_SPCR_TABLE is
always =y), and verified functionality when !CONFIG_ACPI_SPCR_TABLE on
x86.

P.

----8<----

SPCR is currently only enabled or ARM64 and x86 can use SPCR to setup an
early console.

General fixes include updating Documentation & Kconfig (for x86), updating
comments, and changing parse_spcr() to acpi_parse_spcr(), and
earlycon_init_is_deferred to earlycon_acpi_spcr_enable to be more
descriptive.

On x86, many systems have a valid SPCR table but the table version is not
2 so the table version check must be a warning.

On ARM64 when the kernel parameter earlycon is used both the early console
and console are enabled.  On x86, only the earlycon should be enabled by
by default.  Modify acpi_parse_spcr() to allow options for initializing
the early console and console separately.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: linux-acpi@vger.kernel.org
Cc: linux-doc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-pm@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Cc: Bhupesh Sharma <bhsharma@redhat.com>
Cc: Lv Zheng <lv.zheng@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: "Rafael J. Wysocki" Mrjw@rjwysocki.net>
Cc: Timur Tabi <timur@codeaurora.org>
Cc: graeme.gregory@linaro.org
Cc: mark.salter@redhat.com
---
 Documentation/admin-guide/kernel-parameters.txt |  9 +++++---
 arch/arm64/kernel/acpi.c                        |  4 ++--
 arch/x86/kernel/acpi/boot.c                     |  3 +++
 drivers/acpi/Kconfig                            |  7 +++++-
 drivers/acpi/spcr.c                             | 29 +++++++++++++------------
 drivers/tty/serial/earlycon.c                   | 15 +++++--------
 include/linux/acpi.h                            |  7 ++++--
 include/linux/serial_core.h                     |  4 ++--
 8 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 46b26bfee27b..6f519230ed34 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -915,9 +915,12 @@
 
 	earlycon=	[KNL] Output early console device and options.
 
-			When used with no options, the early console is
-			determined by the stdout-path property in device
-			tree's chosen node.
+			[ARM64] The early console is determined by the
+			stdout-path property in device tree's chosen node,
+			or determined by the ACPI SPCR table.
+
+			[X86] When used with no options the early console is
+			determined by the ACPI SPCR table.
 
 		cdns,<addr>[,options]
 			Start an early, polled-mode console on a Cadence
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index b3162715ed78..2aa5609def27 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -230,10 +230,10 @@ void __init acpi_boot_table_init(void)
 
 done:
 	if (acpi_disabled) {
-		if (earlycon_init_is_deferred)
+		if (earlycon_acpi_spcr_enable)
 			early_init_dt_scan_chosen_stdout();
 	} else {
-		parse_spcr(earlycon_init_is_deferred);
+		acpi_parse_spcr(earlycon_acpi_spcr_enable, true);
 		if (IS_ENABLED(CONFIG_ACPI_BGRT))
 			acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
 	}
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index f4c463df8b08..0bf6a58f7a6d 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -36,6 +36,7 @@
 #include <linux/ioport.h>
 #include <linux/pci.h>
 #include <linux/efi-bgrt.h>
+#include <linux/serial_core.h>
 
 #include <asm/e820/api.h>
 #include <asm/irqdomain.h>
@@ -1626,6 +1627,8 @@ int __init acpi_boot_init(void)
 	if (!acpi_noirq)
 		x86_init.pci.init = pci_acpi_init;
 
+	/* Do not enable ACPI SPCR console by default */
+	acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
 	return 0;
 }
 
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 46505396869e..ddcb5f40e8ee 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -79,7 +79,12 @@ config ACPI_DEBUGGER_USER
 endif
 
 config ACPI_SPCR_TABLE
-	bool
+	bool "ACPI Serial Port Console Redirection Support"
+	default y if X86
+	help
+	  Enable support for Serial Port Console Redirection (SPCR) Table.
+	  This table provides information about the configuration of the
+	  earlycon console.
 
 config ACPI_LPIT
 	bool
diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index 324b35bfe781..89e97d21a89c 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -21,7 +21,7 @@
  * occasionally getting stuck as 1. To avoid the potential for a hang, check
  * TXFE == 0 instead of BUSY == 1. This may not be suitable for all UART
  * implementations, so only do so if an affected platform is detected in
- * parse_spcr().
+ * acpi_parse_spcr().
  */
 bool qdf2400_e44_present;
 EXPORT_SYMBOL(qdf2400_e44_present);
@@ -74,19 +74,21 @@ static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
 }
 
 /**
- * parse_spcr() - parse ACPI SPCR table and add preferred console
+ * acpi_parse_spcr() - parse ACPI SPCR table and add preferred console
  *
- * @earlycon: set up earlycon for the console specified by the table
+ * @enable_earlycon: set up earlycon for the console specified by the table
+ * @enable_console: setup the console specified by the table.
  *
  * For the architectures with support for ACPI, CONFIG_ACPI_SPCR_TABLE may be
  * defined to parse ACPI SPCR table.  As a result of the parsing preferred
- * console is registered and if @earlycon is true, earlycon is set up.
+ * console is registered and if @enable_earlycon is true, earlycon is set up.
+ * If @enable_console is true the system console is also configured.
  *
  * When CONFIG_ACPI_SPCR_TABLE is defined, this function should be called
  * from arch initialization code as soon as the DT/ACPI decision is made.
  *
  */
-int __init parse_spcr(bool earlycon)
+int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
 {
 	static char opts[64];
 	struct acpi_table_spcr *table;
@@ -105,11 +107,8 @@ int __init parse_spcr(bool earlycon)
 	if (ACPI_FAILURE(status))
 		return -ENOENT;
 
-	if (table->header.revision < 2) {
-		err = -ENOENT;
-		pr_err("wrong table version\n");
-		goto done;
-	}
+	if (table->header.revision < 2)
+		pr_info("SPCR table version %d\n", table->header.revision);
 
 	if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
 		switch (ACPI_ACCESS_BIT_WIDTH((
@@ -185,7 +184,7 @@ int __init parse_spcr(bool earlycon)
 	 */
 	if (qdf2400_erratum_44_present(&table->header)) {
 		qdf2400_e44_present = true;
-		if (earlycon)
+		if (enable_earlycon)
 			uart = "qdf2400_e44";
 	}
 
@@ -205,11 +204,13 @@ int __init parse_spcr(bool earlycon)
 
 	pr_info("console: %s\n", opts);
 
-	if (earlycon)
+	if (enable_earlycon)
 		setup_earlycon(opts);
 
-	err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
-
+	if (enable_console)
+		err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
+	else
+		err = 0;
 done:
 	acpi_put_table((struct acpi_table_header *)table);
 	return err;
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 4c8b80f1c688..870e84fb6e39 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -197,25 +197,20 @@ int __init setup_earlycon(char *buf)
 }
 
 /*
- * When CONFIG_ACPI_SPCR_TABLE is defined, "earlycon" without parameters in
- * command line does not start DT earlycon immediately, instead it defers
- * starting it until DT/ACPI decision is made.  At that time if ACPI is enabled
- * call parse_spcr(), else call early_init_dt_scan_chosen_stdout()
+ * This defers the initialization of the early console until after ACPI has
+ * been initialized.
  */
-bool earlycon_init_is_deferred __initdata;
+bool earlycon_acpi_spcr_enable __initdata;
 
 /* early_param wrapper for setup_earlycon() */
 static int __init param_setup_earlycon(char *buf)
 {
 	int err;
 
-	/*
-	 * Just 'earlycon' is a valid param for devicetree earlycons;
-	 * don't generate a warning from parse_early_params() in that case
-	 */
+	/* Just 'earlycon' is a valid param for devicetree and ACPI SPCR. */
 	if (!buf || !buf[0]) {
 		if (IS_ENABLED(CONFIG_ACPI_SPCR_TABLE)) {
-			earlycon_init_is_deferred = true;
+			earlycon_acpi_spcr_enable = true;
 			return 0;
 		} else if (!buf) {
 			return early_init_dt_scan_chosen_stdout();
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index dc1ebfeeb5ec..9aac8f0ebe23 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1242,9 +1242,12 @@ static inline void acpi_table_upgrade(void) { }
 
 #ifdef CONFIG_ACPI_SPCR_TABLE
 extern bool qdf2400_e44_present;
-int parse_spcr(bool earlycon);
+int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
 #else
-static inline int parse_spcr(bool earlycon) { return 0; }
+static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
+{
+	return 0;
+}
 #endif
 
 #if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 37b044e78333..aefd0e5115da 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -376,10 +376,10 @@ extern int of_setup_earlycon(const struct earlycon_id *match,
 			     const char *options);
 
 #ifdef CONFIG_SERIAL_EARLYCON
-extern bool earlycon_init_is_deferred __initdata;
+extern bool earlycon_acpi_spcr_enable __initdata;
 int setup_earlycon(char *buf);
 #else
-static const bool earlycon_init_is_deferred;
+static const bool earlycon_acpi_spcr_enable;
 static inline int setup_earlycon(char *buf) { return 0; }
 #endif
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-01-18 15:09 ` Prarit Bhargava
  0 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-01-18 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

Note on testing:  I've tested this on several ARM64 and x86 boxes (only
earlycon, console=ttyS0,115200, and with both options), verified that
functionality on ARM64 has not changed (ie, CONFIG_ACPI_SPCR_TABLE is
always =y), and verified functionality when !CONFIG_ACPI_SPCR_TABLE on
x86.

P.

----8<----

SPCR is currently only enabled or ARM64 and x86 can use SPCR to setup an
early console.

General fixes include updating Documentation & Kconfig (for x86), updating
comments, and changing parse_spcr() to acpi_parse_spcr(), and
earlycon_init_is_deferred to earlycon_acpi_spcr_enable to be more
descriptive.

On x86, many systems have a valid SPCR table but the table version is not
2 so the table version check must be a warning.

On ARM64 when the kernel parameter earlycon is used both the early console
and console are enabled.  On x86, only the earlycon should be enabled by
by default.  Modify acpi_parse_spcr() to allow options for initializing
the early console and console separately.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: linux-acpi at vger.kernel.org
Cc: linux-doc at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-pm at vger.kernel.org
Cc: linux-serial at vger.kernel.org
Cc: Bhupesh Sharma <bhsharma@redhat.com>
Cc: Lv Zheng <lv.zheng@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86 at kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: "Rafael J. Wysocki" Mrjw at rjwysocki.net>
Cc: Timur Tabi <timur@codeaurora.org>
Cc: graeme.gregory at linaro.org
Cc: mark.salter at redhat.com
---
 Documentation/admin-guide/kernel-parameters.txt |  9 +++++---
 arch/arm64/kernel/acpi.c                        |  4 ++--
 arch/x86/kernel/acpi/boot.c                     |  3 +++
 drivers/acpi/Kconfig                            |  7 +++++-
 drivers/acpi/spcr.c                             | 29 +++++++++++++------------
 drivers/tty/serial/earlycon.c                   | 15 +++++--------
 include/linux/acpi.h                            |  7 ++++--
 include/linux/serial_core.h                     |  4 ++--
 8 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 46b26bfee27b..6f519230ed34 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -915,9 +915,12 @@
 
 	earlycon=	[KNL] Output early console device and options.
 
-			When used with no options, the early console is
-			determined by the stdout-path property in device
-			tree's chosen node.
+			[ARM64] The early console is determined by the
+			stdout-path property in device tree's chosen node,
+			or determined by the ACPI SPCR table.
+
+			[X86] When used with no options the early console is
+			determined by the ACPI SPCR table.
 
 		cdns,<addr>[,options]
 			Start an early, polled-mode console on a Cadence
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index b3162715ed78..2aa5609def27 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -230,10 +230,10 @@ void __init acpi_boot_table_init(void)
 
 done:
 	if (acpi_disabled) {
-		if (earlycon_init_is_deferred)
+		if (earlycon_acpi_spcr_enable)
 			early_init_dt_scan_chosen_stdout();
 	} else {
-		parse_spcr(earlycon_init_is_deferred);
+		acpi_parse_spcr(earlycon_acpi_spcr_enable, true);
 		if (IS_ENABLED(CONFIG_ACPI_BGRT))
 			acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
 	}
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index f4c463df8b08..0bf6a58f7a6d 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -36,6 +36,7 @@
 #include <linux/ioport.h>
 #include <linux/pci.h>
 #include <linux/efi-bgrt.h>
+#include <linux/serial_core.h>
 
 #include <asm/e820/api.h>
 #include <asm/irqdomain.h>
@@ -1626,6 +1627,8 @@ int __init acpi_boot_init(void)
 	if (!acpi_noirq)
 		x86_init.pci.init = pci_acpi_init;
 
+	/* Do not enable ACPI SPCR console by default */
+	acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
 	return 0;
 }
 
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 46505396869e..ddcb5f40e8ee 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -79,7 +79,12 @@ config ACPI_DEBUGGER_USER
 endif
 
 config ACPI_SPCR_TABLE
-	bool
+	bool "ACPI Serial Port Console Redirection Support"
+	default y if X86
+	help
+	  Enable support for Serial Port Console Redirection (SPCR) Table.
+	  This table provides information about the configuration of the
+	  earlycon console.
 
 config ACPI_LPIT
 	bool
diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
index 324b35bfe781..89e97d21a89c 100644
--- a/drivers/acpi/spcr.c
+++ b/drivers/acpi/spcr.c
@@ -21,7 +21,7 @@
  * occasionally getting stuck as 1. To avoid the potential for a hang, check
  * TXFE == 0 instead of BUSY == 1. This may not be suitable for all UART
  * implementations, so only do so if an affected platform is detected in
- * parse_spcr().
+ * acpi_parse_spcr().
  */
 bool qdf2400_e44_present;
 EXPORT_SYMBOL(qdf2400_e44_present);
@@ -74,19 +74,21 @@ static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
 }
 
 /**
- * parse_spcr() - parse ACPI SPCR table and add preferred console
+ * acpi_parse_spcr() - parse ACPI SPCR table and add preferred console
  *
- * @earlycon: set up earlycon for the console specified by the table
+ * @enable_earlycon: set up earlycon for the console specified by the table
+ * @enable_console: setup the console specified by the table.
  *
  * For the architectures with support for ACPI, CONFIG_ACPI_SPCR_TABLE may be
  * defined to parse ACPI SPCR table.  As a result of the parsing preferred
- * console is registered and if @earlycon is true, earlycon is set up.
+ * console is registered and if @enable_earlycon is true, earlycon is set up.
+ * If @enable_console is true the system console is also configured.
  *
  * When CONFIG_ACPI_SPCR_TABLE is defined, this function should be called
  * from arch initialization code as soon as the DT/ACPI decision is made.
  *
  */
-int __init parse_spcr(bool earlycon)
+int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
 {
 	static char opts[64];
 	struct acpi_table_spcr *table;
@@ -105,11 +107,8 @@ int __init parse_spcr(bool earlycon)
 	if (ACPI_FAILURE(status))
 		return -ENOENT;
 
-	if (table->header.revision < 2) {
-		err = -ENOENT;
-		pr_err("wrong table version\n");
-		goto done;
-	}
+	if (table->header.revision < 2)
+		pr_info("SPCR table version %d\n", table->header.revision);
 
 	if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
 		switch (ACPI_ACCESS_BIT_WIDTH((
@@ -185,7 +184,7 @@ int __init parse_spcr(bool earlycon)
 	 */
 	if (qdf2400_erratum_44_present(&table->header)) {
 		qdf2400_e44_present = true;
-		if (earlycon)
+		if (enable_earlycon)
 			uart = "qdf2400_e44";
 	}
 
@@ -205,11 +204,13 @@ int __init parse_spcr(bool earlycon)
 
 	pr_info("console: %s\n", opts);
 
-	if (earlycon)
+	if (enable_earlycon)
 		setup_earlycon(opts);
 
-	err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
-
+	if (enable_console)
+		err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
+	else
+		err = 0;
 done:
 	acpi_put_table((struct acpi_table_header *)table);
 	return err;
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 4c8b80f1c688..870e84fb6e39 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -197,25 +197,20 @@ int __init setup_earlycon(char *buf)
 }
 
 /*
- * When CONFIG_ACPI_SPCR_TABLE is defined, "earlycon" without parameters in
- * command line does not start DT earlycon immediately, instead it defers
- * starting it until DT/ACPI decision is made.  At that time if ACPI is enabled
- * call parse_spcr(), else call early_init_dt_scan_chosen_stdout()
+ * This defers the initialization of the early console until after ACPI has
+ * been initialized.
  */
-bool earlycon_init_is_deferred __initdata;
+bool earlycon_acpi_spcr_enable __initdata;
 
 /* early_param wrapper for setup_earlycon() */
 static int __init param_setup_earlycon(char *buf)
 {
 	int err;
 
-	/*
-	 * Just 'earlycon' is a valid param for devicetree earlycons;
-	 * don't generate a warning from parse_early_params() in that case
-	 */
+	/* Just 'earlycon' is a valid param for devicetree and ACPI SPCR. */
 	if (!buf || !buf[0]) {
 		if (IS_ENABLED(CONFIG_ACPI_SPCR_TABLE)) {
-			earlycon_init_is_deferred = true;
+			earlycon_acpi_spcr_enable = true;
 			return 0;
 		} else if (!buf) {
 			return early_init_dt_scan_chosen_stdout();
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index dc1ebfeeb5ec..9aac8f0ebe23 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1242,9 +1242,12 @@ static inline void acpi_table_upgrade(void) { }
 
 #ifdef CONFIG_ACPI_SPCR_TABLE
 extern bool qdf2400_e44_present;
-int parse_spcr(bool earlycon);
+int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
 #else
-static inline int parse_spcr(bool earlycon) { return 0; }
+static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
+{
+	return 0;
+}
 #endif
 
 #if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 37b044e78333..aefd0e5115da 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -376,10 +376,10 @@ extern int of_setup_earlycon(const struct earlycon_id *match,
 			     const char *options);
 
 #ifdef CONFIG_SERIAL_EARLYCON
-extern bool earlycon_init_is_deferred __initdata;
+extern bool earlycon_acpi_spcr_enable __initdata;
 int setup_earlycon(char *buf);
 #else
-static const bool earlycon_init_is_deferred;
+static const bool earlycon_acpi_spcr_enable;
 static inline int setup_earlycon(char *buf) { return 0; }
 #endif
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-01-18 15:09 ` Prarit Bhargava
@ 2018-01-20 14:33   ` Ingo Molnar
  -1 siblings, 0 replies; 29+ messages in thread
From: Ingo Molnar @ 2018-01-20 14:33 UTC (permalink / raw)
  To: Prarit Bhargava
  Cc: linux-kernel, linux-acpi, linux-doc, linux-arm-kernel, linux-pm,
	linux-serial, Bhupesh Sharma, Lv Zheng, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Jonathan Corbet,
	Catalin Marinas, Will Deacon, Timur Tabi, graeme.gregory,
	mark.salter


* Prarit Bhargava <prarit@redhat.com> wrote:

> Note on testing:  I've tested this on several ARM64 and x86 boxes (only
> earlycon, console=ttyS0,115200, and with both options), verified that
> functionality on ARM64 has not changed (ie, CONFIG_ACPI_SPCR_TABLE is
> always =y), and verified functionality when !CONFIG_ACPI_SPCR_TABLE on
> x86.
> 
> P.
> 
> ----8<----
> 
> SPCR is currently only enabled or ARM64 and x86 can use SPCR to setup an
> early console.
> 
> General fixes include updating Documentation & Kconfig (for x86), updating
> comments, and changing parse_spcr() to acpi_parse_spcr(), and
> earlycon_init_is_deferred to earlycon_acpi_spcr_enable to be more
> descriptive.
> 
> On x86, many systems have a valid SPCR table but the table version is not
> 2 so the table version check must be a warning.
> 
> On ARM64 when the kernel parameter earlycon is used both the early console
> and console are enabled.  On x86, only the earlycon should be enabled by
> by default.  Modify acpi_parse_spcr() to allow options for initializing
> the early console and console separately.
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: linux-acpi@vger.kernel.org
> Cc: linux-doc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-pm@vger.kernel.org
> Cc: linux-serial@vger.kernel.org
> Cc: Bhupesh Sharma <bhsharma@redhat.com>
> Cc: Lv Zheng <lv.zheng@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: "Rafael J. Wysocki" Mrjw@rjwysocki.net>
> Cc: Timur Tabi <timur@codeaurora.org>
> Cc: graeme.gregory@linaro.org
> Cc: mark.salter@redhat.com
> ---
>  Documentation/admin-guide/kernel-parameters.txt |  9 +++++---
>  arch/arm64/kernel/acpi.c                        |  4 ++--
>  arch/x86/kernel/acpi/boot.c                     |  3 +++
>  drivers/acpi/Kconfig                            |  7 +++++-
>  drivers/acpi/spcr.c                             | 29 +++++++++++++------------
>  drivers/tty/serial/earlycon.c                   | 15 +++++--------
>  include/linux/acpi.h                            |  7 ++++--
>  include/linux/serial_core.h                     |  4 ++--
>  8 files changed, 44 insertions(+), 34 deletions(-)

I'm fine with the x86 aspect of this:

Acked-by: Ingo Molnar <mingo@kernel.org>

>  	earlycon=	[KNL] Output early console device and options.
>  
> -			When used with no options, the early console is
> -			determined by the stdout-path property in device
> -			tree's chosen node.
> +			[ARM64] The early console is determined by the
> +			stdout-path property in device tree's chosen node,
> +			or determined by the ACPI SPCR table.

s/in device tree's chosen node
 /in the device tree's chosen node

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-01-20 14:33   ` Ingo Molnar
  0 siblings, 0 replies; 29+ messages in thread
From: Ingo Molnar @ 2018-01-20 14:33 UTC (permalink / raw)
  To: linux-arm-kernel


* Prarit Bhargava <prarit@redhat.com> wrote:

> Note on testing:  I've tested this on several ARM64 and x86 boxes (only
> earlycon, console=ttyS0,115200, and with both options), verified that
> functionality on ARM64 has not changed (ie, CONFIG_ACPI_SPCR_TABLE is
> always =y), and verified functionality when !CONFIG_ACPI_SPCR_TABLE on
> x86.
> 
> P.
> 
> ----8<----
> 
> SPCR is currently only enabled or ARM64 and x86 can use SPCR to setup an
> early console.
> 
> General fixes include updating Documentation & Kconfig (for x86), updating
> comments, and changing parse_spcr() to acpi_parse_spcr(), and
> earlycon_init_is_deferred to earlycon_acpi_spcr_enable to be more
> descriptive.
> 
> On x86, many systems have a valid SPCR table but the table version is not
> 2 so the table version check must be a warning.
> 
> On ARM64 when the kernel parameter earlycon is used both the early console
> and console are enabled.  On x86, only the earlycon should be enabled by
> by default.  Modify acpi_parse_spcr() to allow options for initializing
> the early console and console separately.
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: linux-acpi at vger.kernel.org
> Cc: linux-doc at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-pm at vger.kernel.org
> Cc: linux-serial at vger.kernel.org
> Cc: Bhupesh Sharma <bhsharma@redhat.com>
> Cc: Lv Zheng <lv.zheng@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86 at kernel.org
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: "Rafael J. Wysocki" Mrjw at rjwysocki.net>
> Cc: Timur Tabi <timur@codeaurora.org>
> Cc: graeme.gregory at linaro.org
> Cc: mark.salter at redhat.com
> ---
>  Documentation/admin-guide/kernel-parameters.txt |  9 +++++---
>  arch/arm64/kernel/acpi.c                        |  4 ++--
>  arch/x86/kernel/acpi/boot.c                     |  3 +++
>  drivers/acpi/Kconfig                            |  7 +++++-
>  drivers/acpi/spcr.c                             | 29 +++++++++++++------------
>  drivers/tty/serial/earlycon.c                   | 15 +++++--------
>  include/linux/acpi.h                            |  7 ++++--
>  include/linux/serial_core.h                     |  4 ++--
>  8 files changed, 44 insertions(+), 34 deletions(-)

I'm fine with the x86 aspect of this:

Acked-by: Ingo Molnar <mingo@kernel.org>

>  	earlycon=	[KNL] Output early console device and options.
>  
> -			When used with no options, the early console is
> -			determined by the stdout-path property in device
> -			tree's chosen node.
> +			[ARM64] The early console is determined by the
> +			stdout-path property in device tree's chosen node,
> +			or determined by the ACPI SPCR table.

s/in device tree's chosen node
 /in the device tree's chosen node

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-01-18 15:09 ` Prarit Bhargava
@ 2018-01-21 23:21   ` Mark Salter
  -1 siblings, 0 replies; 29+ messages in thread
From: Mark Salter @ 2018-01-21 23:21 UTC (permalink / raw)
  To: Prarit Bhargava, linux-kernel
  Cc: linux-acpi, linux-doc, linux-arm-kernel, linux-pm, linux-serial,
	Bhupesh Sharma, Lv Zheng, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, Jonathan Corbet, Catalin Marinas,
	Will Deacon, Timur Tabi, graeme.gregory, mark.salter

On Thu, 2018-01-18 at 10:09 -0500, Prarit Bhargava wrote:
> Note on testing:  I've tested this on several ARM64 and x86 boxes (only
> earlycon, console=ttyS0,115200, and with both options), verified that
> functionality on ARM64 has not changed (ie, CONFIG_ACPI_SPCR_TABLE is
> always =y), and verified functionality when !CONFIG_ACPI_SPCR_TABLE on
> x86.
> 
> P.
> 
> ----8<----
> 
> SPCR is currently only enabled or ARM64 and x86 can use SPCR to setup an
> early console.
> 
> General fixes include updating Documentation & Kconfig (for x86), updating
> comments, and changing parse_spcr() to acpi_parse_spcr(), and
> earlycon_init_is_deferred to earlycon_acpi_spcr_enable to be more
> descriptive.
> 
> On x86, many systems have a valid SPCR table but the table version is not
> 2 so the table version check must be a warning.
> 
> On ARM64 when the kernel parameter earlycon is used both the early console
> and console are enabled.  On x86, only the earlycon should be enabled by
> by default.  Modify acpi_parse_spcr() to allow options for initializing
> the early console and console separately.
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: linux-acpi@vger.kernel.org
> Cc: linux-doc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-pm@vger.kernel.org
> Cc: linux-serial@vger.kernel.org
> Cc: Bhupesh Sharma <bhsharma@redhat.com>
> Cc: Lv Zheng <lv.zheng@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: "Rafael J. Wysocki" Mrjw@rjwysocki.net>
> Cc: Timur Tabi <timur@codeaurora.org>
> Cc: graeme.gregory@linaro.org
> Cc: mark.salter@redhat.com
> ---
>  Documentation/admin-guide/kernel-parameters.txt |  9 +++++---
>  arch/arm64/kernel/acpi.c                        |  4 ++--
>  arch/x86/kernel/acpi/boot.c                     |  3 +++
>  drivers/acpi/Kconfig                            |  7 +++++-
>  drivers/acpi/spcr.c                             | 29 +++++++++++++------------
>  drivers/tty/serial/earlycon.c                   | 15 +++++--------
>  include/linux/acpi.h                            |  7 ++++--
>  include/linux/serial_core.h                     |  4 ++--
>  8 files changed, 44 insertions(+), 34 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 46b26bfee27b..6f519230ed34 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -915,9 +915,12 @@
>  
>  	earlycon=	[KNL] Output early console device and options.
>  
> -			When used with no options, the early console is
> -			determined by the stdout-path property in device
> -			tree's chosen node.
> +			[ARM64] The early console is determined by the
> +			stdout-path property in device tree's chosen node,
> +			or determined by the ACPI SPCR table.
> +
> +			[X86] When used with no options the early console is
> +			determined by the ACPI SPCR table.
>  
>  		cdns,<addr>[,options]
>  			Start an early, polled-mode console on a Cadence
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index b3162715ed78..2aa5609def27 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -230,10 +230,10 @@ void __init acpi_boot_table_init(void)
>  
>  done:
>  	if (acpi_disabled) {
> -		if (earlycon_init_is_deferred)
> +		if (earlycon_acpi_spcr_enable)
>  			early_init_dt_scan_chosen_stdout();
>  	} else {
> -		parse_spcr(earlycon_init_is_deferred);
> +		acpi_parse_spcr(earlycon_acpi_spcr_enable, true);
>  		if (IS_ENABLED(CONFIG_ACPI_BGRT))
>  			acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
>  	}
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index f4c463df8b08..0bf6a58f7a6d 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -36,6 +36,7 @@
>  #include <linux/ioport.h>
>  #include <linux/pci.h>
>  #include <linux/efi-bgrt.h>
> +#include <linux/serial_core.h>
>  
>  #include <asm/e820/api.h>
>  #include <asm/irqdomain.h>
> @@ -1626,6 +1627,8 @@ int __init acpi_boot_init(void)
>  	if (!acpi_noirq)
>  		x86_init.pci.init = pci_acpi_init;
>  
> +	/* Do not enable ACPI SPCR console by default */
> +	acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
>  	return 0;
>  }
>  
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 46505396869e..ddcb5f40e8ee 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -79,7 +79,12 @@ config ACPI_DEBUGGER_USER
>  endif
>  
>  config ACPI_SPCR_TABLE
> -	bool
> +	bool "ACPI Serial Port Console Redirection Support"
> +	default y if X86
> +	help
> +	  Enable support for Serial Port Console Redirection (SPCR) Table.
> +	  This table provides information about the configuration of the
> +	  earlycon console.
>  
>  config ACPI_LPIT
>  	bool
> diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
> index 324b35bfe781..89e97d21a89c 100644
> --- a/drivers/acpi/spcr.c
> +++ b/drivers/acpi/spcr.c
> @@ -21,7 +21,7 @@
>   * occasionally getting stuck as 1. To avoid the potential for a hang, check
>   * TXFE == 0 instead of BUSY == 1. This may not be suitable for all UART
>   * implementations, so only do so if an affected platform is detected in
> - * parse_spcr().
> + * acpi_parse_spcr().
>   */
>  bool qdf2400_e44_present;
>  EXPORT_SYMBOL(qdf2400_e44_present);
> @@ -74,19 +74,21 @@ static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
>  }
>  
>  /**
> - * parse_spcr() - parse ACPI SPCR table and add preferred console
> + * acpi_parse_spcr() - parse ACPI SPCR table and add preferred console
>   *
> - * @earlycon: set up earlycon for the console specified by the table
> + * @enable_earlycon: set up earlycon for the console specified by the table
> + * @enable_console: setup the console specified by the table.
>   *
>   * For the architectures with support for ACPI, CONFIG_ACPI_SPCR_TABLE may be
>   * defined to parse ACPI SPCR table.  As a result of the parsing preferred
> - * console is registered and if @earlycon is true, earlycon is set up.
> + * console is registered and if @enable_earlycon is true, earlycon is set up.
> + * If @enable_console is true the system console is also configured.
>   *
>   * When CONFIG_ACPI_SPCR_TABLE is defined, this function should be called
>   * from arch initialization code as soon as the DT/ACPI decision is made.
>   *
>   */
> -int __init parse_spcr(bool earlycon)
> +int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
>  {
>  	static char opts[64];
>  	struct acpi_table_spcr *table;
> @@ -105,11 +107,8 @@ int __init parse_spcr(bool earlycon)
>  	if (ACPI_FAILURE(status))
>  		return -ENOENT;
>  
> -	if (table->header.revision < 2) {
> -		err = -ENOENT;
> -		pr_err("wrong table version\n");
> -		goto done;
> -	}
> +	if (table->header.revision < 2)
> +		pr_info("SPCR table version %d\n", table->header.revision);
>  
>  	if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
>  		switch (ACPI_ACCESS_BIT_WIDTH((
> @@ -185,7 +184,7 @@ int __init parse_spcr(bool earlycon)
>  	 */
>  	if (qdf2400_erratum_44_present(&table->header)) {
>  		qdf2400_e44_present = true;
> -		if (earlycon)
> +		if (enable_earlycon)
>  			uart = "qdf2400_e44";
>  	}
>  
> @@ -205,11 +204,13 @@ int __init parse_spcr(bool earlycon)
>  
>  	pr_info("console: %s\n", opts);
>  
> -	if (earlycon)
> +	if (enable_earlycon)
>  		setup_earlycon(opts);
>  
> -	err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
> -
> +	if (enable_console)
> +		err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
> +	else
> +		err = 0;
>  done:
>  	acpi_put_table((struct acpi_table_header *)table);
>  	return err;
> diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
> index 4c8b80f1c688..870e84fb6e39 100644
> --- a/drivers/tty/serial/earlycon.c
> +++ b/drivers/tty/serial/earlycon.c
> @@ -197,25 +197,20 @@ int __init setup_earlycon(char *buf)
>  }
>  
>  /*
> - * When CONFIG_ACPI_SPCR_TABLE is defined, "earlycon" without parameters in
> - * command line does not start DT earlycon immediately, instead it defers
> - * starting it until DT/ACPI decision is made.  At that time if ACPI is enabled
> - * call parse_spcr(), else call early_init_dt_scan_chosen_stdout()
> + * This defers the initialization of the early console until after ACPI has
> + * been initialized.
>   */
> -bool earlycon_init_is_deferred __initdata;
> +bool earlycon_acpi_spcr_enable __initdata;
>  
>  /* early_param wrapper for setup_earlycon() */
>  static int __init param_setup_earlycon(char *buf)
>  {
>  	int err;
>  
> -	/*
> -	 * Just 'earlycon' is a valid param for devicetree earlycons;
> -	 * don't generate a warning from parse_early_params() in that case
> -	 */
> +	/* Just 'earlycon' is a valid param for devicetree and ACPI SPCR. */
>  	if (!buf || !buf[0]) {
>  		if (IS_ENABLED(CONFIG_ACPI_SPCR_TABLE)) {
> -			earlycon_init_is_deferred = true;
> +			earlycon_acpi_spcr_enable = true;
>  			return 0;
>  		} else if (!buf) {
>  			return early_init_dt_scan_chosen_stdout();
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index dc1ebfeeb5ec..9aac8f0ebe23 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -1242,9 +1242,12 @@ static inline void acpi_table_upgrade(void) { }
>  
>  #ifdef CONFIG_ACPI_SPCR_TABLE
>  extern bool qdf2400_e44_present;
> -int parse_spcr(bool earlycon);
> +int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
>  #else
> -static inline int parse_spcr(bool earlycon) { return 0; }
> +static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
> +{
> +	return 0;
> +}
>  #endif
>  
>  #if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 37b044e78333..aefd0e5115da 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -376,10 +376,10 @@ extern int of_setup_earlycon(const struct earlycon_id *match,
>  			     const char *options);
>  
>  #ifdef CONFIG_SERIAL_EARLYCON
> -extern bool earlycon_init_is_deferred __initdata;
> +extern bool earlycon_acpi_spcr_enable __initdata;
>  int setup_earlycon(char *buf);
>  #else
> -static const bool earlycon_init_is_deferred;
> +static const bool earlycon_acpi_spcr_enable;
>  static inline int setup_earlycon(char *buf) { return 0; }
>  #endif
>  

This looks okay to me. Tested on a variety of arm64 platforms.

Reviewed-by: Mark Salter <msalter@redhat.com>
Tested-by: Mark Salter <msalter@redhat.com>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-01-21 23:21   ` Mark Salter
  0 siblings, 0 replies; 29+ messages in thread
From: Mark Salter @ 2018-01-21 23:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2018-01-18 at 10:09 -0500, Prarit Bhargava wrote:
> Note on testing:  I've tested this on several ARM64 and x86 boxes (only
> earlycon, console=ttyS0,115200, and with both options), verified that
> functionality on ARM64 has not changed (ie, CONFIG_ACPI_SPCR_TABLE is
> always =y), and verified functionality when !CONFIG_ACPI_SPCR_TABLE on
> x86.
> 
> P.
> 
> ----8<----
> 
> SPCR is currently only enabled or ARM64 and x86 can use SPCR to setup an
> early console.
> 
> General fixes include updating Documentation & Kconfig (for x86), updating
> comments, and changing parse_spcr() to acpi_parse_spcr(), and
> earlycon_init_is_deferred to earlycon_acpi_spcr_enable to be more
> descriptive.
> 
> On x86, many systems have a valid SPCR table but the table version is not
> 2 so the table version check must be a warning.
> 
> On ARM64 when the kernel parameter earlycon is used both the early console
> and console are enabled.  On x86, only the earlycon should be enabled by
> by default.  Modify acpi_parse_spcr() to allow options for initializing
> the early console and console separately.
> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: linux-acpi at vger.kernel.org
> Cc: linux-doc at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-pm at vger.kernel.org
> Cc: linux-serial at vger.kernel.org
> Cc: Bhupesh Sharma <bhsharma@redhat.com>
> Cc: Lv Zheng <lv.zheng@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86 at kernel.org
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: "Rafael J. Wysocki" Mrjw at rjwysocki.net>
> Cc: Timur Tabi <timur@codeaurora.org>
> Cc: graeme.gregory at linaro.org
> Cc: mark.salter at redhat.com
> ---
>  Documentation/admin-guide/kernel-parameters.txt |  9 +++++---
>  arch/arm64/kernel/acpi.c                        |  4 ++--
>  arch/x86/kernel/acpi/boot.c                     |  3 +++
>  drivers/acpi/Kconfig                            |  7 +++++-
>  drivers/acpi/spcr.c                             | 29 +++++++++++++------------
>  drivers/tty/serial/earlycon.c                   | 15 +++++--------
>  include/linux/acpi.h                            |  7 ++++--
>  include/linux/serial_core.h                     |  4 ++--
>  8 files changed, 44 insertions(+), 34 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 46b26bfee27b..6f519230ed34 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -915,9 +915,12 @@
>  
>  	earlycon=	[KNL] Output early console device and options.
>  
> -			When used with no options, the early console is
> -			determined by the stdout-path property in device
> -			tree's chosen node.
> +			[ARM64] The early console is determined by the
> +			stdout-path property in device tree's chosen node,
> +			or determined by the ACPI SPCR table.
> +
> +			[X86] When used with no options the early console is
> +			determined by the ACPI SPCR table.
>  
>  		cdns,<addr>[,options]
>  			Start an early, polled-mode console on a Cadence
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index b3162715ed78..2aa5609def27 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -230,10 +230,10 @@ void __init acpi_boot_table_init(void)
>  
>  done:
>  	if (acpi_disabled) {
> -		if (earlycon_init_is_deferred)
> +		if (earlycon_acpi_spcr_enable)
>  			early_init_dt_scan_chosen_stdout();
>  	} else {
> -		parse_spcr(earlycon_init_is_deferred);
> +		acpi_parse_spcr(earlycon_acpi_spcr_enable, true);
>  		if (IS_ENABLED(CONFIG_ACPI_BGRT))
>  			acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
>  	}
> diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
> index f4c463df8b08..0bf6a58f7a6d 100644
> --- a/arch/x86/kernel/acpi/boot.c
> +++ b/arch/x86/kernel/acpi/boot.c
> @@ -36,6 +36,7 @@
>  #include <linux/ioport.h>
>  #include <linux/pci.h>
>  #include <linux/efi-bgrt.h>
> +#include <linux/serial_core.h>
>  
>  #include <asm/e820/api.h>
>  #include <asm/irqdomain.h>
> @@ -1626,6 +1627,8 @@ int __init acpi_boot_init(void)
>  	if (!acpi_noirq)
>  		x86_init.pci.init = pci_acpi_init;
>  
> +	/* Do not enable ACPI SPCR console by default */
> +	acpi_parse_spcr(earlycon_acpi_spcr_enable, false);
>  	return 0;
>  }
>  
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 46505396869e..ddcb5f40e8ee 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -79,7 +79,12 @@ config ACPI_DEBUGGER_USER
>  endif
>  
>  config ACPI_SPCR_TABLE
> -	bool
> +	bool "ACPI Serial Port Console Redirection Support"
> +	default y if X86
> +	help
> +	  Enable support for Serial Port Console Redirection (SPCR) Table.
> +	  This table provides information about the configuration of the
> +	  earlycon console.
>  
>  config ACPI_LPIT
>  	bool
> diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
> index 324b35bfe781..89e97d21a89c 100644
> --- a/drivers/acpi/spcr.c
> +++ b/drivers/acpi/spcr.c
> @@ -21,7 +21,7 @@
>   * occasionally getting stuck as 1. To avoid the potential for a hang, check
>   * TXFE == 0 instead of BUSY == 1. This may not be suitable for all UART
>   * implementations, so only do so if an affected platform is detected in
> - * parse_spcr().
> + * acpi_parse_spcr().
>   */
>  bool qdf2400_e44_present;
>  EXPORT_SYMBOL(qdf2400_e44_present);
> @@ -74,19 +74,21 @@ static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
>  }
>  
>  /**
> - * parse_spcr() - parse ACPI SPCR table and add preferred console
> + * acpi_parse_spcr() - parse ACPI SPCR table and add preferred console
>   *
> - * @earlycon: set up earlycon for the console specified by the table
> + * @enable_earlycon: set up earlycon for the console specified by the table
> + * @enable_console: setup the console specified by the table.
>   *
>   * For the architectures with support for ACPI, CONFIG_ACPI_SPCR_TABLE may be
>   * defined to parse ACPI SPCR table.  As a result of the parsing preferred
> - * console is registered and if @earlycon is true, earlycon is set up.
> + * console is registered and if @enable_earlycon is true, earlycon is set up.
> + * If @enable_console is true the system console is also configured.
>   *
>   * When CONFIG_ACPI_SPCR_TABLE is defined, this function should be called
>   * from arch initialization code as soon as the DT/ACPI decision is made.
>   *
>   */
> -int __init parse_spcr(bool earlycon)
> +int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
>  {
>  	static char opts[64];
>  	struct acpi_table_spcr *table;
> @@ -105,11 +107,8 @@ int __init parse_spcr(bool earlycon)
>  	if (ACPI_FAILURE(status))
>  		return -ENOENT;
>  
> -	if (table->header.revision < 2) {
> -		err = -ENOENT;
> -		pr_err("wrong table version\n");
> -		goto done;
> -	}
> +	if (table->header.revision < 2)
> +		pr_info("SPCR table version %d\n", table->header.revision);
>  
>  	if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
>  		switch (ACPI_ACCESS_BIT_WIDTH((
> @@ -185,7 +184,7 @@ int __init parse_spcr(bool earlycon)
>  	 */
>  	if (qdf2400_erratum_44_present(&table->header)) {
>  		qdf2400_e44_present = true;
> -		if (earlycon)
> +		if (enable_earlycon)
>  			uart = "qdf2400_e44";
>  	}
>  
> @@ -205,11 +204,13 @@ int __init parse_spcr(bool earlycon)
>  
>  	pr_info("console: %s\n", opts);
>  
> -	if (earlycon)
> +	if (enable_earlycon)
>  		setup_earlycon(opts);
>  
> -	err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
> -
> +	if (enable_console)
> +		err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
> +	else
> +		err = 0;
>  done:
>  	acpi_put_table((struct acpi_table_header *)table);
>  	return err;
> diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
> index 4c8b80f1c688..870e84fb6e39 100644
> --- a/drivers/tty/serial/earlycon.c
> +++ b/drivers/tty/serial/earlycon.c
> @@ -197,25 +197,20 @@ int __init setup_earlycon(char *buf)
>  }
>  
>  /*
> - * When CONFIG_ACPI_SPCR_TABLE is defined, "earlycon" without parameters in
> - * command line does not start DT earlycon immediately, instead it defers
> - * starting it until DT/ACPI decision is made.  At that time if ACPI is enabled
> - * call parse_spcr(), else call early_init_dt_scan_chosen_stdout()
> + * This defers the initialization of the early console until after ACPI has
> + * been initialized.
>   */
> -bool earlycon_init_is_deferred __initdata;
> +bool earlycon_acpi_spcr_enable __initdata;
>  
>  /* early_param wrapper for setup_earlycon() */
>  static int __init param_setup_earlycon(char *buf)
>  {
>  	int err;
>  
> -	/*
> -	 * Just 'earlycon' is a valid param for devicetree earlycons;
> -	 * don't generate a warning from parse_early_params() in that case
> -	 */
> +	/* Just 'earlycon' is a valid param for devicetree and ACPI SPCR. */
>  	if (!buf || !buf[0]) {
>  		if (IS_ENABLED(CONFIG_ACPI_SPCR_TABLE)) {
> -			earlycon_init_is_deferred = true;
> +			earlycon_acpi_spcr_enable = true;
>  			return 0;
>  		} else if (!buf) {
>  			return early_init_dt_scan_chosen_stdout();
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index dc1ebfeeb5ec..9aac8f0ebe23 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -1242,9 +1242,12 @@ static inline void acpi_table_upgrade(void) { }
>  
>  #ifdef CONFIG_ACPI_SPCR_TABLE
>  extern bool qdf2400_e44_present;
> -int parse_spcr(bool earlycon);
> +int acpi_parse_spcr(bool enable_earlycon, bool enable_console);
>  #else
> -static inline int parse_spcr(bool earlycon) { return 0; }
> +static inline int acpi_parse_spcr(bool enable_earlycon, bool enable_console)
> +{
> +	return 0;
> +}
>  #endif
>  
>  #if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 37b044e78333..aefd0e5115da 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -376,10 +376,10 @@ extern int of_setup_earlycon(const struct earlycon_id *match,
>  			     const char *options);
>  
>  #ifdef CONFIG_SERIAL_EARLYCON
> -extern bool earlycon_init_is_deferred __initdata;
> +extern bool earlycon_acpi_spcr_enable __initdata;
>  int setup_earlycon(char *buf);
>  #else
> -static const bool earlycon_init_is_deferred;
> +static const bool earlycon_acpi_spcr_enable;
>  static inline int setup_earlycon(char *buf) { return 0; }
>  #endif
>  

This looks okay to me. Tested on a variety of arm64 platforms.

Reviewed-by: Mark Salter <msalter@redhat.com>
Tested-by: Mark Salter <msalter@redhat.com>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-01-18 15:09 ` Prarit Bhargava
@ 2018-01-22 21:49   ` Timur Tabi
  -1 siblings, 0 replies; 29+ messages in thread
From: Timur Tabi @ 2018-01-22 21:49 UTC (permalink / raw)
  To: Prarit Bhargava, linux-kernel
  Cc: linux-acpi, linux-doc, linux-arm-kernel, linux-pm, linux-serial,
	Bhupesh Sharma, Lv Zheng, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, Jonathan Corbet, Catalin Marinas,
	Will Deacon, graeme.gregory, mark.salter

On 01/18/2018 09:09 AM, Prarit Bhargava wrote:
>   	if (acpi_disabled) {
> -		if (earlycon_init_is_deferred)
> +		if (earlycon_acpi_spcr_enable)

This patch works for me, so I can ACK it, but first you might want to 
rename earlycon_acpi_spcr_enable, because these two lines don't make 
much sense.

"If ACPI is disabled, and ACPI SCPR is enabled, then ...."

If ACPI is disabled, then how can a variable called 
"earlycon_acpi_spcr_enable" be true?

Would it make more sense to rename it to earlycon_spcr_enable?

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-01-22 21:49   ` Timur Tabi
  0 siblings, 0 replies; 29+ messages in thread
From: Timur Tabi @ 2018-01-22 21:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/18/2018 09:09 AM, Prarit Bhargava wrote:
>   	if (acpi_disabled) {
> -		if (earlycon_init_is_deferred)
> +		if (earlycon_acpi_spcr_enable)

This patch works for me, so I can ACK it, but first you might want to 
rename earlycon_acpi_spcr_enable, because these two lines don't make 
much sense.

"If ACPI is disabled, and ACPI SCPR is enabled, then ...."

If ACPI is disabled, then how can a variable called 
"earlycon_acpi_spcr_enable" be true?

Would it make more sense to rename it to earlycon_spcr_enable?

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-01-22 21:49   ` Timur Tabi
@ 2018-01-23 12:41     ` Prarit Bhargava
  -1 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-01-23 12:41 UTC (permalink / raw)
  To: Timur Tabi, linux-kernel
  Cc: linux-acpi, linux-doc, linux-arm-kernel, linux-pm, linux-serial,
	Bhupesh Sharma, Lv Zheng, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, Jonathan Corbet, Catalin Marinas,
	Will Deacon, graeme.gregory, mark.salter



On 01/22/2018 04:49 PM, Timur Tabi wrote:
> On 01/18/2018 09:09 AM, Prarit Bhargava wrote:
>>       if (acpi_disabled) {
>> -        if (earlycon_init_is_deferred)
>> +        if (earlycon_acpi_spcr_enable)
> 
> This patch works for me, so I can ACK it, but first you might want to rename
> earlycon_acpi_spcr_enable, because these two lines don't make much sense.
> 
> "If ACPI is disabled, and ACPI SCPR is enabled, then ...."
> 
> If ACPI is disabled, then how can a variable called "earlycon_acpi_spcr_enable"
> be true?
> 
> Would it make more sense to rename it to earlycon_spcr_enable?
> 

acpi_disabled is a global runtime flag that can be set via "acpi=off" on the
command line.  It does not disable the tables, only the reading and interpreting
of the data in the tables.

P.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-01-23 12:41     ` Prarit Bhargava
  0 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-01-23 12:41 UTC (permalink / raw)
  To: linux-arm-kernel



On 01/22/2018 04:49 PM, Timur Tabi wrote:
> On 01/18/2018 09:09 AM, Prarit Bhargava wrote:
>>       if (acpi_disabled) {
>> -        if (earlycon_init_is_deferred)
>> +        if (earlycon_acpi_spcr_enable)
> 
> This patch works for me, so I can ACK it, but first you might want to rename
> earlycon_acpi_spcr_enable, because these two lines don't make much sense.
> 
> "If ACPI is disabled, and ACPI SCPR is enabled, then ...."
> 
> If ACPI is disabled, then how can a variable called "earlycon_acpi_spcr_enable"
> be true?
> 
> Would it make more sense to rename it to earlycon_spcr_enable?
> 

acpi_disabled is a global runtime flag that can be set via "acpi=off" on the
command line.  It does not disable the tables, only the reading and interpreting
of the data in the tables.

P.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-01-18 15:09 ` Prarit Bhargava
@ 2018-02-12 13:34   ` Peter Zijlstra
  -1 siblings, 0 replies; 29+ messages in thread
From: Peter Zijlstra @ 2018-02-12 13:34 UTC (permalink / raw)
  To: Prarit Bhargava
  Cc: linux-kernel, linux-acpi, linux-doc, linux-arm-kernel, linux-pm,
	linux-serial, Bhupesh Sharma, Lv Zheng, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Jonathan Corbet,
	Catalin Marinas, Will Deacon, Timur Tabi, graeme.gregory,
	mark.salter

On Thu, Jan 18, 2018 at 10:09:51AM -0500, Prarit Bhargava wrote:
>  config ACPI_SPCR_TABLE
> +	bool "ACPI Serial Port Console Redirection Support"
> +	default y if X86
> +	help
> +	  Enable support for Serial Port Console Redirection (SPCR) Table.
> +	  This table provides information about the configuration of the
> +	  earlycon console.

I just got asked this by oldconfig, which left me rather puzzled, WTF
does this do?

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-02-12 13:34   ` Peter Zijlstra
  0 siblings, 0 replies; 29+ messages in thread
From: Peter Zijlstra @ 2018-02-12 13:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 18, 2018 at 10:09:51AM -0500, Prarit Bhargava wrote:
>  config ACPI_SPCR_TABLE
> +	bool "ACPI Serial Port Console Redirection Support"
> +	default y if X86
> +	help
> +	  Enable support for Serial Port Console Redirection (SPCR) Table.
> +	  This table provides information about the configuration of the
> +	  earlycon console.

I just got asked this by oldconfig, which left me rather puzzled, WTF
does this do?

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-02-12 13:34   ` Peter Zijlstra
@ 2018-02-12 13:47     ` Prarit Bhargava
  -1 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-02-12 13:47 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, linux-acpi, linux-doc, linux-arm-kernel, linux-pm,
	linux-serial, Bhupesh Sharma, Lv Zheng, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Jonathan Corbet,
	Catalin Marinas, Will Deacon, Timur Tabi, graeme.gregory,
	mark.salter



On 02/12/2018 08:34 AM, Peter Zijlstra wrote:
> On Thu, Jan 18, 2018 at 10:09:51AM -0500, Prarit Bhargava wrote:
>>  config ACPI_SPCR_TABLE
>> +	bool "ACPI Serial Port Console Redirection Support"
>> +	default y if X86
>> +	help
>> +	  Enable support for Serial Port Console Redirection (SPCR) Table.
>> +	  This table provides information about the configuration of the
>> +	  earlycon console.
> 
> I just got asked this by oldconfig, which left me rather puzzled, WTF
> does this do?

Odd -- I thought I had taken care of that :(  My apologies Peter.

ACPI SPCR is used by a vendor to define the serial console for a system.  If
SPCR exists a user can add kernel parameter "earlycon" (no extra kernel
parameters) and the console will work out-of-the-box.

The serial console configuration varies from vendor to vendor.  This takes the
guess-work out of defining a serial console.

P.

> 

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-02-12 13:47     ` Prarit Bhargava
  0 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-02-12 13:47 UTC (permalink / raw)
  To: linux-arm-kernel



On 02/12/2018 08:34 AM, Peter Zijlstra wrote:
> On Thu, Jan 18, 2018 at 10:09:51AM -0500, Prarit Bhargava wrote:
>>  config ACPI_SPCR_TABLE
>> +	bool "ACPI Serial Port Console Redirection Support"
>> +	default y if X86
>> +	help
>> +	  Enable support for Serial Port Console Redirection (SPCR) Table.
>> +	  This table provides information about the configuration of the
>> +	  earlycon console.
> 
> I just got asked this by oldconfig, which left me rather puzzled, WTF
> does this do?

Odd -- I thought I had taken care of that :(  My apologies Peter.

ACPI SPCR is used by a vendor to define the serial console for a system.  If
SPCR exists a user can add kernel parameter "earlycon" (no extra kernel
parameters) and the console will work out-of-the-box.

The serial console configuration varies from vendor to vendor.  This takes the
guess-work out of defining a serial console.

P.

> 

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-02-12 13:47     ` Prarit Bhargava
@ 2018-02-12 14:43       ` Timur Tabi
  -1 siblings, 0 replies; 29+ messages in thread
From: Timur Tabi @ 2018-02-12 14:43 UTC (permalink / raw)
  To: Prarit Bhargava, Peter Zijlstra
  Cc: linux-kernel, linux-acpi, linux-doc, linux-arm-kernel, linux-pm,
	linux-serial, Bhupesh Sharma, Lv Zheng, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Jonathan Corbet,
	Catalin Marinas, Will Deacon, graeme.gregory, mark.salter

On 2/12/18 7:47 AM, Prarit Bhargava wrote:
> ACPI SPCR is used by a vendor to define the serial console for a system.  If
> SPCR exists a user can add kernel parameter "earlycon" (no extra kernel
> parameters) and the console will work out-of-the-box.

"earlycon" is needed only for an *early* console.  You don't need any 
command line parameters for a normal console to work with SPCR.

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-02-12 14:43       ` Timur Tabi
  0 siblings, 0 replies; 29+ messages in thread
From: Timur Tabi @ 2018-02-12 14:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 2/12/18 7:47 AM, Prarit Bhargava wrote:
> ACPI SPCR is used by a vendor to define the serial console for a system.  If
> SPCR exists a user can add kernel parameter "earlycon" (no extra kernel
> parameters) and the console will work out-of-the-box.

"earlycon" is needed only for an *early* console.  You don't need any 
command line parameters for a normal console to work with SPCR.

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-02-12 14:43       ` Timur Tabi
@ 2018-02-12 14:49         ` Prarit Bhargava
  -1 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-02-12 14:49 UTC (permalink / raw)
  To: Timur Tabi, Peter Zijlstra
  Cc: linux-kernel, linux-acpi, linux-doc, linux-arm-kernel, linux-pm,
	linux-serial, Bhupesh Sharma, Lv Zheng, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Jonathan Corbet,
	Catalin Marinas, Will Deacon, graeme.gregory, mark.salter



On 02/12/2018 09:43 AM, Timur Tabi wrote:
> On 2/12/18 7:47 AM, Prarit Bhargava wrote:
>> ACPI SPCR is used by a vendor to define the serial console for a system.  If
>> SPCR exists a user can add kernel parameter "earlycon" (no extra kernel
>> parameters) and the console will work out-of-the-box.
> 
> "earlycon" is needed only for an *early* console.  You don't need any command
> line parameters for a normal console to work with SPCR.

That's true on ARM64.  I specifically did not enable the console by default on
x86.  There are users who do not want a console active during boot & runtime.

P.

> 

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-02-12 14:49         ` Prarit Bhargava
  0 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-02-12 14:49 UTC (permalink / raw)
  To: linux-arm-kernel



On 02/12/2018 09:43 AM, Timur Tabi wrote:
> On 2/12/18 7:47 AM, Prarit Bhargava wrote:
>> ACPI SPCR is used by a vendor to define the serial console for a system.  If
>> SPCR exists a user can add kernel parameter "earlycon" (no extra kernel
>> parameters) and the console will work out-of-the-box.
> 
> "earlycon" is needed only for an *early* console.  You don't need any command
> line parameters for a normal console to work with SPCR.

That's true on ARM64.  I specifically did not enable the console by default on
x86.  There are users who do not want a console active during boot & runtime.

P.

> 

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-02-12 13:47     ` Prarit Bhargava
@ 2018-02-12 14:56       ` Peter Zijlstra
  -1 siblings, 0 replies; 29+ messages in thread
From: Peter Zijlstra @ 2018-02-12 14:56 UTC (permalink / raw)
  To: Prarit Bhargava
  Cc: linux-kernel, linux-acpi, linux-doc, linux-arm-kernel, linux-pm,
	linux-serial, Bhupesh Sharma, Lv Zheng, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Jonathan Corbet,
	Catalin Marinas, Will Deacon, Timur Tabi, graeme.gregory,
	mark.salter

On Mon, Feb 12, 2018 at 08:47:57AM -0500, Prarit Bhargava wrote:
> 
> 
> On 02/12/2018 08:34 AM, Peter Zijlstra wrote:
> > On Thu, Jan 18, 2018 at 10:09:51AM -0500, Prarit Bhargava wrote:
> >>  config ACPI_SPCR_TABLE
> >> +	bool "ACPI Serial Port Console Redirection Support"
> >> +	default y if X86
> >> +	help
> >> +	  Enable support for Serial Port Console Redirection (SPCR) Table.
> >> +	  This table provides information about the configuration of the
> >> +	  earlycon console.
> > 
> > I just got asked this by oldconfig, which left me rather puzzled, WTF
> > does this do?
> 
> Odd -- I thought I had taken care of that :(  My apologies Peter.
> 
> ACPI SPCR is used by a vendor to define the serial console for a system.  If
> SPCR exists a user can add kernel parameter "earlycon" (no extra kernel
> parameters) and the console will work out-of-the-box.
> 
> The serial console configuration varies from vendor to vendor.  This takes the
> guess-work out of defining a serial console.

But when I specify "earlyprintk=serial,ttyS0,115200" this SPCR crud will
not interfere?

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-02-12 14:56       ` Peter Zijlstra
  0 siblings, 0 replies; 29+ messages in thread
From: Peter Zijlstra @ 2018-02-12 14:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 12, 2018 at 08:47:57AM -0500, Prarit Bhargava wrote:
> 
> 
> On 02/12/2018 08:34 AM, Peter Zijlstra wrote:
> > On Thu, Jan 18, 2018 at 10:09:51AM -0500, Prarit Bhargava wrote:
> >>  config ACPI_SPCR_TABLE
> >> +	bool "ACPI Serial Port Console Redirection Support"
> >> +	default y if X86
> >> +	help
> >> +	  Enable support for Serial Port Console Redirection (SPCR) Table.
> >> +	  This table provides information about the configuration of the
> >> +	  earlycon console.
> > 
> > I just got asked this by oldconfig, which left me rather puzzled, WTF
> > does this do?
> 
> Odd -- I thought I had taken care of that :(  My apologies Peter.
> 
> ACPI SPCR is used by a vendor to define the serial console for a system.  If
> SPCR exists a user can add kernel parameter "earlycon" (no extra kernel
> parameters) and the console will work out-of-the-box.
> 
> The serial console configuration varies from vendor to vendor.  This takes the
> guess-work out of defining a serial console.

But when I specify "earlyprintk=serial,ttyS0,115200" this SPCR crud will
not interfere?

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-02-12 14:49         ` Prarit Bhargava
@ 2018-02-12 15:10           ` Timur Tabi
  -1 siblings, 0 replies; 29+ messages in thread
From: Timur Tabi @ 2018-02-12 15:10 UTC (permalink / raw)
  To: Prarit Bhargava, Peter Zijlstra
  Cc: linux-kernel, linux-acpi, linux-doc, linux-arm-kernel, linux-pm,
	linux-serial, Bhupesh Sharma, Lv Zheng, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Jonathan Corbet,
	Catalin Marinas, Will Deacon, graeme.gregory, mark.salter

On 2/12/18 8:49 AM, Prarit Bhargava wrote:
> That's true on ARM64.  I specifically did not enable the console by default on
> x86.  There are users who do not want a console active during boot & runtime.

Hmmmm... That's a good point.  On ARM systems with SPCR, you get a 
console whether you like it or not.

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-02-12 15:10           ` Timur Tabi
  0 siblings, 0 replies; 29+ messages in thread
From: Timur Tabi @ 2018-02-12 15:10 UTC (permalink / raw)
  To: linux-arm-kernel

On 2/12/18 8:49 AM, Prarit Bhargava wrote:
> That's true on ARM64.  I specifically did not enable the console by default on
> x86.  There are users who do not want a console active during boot & runtime.

Hmmmm... That's a good point.  On ARM systems with SPCR, you get a 
console whether you like it or not.

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-02-12 14:56       ` Peter Zijlstra
@ 2018-02-12 15:18         ` Prarit Bhargava
  -1 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-02-12 15:18 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, linux-acpi, linux-doc, linux-arm-kernel, linux-pm,
	linux-serial, Bhupesh Sharma, Lv Zheng, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Jonathan Corbet,
	Catalin Marinas, Will Deacon, Timur Tabi, graeme.gregory,
	mark.salter



On 02/12/2018 09:56 AM, Peter Zijlstra wrote:
> On Mon, Feb 12, 2018 at 08:47:57AM -0500, Prarit Bhargava wrote:
>>
>>
>> On 02/12/2018 08:34 AM, Peter Zijlstra wrote:
>>> On Thu, Jan 18, 2018 at 10:09:51AM -0500, Prarit Bhargava wrote:
>>>>  config ACPI_SPCR_TABLE
>>>> +	bool "ACPI Serial Port Console Redirection Support"
>>>> +	default y if X86
>>>> +	help
>>>> +	  Enable support for Serial Port Console Redirection (SPCR) Table.
>>>> +	  This table provides information about the configuration of the
>>>> +	  earlycon console.
>>>
>>> I just got asked this by oldconfig, which left me rather puzzled, WTF
>>> does this do?
>>
>> Odd -- I thought I had taken care of that :(  My apologies Peter.
>>
>> ACPI SPCR is used by a vendor to define the serial console for a system.  If
>> SPCR exists a user can add kernel parameter "earlycon" (no extra kernel
>> parameters) and the console will work out-of-the-box.
>>
>> The serial console configuration varies from vendor to vendor.  This takes the
>> guess-work out of defining a serial console.
> 
> But when I specify "earlyprintk=serial,ttyS0,115200" this SPCR crud will
> not interfere?
> 

I tested "earlyprintk=serial,ttyS0,115200" on a system which is known to have a
functional console with "console=ttyS0,1152008N1" both with and without
CONFIG_ACPI_SPCR_TABLE enabled.

I do not see any significant difference in output.

diff of boot logs:

--- earlyprintk_no_spcr_enable  2018-02-12 10:11:00.477288423 -0500
+++ earlyprintk_spcr_enable     2018-02-12 10:16:02.282574797 -0500
@@ -1,5 +1,5 @@
 microcode: microcode updated early to revision 0x2000035, date = 2017-10-17
-Linux version 4.15.0+ (root@intel-purley-lr-02.khw.lab.eng.bos.redhat.com) (gcc
version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)) #5 SMP Mon Feb 12 10:06:08 EST 2018
+Linux version 4.15.0+ (root@intel-purley-lr-02.khw.lab.eng.bos.redhat.com) (gcc
version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)) #6 SMP Mon Feb 12 10:11:42 EST 2018
 Command line: BOOT_IMAGE=/vmlinuz-4.15.0+
root=/dev/mapper/rhel_intel--purley--lr--02-root ro crashkernel=auto
rd.lvm.lv=rhel_intel-purley-lr-02/root rd.lvm.lv=rhel_intel-purley-lr-02/swap
earlyprintk=serial,ttyS0,115200 LANG=en_US.UTF-8
 x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
 x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
@@ -205,7 +205,7 @@
 e820: last_pfn = 0x6f800 max_arch_pfn = 0x400000000
 Using GB pages for direct mapping
 Secure boot disabled
-RAMDISK: [mem 0x3a563000-0x3bba2fff]
+RAMDISK: [mem 0x3a5da000-0x3bba2fff]
 ACPI: Early table checksum verification disabled
 ACPI: RSDP 0x000000006922A014 000024 (v02 INTEL )
 ACPI: XSDT 0x00000000690DD188 000114 (v01 INTEL  EDK2     00000000      01000013)
@@ -519,6 +519,8 @@
 ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
 Using ACPI (MADT) for SMP configuration information
 ACPI: HPET id: 0x8086a701 base: 0xfed00000
+ACPI: SPCR: SPCR table version 1
+ACPI: SPCR: console: uart,io,0x3f8,115200
 smpboot: Allowing 432 CPUs, 224 hotplug CPUs
 PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
 PM: Registered nosave memory: [mem 0x000a0000-0x000fffff]
@@ -555,10 +557,10 @@
 log_buf_len total cpu_extra contributions: 1765376 bytes
 log_buf_len min size: 524288 bytes
 log_buf_len: 4194304 bytes
-early log buf free: 477984(91%)
-Memory: 394593504K/401282564K available (10252K kernel code, 2147K rwdata,
3664K rodata, 2504K init, 1800K bss, 6689060K reserved, 0K cma-reserved)
+early log buf free: 477876(91%)
+Memory: 394593976K/401282564K available (10252K kernel code, 2147K rwdata,
3664K rodata, 2504K init, 1800K bss, 6688588K reserved, 0K cma-reserved)
 Kernel/User page tables isolation: enabled
-ftrace: allocating 35205 entries in 138 pages
+ftrace: allocating 35206 entries in 138 pages
 Hierarchical RCU implementation.
        RCU restricting CPUs from NR_CPUS=8192 to nr_cpu_ids=432.
        Tasks RCU enabled.

P.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-02-12 15:18         ` Prarit Bhargava
  0 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-02-12 15:18 UTC (permalink / raw)
  To: linux-arm-kernel



On 02/12/2018 09:56 AM, Peter Zijlstra wrote:
> On Mon, Feb 12, 2018 at 08:47:57AM -0500, Prarit Bhargava wrote:
>>
>>
>> On 02/12/2018 08:34 AM, Peter Zijlstra wrote:
>>> On Thu, Jan 18, 2018 at 10:09:51AM -0500, Prarit Bhargava wrote:
>>>>  config ACPI_SPCR_TABLE
>>>> +	bool "ACPI Serial Port Console Redirection Support"
>>>> +	default y if X86
>>>> +	help
>>>> +	  Enable support for Serial Port Console Redirection (SPCR) Table.
>>>> +	  This table provides information about the configuration of the
>>>> +	  earlycon console.
>>>
>>> I just got asked this by oldconfig, which left me rather puzzled, WTF
>>> does this do?
>>
>> Odd -- I thought I had taken care of that :(  My apologies Peter.
>>
>> ACPI SPCR is used by a vendor to define the serial console for a system.  If
>> SPCR exists a user can add kernel parameter "earlycon" (no extra kernel
>> parameters) and the console will work out-of-the-box.
>>
>> The serial console configuration varies from vendor to vendor.  This takes the
>> guess-work out of defining a serial console.
> 
> But when I specify "earlyprintk=serial,ttyS0,115200" this SPCR crud will
> not interfere?
> 

I tested "earlyprintk=serial,ttyS0,115200" on a system which is known to have a
functional console with "console=ttyS0,1152008N1" both with and without
CONFIG_ACPI_SPCR_TABLE enabled.

I do not see any significant difference in output.

diff of boot logs:

--- earlyprintk_no_spcr_enable  2018-02-12 10:11:00.477288423 -0500
+++ earlyprintk_spcr_enable     2018-02-12 10:16:02.282574797 -0500
@@ -1,5 +1,5 @@
 microcode: microcode updated early to revision 0x2000035, date = 2017-10-17
-Linux version 4.15.0+ (root at intel-purley-lr-02.khw.lab.eng.bos.redhat.com) (gcc
version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)) #5 SMP Mon Feb 12 10:06:08 EST 2018
+Linux version 4.15.0+ (root at intel-purley-lr-02.khw.lab.eng.bos.redhat.com) (gcc
version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)) #6 SMP Mon Feb 12 10:11:42 EST 2018
 Command line: BOOT_IMAGE=/vmlinuz-4.15.0+
root=/dev/mapper/rhel_intel--purley--lr--02-root ro crashkernel=auto
rd.lvm.lv=rhel_intel-purley-lr-02/root rd.lvm.lv=rhel_intel-purley-lr-02/swap
earlyprintk=serial,ttyS0,115200 LANG=en_US.UTF-8
 x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
 x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
@@ -205,7 +205,7 @@
 e820: last_pfn = 0x6f800 max_arch_pfn = 0x400000000
 Using GB pages for direct mapping
 Secure boot disabled
-RAMDISK: [mem 0x3a563000-0x3bba2fff]
+RAMDISK: [mem 0x3a5da000-0x3bba2fff]
 ACPI: Early table checksum verification disabled
 ACPI: RSDP 0x000000006922A014 000024 (v02 INTEL )
 ACPI: XSDT 0x00000000690DD188 000114 (v01 INTEL  EDK2     00000000      01000013)
@@ -519,6 +519,8 @@
 ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
 Using ACPI (MADT) for SMP configuration information
 ACPI: HPET id: 0x8086a701 base: 0xfed00000
+ACPI: SPCR: SPCR table version 1
+ACPI: SPCR: console: uart,io,0x3f8,115200
 smpboot: Allowing 432 CPUs, 224 hotplug CPUs
 PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
 PM: Registered nosave memory: [mem 0x000a0000-0x000fffff]
@@ -555,10 +557,10 @@
 log_buf_len total cpu_extra contributions: 1765376 bytes
 log_buf_len min size: 524288 bytes
 log_buf_len: 4194304 bytes
-early log buf free: 477984(91%)
-Memory: 394593504K/401282564K available (10252K kernel code, 2147K rwdata,
3664K rodata, 2504K init, 1800K bss, 6689060K reserved, 0K cma-reserved)
+early log buf free: 477876(91%)
+Memory: 394593976K/401282564K available (10252K kernel code, 2147K rwdata,
3664K rodata, 2504K init, 1800K bss, 6688588K reserved, 0K cma-reserved)
 Kernel/User page tables isolation: enabled
-ftrace: allocating 35205 entries in 138 pages
+ftrace: allocating 35206 entries in 138 pages
 Hierarchical RCU implementation.
        RCU restricting CPUs from NR_CPUS=8192 to nr_cpu_ids=432.
        Tasks RCU enabled.

P.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-02-12 15:18         ` Prarit Bhargava
@ 2018-02-12 15:44           ` Peter Zijlstra
  -1 siblings, 0 replies; 29+ messages in thread
From: Peter Zijlstra @ 2018-02-12 15:44 UTC (permalink / raw)
  To: Prarit Bhargava
  Cc: linux-kernel, linux-acpi, linux-doc, linux-arm-kernel, linux-pm,
	linux-serial, Bhupesh Sharma, Lv Zheng, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Jonathan Corbet,
	Catalin Marinas, Will Deacon, Timur Tabi, graeme.gregory,
	mark.salter

On Mon, Feb 12, 2018 at 10:18:06AM -0500, Prarit Bhargava wrote:
> > But when I specify "earlyprintk=serial,ttyS0,115200" this SPCR crud will
> > not interfere?
> > 
> 
> I tested "earlyprintk=serial,ttyS0,115200" on a system which is known to have a
> functional console with "console=ttyS0,1152008N1" both with and without
> CONFIG_ACPI_SPCR_TABLE enabled.

OK, but my point was that SPCR will never override explicit earlyprintk
stuff. There is absolutely nothing worse than breaking working setups.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-02-12 15:44           ` Peter Zijlstra
  0 siblings, 0 replies; 29+ messages in thread
From: Peter Zijlstra @ 2018-02-12 15:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 12, 2018 at 10:18:06AM -0500, Prarit Bhargava wrote:
> > But when I specify "earlyprintk=serial,ttyS0,115200" this SPCR crud will
> > not interfere?
> > 
> 
> I tested "earlyprintk=serial,ttyS0,115200" on a system which is known to have a
> functional console with "console=ttyS0,1152008N1" both with and without
> CONFIG_ACPI_SPCR_TABLE enabled.

OK, but my point was that SPCR will never override explicit earlyprintk
stuff. There is absolutely nothing worse than breaking working setups.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [PATCH] acpi, spcr: Make SPCR available to x86
  2018-02-12 15:44           ` Peter Zijlstra
@ 2018-02-12 15:54             ` Prarit Bhargava
  -1 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-02-12 15:54 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-kernel, linux-acpi, linux-doc, linux-arm-kernel, linux-pm,
	linux-serial, Bhupesh Sharma, Lv Zheng, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, Jonathan Corbet,
	Catalin Marinas, Will Deacon, Timur Tabi, graeme.gregory,
	mark.salter



On 02/12/2018 10:44 AM, Peter Zijlstra wrote:
> On Mon, Feb 12, 2018 at 10:18:06AM -0500, Prarit Bhargava wrote:
>>> But when I specify "earlyprintk=serial,ttyS0,115200" this SPCR crud will
>>> not interfere?
>>>
>>
>> I tested "earlyprintk=serial,ttyS0,115200" on a system which is known to have a
>> functional console with "console=ttyS0,1152008N1" both with and without
>> CONFIG_ACPI_SPCR_TABLE enabled.
> 
> OK, but my point was that SPCR will never override explicit earlyprintk
> stuff. There is absolutely nothing worse than breaking working setups.
> 

Oh, I see.  SPCR will not override earlyprintk config.

P.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH] acpi, spcr: Make SPCR available to x86
@ 2018-02-12 15:54             ` Prarit Bhargava
  0 siblings, 0 replies; 29+ messages in thread
From: Prarit Bhargava @ 2018-02-12 15:54 UTC (permalink / raw)
  To: linux-arm-kernel



On 02/12/2018 10:44 AM, Peter Zijlstra wrote:
> On Mon, Feb 12, 2018 at 10:18:06AM -0500, Prarit Bhargava wrote:
>>> But when I specify "earlyprintk=serial,ttyS0,115200" this SPCR crud will
>>> not interfere?
>>>
>>
>> I tested "earlyprintk=serial,ttyS0,115200" on a system which is known to have a
>> functional console with "console=ttyS0,1152008N1" both with and without
>> CONFIG_ACPI_SPCR_TABLE enabled.
> 
> OK, but my point was that SPCR will never override explicit earlyprintk
> stuff. There is absolutely nothing worse than breaking working setups.
> 

Oh, I see.  SPCR will not override earlyprintk config.

P.

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2018-02-12 15:54 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 15:09 [PATCH] acpi, spcr: Make SPCR available to x86 Prarit Bhargava
2018-01-18 15:09 ` Prarit Bhargava
2018-01-18 15:09 ` Prarit Bhargava
2018-01-20 14:33 ` Ingo Molnar
2018-01-20 14:33   ` Ingo Molnar
2018-01-21 23:21 ` Mark Salter
2018-01-21 23:21   ` Mark Salter
2018-01-22 21:49 ` Timur Tabi
2018-01-22 21:49   ` Timur Tabi
2018-01-23 12:41   ` Prarit Bhargava
2018-01-23 12:41     ` Prarit Bhargava
2018-02-12 13:34 ` Peter Zijlstra
2018-02-12 13:34   ` Peter Zijlstra
2018-02-12 13:47   ` Prarit Bhargava
2018-02-12 13:47     ` Prarit Bhargava
2018-02-12 14:43     ` Timur Tabi
2018-02-12 14:43       ` Timur Tabi
2018-02-12 14:49       ` Prarit Bhargava
2018-02-12 14:49         ` Prarit Bhargava
2018-02-12 15:10         ` Timur Tabi
2018-02-12 15:10           ` Timur Tabi
2018-02-12 14:56     ` Peter Zijlstra
2018-02-12 14:56       ` Peter Zijlstra
2018-02-12 15:18       ` Prarit Bhargava
2018-02-12 15:18         ` Prarit Bhargava
2018-02-12 15:44         ` Peter Zijlstra
2018-02-12 15:44           ` Peter Zijlstra
2018-02-12 15:54           ` Prarit Bhargava
2018-02-12 15:54             ` Prarit Bhargava

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.