Skip to contentSkip to conversation

Enable SPCR table for console output on RISC-V

RFC Superseded Sia Jee Heng 2 participants 4 messages Dec 29, 2023 – Jan 5, 2024 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Enable SPCR table for console output on RISC-V

This patch will enable the SPCR table 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.

This patch depends on Sunil's patch series, as indicated in [1] and the corresponding Qemu patch can be found at [2].

[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/qemu-devel/[email protected]/

Sia Jee Heng (1):
RISC-V: ACPI: Enable SPCR table for console output on RISC-V

 arch/riscv/kernel/acpi.c | 4 ++++
 1 file changed, 4 insertions(+)
Signature · 1 line
2.34.1
#1 lore raw

RFC 1/1 RISC-V: ACPI: Enable SPCR table for console output on RISC-V

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.

---
 arch/riscv/kernel/acpi.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/riscv/kernel/acpi.c +4 -0
index e619edc8b0cc..5ec2fdf9e09f 100644
@@ -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)
Signature · 1 line
2.34.1
#2 lore raw

Re: [RFC v1 1/1] RISC-V: ACPI: Enable SPCR table for console output on RISC-V

Quoted 25 lines · Sia Jee Heng

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.

---
 arch/riscv/kernel/acpi.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/riscv/kernel/acpi.c +1 -0
index e619edc8b0cc..5ec2fdf9e09f 100644
@@ -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;

arch/riscv/kernel/acpi.c void __init acpi_boot_table_init(void) · line 157

Quoted 6 lines
arch/riscv/kernel/acpi.c +3 -0
@@ -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

Quoted 6 lines
arch/riscv/kernel/acpi.c +0 -0
 }
 
 static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, const unsigned long end)
Signature · 1 line
2.34.1
#3 lore raw

RE: [RFC v1 1/1] RISC-V: ACPI: Enable SPCR table for console output on RISC-V

Quoted 33 lines

-----Original Message-----
From: Andrew Jones <[email protected]>
Sent: Tuesday, January 2, 2024 11:39 PM
To: JeeHeng Sia <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [RFC v1 1/1] RISC-V: ACPI: Enable SPCR table for console output on RISC-V

Quoted 22 lines · Sia Jee Heng

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.

---
 arch/riscv/kernel/acpi.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/riscv/kernel/acpi.c +1 -0
index e619edc8b0cc..5ec2fdf9e09f 100644
@@ -18,6 +18,7 @@
 #include <linux/io.h>
 #include <linux/memblock.h>
 #include <linux/pci.h>
+#include <linux/serial_core.h>
 
Quoted 13 lines

arch/riscv/kernel/acpi.c void __init acpi_boot_table_init(void) · line 157

Quoted 9 lines
arch/riscv/kernel/acpi.c +3 -0
 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.

Quoted 10 lines

Thanks,
drew

Quoted 6 lines
arch/riscv/kernel/acpi.c +0 -1
 }
 
 static int acpi_parse_madt_rintc(union acpi_subtable_headers *header, const unsigned long end)
--

2.34.1