arm: io: Set is_pl011_uart flag in ACPI initialization
Subsystems (3)
PATCH v2 1/1 arm: io: Set is_pl011_uart flag in ACPI initialization
When booting via ACPI on ARM64, the SPCR table is parsed to initialize the console UART. However, the code was neglecting to set the is_pl011_uart flag. This caused __getchar() to fall back to treating the UART as a 16550A device, which fails on systems with a PL011.
Tests that wait for serial input (like its-migration) would hang indefinitely because __getchar() would always return -1.
Update uart0_init_acpi() to inspect the SPCR interface_type and set is_pl011_uart accordingly. Also define DBG2 macros for SPCR interface types in lib/acpi.h.
---
v2:
- Align macro names with Linux kernel DBG2 definitions (Alexandru Elisei).
v1:
https://lore.kernel.org/r/[email protected]
lib/acpi.h | 6 ++++++ lib/arm/io.c | 3 +++ 2 files changed, 9 insertions(+)
lib/acpi.h +6 -0
@@ -251,6 +251,12 @@ enum acpi_madt_type {/* MADT Local APIC flags */ #define ACPI_MADT_ENABLED (1)/* 00: Processor is usable if set */ +/* Values for interface_type field in struct spcr_descriptor */ +#define ACPI_DBG2_16550_COMPATIBLE 0x0000 +#define ACPI_DBG2_16550_SUBSET 0x0001 +#define ACPI_DBG2_MAX311XE_SPI 0x0002 +#define ACPI_DBG2_ARM_PL011 0x0003 +struct spcr_descriptor {ACPI_TABLE_HEADER_DEF /* ACPI common table header */ u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
lib/arm/io.c +3 -0
@@ -81,6 +81,9 @@ static void uart0_init_acpi(void)assert_msg (spcr,"Unable to find ACPI SPCR" ); uart0_base =ioremap (spcr->serial_port.address, spcr->serial_port.bit_width); + +if (spcr->interface_type ==ACPI_DBG2_ARM_PL011 ) + is_pl011_uart = true; }#else
Signature · 1 line
2.55.0.rc0.738.g0c8ab3ebcc-goog
Quoted 20 lines · Colton Lewis
When booting via ACPI on ARM64, the SPCR table is parsed to initialize the console UART. However, the code was neglecting to set the
is_pl011_uartflag. This caused__getchar()to fall back to treating the UART as a 16550A device, which fails on systems with a PL011.Tests that wait for serial input (like its-migration) would hang indefinitely because
__getchar()would always return -1.Update
uart0_init_acpi()to inspect the SPCRinterface_typeand setis_pl011_uartaccordingly. Also define DBG2 macros for SPCR interface types inlib/acpi.h.Reviewed-by Alexandru Elisei <[email protected]>Assisted-by Gemini:gemini-3.1-proSigned-off-by Colton Lewis <[email protected]>---
v2:
- Align macro names with Linux kernel DBG2 definitions (Alexandru Elisei).
Quoted 7 lines
v1:
https://lore.kernel.org/r/[email protected]lib/acpi.h | 6 ++++++ lib/arm/io.c | 3 +++ 2 files changed, 9 insertions(+)
Added
and queued, https://gitlab.com/jones-drew/kvm-unit-tests/-/commits/arm/queue
Thanks,
drew
Quoted 29 lines · Andrew Jones
Quoted 20 lines · Colton Lewis
When booting via ACPI on ARM64, the SPCR table is parsed to initialize the console UART. However, the code was neglecting to set the
is_pl011_uartflag. This caused__getchar()to fall back to treating the UART as a 16550A device, which fails on systems with a PL011.Tests that wait for serial input (like its-migration) would hang indefinitely because
__getchar()would always return -1.Update
uart0_init_acpi()to inspect the SPCRinterface_typeand setis_pl011_uartaccordingly. Also define DBG2 macros for SPCR interface types inlib/acpi.h.Reviewed-by Alexandru Elisei <[email protected]>Assisted-by Gemini:gemini-3.1-proSigned-off-by Colton Lewis <[email protected]>---
v2:
- Align macro names with Linux kernel DBG2 definitions (Alexandru Elisei).Quoted 7 lines
v1:
https://lore.kernel.org/r/[email protected]lib/acpi.h | 6 ++++++ lib/arm/io.c | 3 +++ 2 files changed, 9 insertions(+)
Quoted 6 lines
Added
Fixes 8c065edf33c0 ("lib/arm/io: Fix calling getchar() multiple times")and queued, https://gitlab.com/jones-drew/kvm-unit-tests/-/commits/arm/queue
Merged.
Thanks,
drew