Hi Li,

On 15/5/25 14:41, Li Chen wrote:
From: Li Chen <chenl...@chinatelecom.cn>

The ACPI SPCR (Serial Port Console Redirection) table allows firmware
to specify a preferred serial console device to the operating system.
On ARM64 systems, Linux by default respects this table: even if the
kernel command line does not include a hardware serial console (e.g.,
"console=ttyAMA0"), the kernel still register the serial device
referenced by SPCR as a printk console.

While this behavior is standard-compliant, it can lead to situations
where guest console behavior is influenced by platform firmware rather
than user-specified configuration. To make guest console behavior more
predictable and under user control, this patch introduces a machine
option to explicitly disable SPCR table exposure:

     -machine spcr=off

By default, the option is enabled (spcr=on), preserving existing
behavior. When disabled, QEMU will omit the SPCR table from the guest's
ACPI namespace, ensuring that only consoles explicitly declared in the
kernel command line are registered.

Signed-off-by: Li Chen <chenl...@chinatelecom.cn>
Reviewed-by: Bibo Mao <maob...@loongson.cn>
Acked-by: Michael S. Tsirkin <m...@redhat.com>
Reviewed-by: Gavin Shan <gs...@redhat.com>
---


diff --git a/include/hw/boards.h b/include/hw/boards.h
index 765dc8dd35..089104d54b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -444,6 +444,7 @@ struct MachineState {
      SmpCache smp_cache;
      struct NVDIMMState *nvdimms_state;
      struct NumaState *numa_state;
+    bool enable_spcr;

This structure is used by all machines. Can we be more
descriptive, maybe naming as "acpi_spcr_enabled"?

Thanks,

Phil.


Reply via email to