Skip to contentSkip to conversation

LoongArch: Align VIRT_GED_CPUHP_ADDR

PATCH Applied Huacai Chen 4 participants 9 messages Sep 23, 2025 – Oct 9, 2025

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

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
index dfb8523c8b..2ed837faee 100644
@@ -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
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] bios-tables-test-allowed-diff.h: Allow LoongArch DSDT.*

Quoted 16 lines · Huacai Chen
---
  tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++
  1 file changed, 4 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +4 -0
index dfb8523c8b..2ed837faee 100644
@@ -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",
#3 lore raw

PATCH 2/3 hw/loongarch/virt: Align VIRT_GED_CPUHP_ADDR to 4 bytes

In reply to Huacai Chen

From: 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
index 602feab0f0..be4f5d603f 100644
@@ -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
Reviewed-by on v1 2/3
#4 lore raw

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_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 +0 -0
index 602feab0f0..be4f5d603f 100644
@@ -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
 
#5 lore raw

PATCH 3/3 tests/data/acpi/loongarch64: Update expected DSDT.*

In reply to Huacai Chen

DSDT 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
index b31841aec6ed296f10ea1695a67ead38f45424d5..55aa34f988d6ef69293e91c5fe45bee0a02bc5f1 100644
GIT binary patch
tests/data/acpi/loongarch64/virt/DSDT.memhp binary +0 -0
index e291200fc91caa3d93dcd6ec4736f7340f5e3f65..c0955eb60448cc5f4d38d410abc260ae54ea2e9a 100644
GIT binary patch
tests/data/acpi/loongarch64/virt/DSDT.numamem binary +0 -0
index 07923ac39584c5a5e73c9556d251814ce10de6cc..61e47e7252155dcf9c76879c4f60f4b3eef63f86 100644
GIT binary patch
tests/data/acpi/loongarch64/virt/DSDT.topology binary +0 -0
index 6dfbb495f88b74b87849b58473e46717bc588a56..b2afebc938ce45d798c8aa5f45a463f1617e257e 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -4
index 2ed837faee..dfb8523c8b 100644
@@ -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
#6 lore raw

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),
---
  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
index b31841aec6ed296f10ea1695a67ead38f45424d5..55aa34f988d6ef69293e91c5fe45bee0a02bc5f1 100644
GIT binary patch
tests/data/acpi/loongarch64/virt/DSDT.memhp binary +0 -0
index e291200fc91caa3d93dcd6ec4736f7340f5e3f65..c0955eb60448cc5f4d38d410abc260ae54ea2e9a 100644
GIT binary patch
tests/data/acpi/loongarch64/virt/DSDT.numamem binary +0 -0
index 07923ac39584c5a5e73c9556d251814ce10de6cc..61e47e7252155dcf9c76879c4f60f4b3eef63f86 100644
GIT binary patch
tests/data/acpi/loongarch64/virt/DSDT.topology binary +0 -0
index 6dfbb495f88b74b87849b58473e46717bc588a56..b2afebc938ce45d798c8aa5f45a463f1617e257e 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -4
index 2ed837faee..dfb8523c8b 100644
@@ -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",
#7 lore raw

Re: [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

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 -0
index b31841aec6ed296f10ea1695a67ead38f45424d5..55aa34f988d6ef69293e91c5fe45bee0a02bc5f1 100644
GIT binary patch
tests/data/acpi/loongarch64/virt/DSDT.memhp binary +0 -0
index e291200fc91caa3d93dcd6ec4736f7340f5e3f65..c0955eb60448cc5f4d38d410abc260ae54ea2e9a 100644
GIT binary patch
tests/data/acpi/loongarch64/virt/DSDT.numamem binary +0 -0
index 07923ac39584c5a5e73c9556d251814ce10de6cc..61e47e7252155dcf9c76879c4f60f4b3eef63f86 100644
GIT binary patch
tests/data/acpi/loongarch64/virt/DSDT.topology binary +0 -0
index 6dfbb495f88b74b87849b58473e46717bc588a56..b2afebc938ce45d798c8aa5f45a463f1617e257e 100644
GIT binary patch
tests/qtest/bios-tables-test-allowed-diff.h +0 -4
index 2ed837faee..dfb8523c8b 100644
@@ -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",
Applied
#8 lore raw
In reply to Huacai Chen
Quoted 15 lines · Huacai Chen

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(-)
Quoted 2 lines

--
2.7.0

Applied to loongarch-next

Thanks.
Song Gao