From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71F9C3ED138 for ; Fri, 29 May 2026 14:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780065209; cv=none; b=NXIL94rUGkWM3u13nHZWyjENsg9GWfO5UgnXpcpo/QwBEow9xp7D+tslVqrpSWe0LlVGFbVgX6I3VUBuuE41+qcfpLI8sSL/I79U8QUk/bPFMRs//BMgh1HEY5CMPnFYcooX687NtogpxtzeHFlQ70er8OAUcBZzMaZNrjutIpk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780065209; c=relaxed/simple; bh=Ccj9ZpUgY4tBeuHbuTFichB9kjENOt2fJqak4PkNyZ8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=q0z231ZhBaIJ/8VB2WCVrt+T1VQ5zzlfMV/mjMUSnkwN3/pC0nFpSBA6QX477uNoLoingIcZEknQJ9dFmnZu4n5g9+ehw6y6Y+notKumZMZ+S9DsxII/z01ot95bYlsXlCozyJFH2bPar2ue1UM15EHMyPzfbMbtuoaIET7eDeM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=trmWex9p; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="trmWex9p" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780065206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2pmFg0ye5kd/wVZc0l7oWo0it3EFeUIanJ2wGfN6Hps=; b=trmWex9plGSmdvJZunorsxrk9A0B2CC66Xq5oDxgPLcra8WcWhAj+yrSNtWCGyJf3kmJUB OvAuB90ejBL3rRZNg2vI3fJmInKADuvJEKE9i+aIfK2LrZiw/E/vZ1B+b9g/+1YrF7T5nE RMSbjPyQza44x3A7soqYrdkbpo28Eq0= From: George Guo To: Huacai Chen , Mike Rapoport , Pasha Tatashin , Pratyush Yadav , Shuah Khan Cc: WANG Xuerui , Alexander Graf , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, George Guo , Kexin Liu Subject: [PATCH v2 3/4] selftests/kho: add LoongArch vmtest support Date: Fri, 29 May 2026 22:32:37 +0800 Message-Id: <20260529143238.169169-4-dongtai.guo@linux.dev> In-Reply-To: <20260529143238.169169-1-dongtai.guo@linux.dev> References: <20260529143238.169169-1-dongtai.guo@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: George Guo Add loongarch.conf to configure QEMU's LoongArch virt machine with a la464 CPU, enable the 8250 serial console, and set the kernel image to vmlinux.efi. Extend vmtest.sh to recognize loongarch64 as a supported target and map it to the 'loongarch' kernel arch name. QEMU's LoongArch virt machine provides no ACPI tables and relies on FDT to describe hardware. Without 'earlycon' on the kernel command line, the FDT is not scanned for a console UART, no output reaches the console, and vmtest.sh's console log stays empty causing the test to always fail. Add 'earlycon' to KERNEL_CMDLINE in loongarch.conf to fix this. QEMU's LoongArch virt machine has no i8042 PS/2 controller. When PNP detection finds nothing, i8042_init() falls back to probing the ports directly. On LoongArch the I/O ports are memory-mapped, and the i8042 port addresses are not backed by any device on the virt machine, so i8042_flush() takes a page fault and the kernel panics: i8042: PNP: No PS/2 controller found. i8042: Probing ports directly. CPU 0 Unable to handle kernel paging request at virtual address ffff800000008064 ERA: i8042_flush+0x50/0x198 RA: i8042_init+0x2a8/0x35c Kernel panic - not syncing: Attempted to kill init! Disable SERIO_I8042 and its dependents (KEYBOARD_ATKBD, MOUSE_PS2) in the QEMU_KCONFIG fragment to prevent the driver from being built. Co-developed-by: Kexin Liu Signed-off-by: Kexin Liu Signed-off-by: George Guo --- tools/testing/selftests/kho/loongarch.conf | 10 ++++++++++ tools/testing/selftests/kho/vmtest.sh | 3 ++- 2 files changed, 12 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..0145cb49e5b2 --- /dev/null +++ b/tools/testing/selftests/kho/loongarch.conf @@ -0,0 +1,10 @@ +QEMU_CMD="qemu-system-loongarch64 -M virt -cpu la464" +QEMU_KCONFIG=" +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +# CONFIG_KEYBOARD_ATKBD is not set +# CONFIG_MOUSE_PS2 is not set +# CONFIG_SERIO_I8042 is not set +" +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 49fdac8e8b15..a6ae9ac09595 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, x86_64, loongarch64 -h) display this help EOF } @@ -123,6 +123,7 @@ function target_to_arch() { case $target in aarch64) echo "arm64" ;; x86_64) echo "x86" ;; + loongarch64) echo "loongarch" ;; *) skip "architecture $target is not supported" esac } -- 2.25.1