From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6781CCD5BC2 for ; Thu, 13 Nov 2025 10:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Subject:Cc:To:From: Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=D9qI5ZvfTa0mQrrAkzpYrWodT4xWHf74yruf7flnfVU=; b=kzn/sZV1g2y2zEhSOYiTPmPgpq uS6JmbRP8+H7koLFirmyqC2QuSUIPQEII9lOlo31mM7JAyJBTjJVFTSDcSghz29sBHlkjscHvdxFi 7vFAXrQiaMwE7B8qACk5ryxYtosDmaLRXfEaxnhpzgxByj+PIDp+YQr5UF7uGebJEHqoq17a3OVLj lHeLgGa8MaelAzeHRkv7l2L8dDmo7Lu4T2Seu8Samhghskfhju74KC0s9UV24sU3WZsjb/EvmRx9E P+4jgMYrAzSctkl+CkLHVOirW2CVJbzxthKsA1GUxeURJub1cv9mrqsuGahWaEJCr7BYT16I9CEZM Re9OV50A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vJV2r-0000000ALiv-1Sws; Thu, 13 Nov 2025 10:59:17 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vJV2q-0000000ALiR-1bsc for linux-arm-kernel@lists.infradead.org; Thu, 13 Nov 2025 10:59:16 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id CC98E601A5; Thu, 13 Nov 2025 10:59:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B6EDC4CEF8; Thu, 13 Nov 2025 10:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763031555; bh=Zvdweb7sPHEeEOATLYg5ZKE15WfGNFkQDUUENT+CM2M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rgAn7ljucc1JPWaouEyA8zXhdLpPmZmFbDbjO4S3nTHajpiLuhplgiWIlOw+pwCaB 5DKkwciq0/+d9fuSjkTT7YegU+jC5E0sNoZaQVvZRsi9Dvr81nsG2Cke1fCje2fJjU 8/2iVkzdSSNG3y3k0zRC+13VHg7VASh0UQICb50YmzY1uJQmTUHbs/P4cs37ZtxcrX 7dCblITogY7v2CfelGJJ3kbzmNOpZviCSwDUpGGu1adTcG+ijz6pDlCdHnNVQewEO4 Uy2Ia2FV6WmEQDG8kozDJvRZftMvVpRbwjzF6GmvBIBIaD1SmHTk09FNZ0Pr93Bsz+ OOz8LUCx0PJBA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vJV2n-00000004qU6-0pnK; Thu, 13 Nov 2025 10:59:13 +0000 Date: Thu, 13 Nov 2025 10:59:12 +0000 Message-ID: <86qzu2tczj.wl-maz@kernel.org> From: Marc Zyngier To: Marek Szyprowski Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Christoffer Dall , Volodymyr Babchuk , Yao Yuan Subject: Re: [PATCH v2 04/45] KVM: arm64: Turn vgic-v3 errata traps into a patched-in constant In-Reply-To: References: <20251109171619.1507205-1-maz@kernel.org> <20251109171619.1507205-5-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: m.szyprowski@samsung.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, oupton@kernel.org, yuzenghui@huawei.com, christoffer.dall@arm.com, Volodymyr_Babchuk@epam.com, yaoyuan@linux.alibaba.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 13 Nov 2025 09:52:23 +0000, Marek Szyprowski wrote: >=20 > On 09.11.2025 18:15, Marc Zyngier wrote: > > The trap bits are currently only set to manage CPU errata. However, > > we are about to make use of them for purposes beyond beating broken > > CPUs into submission. > > > > For this purpose, turn these errata-driven bits into a patched-in > > constant that is merged with the KVM-driven value at the point of > > programming the ICH_HCR_EL2 register, rather than being directly > > stored with with the shadow value.. > > > > This allows the KVM code to distinguish between a trap being handled > > for the purpose of an erratum workaround, or for KVM's own need. > > > > Signed-off-by: Marc Zyngier >=20 > This patch landed in today's linux-next as commit ca30799f7c2d ("KVM:=20 > arm64: Turn vgic-v3 errata traps into a patched-in constant"). In my=20 > tests I found that it triggers oops and breaks booting on Raspberry Pi5=20 > and Amlogic SM1 based boards: Odroid-C4 and Khadas VIM3l. Here is the=20 > failure log: >=20 > alternatives: applying system-wide alternatives > Internal error: Oops - Undefined instruction: 0000000002000000 [#1]=C2=A0= SMP > Modules linked in: > CPU: 0 UID: 0 PID: 18 Comm: migration/0 Not tainted 6.18.0-rc3+ #11665=20 > PREEMPT > Hardware name: Raspberry Pi 5 Model B Rev 1.0 (DT) > Stopper: multi_cpu_stop+0x0/0x178 <- __stop_cpus.constprop.0+0x7c/0xc8 > pstate: 604000c9 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) > pc : vgic_v3_broken_seis+0x14/0x44 > lr : kvm_compute_ich_hcr_trap_bits+0x48/0xd8 > ... > Call trace: > =C2=A0vgic_v3_broken_seis+0x14/0x44 (P) > =C2=A0__apply_alternatives+0x1b4/0x200 > =C2=A0__apply_alternatives_multi_stop+0xac/0xc8 > =C2=A0multi_cpu_stop+0x90/0x178 > =C2=A0cpu_stopper_thread+0x8c/0x11c > =C2=A0smpboot_thread_fn+0x160/0x32c > =C2=A0kthread+0x150/0x228 > =C2=A0ret_from_fork+0x10/0x20 > Code: 52800000 f100203f 54000040 d65f03c0 (d53ccb21) > ---[ end trace 0000000000000000 ]--- > note: migration/0[18] exited with irqs disabled > note: migration/0[18] exited with preempt_count 1 > rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: > rcu:=C2=A0=C2=A0=C2=A0=C2=A0 1-...0: (7 ticks this GP) idle=3D0124/1/0x40= 00000000000000=20 > softirq=3D9/10 fqs=3D3250 > rcu:=C2=A0=C2=A0=C2=A0=C2=A0 2-...0: (7 ticks this GP) idle=3D0154/1/0x40= 00000000000000=20 > softirq=3D9/10 fqs=3D3250 > rcu:=C2=A0=C2=A0=C2=A0=C2=A0 3-...0: (7 ticks this GP) idle=3D018c/1/0x40= 00000000000000=20 > softirq=3D9/10 fqs=3D3250 > rcu:=C2=A0=C2=A0=C2=A0=C2=A0 (detected by 0, t=3D6502 jiffies, g=3D-1179,= q=3D2 ncpus=3D4) > Sending NMI from CPU 0 to CPUs 1: > Sending NMI from CPU 0 to CPUs 2: > Sending NMI from CPU 0 to CPUs 3: >=20 > Let me know how I can help in debugging this issue. Wild guess. Can you try this (untested)? M. diff --git a/arch/arm64/kvm/vgic/vgic-v3.c b/arch/arm64/kvm/vgic/vgic-v3.c index fc7a4cb8e231d..598621b14a30d 100644 --- a/arch/arm64/kvm/vgic/vgic-v3.c +++ b/arch/arm64/kvm/vgic/vgic-v3.c @@ -829,8 +829,8 @@ static const struct midr_range broken_seis[] =3D { static bool vgic_v3_broken_seis(void) { return (is_kernel_in_hyp_mode() && - (read_sysreg_s(SYS_ICH_VTR_EL2) & ICH_VTR_EL2_SEIS) && - is_midr_in_range_list(broken_seis)); + is_midr_in_range_list(broken_seis) && + (read_sysreg_s(SYS_ICH_VTR_EL2) & ICH_VTR_EL2_SEIS)); } =20 void noinstr kvm_compute_ich_hcr_trap_bits(struct alt_instr *alt, --=20 Without deviation from the norm, progress is not possible.