From patchwork Mon Dec 11 15:50:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 10105467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 583BE602B3 for ; Mon, 11 Dec 2017 15:51:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DC0029696 for ; Mon, 11 Dec 2017 15:51:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 522F32972E; Mon, 11 Dec 2017 15:51:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B039D29696 for ; Mon, 11 Dec 2017 15:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=NddLyadIbw+Mp0QybzbWEygj7ZQRdKrK/drLTetgeog=; b=BHCdupMUUeFZyCdAPhV0VUTu7G LAJsbkDVg9YIBUdUw9ZmrvruR56iLt7mUh7lFzvB+jixdfbJFvb/U1ie3X3wj6WTl8XrGz2iyVw4b vu07YTPMiuhqvzOBdTo6Wg7JKiAz1B/A+X52agcGdPIF1OwbX7sNeopXKBSQ6KC4oohMbMm9IgTVT B3xOOaS8Zp9mPdIjpzElhlxHss0hCQG4rJblwSMhbOHoidf/mh9weh3wREAy+J1fKtiTl2rHwMczG VdQXFr10f2jywmpggrNPaL4O4erAtX1mmv4FnrqUByvN6bMzws6Mob69GR8QLydix8r403d2NtxlE 24cPbx+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eOQMa-00011X-T5; Mon, 11 Dec 2017 15:51:28 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eOQMX-0000zR-Nc for linux-arm-kernel@lists.infradead.org; Mon, 11 Dec 2017 15:51:27 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 36A684E02A; Mon, 11 Dec 2017 15:51:08 +0000 (UTC) Received: from praritdesktop.bos.redhat.com (prarit-guest.khw.lab.eng.bos.redhat.com [10.16.186.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 886F560605; Mon, 11 Dec 2017 15:51:06 +0000 (UTC) From: Prarit Bhargava To: linux-acpi@vger.kernel.org Subject: [PATCH v2 2/2] acpi, x86: Use SPCR table for earlycon on x86 Date: Mon, 11 Dec 2017 10:50:59 -0500 Message-Id: <20171211155059.17062-3-prarit@redhat.com> In-Reply-To: <20171211155059.17062-1-prarit@redhat.com> References: <20171211155059.17062-1-prarit@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 11 Dec 2017 15:51:08 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171211_075125_817912_8571DDF7 X-CRM114-Status: GOOD ( 17.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prarit Bhargava , Jonathan Corbet , x86@kernel.org, linux-pm@vger.kernel.org, Catalin Marinas , Bhupesh Sharma , linux-doc@vger.kernel.org, Will Deacon , linux-kernel@vger.kernel.org, Ingo Molnar , "Rafael J. Wysocki" , Lv Zheng , linux-serial@vger.kernel.org, "H. Peter Anvin" , Thomas Gleixner , Timur Tabi , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The ACPI SPCR code has been used to define an earlycon console for ARM64 and can be used for x86. Modify the ACPI SPCR parsing code to account for console behaviour differences between ARM64 and x86. Initialize the SPCR code from x86 ACPI initialization code. Signed-off-by: Prarit Bhargava Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-pm@vger.kernel.org Cc: linux-acpi@vger.kernel.org Cc: linux-serial@vger.kernel.org Cc: Bhupesh Sharma Cc: Lv Zheng Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: Jonathan Corbet Cc: Catalin Marinas Cc: Will Deacon Cc: "Rafael J. Wysocki" Cc: Timur Tabi --- Documentation/admin-guide/kernel-parameters.txt | 3 +++ arch/arm64/kernel/acpi.c | 2 +- arch/x86/kernel/acpi/boot.c | 4 ++++ drivers/acpi/Kconfig | 2 +- drivers/acpi/spcr.c | 7 +++++-- include/linux/acpi.h | 7 +++++-- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 0d173289c67e..c7cc890a0e81 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -918,6 +918,9 @@ 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,[,options] Start an early, polled-mode console on a Cadence (xuartps) serial port at the specified address. Only diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index b3e33bbdf3b7..aaee4864b63e 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -355,7 +355,7 @@ void __init acpi_boot_table_init(void) early_init_dt_scan_chosen_stdout(); } else { /* Always enable the ACPI SPCR console */ - acpi_parse_spcr(console_acpi_spcr_enable); + acpi_parse_spcr(console_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..f01a03643cff 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -1626,6 +1627,9 @@ 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(console_acpi_spcr_enable, console_acpi_spcr_enable); + return 0; } diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 9ae98eeada76..2d4e841e0682 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -80,7 +80,7 @@ endif config ACPI_SPCR_TABLE bool "ACPI Serial Port Console Redirection Support" - default y if ARM64 + default y if (X86 || ARM64) help Enable support for Serial Port Console Redirection (SPCR) Table. This table provides information about the configuration of the diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c index f4bb8110e404..c9469b488527 100644 --- a/drivers/acpi/spcr.c +++ b/drivers/acpi/spcr.c @@ -39,7 +39,7 @@ bool console_acpi_spcr_enable __initdata; * from arch initialization code as soon as the DT/ACPI decision is made. * */ -int __init acpi_parse_spcr(bool earlycon) +int __init acpi_parse_spcr(bool earlycon, bool enable_console) { static char opts[ACPI_SPCR_OPTS_SIZE]; static char uart[ACPI_SPCR_BUF_SIZE]; @@ -112,7 +112,10 @@ int __init acpi_parse_spcr(bool earlycon) if (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/include/linux/acpi.h b/include/linux/acpi.h index 875d7327d91c..4c2d449bab9b 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1248,10 +1248,13 @@ extern bool console_acpi_spcr_enable __initdata; extern int acpi_arch_setup_console(struct acpi_table_spcr *table, char *opts, char *uart, char *iotype, int baud_rate, bool earlycon); -int acpi_parse_spcr(bool earlycon); +int acpi_parse_spcr(bool earlycon, bool enable_console); #else static const bool console_acpi_spcr_enable; -static inline int acpi_parse_spcr(bool earlycon) { return 0; } +static inline int acpi_parse_spcr(bool earlycon, bool enable_console) +{ + return 0; +} #endif #if IS_ENABLED(CONFIG_ACPI_GENERIC_GSI)