From: George Guo <dongtai.guo@linux.dev>
To: chenhuacai@kernel.org
Cc: rppt@kernel.org, pasha.tatashin@soleen.com, pratyush@kernel.org,
shuah@kernel.org, ardb@kernel.org, guodongtai@kylinos.cn,
kernel@xen0n.name, graf@amazon.com, liukexin@kylinos.cn,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
kexec@lists.infradead.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-efi@vger.kernel.org
Subject: Re: [PATCH v4 4/4] selftests/kho: add LoongArch vmtest support
Date: Fri, 14 Aug 2026 00:03:07 +0800 [thread overview]
Message-ID: <20260813160307.15130-1-dongtai.guo@linux.dev> (raw)
In-Reply-To: <CAAhV-H7+1bv6ULPO1+SZ5R=XFxNTh+54rqnYQUAW26kF83kiMg@mail.gmail.com>
Hi Huacai,
On Sun, 9 Aug 2026 at 12:16, Huacai Chen <chenhuacai@kernel.org> wrote:
> You never answer me why in your test you should disable i8042 from V1
> until V4. In normal use we use a single kernel for both host and guest.
I owe you an apology: I did not actually understand your question. I
thought the commit message had already explained the reason (the
i8042_flush() panic), so I treated it as answered and never addressed
what you were really asking. Let me answer it directly now.
You are right that this is not just a selftest detail. i8042 is built on
every LoongArch kernel: arch/loongarch/Kconfig selects
ARCH_MIGHT_HAVE_PC_SERIO, and KEYBOARD_ATKBD and MOUSE_PS2 (both default
y) select SERIO_I8042 under it. So your "single kernel for host and
guest" point is correct -- a normal defconfig kernel has i8042 built in.
On the QEMU virtual machine there is no i8042, so PNP finds nothing and
i8042_pnp_init() falls back to probing the i8042 status and data
registers (I8042_STATUS_REG, I8042_DATA_REG) directly. On LoongArch those
registers are memory-mapped, and on the virtual machine they are not backed
by any device, so i8042_flush() takes a page fault and the kernel panics
before userspace. A normal LoongArch defconfig kernel booted as a QEMU
guest hits the same panic -- the "# CONFIG_SERIO_I8042 is not set" in
loongarch.conf is only a workaround to let the KHO selftest boot, not a
fix.
The real fix is separate from the KHO series: make i8042 bail out on
LoongArch when ACPI/PNP does not describe a controller, so the direct-port
fallback never runs. I have prepared that as a standalone patch -- the
relevant hunk is below -- and will send the full patch separately. The
selftest workaround can be dropped once it lands.
diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
--- a/drivers/input/serio/i8042-acpipnpio.h
+++ b/drivers/input/serio/i8042-acpipnpio.h
@@ -1633,8 +1633,14 @@ static int __init i8042_pnp_init(void)
#else
pr_info("PNP: No PS/2 controller found.\n");
#if defined(__loongarch__)
- if (acpi_disabled == 0)
- return -ENODEV;
+ /*
+ * LoongArch legacy I/O ports are memory-mapped and are not
+ * safely probeable when no controller is present: a direct
+ * probe faults on the QEMU virtual machine and on any FDT-based
+ * boot. Do not fall back to probing them directly; if ACPI/PNP
+ * did not describe a controller, assume there is none.
+ */
+ return -ENODEV;
#else
if (x86_platform.legacy.i8042 !=
X86_LEGACY_I8042_EXPECTED_PRESENT)
Thanks,
George
next prev parent reply other threads:[~2026-08-13 16:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260807103714.33074-1-dongtai.guo@linux.dev>
2026-08-07 10:37 ` [PATCH v4 3/4] liveupdate: luo_session: include linux/mm.h for virt/phys translation George Guo
2026-08-10 14:37 ` Huacai Chen
2026-08-10 17:39 ` Pratyush Yadav
2026-08-10 17:44 ` Pratyush Yadav
2026-08-12 10:25 ` George Guo
2026-08-07 10:37 ` [PATCH v4 4/4] selftests/kho: add LoongArch vmtest support George Guo
2026-08-09 4:16 ` Huacai Chen
2026-08-13 16:03 ` George Guo [this message]
[not found] ` <20260807103714.33074-2-dongtai.guo@linux.dev>
2026-08-09 4:18 ` [PATCH v4 1/4] efi: add a KHO configuration table GUID Huacai Chen
2026-08-10 13:13 ` Ard Biesheuvel
2026-08-10 14:35 ` Huacai Chen
2026-08-10 16:19 ` Pratyush Yadav
[not found] ` <20260807103714.33074-3-dongtai.guo@linux.dev>
2026-08-10 14:42 ` [PATCH v4 2/4] LoongArch: kexec: add KHO support Huacai Chen
2026-08-10 17:37 ` Pratyush Yadav
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260813160307.15130-1-dongtai.guo@linux.dev \
--to=dongtai.guo@linux.dev \
--cc=ardb@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=graf@amazon.com \
--cc=guodongtai@kylinos.cn \
--cc=kernel@xen0n.name \
--cc=kexec@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liukexin@kylinos.cn \
--cc=loongarch@lists.linux.dev \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox