Message ID | 20231229065405.235625-2-jeeheng.sia@starfivetech.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-12961-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp2417348dyb; Thu, 28 Dec 2023 22:54:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHu3IdMj9jYMJ41APrufXDOh2wBgoAEpz8iFU+9xhRuIxuT+aYKS7yHuT19Qk2hpnGDJT+q X-Received: by 2002:a05:620a:4554:b0:781:147a:88c2 with SMTP id u20-20020a05620a455400b00781147a88c2mr17737485qkp.61.1703832883052; Thu, 28 Dec 2023 22:54:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703832883; cv=none; d=google.com; s=arc-20160816; b=Ukoir5BOwNlvLZTRfqeY5MUq4BtfZ2pgPZuYM3i9VHWgGNwsnRGx6hgJyk64DYHLhU FEuoz9ePwUUzxYRhgt5yvZMUiVsXJNNATn7twYEgwd6K+M138UzrNQ2TvozjbcQmSNbb 2bx3FqWGcq3jUEFmjpXh8wXDx6Fi/WPUU2HHeuc/jB1xqJ5wu3Nuo+IZPwcNW+stwnDO 0UJ6Te8fVJ92NPa9iFFKSUjMqd1RYuOq5fpeLbV3TDKZ+RaL1XYrhvPjgMWy+70KI5Fe fsofsT2MxaxsrHL1ChGR6Xo4FaQysNJ/HkkeW3F/83Drx15c1AglEef6LFFK0XpGZa+2 f/YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=NOUOzVH6msMixl814kEDl//jby808gNDU5YQ+GvCc5k=; fh=ZYQJBVImpC6sYxKYKHV6SrBB7jlq5NQnfvghGRBJdJU=; b=rMEP4YsmFPn1TwGw6z8QJpInD1ncmDp+mWyEUBRrCqRkk++QbP+lDJt2CzAiFpjRMK ha4NaRclzlhjnQKl/1kTJ8V3ekrT8JbwTsrUyTqTptRdNbwiACH6X0lO+XFXwjoKmy3L +OlBffA5Mlm7buREMezFWmGii0h+I6pDDBvPllrZQ4PDVTN3thbFzkCtZiHzS56JK0T/ cxqTLDJvndjv4fjOAE2YeylckSydkX4wFhajmy8RR7R5ebPN3cb+nwqZlp1/9kmmiFho zWQUrnJ/fiJyzov9WRr+kg3gzXikTHVKt0zlZKIt/1RVqKQRyRo6Or9XqFEpPmRpyuHL BD4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12961-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12961-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b11-20020a05620a126b00b0077f0aef8580si18044757qkl.335.2023.12.28.22.54.42 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 22:54:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12961-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12961-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12961-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8D7811C20E0E for <ouuuleilei@gmail.com>; Fri, 29 Dec 2023 06:54:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B08C26FCE; Fri, 29 Dec 2023 06:54:29 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DBA15669 for <linux-kernel@vger.kernel.org>; Fri, 29 Dec 2023 06:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id BE36824E03E; Fri, 29 Dec 2023 14:54:21 +0800 (CST) Received: from EXMBX066.cuchost.com (172.16.7.66) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 29 Dec 2023 14:54:21 +0800 Received: from jsia-virtual-machine.localdomain (175.136.135.142) by EXMBX066.cuchost.com (172.16.6.66) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 29 Dec 2023 14:54:17 +0800 From: Sia Jee Heng <jeeheng.sia@starfivetech.com> To: <linux-kernel@vger.kernel.org>, <linux-riscv@lists.infradead.org> CC: <rafael.j.wysocki@intel.com>, <ajones@ventanamicro.com>, <conor.dooley@microchip.com>, <sunilvl@ventanamicro.com>, <jeeheng.sia@starfivetech.com>, <aou@eecs.berkeley.edu>, <palmer@dabbelt.com>, <paul.walmsley@sifive.com> Subject: [RFC v1 1/1] RISC-V: ACPI: Enable SPCR table for console output on RISC-V Date: Fri, 29 Dec 2023 14:54:05 +0800 Message-ID: <20231229065405.235625-2-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231229065405.235625-1-jeeheng.sia@starfivetech.com> References: <20231229065405.235625-1-jeeheng.sia@starfivetech.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX066.cuchost.com (172.16.6.66) X-YovoleRuleAgent: yovoleflag Content-Transfer-Encoding: quoted-printable X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786598269075785340 X-GMAIL-MSGID: 1786598269075785340 |
Series |
Enable SPCR table for console output on RISC-V
|
|
Commit Message
JeeHeng Sia
Dec. 29, 2023, 6:54 a.m. UTC
The ACPI SPCR code has been used to enable console output for ARM64 and
X86. The same code can be reused for RISC-V.
Vendor will enable/disable the SPCR table in the firmware based on the
platform design. However, in cases where the SPCR table is not usable,
a kernel parameter could be used to specify the preferred console.
Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
---
arch/riscv/kernel/acpi.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
On Fri, Dec 29, 2023 at 02:54:05PM +0800, Sia Jee Heng wrote: > The ACPI SPCR code has been used to enable console output for ARM64 and > X86. The same code can be reused for RISC-V. > > Vendor will enable/disable the SPCR table in the firmware based on the > platform design. However, in cases where the SPCR table is not usable, > a kernel parameter could be used to specify the preferred console. > > Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com> > --- > arch/riscv/kernel/acpi.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c > index e619edc8b0cc..5ec2fdf9e09f 100644 > --- a/arch/riscv/kernel/acpi.c > +++ b/arch/riscv/kernel/acpi.c > @@ -18,6 +18,7 @@ > #include <linux/io.h> > #include <linux/memblock.h> > #include <linux/pci.h> > +#include <linux/serial_core.h> > > int acpi_noirq = 1; /* skip ACPI IRQ initialization */ > int acpi_disabled = 1; > @@ -151,6 +152,9 @@ void __init acpi_boot_table_init(void) > if (!param_acpi_force) > disable_acpi(); > } > + > + if (!acpi_disabled) > + acpi_parse_spcr(earlycon_acpi_spcr_enable, true); Both arm64 and loongarch call early_init_dt_scan_chosen_stdout() when acpi_disabled and earlycon_acpi_spcr_enable are both true. Is that not necessary for RISC-V? Thanks, drew > } > > static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, const unsigned long end) > -- > 2.34.1 >
> -----Original Message----- > From: Andrew Jones <ajones@ventanamicro.com> > Sent: Tuesday, January 2, 2024 11:39 PM > To: JeeHeng Sia <jeeheng.sia@starfivetech.com> > Cc: linux-kernel@vger.kernel.org; linux-riscv@lists.infradead.org; rafael.j.wysocki@intel.com; conor.dooley@microchip.com; > sunilvl@ventanamicro.com; aou@eecs.berkeley.edu; palmer@dabbelt.com; paul.walmsley@sifive.com > Subject: Re: [RFC v1 1/1] RISC-V: ACPI: Enable SPCR table for console output on RISC-V > > On Fri, Dec 29, 2023 at 02:54:05PM +0800, Sia Jee Heng wrote: > > The ACPI SPCR code has been used to enable console output for ARM64 and > > X86. The same code can be reused for RISC-V. > > > > Vendor will enable/disable the SPCR table in the firmware based on the > > platform design. However, in cases where the SPCR table is not usable, > > a kernel parameter could be used to specify the preferred console. > > > > Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com> > > --- > > arch/riscv/kernel/acpi.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c > > index e619edc8b0cc..5ec2fdf9e09f 100644 > > --- a/arch/riscv/kernel/acpi.c > > +++ b/arch/riscv/kernel/acpi.c > > @@ -18,6 +18,7 @@ > > #include <linux/io.h> > > #include <linux/memblock.h> > > #include <linux/pci.h> > > +#include <linux/serial_core.h> > > > > int acpi_noirq = 1; /* skip ACPI IRQ initialization */ > > int acpi_disabled = 1; > > @@ -151,6 +152,9 @@ void __init acpi_boot_table_init(void) > > if (!param_acpi_force) > > disable_acpi(); > > } > > + > > + if (!acpi_disabled) > > + acpi_parse_spcr(earlycon_acpi_spcr_enable, true); > > Both arm64 and loongarch call early_init_dt_scan_chosen_stdout() when > acpi_disabled and earlycon_acpi_spcr_enable are both true. Is that > not necessary for RISC-V? It is needed for device tree support. However, since this patch targets ACPI, that's why I didn't include a DT solution in this patch. I can submit a separate patch targeting DT-based earlycon if needed. Please let me know if you think otherwise. > > Thanks, > drew > > > } > > > > static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, const unsigned long end) > > -- > > 2.34.1 > >
diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c index e619edc8b0cc..5ec2fdf9e09f 100644 --- a/arch/riscv/kernel/acpi.c +++ b/arch/riscv/kernel/acpi.c @@ -18,6 +18,7 @@ #include <linux/io.h> #include <linux/memblock.h> #include <linux/pci.h> +#include <linux/serial_core.h> int acpi_noirq = 1; /* skip ACPI IRQ initialization */ int acpi_disabled = 1; @@ -151,6 +152,9 @@ void __init acpi_boot_table_init(void) if (!param_acpi_force) disable_acpi(); } + + if (!acpi_disabled) + acpi_parse_spcr(earlycon_acpi_spcr_enable, true); } static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, const unsigned long end)