From patchwork Sat Jun 22 09:35:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Wei X-Patchwork-Id: 13708260 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C402EC27C53 for ; Sat, 22 Jun 2024 09:36:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6Oai+wVCUH3uvSBOw6yBx4clx/EzGXkK7VNkJO6znII=; b=MFFc15SJVRKlBKGghUEdr4njAo Rl1aYzzVdnY2kOu3MTWVQ8UJcnar/FNlmM3kuLCQIS92OxyQ78yrl9RfWf6+3z7TBUsw5vs83MqPZ Yjj9Wz4QFMIWe4G0xCsJ/opO3tW/OYZbx/7Sd7QHcgZHFSqvOnUsiKlI6ZzhYjfBHVGKvtPl/XoUQ RtvnjOzr1eOdhMokb6mL4yIZ1rwLrlEUlM3Os9oYjDHe1wRHmVsMLi1NEnHhSoIuqwnRLHJ+PicQo 5Cu+yu2objR9RErmW7aJ1b4VGPv/UbHZSPJwaZhc6get+lLudYHuPC9b+UbWDHgBpZpIWKrM8KgH0 r8gvpt4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKxAB-0000000BnON-2oc3; Sat, 22 Jun 2024 09:36:03 +0000 Received: from [1.203.97.246] (helo=smtp.cecloud.com) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKxA6-0000000BnNB-2F14 for linux-arm-kernel@lists.infradead.org; Sat, 22 Jun 2024 09:36:00 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.cecloud.com (Postfix) with ESMTP id D2BC37C0114; Sat, 22 Jun 2024 17:35:48 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-SKE-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from localhost.localdomain (117.240.211.222.broad.my.sc.dynamic.163data.com.cn [222.211.240.117]) by smtp.cecloud.com (postfix) whith ESMTP id P2702681T281465036140912S1719048947961346_; Sat, 22 Jun 2024 17:35:48 +0800 (CST) X-RL-SENDER: liuwei09@cestc.cn X-SENDER: liuwei09@cestc.cn X-LOGIN-NAME: liuwei09@cestc.cn X-FST-TO: liuwei09@cestc.cn X-RCPT-COUNT: 6 X-LOCAL-RCPT-COUNT: 1 X-MUTI-DOMAIN-COUNT: 0 X-SENDER-IP: 222.211.240.117 X-ATTACHMENT-NUM: 0 X-UNIQUE-TAG: X-System-Flag: 0 From: Liu Wei To: liuwei09@cestc.cn, prarit@redhat.com Cc: catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will@kernel.org Subject: [PATCH V3] ACPI: Add acpi=nospcr to disable ACPI SPCR as default console on arm64 Date: Sat, 22 Jun 2024 17:35:21 +0800 Message-ID: <20240622093521.71770-1-liuwei09@cestc.cn> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20240530015332.7305-1-liuwei09@cestc.cn> References: <20240530015332.7305-1-liuwei09@cestc.cn> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240622_023558_938671_9C812042 X-CRM114-Status: GOOD ( 14.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For varying privacy and security reasons, sometimes we would like to completely silence the serial console, and only enable it when needed. But there are many existing systems that depend on this console, so add acpi=nospcr for this situation. Signed-off-by: Liu Wei Suggested-by: Prarit Bhargava --- v2: Add a config option suggested by Prarit v3: Use cmdline acpi=nospcr instead of config --- Documentation/admin-guide/kernel-parameters.txt | 9 ++++++--- arch/arm64/kernel/acpi.c | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 11e57ba2985c..4c331cfb28f5 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -12,7 +12,7 @@ acpi= [HW,ACPI,X86,ARM64,RISCV64,EARLY] Advanced Configuration and Power Interface Format: { force | on | off | strict | noirq | rsdt | - copy_dsdt } + copy_dsdt | nospcr } force -- enable ACPI if default was off on -- enable ACPI but allow fallback to DT [arm64,riscv64] off -- disable ACPI if default was on @@ -21,8 +21,11 @@ strictly ACPI specification compliant. rsdt -- prefer RSDT over (default) XSDT copy_dsdt -- copy DSDT to memory - For ARM64 and RISCV64, ONLY "acpi=off", "acpi=on" or - "acpi=force" are available + nospcr -- disable ACPI SPCR as default console on ARM64 + For ARM64, ONLY "acpi=off", "acpi=on", "acpi=force" or + "acpi=nospcr" are available + For RISCV64, ONLY "acpi=off", "acpi=on" or "acpi=force" + are available See also Documentation/power/runtime_pm.rst, pci=noacpi diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index e0e7b93c16cc..35cb12f3b9bd 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -45,6 +45,7 @@ EXPORT_SYMBOL(acpi_pci_disabled); static bool param_acpi_off __initdata; static bool param_acpi_on __initdata; static bool param_acpi_force __initdata; +static bool param_acpi_nospcr __initdata; static int __init parse_acpi(char *arg) { @@ -58,6 +59,8 @@ static int __init parse_acpi(char *arg) param_acpi_on = true; else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */ param_acpi_force = true; + else if (strcmp(arg, "nospcr") == 0) /* disable ACPI SPCR as default console */ + param_acpi_nospcr = true; else return -EINVAL; /* Core will print when we return error */ @@ -237,7 +240,19 @@ void __init acpi_boot_table_init(void) acpi_put_table(facs); } #endif - acpi_parse_spcr(earlycon_acpi_spcr_enable, true); + + /* + * For varying privacy and security reasons, sometimes need + * to completely silence the serial console output, and only + * enable it when needed. + * But there are many existing systems that depend on this + * behavior, use acpi=nospcr for this. + */ + acpi_parse_spcr(earlycon_acpi_spcr_enable, + !param_acpi_nospcr); + pr_info("Use ACPI SPCR as default console: %s\n", + param_acpi_nospcr ? "No" : "Yes"); + if (IS_ENABLED(CONFIG_ACPI_BGRT)) acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt); }