From: George Guo Add loongarch.conf to run the test on QEMU's LoongArch virtual machine with a la464 CPU and an 8250 serial console, and let vmtest.sh accept the loongarch64 target. Boot vmlinux.efi through EFI firmware. The EFI stub installs the KHO EFI table, and QEMU's direct kernel boot would skip the stub. QEMU_EFI defaults to /usr/share/edk2/loongarch64/QEMU_EFI.fd and can be set for distributions that install the firmware elsewhere, such as Debian's qemu-efi-loongarch64 package. QEMU's LoongArch virtual machine has no i8042 controller. Enable the generic PCI host so its I/O space is mapped before the i8042 fallback probe touches the legacy ports. This keeps i8042 enabled, so the same kernel configuration still works on real hardware. Enable ACPI_SPCR_TABLE so the bare earlycon parameter gets the UART from the SPCR table installed by EDK2. Unlike x86, LoongArch does not enable it by default, and without it there is no early console and vmtest sees no early boot output. The KHO vmtest needs CONFIG_DEFERRED_STRUCT_PAGE_INIT=y, which depends on SPARSEMEM, so select CONFIG_SPARSEMEM_MANUAL=y. Co-developed-by: Kexin Liu Signed-off-by: Kexin Liu Signed-off-by: George Guo --- tools/testing/selftests/kho/loongarch.conf | 11 +++++++++++ tools/testing/selftests/kho/vmtest.sh | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/kho/loongarch.conf diff --git a/tools/testing/selftests/kho/loongarch.conf b/tools/testing/selftests/kho/loongarch.conf new file mode 100644 index 000000000000..36153b03c4ef --- /dev/null +++ b/tools/testing/selftests/kho/loongarch.conf @@ -0,0 +1,11 @@ +QEMU_EFI="${QEMU_EFI:-/usr/share/edk2/loongarch64/QEMU_EFI.fd}" +QEMU_CMD="qemu-system-loongarch64 -M virt -cpu la464 -bios $QEMU_EFI" +QEMU_KCONFIG=" +CONFIG_ACPI_SPCR_TABLE=y +CONFIG_PCI_HOST_GENERIC=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SPARSEMEM_MANUAL=y +" +KERNEL_IMAGE="vmlinux.efi" +KERNEL_CMDLINE="console=ttyS0 earlycon" diff --git a/tools/testing/selftests/kho/vmtest.sh b/tools/testing/selftests/kho/vmtest.sh index 0014bd76e88d..d05ba0734b25 100755 --- a/tools/testing/selftests/kho/vmtest.sh +++ b/tools/testing/selftests/kho/vmtest.sh @@ -21,7 +21,7 @@ Options: -d) path to the kernel build directory -j) number of jobs for compilation, similar to -j in make -t) run test for target_arch, requires CROSS_COMPILE set - supported targets: aarch64, x86_64 + supported targets: aarch64, loongarch64, x86_64 -h) display this help EOF } @@ -126,6 +126,7 @@ function target_to_arch() { case $target in aarch64) echo "arm64" ;; + loongarch64) echo "loongarch" ;; x86_64) echo "x86" ;; *) skip "architecture $target is not supported" esac -- 2.53.0