From: Colton Lewis <coltonlewis@google.com>
To: andrew.jones@linux.dev
Cc: alexandru.elisei@arm.com, eric.auger@redhat.com,
joey.gouly@arm.com, maz@kernel.org, thuth@redhat.com,
pbonzini@redhat.com, nrb@linux.ibm.com, imbrenda@linux.ibm.com,
marcorr@google.com, oliver.upton@linux.dev, kvm@vger.kernel.org,
kvmarm@lists.linux.dev, Colton Lewis <coltonlewis@google.com>
Subject: [kvm-unit-tests PATCH v2] arm: io: Set is_pl011_uart flag in ACPI initialization
Date: Fri, 19 Jun 2026 00:25:04 +0000 [thread overview]
Message-ID: <20260619002505.669698-1-coltonlewis@google.com> (raw)
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.
Link: https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debug-port-table#table-3-debug-port-types-and-subtypes
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Assisted-by: Gemini:gemini-3.1-pro
Signed-off-by: Colton Lewis <coltonlewis@google.com>
---
v2:
- Align macro names with Linux kernel DBG2 definitions (Alexandru Elisei).
v1:
https://lore.kernel.org/r/20260513211624.2416284-1-coltonlewis@google.com
lib/acpi.h | 6 ++++++
lib/arm/io.c | 3 +++
2 files changed, 9 insertions(+)
diff --git a/lib/acpi.h b/lib/acpi.h
index 66e3062d..a62cd3a9 100644
--- a/lib/acpi.h
+++ b/lib/acpi.h
@@ -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 */
diff --git a/lib/arm/io.c b/lib/arm/io.c
index 836fa854..9c07fa3d 100644
--- a/lib/arm/io.c
+++ b/lib/arm/io.c
@@ -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
--
2.55.0.rc0.738.g0c8ab3ebcc-goog
next reply other threads:[~2026-06-19 0:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 0:25 Colton Lewis [this message]
2026-06-22 16:42 ` [kvm-unit-tests PATCH v2] arm: io: Set is_pl011_uart flag in ACPI initialization Andrew Jones
2026-06-26 14:51 ` Andrew Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260619002505.669698-1-coltonlewis@google.com \
--to=coltonlewis@google.com \
--cc=alexandru.elisei@arm.com \
--cc=andrew.jones@linux.dev \
--cc=eric.auger@redhat.com \
--cc=imbrenda@linux.ibm.com \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=marcorr@google.com \
--cc=maz@kernel.org \
--cc=nrb@linux.ibm.com \
--cc=oliver.upton@linux.dev \
--cc=pbonzini@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox