LoongArch: Align VIRT_GED_CPUHP_ADDR
cover LoongArch: Align VIRT_GED_CPUHP_ADDR
Align VIRT_GED_CPUHP_ADDR to 4 bytes to avoid ACPI errors during boot.
Huacai Chen (3):
bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.* hw/loongarch/virt: Align VIRT_GED_CPUHP_ADDR to 4 bytes tests/data/acpi/loongarch64: Update expected DSDT.*
--- include/hw/loongarch/virt.h | 6 +++--- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4603 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5824 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4609 bytes tests/data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4905 bytes 5 files changed, 3 insertions(+), 3 deletions(-)
--
2.7.0
PATCH 1/3 bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.*
--- tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++ 1 file changed, 4 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +4 -0
@@ -1 +1,5 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/loongarch64/virt/DSDT" , +"tests/data/acpi/loongarch64/virt/DSDT.memhp" , +"tests/data/acpi/loongarch64/virt/DSDT.numamem" , +"tests/data/acpi/loongarch64/virt/DSDT.topology",
Signature · 1 line
2.47.3
Re: [PATCH 1/3] bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.*
Quoted 16 lines · Huacai Chen
Signed-off-by Huacai Chen <[email protected]>--- tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++ 1 file changed, 4 insertions(+)tests/qtest/bios-tables-test-allowed-diff.h +4
-0@@ -1 +1,5 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/loongarch64/virt/DSDT" , +"tests/data/acpi/loongarch64/virt/DSDT.memhp" , +"tests/data/acpi/loongarch64/virt/DSDT.numamem" , +"tests/data/acpi/loongarch64/virt/DSDT.topology",
PATCH 2/3 hw/loongarch/virt: Align VIRT_GED_CPUHP_ADDR to 4 bytes
In reply to Huacai ChenFrom: Huacai Chen <[email protected]>
Now VIRT_GED_CPUHP_ADDR is not aligned to 4 bytes, but if Linux kernel is built with ACPI_MISALIGNMENT_NOT_SUPPORTED, it assumes the alignment, otherwise we get ACPI errors at boot phase:
ACPI Error: AE_AML_ALIGNMENT, Returned by Handler for [SystemMemory] (20250404/evregion-301)
ACPI Error: Aborting method \_SB.CPUS.CSTA due to previous error (AE_AML_ALIGNMENT) (20250404/psparse-529) ACPI Error: Aborting method \_SB.CPUS.C000._STA due to previous error (AE_AML_ALIGNMENT) (20250404/psparse-529) ACPI Error: Method execution failed \_SB.CPUS.C000._STA due to previous error (AE_AML_ALIGNMENT) (20250404/uteval-68)
VIRT_GED_MEM_ADDR and VIRT_GED_REG_ADDR are already aligned now, but use QEMU_ALIGN_UP() to explicitly align them can make code more robust.
--- include/hw/loongarch/virt.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/hw/loongarch/virt.h +3 -3
@@ -28,9 +28,9 @@#define VIRT_LOWMEM_SIZE 0x10000000#define VIRT_HIGHMEM_BASE 0x80000000#define VIRT_GED_EVT_ADDR 0x100e0000 -#define VIRT_GED_MEM_ADDR (VIRT_GED_EVT_ADDR + ACPI_GED_EVT_SEL_LEN) -#define VIRT_GED_REG_ADDR (VIRT_GED_MEM_ADDR + MEMORY_HOTPLUG_IO_LEN) -#define VIRT_GED_CPUHP_ADDR (VIRT_GED_REG_ADDR + ACPI_GED_REG_COUNT) +#define VIRT_GED_MEM_ADDR QEMU_ALIGN_UP(VIRT_GED_EVT_ADDR + ACPI_GED_EVT_SEL_LEN, 4) +#define VIRT_GED_REG_ADDR QEMU_ALIGN_UP(VIRT_GED_MEM_ADDR + MEMORY_HOTPLUG_IO_LEN, 4) +#define VIRT_GED_CPUHP_ADDR QEMU_ALIGN_UP(VIRT_GED_REG_ADDR + ACPI_GED_REG_COUNT, 4)#define COMMAND_LINE_SIZE 512
Signature · 1 line
2.47.3
Re: [PATCH 2/3] hw/loongarch/virt: Align VIRT_GED_CPUHP_ADDR to 4 bytes
Quoted 29 lines · Huacai Chen
From: Huacai Chen <[email protected]>
Now
VIRT_GED_CPUHP_ADDRis not aligned to 4 bytes, but if Linux kernel is built withACPI_MISALIGNMENT_NOT_SUPPORTED, it assumes the alignment, otherwise we get ACPI errors at boot phase:ACPI Error:
AE_AML_ALIGNMENT, Returned by Handler for [SystemMemory] (20250404/evregion-301)
ACPI Error: Aborting method \_SB.CPUS.CSTA due to previous error (AE_AML_ALIGNMENT) (20250404/psparse-529) ACPI Error: Aborting method \_SB.CPUS.C000._STA due to previous error (AE_AML_ALIGNMENT) (20250404/psparse-529) ACPI Error: Method execution failed \_SB.CPUS.C000._STA due to previous error (AE_AML_ALIGNMENT) (20250404/uteval-68)
VIRT_GED_MEM_ADDRandVIRT_GED_REG_ADDRare already aligned now, but useQEMU_ALIGN_UP()to explicitly align them can make code more robust.Reported-by Nathan Chancellor <[email protected]>Suggested-by WANG Rui <[email protected]>Signed-off-by Huacai Chen <[email protected]>--- include/hw/loongarch/virt.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)include/hw/loongarch/virt.h +0
-0@@ -28,9 +28,9 @@#define VIRT_LOWMEM_SIZE 0x10000000#define VIRT_HIGHMEM_BASE 0x80000000
include/hw/loongarch/virt.h line 36
Quoted 10 lines
include/hw/loongarch/virt.h +3
-3#define VIRT_GED_EVT_ADDR 0x100e0000 -#define VIRT_GED_MEM_ADDR (VIRT_GED_EVT_ADDR + ACPI_GED_EVT_SEL_LEN) -#define VIRT_GED_REG_ADDR (VIRT_GED_MEM_ADDR + MEMORY_HOTPLUG_IO_LEN) -#define VIRT_GED_CPUHP_ADDR (VIRT_GED_REG_ADDR + ACPI_GED_REG_COUNT) +#define VIRT_GED_MEM_ADDR QEMU_ALIGN_UP(VIRT_GED_EVT_ADDR + ACPI_GED_EVT_SEL_LEN, 4) +#define VIRT_GED_REG_ADDR QEMU_ALIGN_UP(VIRT_GED_MEM_ADDR + MEMORY_HOTPLUG_IO_LEN, 4) +#define VIRT_GED_CPUHP_ADDR QEMU_ALIGN_UP(VIRT_GED_REG_ADDR + ACPI_GED_REG_COUNT, 4)#define COMMAND_LINE_SIZE 512
PATCH 3/3 tests/data/acpi/loongarch64: Update expected DSDT.*
In reply to Huacai ChenDSDT diffs from "iasl -d":
@@ -11,7 +11,7 @@
* Signature "DSDT" * Length 0x000011FB (4603) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0x5D + * Checksum 0x5B * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1)
@@ -1426,11 +1426,11 @@
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings {
Memory32Fixed (ReadWrite,
- 0x100E001F, // Address Base
+ 0x100E0020, // Address Base
0x0000000C, // Address Length
)
})
- OperationRegion (PRST, SystemMemory, 0x100E001F, 0x0C)
+ OperationRegion (PRST, SystemMemory, 0x100E0020, 0x0C)
Field (PRST, ByteAcc, NoLock, WriteAsZeros)
{
Offset (0x04), --- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4603 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5824 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4609 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4905 bytes tests/qtest/bios-tables-test-allowed-diff.h | 4 ---- 5 files changed, 4 deletions(-)
tests/data/acpi/loongarch64/virt/DSDT binary +0 -0
tests/data/acpi/loongarch64/virt/DSDT.memhp binary +0 -0
tests/data/acpi/loongarch64/virt/DSDT.numamem binary +0 -0
tests/data/acpi/loongarch64/virt/DSDT.topology binary +0 -0
tests/qtest/bios-tables-test-allowed-diff.h +0 -4
@@ -1,5 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/loongarch64/virt/DSDT" , -"tests/data/acpi/loongarch64/virt/DSDT.memhp" , -"tests/data/acpi/loongarch64/virt/DSDT.numamem" , -"tests/data/acpi/loongarch64/virt/DSDT.topology",
Signature · 1 line
2.47.3
Re: [PATCH 3/3] tests/data/acpi/loongarch64: Update expected DSDT.*
Add Michael
Quoted 86 lines · Huacai Chen
DSDT diffs from "iasl -d":
(quoted diff) +3
-3@@ -11,7 +11,7 @@ * Signature "DSDT" * Length 0x000011FB (4603) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0x5D + * Checksum 0x5B * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1)@@ -1426,11 +1426,11 @@ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, - 0x100E001F, // Address Base + 0x100E0020, // Address Base 0x0000000C, // Address Length ) }) - OperationRegion (PRST, SystemMemory, 0x100E001F, 0x0C) + OperationRegion (PRST, SystemMemory, 0x100E0020, 0x0C) Field (PRST, ByteAcc, NoLock, WriteAsZeros) { Offset (0x04),Signed-off-by Huacai Chen <[email protected]>--- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4603 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5824 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4609 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4905 bytes tests/qtest/bios-tables-test-allowed-diff.h | 4 ---- 5 files changed, 4 deletions(-)tests/data/acpi/loongarch64/virt/DSDT binary +0
-0tests/data/acpi/loongarch64/virt/DSDT.memhp binary +0
-0tests/data/acpi/loongarch64/virt/DSDT.numamem binary +0
-0tests/data/acpi/loongarch64/virt/DSDT.topology binary +0
-0tests/qtest/bios-tables-test-allowed-diff.h +0
-4@@ -1,5 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/loongarch64/virt/DSDT" , -"tests/data/acpi/loongarch64/virt/DSDT.memhp" , -"tests/data/acpi/loongarch64/virt/DSDT.numamem" , -"tests/data/acpi/loongarch64/virt/DSDT.topology",
Michael S. Tsirkin
Acked-byRe: [PATCH 3/3] tests/data/acpi/loongarch64: Update expected DSDT.*
Quoted 29 lines · Bibo Mao
Add Michael
Quoted 26 lines · Huacai Chen
DSDT diffs from "iasl -d":
(quoted diff) +3
-3@@ -11,7 +11,7 @@ * Signature "DSDT" * Length 0x000011FB (4603) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0x5D + * Checksum 0x5B * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1)@@ -1426,11 +1426,11 @@ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, - 0x100E001F, // Address Base + 0x100E0020, // Address Base 0x0000000C, // Address Length ) }) - OperationRegion (PRST, SystemMemory, 0x100E001F, 0x0C) + OperationRegion (PRST, SystemMemory, 0x100E0020, 0x0C) Field (PRST, ByteAcc, NoLock, WriteAsZeros) { Offset (0x04),
Quoted 1 line
Quoted 1 line
Signed-off-by Huacai Chen <[email protected]>
this does what the patch says it does
up to maintainers to figure out if it's TRT
Quoted 59 lines
Quoted 59 lines
--- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4603 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5824 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4609 bytes .../data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4905 bytes tests/qtest/bios-tables-test-allowed-diff.h | 4 ---- 5 files changed, 4 deletions(-)tests/data/acpi/loongarch64/virt/DSDT binary +0
-0tests/data/acpi/loongarch64/virt/DSDT.memhp binary +0
-0tests/data/acpi/loongarch64/virt/DSDT.numamem binary +0
-0tests/data/acpi/loongarch64/virt/DSDT.topology binary +0
-0tests/qtest/bios-tables-test-allowed-diff.h +0
-4@@ -1,5 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/loongarch64/virt/DSDT" , -"tests/data/acpi/loongarch64/virt/DSDT.memhp" , -"tests/data/acpi/loongarch64/virt/DSDT.numamem" , -"tests/data/acpi/loongarch64/virt/DSDT.topology",
gaosong
AppliedQuoted 15 lines · Huacai Chen
Align
VIRT_GED_CPUHP_ADDRto 4 bytes to avoid ACPI errors during boot.Huacai Chen (3):
bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.* hw/loongarch/virt: AlignVIRT_GED_CPUHP_ADDRto 4 bytes tests/data/acpi/loongarch64: Update expected DSDT.*Signed-off-by Huacai Chen <[email protected]>--- include/hw/loongarch/virt.h | 6 +++--- tests/data/acpi/loongarch64/virt/DSDT | Bin 4603 -> 4603 bytes tests/data/acpi/loongarch64/virt/DSDT.memhp | Bin 5824 -> 5824 bytes tests/data/acpi/loongarch64/virt/DSDT.numamem | Bin 4609 -> 4609 bytes tests/data/acpi/loongarch64/virt/DSDT.topology | Bin 4905 -> 4905 bytes 5 files changed, 3 insertions(+), 3 deletions(-)
Quoted 2 lines
--
2.7.0
Applied to loongarch-next
Thanks.
Song Gao