hw/riscv/virt: Fix the UART register width in SPCR
v2 cover hw/riscv/virt: Fix the UART register width in SPCR
The riscv virt board's SPCR table says its 16550 UART has a 32-bit register stride, but the registers are actually byte spaced. Linux doesn't use this field to work out the register spacing, but FreeBSD's EFI loader does, and the FreeBSD kernel then crashes on the console UART when booted through EDK2 with ACPI enabled.
This series fixes the width, plus the usual bios-tables-test patches to update the golden reference so 'make check' keeps passing.
v2:
- Keep the relative file path in the patch 3 iasl diff (Daniel)
- Add Reviewed-by tags
Thanks,
Rick
Rick Richard (3):
tests/qtest/bios-tables-test: Allow changes to riscv64 virt SPCR hw/riscv/virt-acpi-build: Fix the UART register width in SPCR tests/qtest/bios-tables-test: Update riscv64 virt SPCR golden
reference
hw/riscv/virt-acpi-build.c | 2 +- tests/data/acpi/riscv64/virt/SPCR | Bin 90 -> 90 bytes 2 files changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.43.0
PATCH v2 1/3 tests/qtest/bios-tables-test: Allow changes to riscv64 virt SPCR
Allow changes to the riscv64 virt board SPCR -- we are going to fix an error in the UART description there.
--- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+)
tests/qtest/bios-tables-test-allowed-diff.h +1 -0
@@ -1 +1,2 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/riscv64/virt/SPCR",
Signature · 1 line
2.43.0
PATCH v2 2/3 hw/riscv/virt-acpi-build: Fix the UART register width in SPCR
In reply to Rick RichardThe riscv virt board uses a 16550 UART with an 8-bit register stride, but the SPCR table reports 32, which looks to have been copied from arm virt, whose PL011 has a 32-bit stride. Change it to the correct stride for a 16550.
--- hw/riscv/virt-acpi-build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/riscv/virt-acpi-build.c +1 -1
@@ -246,7 +246,7 @@ spcr_setup(GArray *table_data, BIOSLinker *linker, RISCVVirtState *s)AcpiSpcrData serial = { .interface_type =0x12 ,/* 16550 compatible */ .base_addr.id =AML_AS_SYSTEM_MEMORY , - .base_addr.width =32 , + .base_addr.width =8 , .base_addr.offset =0 , .base_addr.size =1 , .base_addr.addr = s->memmap[VIRT_UART0 ].base,
Signature · 1 line
2.43.0
PATCH v2 3/3 tests/qtest/bios-tables-test: Update riscv64 virt SPCR golden reference
In reply to Rick RichardUpdate the riscv64 virt SPCR golden reference file to have the fix for the UART register width.
Diffs from iasl:
@@ -1,58 +1,58 @@
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20230628 (64-bit version)
* Copyright (c) 2000 - 2023 Intel Corporation
*
* Disassembly of tests/data/acpi/riscv64/virt/SPCR, Sat Oct 3 08:44:51 2026 *
* ACPI Data Table [SPCR]
*
* Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue (in hex) */
[000h 0000 004h] Signature : "SPCR" [Serial Port Console Redirection Table]
[004h 0004 004h] Table Length : 0000005A
[008h 0008 001h] Revision : 04 -[009h 0009 001h] Checksum : 13 +[009h 0009 001h] Checksum : 2B
[00Ah 0010 006h] Oem ID : "BOCHS "
[010h 0016 008h] Oem Table ID : "BXPC "
[018h 0024 004h] Oem Revision : 00000001
[01Ch 0028 004h] Asl Compiler ID : "BXPC"
[020h 0032 004h] Asl Compiler Revision : 00000001
[024h 0036 001h] Interface Type : 12
[025h 0037 003h] Reserved : 000000
[028h 0040 00Ch] Serial Port Register : [Generic Address Structure]
[028h 0040 001h] Space ID : 00 [SystemMemory]
-[029h 0041 001h] Bit Width : 20
+[029h 0041 001h] Bit Width : 08
[02Ah 0042 001h] Bit Offset : 00
[02Bh 0043 001h] Encoded Access Width : 01 [Byte Access:8]
[02Ch 0044 008h] Address : 0000000010000000
[034h 0052 001h] Interrupt Type : 10
[035h 0053 001h] PCAT-compatible IRQ : 00
[036h 0054 004h] Interrupt : 0000000A
[03Ah 0058 001h] Baud Rate : 07
[03Bh 0059 001h] Parity : 00
[03Ch 0060 001h] Stop Bits : 01
[03Dh 0061 001h] Flow Control : 00
[03Eh 0062 001h] Terminal Type : 03
[04Ch 0076 001h] Reserved : 00
[040h 0064 002h] PCI Device ID : FFFF
[042h 0066 002h] PCI Vendor ID : FFFF
[044h 0068 001h] PCI Bus : 00
[045h 0069 001h] PCI Device : 00
[046h 0070 001h] PCI Function : 00
[047h 0071 004h] PCI Flags : 00000000
[04Bh 0075 001h] PCI Segment : 00
[04Ch 0076 004h] Reserved : 00000000
Raw Table Data: Length 90 (0x5A)
- 0000: 53 50 43 52 5A 00 00 00 04 13 42 4F 43 48 53 20 // SPCRZ.....BOCHS
+ 0000: 53 50 43 52 5A 00 00 00 04 2B 42 4F 43 48 53 20 // SPCRZ....+BOCHS
0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43 // BXPC ....BXPC
- 0020: 01 00 00 00 12 00 00 00 00 20 00 01 00 00 00 10 // ......... ......
+ 0020: 01 00 00 00 12 00 00 00 00 08 00 01 00 00 00 10 // ................
0030: 00 00 00 00 10 00 0A 00 00 00 07 00 01 00 03 00 // ................
0040: FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 // ................
0050: 00 00 00 00 02 00 58 00 2E 00 // ......X...--- tests/data/acpi/riscv64/virt/SPCR | Bin 90 -> 90 bytes tests/qtest/bios-tables-test-allowed-diff.h | 1 - 2 files changed, 1 deletion(-)
tests/data/acpi/riscv64/virt/SPCR binary +0 -0
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
@@ -1,2 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/riscv64/virt/SPCR",
Signature · 1 line
2.43.0
Alistair
AppliedQuoted 15 lines · Rick Richard
The riscv virt board's SPCR table says its 16550 UART has a 32-bit register stride, but the registers are actually byte spaced. Linux doesn't use this field to work out the register spacing, but FreeBSD's
EFI loader does, and the FreeBSD kernel then crashes on the console UART when booted through EDK2 with ACPI enabled.This series fixes the width, plus the usual bios-tables-test patches to
update the golden reference so 'make check' keeps passing.v2:
- Keep the relative file path in the patch 3 iasl diff (Daniel)
- Add Reviewed-by tags
Quoted 8 lines
Thanks,
RickRick Richard (3):
tests/qtest/bios-tables-test: Allow changes to riscv64 virt SPCR hw/riscv/virt-acpi-build: Fix the UART register width in SPCR tests/qtest/bios-tables-test: Update riscv64 virt SPCR golden reference
Thanks!
Applied to riscv-to-apply.next
Alistair
Quoted 4 lines
hw/riscv/virt-acpi-build.c | 2 +- tests/data/acpi/riscv64/virt/SPCR | Bin 90 -> 90 bytes
2 files changed, 1 insertion(+), 1 deletion(-)
Quoted 23 lines · Rick Richard
The riscv virt board's SPCR table says its 16550 UART has a 32-bit register stride, but the registers are actually byte spaced. Linux doesn't use this field to work out the register spacing, but FreeBSD's EFI loader does, and the FreeBSD kernel then crashes on the console UART when booted through EDK2 with ACPI enabled.
This series fixes the width, plus the usual bios-tables-test patches to update the golden reference so 'make check' keeps passing.
v2:
- Keep the relative file path in the patch 3 iasl diff (Daniel)
- Add Reviewed-by tagsThanks,
RickRick Richard (3):
tests/qtest/bios-tables-test: Allow changes to riscv64 virt SPCR hw/riscv/virt-acpi-build: Fix the UART register width in SPCR tests/qtest/bios-tables-test: Update riscv64 virt SPCR golden
reference
Quoted 7 lines
hw/riscv/virt-acpi-build.c | 2 +- tests/data/acpi/riscv64/virt/SPCR | Bin 90 -> 90 bytes 2 files changed, 1 insertion(+), 1 deletion(-)--
2.43.0
Thanks for the fix!. Looks good to me.
For the series,