On 2025/4/1 下午9:41, Igor Mammedov wrote:
On Fri, 28 Feb 2025 17:27:26 +0800
Bibo Mao <maob...@loongson.cn> wrote:

Add basic ACPI table test case for LoongArch64.

Signed-off-by: Bibo Mao <maob...@loongson.cn>
---
  tests/qtest/bios-tables-test.c | 62 ++++++++++++++++++++++++++++++++++
  1 file changed, 62 insertions(+)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 0a333ec435..008d7a0497 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -2420,6 +2420,59 @@ static void test_acpi_aarch64_virt_oem_fields(void)
      g_free(args);
  }
+#define LOONGARCH64_INIT_TEST_DATA(data) \
+    test_data data = {                                            \
+        .machine = "virt",                                        \
+        .arch    = "loongarch64",                                 \
+        .tcg_only = true,                                         \
+        .uefi_fl1 = "pc-bios/edk2-loongarch64-code.fd",           \
+        .uefi_fl2 = "pc-bios/edk2-loongarch64-vars.fd",           \
+        .cd = "tests/data/uefi-boot-images/"                      \
+              "bios-tables-test.loongarch64.iso.qcow2",           \
+        .ram_start = 0,                                           \
+        .scan_len = 128ULL * 1024 * 1024,                         \

while it consistent with other test, we should switch to using MiB macro
so I'd like to ask
  * 1st convert all similar places in bios-tables-test.c 'x * MiB' style
  * fix up this patch to use that as well
yes, will use MiB macro.


+    }
+
+static void test_acpi_loongarch64_virt(void)
+{
+    LOONGARCH64_INIT_TEST_DATA(data);
+
+    test_acpi_one("-cpu la464 ", &data);
+    free_test_data(&data);
+}
+
+static void test_acpi_loongarch64_virt_topology(void)
+{
+    LOONGARCH64_INIT_TEST_DATA(data);
+
+    data.variant = ".topology";
+    test_acpi_one("-cpu la464 -smp sockets=1,cores=4,threads=2", &data);
+    free_test_data(&data);
+}
+
+static void test_acpi_loongarch64_virt_numamem(void)
+{
+    LOONGARCH64_INIT_TEST_DATA(data);
+
+    data.variant = ".numamem";
+    test_acpi_one(" -cpu la464 -object memory-backend-ram,id=ram0,size=128M"
+                  " -numa node,memdev=ram0", &data);
+    free_test_data(&data);
+}
+

+static void test_acpi_loongarch64_virt_memhp(void)
+{
+    LOONGARCH64_INIT_TEST_DATA(data);
+
+    data.variant = ".memhp";
+    test_acpi_one(" -cpu la464 -m 128,slots=3,maxmem=1G"

+                  " -object memory-backend-ram,id=ram0,size=64M"
+                  " -object memory-backend-ram,id=ram1,size=64M"
+                  " -numa node,memdev=ram0 -numa node,memdev=ram1"
+                  " -numa dist,src=0,dst=1,val=21",
I'd test numa specific stuff in test_acpi_loongarch64_virt_numamem()
and simplify this test case.
Actually it is a little strange here. There is no SLIT information in numamem(), however it is in memhp() test case.

Will move it to numa test case and make memory hotplug case simpler.

+                  &data);
+    free_test_data(&data);
+}
int main(int argc, char *argv[])
  {
@@ -2593,6 +2646,15 @@ int main(int argc, char *argv[])
              qtest_add_func("acpi/virt/numamem",
                             test_acpi_riscv64_virt_tcg_numamem);
          }
+    } else if (strcmp(arch, "loongarch64") == 0) {
+        if (has_tcg && qtest_has_device("virtio-blk-pci")) {
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
is it necessary?
if yes, then add explanation to commit message, why it's need.
From the code it is not necessary if UEFI bios is used here. It passes to run if it is removed.

Will remove it in next patch.

Regards
Bibo Mao

+            qtest_add_func("acpi/virt", test_acpi_loongarch64_virt);
+            qtest_add_func("acpi/virt/topology",
+                           test_acpi_loongarch64_virt_topology);
+            qtest_add_func("acpi/virt/numamem",
+                           test_acpi_loongarch64_virt_numamem);
+            qtest_add_func("acpi/virt/memhp", 
test_acpi_loongarch64_virt_memhp);
+        }
      }
      ret = g_test_run();
      boot_sector_cleanup(disk);


Reply via email to